aboutsummaryrefslogtreecommitdiff
path: root/setup.sh
diff options
context:
space:
mode:
Diffstat (limited to 'setup.sh')
-rwxr-xr-xsetup.sh16
1 files changed, 12 insertions, 4 deletions
diff --git a/setup.sh b/setup.sh
index f667247..ed5bce5 100755
--- a/setup.sh
+++ b/setup.sh
@@ -348,15 +348,23 @@ else
fi
log "Generating systemd service file: $SYSTEMD_DIR/restic-backup.service"
+# Generate the service file with correct paths
sed -e "s|ExecStart=/path/to/be/replaced/restic_backup.sh|ExecStart=$INSTALL_DIR/restic_backup.sh|" \
- -e "s|Environment=\"HOME=/root\"|Environment=\"HOME=$HOME_PATH\"|" \
- -e "s|# Environment variable will be set by setup.sh based on scope|Environment=\"RESTIC_ENV_FILE=$ENV_FILE\"|" \
+ -e "s|Environment=\"RESTIC_ENV_FILE=/path/to/be/replaced\"|Environment=\"RESTIC_ENV_FILE=$ENV_FILE\"|" \
systemd/restic-backup.service >"$SYSTEMD_DIR/restic-backup.service"
+# Add HOME environment variable only for system scope
+if [ "$SCOPE" == "system" ]; then
+ sed -i "/# HOME will be set by setup.sh for system scope only/a Environment=\"HOME=/root\"" "$SYSTEMD_DIR/restic-backup.service"
+fi
log "Generating systemd service file: $SYSTEMD_DIR/restic-check.service"
+# Generate the service file with correct paths
sed -e "s|ExecStart=/path/to/be/replaced/restic_check.sh|ExecStart=$INSTALL_DIR/restic_check.sh|" \
- -e "s|Environment=\"HOME=/root\"|Environment=\"HOME=$HOME_PATH\"|" \
- -e "s|# Environment variable will be set by setup.sh based on scope|Environment=\"RESTIC_ENV_FILE=$ENV_FILE\"|" \
+ -e "s|Environment=\"RESTIC_ENV_FILE=/path/to/be/replaced\"|Environment=\"RESTIC_ENV_FILE=$ENV_FILE\"|" \
systemd/restic-check.service >"$SYSTEMD_DIR/restic-check.service"
+# Add HOME environment variable only for system scope
+if [ "$SCOPE" == "system" ]; then
+ sed -i "/# HOME will be set by setup.sh for system scope only/a Environment=\"HOME=/root\"" "$SYSTEMD_DIR/restic-check.service"
+fi
# Copy systemd timer files
log "Copying systemd timer file: $SYSTEMD_DIR/restic-backup.timer"