fix: derive brewpi home from script location in service install
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VsJfJngYUpB4dr77GvcEb8
This commit is contained in:
+5
-3
@@ -1,11 +1,13 @@
|
||||
#!/usr/bin/env bash
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
SERVICE=brewpi
|
||||
UNIT_FILE="$(dirname "$(realpath "$0")")/${SERVICE}.service"
|
||||
DEPLOY_DIR="$(dirname "$(realpath "$0")")"
|
||||
UNIT_FILE="${DEPLOY_DIR}/${SERVICE}.service"
|
||||
TARGET=/etc/systemd/system/${SERVICE}.service
|
||||
|
||||
sudo cp "$UNIT_FILE" "$TARGET"
|
||||
export BREWPI_HOME="$(realpath "${DEPLOY_DIR}/..")"
|
||||
envsubst < "$UNIT_FILE" | sudo tee "$TARGET" > /dev/null
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl enable "$SERVICE"
|
||||
echo "Installed. Start with: sudo systemctl start $SERVICE"
|
||||
|
||||
Reference in New Issue
Block a user