diff options
author | Robert Schwebel <r.schwebel@pengutronix.de> | 2020-08-10 11:54:51 +0200 |
---|---|---|
committer | Robert Schwebel <r.schwebel@pengutronix.de> | 2020-08-10 17:30:26 +0200 |
commit | 86b84a60ff3629c325b0d65553530297bb53a953 (patch) | |
tree | 5e00b1b38c473679b474e7c5c9e87f768168b968 | |
parent | 6d58761639e98c250c3179234f11a23d7cb62957 (diff) | |
download | DistroKit-86b84a60ff3629c325b0d65553530297bb53a953.tar.gz DistroKit-86b84a60ff3629c325b0d65553530297bb53a953.tar.xz |
rc-once: copy upstream systemd-rc-once from ptxdist-2020.08.0
This is the original file, which will be modified in the next commit.
Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
-rw-r--r-- | projectroot/usr/lib/systemd/systemd-rc-once | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/projectroot/usr/lib/systemd/systemd-rc-once b/projectroot/usr/lib/systemd/systemd-rc-once new file mode 100644 index 0000000..e14936e --- /dev/null +++ b/projectroot/usr/lib/systemd/systemd-rc-once @@ -0,0 +1,54 @@ +#!/bin/sh + +. /lib/init/initmethod-bbinit-functions.sh +. /lib/init/rc-once.sh + +start() { + if ! mount_root_rw; then + systemctl --no-block rescue + exit 1 + fi + if run_rc_once; then + rm -f /system-update + fi + systemctl daemon-reexec + sleep 1 + if [ -d /var/lib/systemd/timesync ]; then + touch /var/lib/systemd/timesync/clock + chown systemd-timesync:nogroup /var/lib/systemd/timesync/clock + fi + exec "$0" umount +} + +umount() { + if ! mount_root_restore; then + # remounting rw/ro during the second boot will flush anything + # left in the filesystem journal + ln -sf /etc/rc.once.d /system-update + systemctl --no-block reboot + else + if [ -e /system-update ]; then + systemctl --no-block rescue + else + systemctl --no-block default + fi + fi +} + +case "$1" in + + start|"") + start + ;; + umount) + umount + ;; + *) + echo "Usage: $0 {start|umount}" >&2 + exit 1 + ;; +esac + +exit 0 + + |