31 lines
767 B
Bash
Executable File
31 lines
767 B
Bash
Executable File
#!/bin/bash
|
|
#
|
|
# This script copies the contents of a directory to the git master
|
|
# of a given repository. It thus can abuse Git for revisioned
|
|
# backups. Sweet!
|
|
# 2021, Public Domain, SvenK
|
|
|
|
backup_directory="assets"
|
|
git_work_directory="AnarWiki"
|
|
|
|
# these are secrets:
|
|
#user="<YOUR USERNEME. better make a dedicated token at github/gitlab/etc>"
|
|
#pass="<YOUR PASS>"
|
|
remote="git@github.com:AnarDocs/AnarWiki.git"
|
|
|
|
set -e
|
|
|
|
rm -rf $git_work_directory
|
|
|
|
git clone --depth=1 $remote $git_work_directory
|
|
cp $backup_directory/* $git_work_directory
|
|
cd $git_work_directory
|
|
split -b 50M wikidata.tar.gz "wikidata.part"
|
|
rm wikidata.tar.gz
|
|
git add *
|
|
git repack -a -d -f --window=0
|
|
git commit -m"New backup carried out on $(hostname) by $(whoami) at local $(date)."
|
|
git push
|
|
cd ..
|
|
|