fix where update-kiosk script will pull latest but not update the deployed install
This commit is contained in:
parent
9f20e5d26f
commit
57f88c41ee
@ -2,23 +2,38 @@
|
||||
|
||||
set -e
|
||||
|
||||
cd /home/pi/kiosk || exit 1
|
||||
REPO_DIR="/home/pi/kiosk"
|
||||
SYSTEMD_DIR="/etc/systemd/system"
|
||||
|
||||
# Fetch latest updates and tags
|
||||
cd "$REPO_DIR" || exit 1
|
||||
|
||||
echo "🔄 Pulling latest repo and tags..."
|
||||
git fetch --tags origin
|
||||
git fetch origin
|
||||
|
||||
# Get latest tag, if any
|
||||
LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1` 2>/dev/null || echo "")
|
||||
# Determine latest tag
|
||||
LATEST_TAG=$(git describe --tags "$(git rev-list --tags --max-count=1)" 2>/dev/null || echo "")
|
||||
|
||||
if [ -n "$LATEST_TAG" ]; then
|
||||
echo "Checking out latest tag: $LATEST_TAG"
|
||||
echo "➡️ Checking out latest tag: $LATEST_TAG"
|
||||
git checkout "$LATEST_TAG"
|
||||
else
|
||||
echo "No tags found — using main branch"
|
||||
echo "⚠️ No tags found — using main"
|
||||
git checkout main
|
||||
git pull origin main
|
||||
fi
|
||||
|
||||
# Restart the kiosk service to apply updates
|
||||
# Re-copy updated service and timer files
|
||||
echo "📦 Updating systemd service files..."
|
||||
sudo cp kiosk.service "$SYSTEMD_DIR/"
|
||||
sudo cp update-kiosk.service "$SYSTEMD_DIR/"
|
||||
sudo cp update-kiosk.timer "$SYSTEMD_DIR/"
|
||||
|
||||
echo "🔁 Reloading systemd..."
|
||||
sudo systemctl daemon-reexec
|
||||
sudo systemctl daemon-reload
|
||||
|
||||
echo "🚀 Restarting kiosk service..."
|
||||
sudo systemctl restart kiosk.service
|
||||
|
||||
echo "✅ Update complete!"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user