Skip to content

Commit

Permalink
refactor: Update the implementation of the re-installation timer to r…
Browse files Browse the repository at this point in the history
…educe the likelihood of failure to execute
  • Loading branch information
notheotherben committed Jan 8, 2025
1 parent 03d0667 commit 2b921e5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
6 changes: 3 additions & 3 deletions package/tailscale-install.service
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[Unit]
Description=Ensure that Tailscale is installed on your device
After=network.target
Requires=mnt-.rwfs.mount
Wants=tailscale-install.timer

[Service]
Type=oneshot
RemainAfterExit=no
Restart=no
Environment=DEBIAN_FRONTEND=noninteractive
ExecStart=/bin/bash /data/tailscale/manage.sh on-boot
ExecStart=/bin/bash -c "/data/tailscale/manage.sh on-boot"

[Install]
WantedBy=multi-user.target
3 changes: 2 additions & 1 deletion package/tailscale-install.timer
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
[Unit]
Description=Ensure that Tailscale is updated automatically on your device.
Requires=tailscale-install.service

[Timer]
OnBootSec=5m
OnUnitActiveSec=24h
Unit=tailscale-install.service

[Install]
WantedBy=multi-user.target
WantedBy=timers.target
13 changes: 7 additions & 6 deletions package/unios_2.x.sh
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,6 @@ _tailscale_install() {

echo "Installing pre-start script to install Tailscale on firmware updates."
ln -s "${TAILSCALE_ROOT}/tailscale-install.service" /etc/systemd/system/tailscale-install.service

systemctl daemon-reload
systemctl enable tailscale-install.service
fi

if [ ! -L "/etc/systemd/system/tailscale-install.timer" ]; then
Expand All @@ -102,11 +99,12 @@ _tailscale_install() {

echo "Installing auto-update timer to ensure that Tailscale is kept installed and up to date."
ln -s "${TAILSCALE_ROOT}/tailscale-install.timer" /etc/systemd/system/tailscale-install.timer

systemctl daemon-reload
systemctl enable --now tailscale-install.timer
fi

systemctl daemon-reload
systemctl enable tailscale-install.service
systemctl enable --now tailscale-install.timer

echo "Installation complete, run '$0 start' to start Tailscale"
}

Expand All @@ -116,4 +114,7 @@ _tailscale_uninstall() {

systemctl disable tailscale-install.service || true
rm -f /lib/systemd/system/tailscale-install.service || true

systemctl disable tailscale-install.timer || true
rm -f /lib/systemd/system/tailscale-install.timer || true
}

0 comments on commit 2b921e5

Please sign in to comment.