testsAndMisc/python_pkg/morning_routine/install.sh
Krzysztof kuhy Rudnicki 42e41319dd
Some checks failed
dependency freshness / dependencies on newest stable (push) Has been cancelled
md-naming / markdown naming convention (push) Has been cancelled
Pre-commit checks / pre-commit (push) Has been cancelled
Python tests / test (push) Has been cancelled
Shell tests / shell-tests (push) Has been cancelled
Shell tests / arch-tests (push) Has been cancelled
Drop the alarm leg from the morning routine
wake_alarm._alarm no longer exists: the PC's waking role was deleted in
kuhyx/wake-alarm, and the phone owns the alarm now. This removes ALARM_MODULE,
_run_alarm() and the --with-alarm flag, leaving one leg -- the workout lock.

Landing this in the same change as the deletion is the point. An orchestrator
left pointing at a module that no longer exists is exactly the failure this
repo has already had once: after screen-locker was extracted on 2026-05-28 the
reference here went stale and the workout lock died with ModuleNotFoundError on
every run for a month, while the alarm half kept working and hid it.

morning-routine.service loses --with-alarm and its comments now name what
actually starts it: wake-alarm-trigger.timer, at the phone's synced alarm time,
not the deleted systemd-sleep hook. Environment=DISPLAY=:0 stays -- the comment
credited it to the alarm's Tk window, but workout-locker.service needs it too.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PcdngP688mW6rJye3LRkSN
2026-08-30 15:26:04 +02:00

43 lines
1.7 KiB
Bash
Executable File

#!/bin/bash
# Install the morning routine: the workout lock, started at the alarm time.
#
# What it does:
# 1. Installs morning-routine.service (user service, started at alarm time).
# 2. Clears the retired standalone wake-alarm.service left by old installs.
# 3. Leaves workout-locker.service + the early-bird timer for login / 08:30.
#
# Prereq: run wake_alarm's own install.sh first (https://github.com/kuhyx/wake-alarm).
# It installs wake-alarm-trigger.timer, which ticks every minute and starts
# this unit at the time the phone synced. The PC no longer wakes anyone, so
# there is no longer a shutdown wrapper or systemd-sleep hook involved.
set -euo pipefail
SCRIPT_DIR="$(dirname "$(readlink -f "$0")")"
SERVICE_SRC="$SCRIPT_DIR/morning-routine.service"
SYSTEMD_USER_DIR="$HOME/.config/systemd/user"
echo "=== Unified Morning Routine Installer ==="
# 1. Install the orchestrator user service.
echo "[1/2] Installing morning-routine.service..."
mkdir -p "$SYSTEMD_USER_DIR"
cp "$SERVICE_SRC" "$SYSTEMD_USER_DIR/morning-routine.service"
systemctl --user daemon-reload
echo " Installed to $SYSTEMD_USER_DIR/morning-routine.service"
# 2. Clear the retired wake-alarm.service, which no longer exists upstream.
echo "[2/2] Clearing the retired wake-alarm.service..."
if systemctl --user cat wake-alarm.service &>/dev/null; then
systemctl --user disable wake-alarm.service 2>/dev/null || true
systemctl --user stop wake-alarm.service 2>/dev/null || true
echo " retired wake-alarm.service disabled"
else
echo " wake-alarm.service not installed; nothing to clear"
fi
echo "=== Installation complete ==="
echo "wake-alarm-trigger.timer starts this at the phone's synced alarm time."
echo "Test now:"
echo " python -m python_pkg.morning_routine._orchestrator --production"