Pause backup scheduling and atomically deploy workstation updates
This commit is contained in:
1 parent
8245571f15
commit
a1a843a6f7
4 files changed
+39
-6
No files matched your search
+12
-4
@@ -20,9 +20,6 @@ EXISTING_CONFIG=false
|
||||
|
||||
mkdir -p "${HOME}/.local/libexec" "$BIN_DIR" "$CONFIG_DIR" "$STATE_DIR/logs" "$SYSTEMD_USER_DIR"
|
||||
|
||||
install -m 0750 "$ROOT_DIR/scripts/nextcloud-borg-runner.py" "${HOME}/.local/libexec/nextcloud-borg-runner.py"
|
||||
install -m 0750 "$ROOT_DIR/scripts/nextcloud-borg-backup" "$BIN_DIR/nextcloud-borg-backup"
|
||||
|
||||
if [[ ! -f "$CONFIG_DIR/config" ]]; then
|
||||
install -m 0600 "$ROOT_DIR/etc/config.example" "$CONFIG_DIR/config"
|
||||
printf 'Installed config: %s\n' "$CONFIG_DIR/config"
|
||||
@@ -60,8 +57,19 @@ if [[ ! -f "$KEY_PATH" ]]; then
|
||||
printf 'Store a copy of this passphrase somewhere safe for disaster recovery.\n'
|
||||
fi
|
||||
|
||||
# Prevent a pending timer event from starting between replacing wrapper and runner.
|
||||
if systemctl --user cat nextcloud-borg-backup.service >/dev/null 2>&1; then
|
||||
systemctl --user stop nextcloud-borg-backup.service nextcloud-borg-backup.timer
|
||||
fi
|
||||
atomic_install() {
|
||||
install -m "$3" "$1" "$2.new"
|
||||
mv -f "$2.new" "$2"
|
||||
}
|
||||
atomic_install "$ROOT_DIR/scripts/nextcloud-borg-runner.py" "${HOME}/.local/libexec/nextcloud-borg-runner.py" 0750
|
||||
atomic_install "$ROOT_DIR/scripts/nextcloud-borg-backup" "$BIN_DIR/nextcloud-borg-backup" 0750
|
||||
|
||||
for unit in nextcloud-borg-backup.service nextcloud-borg-backup.timer nextcloud-borg-health.service nextcloud-borg-health.timer; do
|
||||
install -m 0644 "$ROOT_DIR/systemd/user/$unit" "$SYSTEMD_USER_DIR/$unit"
|
||||
atomic_install "$ROOT_DIR/systemd/user/$unit" "$SYSTEMD_USER_DIR/$unit" 0644
|
||||
done
|
||||
systemctl --user daemon-reload
|
||||
systemctl --user enable nextcloud-borg-backup.timer nextcloud-borg-health.timer
|
||||
|
||||
Reference in new issue
Block a user