feat: add feature-flag subsystem with on-demand features install
- Move autostart.sh from bin/ to features/ so re-installs never reset it - Add lib/flags.sh (flag_set/clear/is_set/value/list/status) + flag-reader/set/clear CLIs - install.sh --feature copies features/* to /usr/local/bin with overwrite prompt, sets flags - postinstall.sh enables autostart.service only when the autostart flag is set - Document features & flags in README, DEV.md, AGENT_Context_Project.md
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
source "$(dirname "$0")/lib/common.sh"
|
||||
source "$(dirname "$0")/lib/flags.sh"
|
||||
|
||||
log "Running post-install..."
|
||||
|
||||
@@ -79,6 +80,12 @@ if [ -d systemd ] && [ -n "$(ls -A systemd/*.service 2>/dev/null)" ]; then
|
||||
|
||||
for svc in systemd/*.service; do
|
||||
svc_name=$(basename "$svc")
|
||||
# autostart.service runs features/autostart.sh — enable only when
|
||||
# the autostart feature flag is green (set by ./install.sh --feature)
|
||||
if [ "$svc_name" = "autostart.service" ] && ! flag_is_set autostart; then
|
||||
warn "autostart feature not installed — skipping autostart.service (run ./install.sh --feature)"
|
||||
continue
|
||||
fi
|
||||
run sudo systemctl enable --now "$svc_name" 2>/dev/null || \
|
||||
run sudo systemctl enable "$svc_name"
|
||||
done
|
||||
|
||||
Reference in New Issue
Block a user