Skip to content

Commit 49973e6

Browse files
committed
fix: start main service after restore for single-boot recovery
install.sh now explicitly starts unifi-on-boot.service after dpkg -i so on_boot.d scripts run on the same boot as the restore, not requiring a second reboot. Removed Before=network-online.target from the install service to prevent a deadlock (main service needs After=network-online.target). Bumped to v1.0.7.
1 parent 4cdfcea commit 49973e6

5 files changed

Lines changed: 15 additions & 9 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ Install: `ansible-galaxy install -r requirements.yml`
172172

173173
| Variable | Default | Description |
174174
|----------|---------|-------------|
175-
| `unifi_on_boot_version` | `"1.0.6"` | Version to install from GitHub releases (update to latest) |
175+
| `unifi_on_boot_version` | `"1.0.7"` | Version to install from GitHub releases (update to latest) |
176176
| `unifi_on_boot_remove_conflicts` | `true` | Remove `udm-boot`/`udm-boot-2x` if present |
177177
| `unifi_on_boot_scripts` | `[]` | List of scripts to deploy (see example above) |
178178
| `unifi_on_boot_run_after_deploy` | `false` | Run on-boot scripts immediately after deploy |

ansible/defaults/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# defaults for unifi-on-boot ansible role
33

44
# Version of unifi-on-boot to install
5-
unifi_on_boot_version: "1.0.6"
5+
unifi_on_boot_version: "1.0.7"
66

77
# GitHub release download URL
88
unifi_on_boot_github_repo: "unredacted/unifi-on-boot"

debian/control

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Package: unifi-on-boot
2-
Version: 1.0.6
2+
Version: 1.0.7
33
Architecture: all
44
Maintainer: Unredacted <contact@unredacted.org>
55
Depends: bash, systemd

debian/install.sh

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,19 @@ fi
4040
log "Restoring from: ${DEB}"
4141

4242
# Install the package
43-
# Note: postinst handles systemctl enable + daemon-reload.
44-
# Do NOT start the service here — it would run all on_boot.d scripts
45-
# (including Tailscale) which can disrupt network connectivity.
46-
# The main service starts later in the same boot via WantedBy=multi-user.target.
43+
# postinst handles systemctl enable + daemon-reload.
44+
# We also need to start the main service explicitly because it gets enabled
45+
# mid-boot after multi-user.target has already evaluated its dependencies.
46+
# This is safe: install.sh only runs from a systemd service at boot time,
47+
# not during interactive SSH sessions, so Tailscale restarts won't disrupt anything.
4748
if dpkg -i "${DEB}"; then
48-
log "Package restored successfully (service will start later in boot)"
49+
log "Package restored successfully"
50+
# Start the main service so on_boot.d scripts run on this boot
51+
if systemctl start "${PACKAGE_NAME}.service" 2>/dev/null; then
52+
log "Service started — on_boot.d scripts executed"
53+
else
54+
log "WARNING: Could not start service (scripts will run on next boot)"
55+
fi
4956
else
5057
log "ERROR: Failed to restore package"
5158
exit 1

debian/unifi-on-boot-install.service

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
[Unit]
22
Description=Restore unifi-on-boot after firmware upgrade
33
After=local-fs.target
4-
Before=network-online.target
54
RequiresMountsFor=/data
65

76
[Service]

0 commit comments

Comments
 (0)