Migrate LMS/Squeezelite addon; fix is_service_enabled dead pre-check; bump to v2.9.0
New menus/addon_lms_squeezelite.sh: install/reconfigure/uninstall for an LMS (Lyrion/Logitech Media Server) server and a Squeezelite player, wired into install.sh's Addons menu. Squeezelite's own start script and systemd unit now go through $BIN_DIR/$SYSTEMD_DIR like every other addon instead of hardcoded /usr/local/bin and /etc/systemd/system; LMS's own apt repo/GPG key/ufw rules stay at their real fixed system paths, same approach as CUPS. Fixed a real unguarded-pipeline bug from the legacy install_lms(): `sudo systemctl enable "$service_name" 2>&1 | tee ...` made the exit status depend on tee (always 0) instead of systemctl enable, silently swallowing real enable/start failures. Now uses enable_and_start_units(). Fixed is_service_enabled() (shared helper, backported into the legacy script too): its list-unit-files pre-check never matched a bare service name, so it always fell through to "not enabled" regardless of the real state. Dropped the dead pre-check. Full command-level stubbed test suite covering install/reconfigure/ uninstall for both LMS and Squeezelite, including the repo-vs-fallback- download path, undetectable-service-name path, and enable/start-failure path. Full 12-suite regression + real end-to-end menu navigation via install.sh all pass. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VfsFSoRqfbRG7XAg5RoE7e
This commit is contained in:
@@ -78,6 +78,20 @@ is_service_active() {
|
||||
systemctl is-active --quiet "$service" 2>/dev/null
|
||||
}
|
||||
|
||||
# Whether a service is enabled (would start on boot), regardless of
|
||||
# whether it's currently running. The legacy script's version of this
|
||||
# pre-checked `systemctl list-unit-files | grep -q "^${service}\s"`
|
||||
# before calling is-enabled - but every call site passes a bare service
|
||||
# name (e.g. "squeezelite"), while list-unit-files lines start with
|
||||
# "squeezelite.service", so that regex never matched and the legacy
|
||||
# function always fell through to `return 1` no matter the real state.
|
||||
# `systemctl is-enabled` already reports "not found" as a failure on its
|
||||
# own, so the pre-check was both broken and unnecessary - dropped here.
|
||||
is_service_enabled() {
|
||||
local service="$1"
|
||||
systemctl is-enabled --quiet "$service" 2>/dev/null
|
||||
}
|
||||
|
||||
# Load every setting config.json has into the bash globals above.
|
||||
# Safe to call with no existing config file - leaves script defaults in place.
|
||||
load_existing_config() {
|
||||
|
||||
Reference in New Issue
Block a user