Fix Volumio startup and online updates
This commit is contained in:
Executable
+58
@@ -0,0 +1,58 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
if [ "$(id -u)" -ne 0 ]; then
|
||||
echo "run this installer as root" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)"
|
||||
PHOENIX_ROOT="$(cd "$SCRIPT_DIR/.." && pwd -P)"
|
||||
SYSTEMD_SOURCE="$PHOENIX_ROOT/etc/systemd/system"
|
||||
SUDOERS_SOURCE="$PHOENIX_ROOT/etc/sudoers.d/phoenix-update-volumio"
|
||||
LIBEXEC_DIR="/usr/local/libexec/phoenix"
|
||||
|
||||
required_files=(
|
||||
"$SYSTEMD_SOURCE/analyzer-kiosk-volumio.service"
|
||||
"$SYSTEMD_SOURCE/analyzer-web-volumio.service"
|
||||
"$SYSTEMD_SOURCE/phoenix-update-volumio.service"
|
||||
"$SUDOERS_SOURCE"
|
||||
"$PHOENIX_ROOT/scripts/restart_phoenix_services.sh"
|
||||
)
|
||||
|
||||
for path in "${required_files[@]}"; do
|
||||
if [ ! -f "$path" ]; then
|
||||
echo "required Volumio integration file missing: $path" >&2
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
if ! command -v visudo >/dev/null 2>&1; then
|
||||
echo "visudo not found; refusing to install sudo policy" >&2
|
||||
exit 1
|
||||
fi
|
||||
visudo -cf "$SUDOERS_SOURCE"
|
||||
|
||||
install -d -o root -g root -m 0755 "$LIBEXEC_DIR"
|
||||
install -o root -g root -m 0755 \
|
||||
"$PHOENIX_ROOT/scripts/restart_phoenix_services.sh" \
|
||||
"$LIBEXEC_DIR/restart_phoenix_services.sh"
|
||||
install -o root -g root -m 0644 \
|
||||
"$SYSTEMD_SOURCE/analyzer-kiosk-volumio.service" \
|
||||
/etc/systemd/system/analyzer-kiosk-volumio.service
|
||||
install -o root -g root -m 0644 \
|
||||
"$SYSTEMD_SOURCE/analyzer-web-volumio.service" \
|
||||
/etc/systemd/system/analyzer-web-volumio.service
|
||||
install -o root -g root -m 0644 \
|
||||
"$SYSTEMD_SOURCE/phoenix-update-volumio.service" \
|
||||
/etc/systemd/system/phoenix-update-volumio.service
|
||||
install -o root -g root -m 0440 \
|
||||
"$SUDOERS_SOURCE" \
|
||||
/etc/sudoers.d/phoenix-update-volumio
|
||||
|
||||
systemctl daemon-reload
|
||||
systemctl enable analyzer-web-volumio.service analyzer-kiosk-volumio.service
|
||||
|
||||
echo "Volumio integration installed"
|
||||
echo "Existing services were not restarted"
|
||||
Reference in New Issue
Block a user