From c758f6d282333666146fb450d55f08fc98842bf4 Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Fri, 27 Mar 2020 23:00:43 +0100 Subject: [PATCH] Refactor borg migration into own script. --- buster/setup_scripts/migrate_borg.sh | 12 ++++++++++++ buster/setup_scripts/setup_website.sh | 8 +------- 2 files changed, 13 insertions(+), 7 deletions(-) create mode 100755 buster/setup_scripts/migrate_borg.sh 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 -- 2.30.2