Skip to content

Commit fe95c5e

Browse files
adam-azarchsEdSchouten
authored andcommitted
fix(deb): make postinst to work without notify-reboot-required
That doesn't exist on all systems, e.g. WSL. Check for existence before attempting to execute it. Also, use deb-systemd-invoke rather than directly using systemctl.
1 parent 4c6f8ab commit fe95c5e

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

configs/linux/postinst.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ fi
88

99
# Pick up changes to /etc/logind.conf.
1010
if [ -z "$(loginctl --no-legend list-sessions)" ]; then
11-
systemctl restart systemd-logind.service
11+
deb-systemd-invoke --system restart systemd-logind.service
1212
else
1313
# Restarting systemd-logind.service effectively kills user sessions and the
1414
# users' desktop environment, so let the user get a hint about reboot
@@ -21,7 +21,9 @@ else
2121
# In the future, the old version can determine if reboot is required:
2222
# if dpkg --compare-versions "$old_version" lt "20250312T094712Z-2b641c6"; then
2323
if [ -z "$old_version" ]; then
24-
/usr/share/update-notifier/notify-reboot-required
24+
if [ -x /usr/share/update-notifier/notify-reboot-required ]; then
25+
/usr/share/update-notifier/notify-reboot-required
26+
fi
2527
if [ -e /var/run/reboot-required ]; then
2628
cat /var/run/reboot-required
2729
fi
@@ -30,7 +32,7 @@ else
3032
fi
3133

3234
# Pick up changes to the systemd service.
33-
systemctl daemon-reload
35+
deb-systemd-invoke --system daemon-reload
3436

3537
# Multiple users may have enabled bb_clientd as a systemd user service.
3638
# Force a restart of all of these instances to ensure they do not run an

0 commit comments

Comments
 (0)