home · contact · privacy
Refactor borg migration into own script.
authorChristian Heller <c.heller@plomlompom.de>
Fri, 27 Mar 2020 22:00:43 +0000 (23:00 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Fri, 27 Mar 2020 22:00:43 +0000 (23:00 +0100)
buster/setup_scripts/migrate_borg.sh [new file with mode: 0755]
buster/setup_scripts/setup_website.sh

diff --git a/buster/setup_scripts/migrate_borg.sh b/buster/setup_scripts/migrate_borg.sh
new file mode 100755 (executable)
index 0000000..477010b
--- /dev/null
@@ -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
index fef4b6772282d0cc25cf2c2d3606518032809c12..a79468a52abee687fa13326f45285e8c8cca2aa8 100755 (executable)
@@ -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