5ef38dc46f
- deps guards before -h|--help in docker-health/ps, network-scan, usb-server, media-mp3/mp4 (--dry-run pre-scan kept); system-firewall gains usage()/--help; autostart/usb-automount get flags.sh + template - install.sh: normalize N-M range syntax in --steps - bin/pos: INTERACTIVE_CMDS += docker-compose docker-vbox network-hotspot - common.sh: canonical XDG-aware CONFIG_DIR + DIM color var; notify.sh stderr fallback; ent_plugin_* registry renames (runtime plugin API kept) - docker-compose SCALE_DIR/CONFIG_ENV env seams; ffmpeg in PACKAGES; scrcpy.sh exec bit - docs: health is console-only (--send/--markdown removed), POS.md file refs for config/tree/entertainment, DEV.md no-guard exception, docmap/ filetable regenerated (make gen), hand-maintained line rows bumped - add scripts/lint-conventions.sh gate + Makefile lint target; record all VERIFIED outcomes in MAINTENANCE.md; AGENT_TODO Done entry (2026-08-14) - gates: make gen/check/lint all green (0 FAIL, 0 WARN); bash -n sweep clean; restricted-PATH dep tests + step-matrix dry-runs verified
50 lines
1.5 KiB
Bash
Executable File
50 lines
1.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
# POS: entertainment enable — Enable an auto-trigger for a plugin on a schedule
|
|
|
|
source "$(dirname "$0")/../lib/common.sh" 2>/dev/null || source "$(dirname "$0")/common.sh"
|
|
source "$(dirname "$0")/../lib/entertainment-lib.sh" 2>/dev/null || source "$(dirname "$0")/entertainment-lib.sh"
|
|
|
|
usage() {
|
|
cat <<EOF
|
|
Usage: pos entertainment enable <plugin> [interval]
|
|
|
|
Enable an auto-trigger: writes '<plugin>, <interval>' into the ENABLED list in
|
|
$CONFIG_FILE
|
|
and schedules 'pos entertainment send <plugin>' to run as a systemd user
|
|
timer. Re-running without an interval keeps the plugin's current one.
|
|
|
|
Available plugins:
|
|
$(list_plugins "$(ent_plugin_dir)" | sed 's/^/ /')
|
|
|
|
Intervals: 5m 10m 15m 30m 45m hourly 2h 6h 12h daily weekly, or OnCalendar=...
|
|
Default: $DEFAULT_INTERVAL
|
|
|
|
Stop it with: pos entertainment disable <plugin>
|
|
|
|
Examples:
|
|
pos entertainment enable weather 5m
|
|
pos entertainment enable gold hourly
|
|
pos entertainment enable joke
|
|
EOF
|
|
exit 0
|
|
}
|
|
|
|
case "${1:-}" in
|
|
-h|--help) usage ;;
|
|
esac
|
|
|
|
[ $# -ge 1 ] || usage
|
|
plugin="$1"
|
|
interval="${2:-}"
|
|
|
|
resolve_plugin "$(ent_plugin_dir)" "$plugin" >/dev/null
|
|
if [ -n "$interval" ]; then
|
|
ut_interval_to_oncalendar "$interval" >/dev/null || \
|
|
err "Invalid interval '$interval' (allowed: 5m 10m 15m 30m 45m hourly 2h 6h 12h daily weekly, or OnCalendar=...)"
|
|
fi
|
|
|
|
enabled_upsert "$plugin" "$interval"
|
|
sync_timers
|
|
ok "'$plugin' enabled${interval:+ (every $interval)} — schedule synced"
|