Skip to content

Commit

Permalink
fix: ensure config file exists at boot
Browse files Browse the repository at this point in the history
  • Loading branch information
Julusian committed Feb 2, 2024
1 parent e5c241d commit c410c65
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
15 changes: 15 additions & 0 deletions pi-image/fixup-config.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

SATELLITE_CONFIG_PATH=/boot/satellite-config

# path could be a symlink
SATELLITE_CONFIG_PATH=$(realpath $SATELLITE_CONFIG_PATH)

# config file doesn't exist, try and find it
if ! [ -f "$SATELLITE_CONFIG_PATH" ]; then
if [ -f "/boot/firmware/satellite-config" ]; then
ln -s /boot/firmware/satellite-config $SATELLITE_CONFIG_PATH
else
echo "Warning: Failed to find config"
fi
fi
5 changes: 3 additions & 2 deletions pi-image/satellite.service
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ Wants=network-online.target
Type=simple
User=satellite
WorkingDirectory=/usr/local/src/companion-satellite
EnvironmentFile=/boot/satellite-config
EnvironmentFile=-/boot/satellite-config
Environment=SATELLITE_CONFIG_PATH=/boot/satellite-config
ExecStartPre=+/usr/local/src/companion-satellite/pi-image/fixup-config.sh
ExecStart=/opt/fnm/aliases/default/bin/node /usr/local/src/companion-satellite/dist/main.js $COMPANION_IP $COMPANION_PORT $REST_PORT
Restart=on-failure
Restart=always
KillSignal=SIGINT
TimeoutStopSec=60

Expand Down

0 comments on commit c410c65

Please sign in to comment.