From: Christian Heller Date: Fri, 27 Mar 2020 22:00:43 +0000 (+0100) Subject: Refactor borg migration into own script. X-Git-Url: https://plomlompom.com/repos/%7B%7Bdb.prefix%7D%7D/tasks?a=commitdiff_plain;h=c758f6d282333666146fb450d55f08fc98842bf4;p=config Refactor borg migration into own script. --- diff --git a/buster/setup_scripts/migrate_borg.sh b/buster/setup_scripts/migrate_borg.sh new file mode 100755 index 0000000..477010b --- /dev/null +++ b/buster/setup_scripts/migrate_borg.sh @@ -0,0 +1,12 @@ +#!/bin/sh +set -e + +if [ "$#" -ne 1 ]; then + echo 'Need old server IP.' + false +fi +old_server="$1" +config_tree_prefix="${HOME}/config/buster" +cp "${config_tree_prefix}/setup_scripts/mirror_dir.sh" /home/plom/ +su -lc "./mirror_dir.sh ${old_server} /home/plom/borg" plom +rm /home/plom/{prepare_to_meet_server,mirror_dir}.sh diff --git a/buster/setup_scripts/setup_website.sh b/buster/setup_scripts/setup_website.sh index fef4b67..a79468a 100755 --- a/buster/setup_scripts/setup_website.sh +++ b/buster/setup_scripts/setup_website.sh @@ -46,6 +46,7 @@ read -p'Hit Enter when you are done.' ignore su -lc "cd /var/repos && git clone --mirror ${old_server}:repos/website" plom cp "${config_tree_prefix}/other_files/website_hook_post-receive" /var/repos/website.git/hooks/post-receive su -lc 'cd /var/www && git clone /var/repos/website.git .' plom +rm /home/plom/prepare_to_meet_server.sh # Add encryption key. keyservers='sks-keyservers.net/ keys.gnupg.net' @@ -84,13 +85,6 @@ chown plom:plom /home/plom/.plomlombot systemctl enable plomlombot.service service plomlombot start -# Migrate borg repo. -cp "${config_tree_prefix}/setup_scripts/mirror_dir.sh" /home/plom/ -su -lc "./mirror_dir.sh ${old_server} /home/plom/borg" plom - -# Clean up -rm /home/plom/{prepare_to_meet_server,mirror_dir}.sh - # TODO: # - commit git-daemon-export-ok directly into the public repos; rename # /home/plom/public_repos to /home/plom/repos