slaprunner: importer script: use variables.

Allow to lint/edit/develop more easily the bash script without having tons of template parameters.
parent 488f8554
......@@ -2,6 +2,7 @@
LC_ALL=C
export LC_ALL
umask 077
srv_directory={{ directory['srv'] }}
restore_element () {
backup_path=$1
restore_path=$2
......@@ -18,23 +19,24 @@ restore_element () {
write_backup_proof () {
cd {{ directory['backup'] }}
find -type f ! -name backup.signature ! -wholename "./rdiff-backup-data/*" -print0 | xargs -P4 -0 sha256sum | LC_ALL=C sort -k 66 > {{ directory['srv'] }}/proof.signature
diff -ruw {{ directory['backup'] }} {{ directory['srv'] }}/proof.signature > {{ directory['srv'] }}/backup.diff
find -type f ! -name backup.signature ! -wholename "./rdiff-backup-data/*" -print0 | xargs -P4 -0 sha256sum | LC_ALL=C sort -k 66 > $srv_directory/proof.signature
diff -ruw {{ directory['backup'] }} $srv_directory/proof.signature > $srv_directory/backup.diff
}
# For now we just make the diff before
# For now we just make the diff before
write_backup_proof
restore_element {{ directory['backup'] }}/runner/ {{ directory['srv'] }}/runner instance project proxy.db
restore_element {{ directory['backup'] }}/runner/ $srv_directory/runner instance project proxy.db
restore_element {{ directory['backup'] }}/etc/ {{ directory['etc'] }} config.json ssh
cp -r {{ directory['backup'] }}/etc/.??* {{ directory['etc'] }};
{{ curl_binary }} --insecure -vg6L --max-time 5 {{ backend_url }}/isSRReady;
if [ -e {{ directory['srv'] }}/runner-import-restore ]; then
touch {{ directory['srv'] }}/runner-import-restore
chmod +x {{ directory['srv'] }}/runner-import-restore
if [ -e $srv_directory/runner-import-restore ]; then
touch $srv_directory/runner-import-restore
chmod +x $srv_directory/runner-import-restore
fi
# Invoke arbitrary script to perform specific restauration
# Invoke arbitrary script to perform specific restoration
# procedure.
{{ directory['srv'] }}/runner-import-restore
$srv_directory/runner-import-restore
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment