home · contact · privacy
Add borg repo mirroring.
authorChristian Heller <c.heller@plomlompom.de>
Fri, 27 Mar 2020 21:22:25 +0000 (22:22 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Fri, 27 Mar 2020 21:22:25 +0000 (22:22 +0100)
buster/other_files/plomlombot_daemon.sh
buster/setup_scripts/mirror_dir.sh [new file with mode: 0755]
buster/setup_scripts/setup_website.sh

index 8cf58a10d38b2734fe731d5a5c155f48dfbbc3dc..2f267bdd790de87f2e6b2cbc3a37c53c774e5198 100755 (executable)
@@ -41,7 +41,7 @@ while true; do
                 ln -sfn "${logs_dir}" "${irclogs_dir}/${shortened_channel_name}"
                 echo "${login_user}":'{PLAIN}'"${login_pw}" > "${irclogs_pw_dir}/${shortened_channel_name}"
 
-            # If "gpg" line, encrypt old raw logs to that GPG key.
+            # If "gpg_key" line, encrypt old raw logs to that GPG key.
             elif [ "${first_word}" = "gpg_key" ]; then
                 key=$(echo -n "${line}" | cut -d' ' -f2)
                 mkdir -p ~/plomlombot_db
diff --git a/buster/setup_scripts/mirror_dir.sh b/buster/setup_scripts/mirror_dir.sh
new file mode 100755 (executable)
index 0000000..0fc03aa
--- /dev/null
@@ -0,0 +1,23 @@
+#!/bin/sh
+# Mirror directory tree from remote to local server, keeping the path.
+set -e
+
+if [ $# -lt 2 ]; then
+    echo "Need server and directory as arguments."
+    false
+fi
+server=$1
+dir=$2
+path_package=/tmp/delete.tar
+
+eval `ssh-agent`
+ssh-add
+cd
+ssh plom@"${server}" "cd \"${dir}\" && tar cf ${path_package} ."
+scp plom@"${server}":"${path_package}" "${path_package}"
+mkdir -p "${dir}"
+cd "${dir}"
+tar xf "${path_package}"
+cd
+rm "${path_package}"
+ssh plom@"${server}" rm "${path_package}"
index 2eabead2c8a83ea8a0bcb02bebe7c02ad8510a3e..fef4b6772282d0cc25cf2c2d3606518032809c12 100755 (executable)
@@ -84,6 +84,13 @@ 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