#!/bin/bash # Define paths SWEEP_SCRIPT="$HOME/.local/bin/exokortex_auto_commit.sh" TIMER_FILE="$HOME/.config/systemd/user/exokortex_auto_commit.timer" # Ensure the sweeper script is executable if [ -f "$SWEEP_SCRIPT" ] && [ ! -x "$SWEEP_SCRIPT" ]; then echo "Making the exokortex sweep script executable: $SWEEP_SCRIPT" chmod +x "$SWEEP_SCRIPT" || { echo "Failed to make the script executable"; exit 1; } else echo "Sweep script already executable or doesn't exist yet." fi # Reload user systemd to recognize the new units systemctl --user daemon-reload # Enable and start the timer if the configuration file is in place if [ -f "$TIMER_FILE" ]; then if ! systemctl --user is-enabled --quiet exokortex_auto_commit.timer; then echo "Enabling the exokortex_auto_commit timer." systemctl --user enable exokortex_auto_commit.timer || { echo "Failed to enable the timer"; exit 1; } else echo "Exokortex timer already enabled." fi else echo "Timer file does not exist at $TIMER_FILE." exit 1 fi # Start the timer if it is not currently ticking if systemctl --user is-active --quiet exokortex_auto_commit.timer; then echo "exokortex_auto_commit timer is already running." else echo "Starting the exokortex_auto_commit timer." systemctl --user start exokortex_auto_commit.timer || echo "Warning: ExoKortex timer failed to start, skipping..." fi echo "Post-installation steps for exokortex completed."