Skip to content

Commit

Permalink
dietpi: make sure update-os isn't interrupted when triggered from web…
Browse files Browse the repository at this point in the history
…interface

dietpi-update stops adsb-setup, so when called from adsb-setup it will
kill itself and leave the system without adsb-setup running

fix this by calling update-os via systemd-run in a transient systemd
unit
  • Loading branch information
wiedehopf committed Dec 21, 2024
1 parent f60d6f7 commit 60a464b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions release-notes.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Changes since v2.2.4 include:
- dietpi: fix os update from webinterface producing a bad state requiring reboot
- fix range outline reset not working in many cases
- fix up base image reporting in log sanitizer
- vm images / dietpi: shutdown on ACPI shutdown / power button pressed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def do_reboot():
threading.Thread(target=do_reboot).start()

def os_update(self) -> None:
subprocess.call("/opt/adsb/scripts/update-os", shell=True)
subprocess.call("systemd-run --wait -u adsb-feeder-update-os /bin/bash /opt/adsb/scripts/update-os", shell=True)

def check_dns(self):
try:
Expand Down
13 changes: 13 additions & 0 deletions src/modules/adsb-feeder/filesystem/root/opt/adsb/scripts/update-os
Original file line number Diff line number Diff line change
@@ -1,9 +1,22 @@
#!/bin/bash
# do an OS update - either using the DietPi update tool or by just using apt

# log to /run/adsb-feeder-image.log
exec &>> /run/adsb-feeder-image.log

if [ -x /boot/dietpi/dietpi-update ] ; then
G_INTERACTIVE=0 CONFIG_CHECK_APT_UPDATES=2 /boot/dietpi/dietpi-update 1
else
apt update
apt upgrade -y
fi

# restart important services if not running for some reason
# dietpi-update will stop adsb-setup / adsb-docker (dietpi services?!)
# it should start it back up but let's just be safe here
if ! systemctl is-active adsb-update.service; then
systemctl restart adsb-update.service
fi
if ! systemctl is-active adsb-docker.service; then
systemctl restart adsb-docker.service
fi

0 comments on commit 60a464b

Please sign in to comment.