| 1 |
# SPDX-License-Identifier: LGPL-2.1-or-later |
| 2 |
# |
| 3 |
# This file is part of systemd. |
| 4 |
# |
| 5 |
# systemd is free software; you can redistribute it and/or modify it |
| 6 |
# under the terms of the GNU Lesser General Public License as published by |
| 7 |
# the Free Software Foundation; either version 2.1 of the License, or |
| 8 |
# (at your option) any later version. |
| 9 |
|
| 10 |
[Unit] |
| 11 |
Description=Remove the Offline System Updates Symlink |
| 12 |
Documentation=man:systemd.special(7) man:systemd.offline-updates(7) |
| 13 |
After=system-update.target |
| 14 |
DefaultDependencies=no |
| 15 |
Conflicts=shutdown.target |
| 16 |
Before=shutdown.target |
| 17 |
SuccessAction=reboot |
| 18 |
|
| 19 |
# system-update-generator uses laccess("/system-update"), while a plain |
| 20 |
# ConditionPathExists=/system-update uses access("/system-update"), so |
| 21 |
# we need an alternate condition to cover the case of a dangling symlink. |
| 22 |
# |
| 23 |
# This service is only invoked if /system-update exists, i.e. if the |
| 24 |
# condition tested by system-update-generator remains true and the system |
| 25 |
# would be diverted into system-update.target again after reboot. This way |
| 26 |
# we guard against being diverted into system-update.target again, which |
| 27 |
# works as a safety measure, but we will not step on the toes of the |
| 28 |
# update script if it successfully removed the symlink and scheduled a |
| 29 |
# reboot or some other action on its own. |
| 30 |
ConditionPathExists=|/system-update |
| 31 |
ConditionPathIsSymbolicLink=|/system-update |
| 32 |
ConditionPathExists=|/etc/system-update |
| 33 |
ConditionPathIsSymbolicLink=|/etc/system-update |
| 34 |
|
| 35 |
[Service] |
| 36 |
Type=oneshot |
| 37 |
ExecStart=systemd-tmpfiles --inline --remove 'r /system-update' 'r /etc/system-update' |