diff options
Diffstat (limited to 'projectroot/usr/lib/systemd/systemd-rc-once')
-rw-r--r-- | projectroot/usr/lib/systemd/systemd-rc-once | 51 |
1 files changed, 51 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 000000000..ff7f7d3dc --- /dev/null +++ b/projectroot/usr/lib/systemd/systemd-rc-once @@ -0,0 +1,51 @@ +#!/bin/sh + +. /lib/init/initmethod-bbinit-functions.sh +. /lib/init/rc-once.sh + +start() { + if ! mount_root_rw; then + systemctl rescue + exit 1 + fi + if run_rc_once; then + rm -f /system-update + fi + systemctl daemon-reexec + sleep 1 + touch /var/lib/systemd/clock + 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 reboot + else + if [ -e /system-update ]; then + systemctl rescue + else + systemctl default + fi + fi +} + +case "$1" in + + start|"") + start + ;; + umount) + umount + ;; + *) + echo "Usage: $0 {start|umount}" >&2 + exit 1 + ;; +esac + +exit 0 + + |