testsAndMisc/python_pkg/morning_routine/install.sh
Krzysztof kuhy Rudnicki e9ba82ed66
Some checks are pending
md-naming / markdown naming convention (push) Waiting to run
Pre-commit checks / pre-commit (${{ matrix.group }}) (mypy, mypy) (push) Waiting to run
Pre-commit checks / pre-commit (${{ matrix.group }}) (pylint, pylint) (push) Waiting to run
Pre-commit checks / pre-commit (${{ matrix.group }}) (rest, ) (push) Waiting to run
Pre-commit checks / pre-commit (${{ matrix.group }}) (shellcheck, shellcheck) (push) Waiting to run
Python tests / test (push) Waiting to run
repo-contract / repo contract (push) Waiting to run
Shell tests / shell-tests (push) Waiting to run
Shell tests / lib-tests (push) Waiting to run
Shell tests / arch-tests (push) Waiting to run
Put the kuhy credit on every python_pkg CLI
Twelve interactive CLIs end their --help on credit_line() from
kuhy-credit v0.3.1 (android_ui, workout_firebase_flow, app_icons,
archwiki_rag, artgate, code_tutor, js_anki, morning_routine,
phone_lease, random_jpg, sql_drills, vscode_optimizer). The repo has
no GUI, web app or game, so --help is the only surface.

morning_routine's unit runs /usr/bin/python, so its install.sh now
installs the requirements.txt pin there. Stdio/daemon entry points
stay without it; the evidence file lists each with the reason.

Also bumps Flutter to 3.50.1 and the stale Python pins.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 10:17:38 +01:00

52 lines
2.3 KiB
Bash
Executable File

#!/bin/bash
# Install the morning routine: the workout lock, started at the alarm time.
#
# What it does:
# 0. Installs kuhy-credit (pinned in meta/requirements.txt) for /usr/bin/python.
# 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"
REQUIREMENTS="$SCRIPT_DIR/../../meta/requirements.txt"
echo "=== Unified Morning Routine Installer ==="
# 0. The unit runs /usr/bin/python, not the repo venv, so the one third-party
# import (the kuhy credit on --help) goes into that interpreter's user site.
# The pin is read from meta/requirements.txt so the two never drift.
echo "[0/2] Installing kuhy-credit for /usr/bin/python..."
credit_pin="$(grep -m1 '^kuhy-credit @' "$REQUIREMENTS")"
/usr/bin/python -m pip install --user --break-system-packages --quiet "$credit_pin"
# 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"