Offline addons, LAN-aware emergency hotspot, LAN time server
Offline bundle now carries every addon that works on a network without internet: LMS (Lyrion's own .deb, from the addon's LMS_DEB_URL) + Squeezelite, Asterisk Intercom (baresip), VNC, WireGuard and the Emergency Hotspot packages - each list in a variable next to the code that installs it (SQUEEZELITE_APT_PACKAGES, ASTERISK_INTERCOM_APT_PACKAGES, VNC_APT_PACKAGES, WIREGUARD_APT_PACKAGES, EMERGENCY_HOTSPOT_APT_PACKAGES), read by build-bundle.sh. Each install goes through run_with_offline_fallback like CUPS, so they install offline from the normal menus / Web UI. LMS installs as a bundle package when offline (lms_offline_install_wanted); its online repo/direct-download paths are unchanged. Tailscale/Netbird deliberately not bundled (vendor scripts, vendor servers). Bundle: 524 MB (+87 MB). Emergency hotspot: the boot check pinged only 8.8.8.8, so on a LAN with no internet the hotspot started on every boot. Now chosen at setup: "network" (default - router or internet must answer; a router that ignores ping still counts if it answered ARP), "internet" (old check), or "host" (a specific address). Three tries 10s apart. Existing scripts keep the old check until Reconfigure. New Core Settings -> Time Server (NTP) (menus/time_sync.sh): point systemd-timesyncd at LAN time server(s) via a timesyncd.conf.d drop-in, back to Ubuntu's defaults, or set the clock by hand (and the RTC) for a network with no time server. Complete Uninstall resets it. Also: lms_service_name used `systemctl list-unit-files | grep -q`, the same pipefail/SIGPIPE pattern as the earlier cups_is_installed bug; now `systemctl cat`. Tested in a network-less chroot of the 26.04.1 server filesystem: kiosk base, then action_wireguard_install and action_install_lms (real functions) and the Squeezelite/Intercom/VNC/hotspot package sets all installed from the bundle, apt left on normal sources after each. Hotspot script generated for all three modes (plus an invalid address, which falls back to "network") and its check run against simulated networks: LAN-only with router answering ping or only ARP -> no hotspot in "network" mode; nothing reachable -> hotspot. Time Server actions driven with timedatectl stubbed: drop-in contents, input validation, manual set-time sequence, reset removes the drop-in. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Cjz8a58eB5P9sUweqd3NHm
This commit is contained in:
@@ -22,10 +22,23 @@
|
||||
# Depends on: lib/menu.sh, lib/config.sh being sourced first.
|
||||
################################################################################
|
||||
|
||||
# Also read by iso/offline/build-bundle.sh, to bundle the same versions
|
||||
# for offline installs (the .deb itself plus its apt dependencies).
|
||||
LMS_DEB_URL="https://downloads.lms-community.org/LyrionMusicServer_v9.0.3/lyrionmusicserver_9.0.3_amd64.deb"
|
||||
SQUEEZELITE_APT_PACKAGES=(squeezelite)
|
||||
|
||||
# True on a kiosk installed from an --offline ISO that can't reach the
|
||||
# internet right now - the one case where LMS comes from the bundle.
|
||||
lms_offline_install_wanted() {
|
||||
grep -q '^Package: lyrionmusicserver$' "$KIOSK_OFFLINE_DIR/apt/Packages" 2>/dev/null && ! have_internet
|
||||
}
|
||||
|
||||
lms_service_name() {
|
||||
if systemctl list-unit-files 2>/dev/null | grep -q "lyrionmusicserver.service"; then
|
||||
# `systemctl cat`, not `list-unit-files | grep -q`: grep -q exiting
|
||||
# early can SIGPIPE systemctl, failing the pipeline under pipefail.
|
||||
if systemctl cat lyrionmusicserver.service &>/dev/null; then
|
||||
echo "lyrionmusicserver"
|
||||
elif systemctl list-unit-files 2>/dev/null | grep -q "logitechmediaserver.service"; then
|
||||
elif systemctl cat logitechmediaserver.service &>/dev/null; then
|
||||
echo "logitechmediaserver"
|
||||
fi
|
||||
}
|
||||
@@ -114,42 +127,53 @@ action_install_lms() {
|
||||
|
||||
echo "Installing Lyrion Music Server..."
|
||||
|
||||
# Try the repository method first.
|
||||
if wget -qO - https://debian.slimdevices.com/debian/squeezebox-keyring.gpg | sudo gpg --dearmor -o /usr/share/keyrings/lms-keyring.gpg 2>/dev/null; then
|
||||
echo "deb [signed-by=/usr/share/keyrings/lms-keyring.gpg] http://debian.slimdevices.com/debian stable main" | sudo tee /etc/apt/sources.list.d/lms.list
|
||||
# `|| true`: a bare, unguarded `apt update` failing here (bad
|
||||
# mirror, no network) would otherwise crash the whole session
|
||||
# under set -e instead of falling through to the direct-download
|
||||
# fallback below, which is exactly the degrade path this is
|
||||
# supposed to hit when the repository route doesn't work.
|
||||
sudo apt update 2>/dev/null || true
|
||||
if sudo apt install -y logitechmediaserver 2>/dev/null; then
|
||||
log_success "LMS installed via repository"
|
||||
else
|
||||
log_warning "Repository install failed, trying direct download..."
|
||||
if lms_offline_install_wanted; then
|
||||
# Kiosk installed from an --offline ISO with no internet right now:
|
||||
# the bundle carries the same LMS_DEB_URL .deb as a package.
|
||||
if ! run_with_offline_fallback sudo apt install -y lyrionmusicserver; then
|
||||
log_error "Failed to install LMS from the offline bundle"
|
||||
pause
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Fall back to a direct .deb download if the repository didn't produce
|
||||
# either possible package.
|
||||
if ! command -v logitechmediaserver &>/dev/null && ! command -v lyrionmusicserver &>/dev/null; then
|
||||
local lms_deb="/tmp/lms.deb"
|
||||
echo "Downloading LMS v9.0.3..."
|
||||
if wget -q https://downloads.lms-community.org/LyrionMusicServer_v9.0.3/lyrionmusicserver_9.0.3_amd64.deb -O "$lms_deb"; then
|
||||
echo "Installing LMS package..."
|
||||
if sudo apt install -y "$lms_deb"; then
|
||||
log_success "LMS installed via direct download"
|
||||
log_success "LMS installed from the offline bundle"
|
||||
else
|
||||
# Try the repository method first.
|
||||
if wget -qO - https://debian.slimdevices.com/debian/squeezebox-keyring.gpg | sudo gpg --dearmor -o /usr/share/keyrings/lms-keyring.gpg 2>/dev/null; then
|
||||
echo "deb [signed-by=/usr/share/keyrings/lms-keyring.gpg] http://debian.slimdevices.com/debian stable main" | sudo tee /etc/apt/sources.list.d/lms.list
|
||||
# `|| true`: a bare, unguarded `apt update` failing here (bad
|
||||
# mirror, no network) would otherwise crash the whole session
|
||||
# under set -e instead of falling through to the direct-download
|
||||
# fallback below, which is exactly the degrade path this is
|
||||
# supposed to hit when the repository route doesn't work.
|
||||
sudo apt update 2>/dev/null || true
|
||||
if sudo apt install -y logitechmediaserver 2>/dev/null; then
|
||||
log_success "LMS installed via repository"
|
||||
else
|
||||
log_error "Failed to install LMS package"
|
||||
log_warning "Repository install failed, trying direct download..."
|
||||
fi
|
||||
fi
|
||||
|
||||
# Fall back to a direct .deb download if the repository didn't produce
|
||||
# either possible package.
|
||||
if ! command -v logitechmediaserver &>/dev/null && ! command -v lyrionmusicserver &>/dev/null; then
|
||||
local lms_deb="/tmp/lms.deb"
|
||||
echo "Downloading LMS ($(basename "$LMS_DEB_URL"))..."
|
||||
if wget -q "$LMS_DEB_URL" -O "$lms_deb"; then
|
||||
echo "Installing LMS package..."
|
||||
if sudo apt install -y "$lms_deb"; then
|
||||
log_success "LMS installed via direct download"
|
||||
else
|
||||
log_error "Failed to install LMS package"
|
||||
rm -f "$lms_deb"
|
||||
pause
|
||||
return 1
|
||||
fi
|
||||
rm -f "$lms_deb"
|
||||
else
|
||||
log_error "Failed to download LMS from lms-community.org"
|
||||
pause
|
||||
return 1
|
||||
fi
|
||||
rm -f "$lms_deb"
|
||||
else
|
||||
log_error "Failed to download LMS from lms-community.org"
|
||||
pause
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -250,7 +274,7 @@ action_install_squeezelite() {
|
||||
fi
|
||||
|
||||
if ! command -v squeezelite &>/dev/null; then
|
||||
if ! sudo apt install -y squeezelite; then
|
||||
if ! run_with_offline_fallback sudo apt install -y "${SQUEEZELITE_APT_PACKAGES[@]}"; then
|
||||
log_error "squeezelite package installation failed"
|
||||
pause
|
||||
return 1
|
||||
|
||||
Reference in New Issue
Block a user