From e74c5e613d9e1a7e3813a5fd830dac5758f4462b Mon Sep 17 00:00:00 2001 From: Michael Olbrich Date: Mon, 9 Jan 2017 15:30:47 +0100 Subject: rc-once: /usr merge Signed-off-by: Michael Olbrich --- projectroot/lib/init/rc-once.sh | 25 ----------- projectroot/lib/systemd/system/rc-once.service | 15 ------- projectroot/lib/systemd/systemd-rc-once | 51 ---------------------- projectroot/sbin/enable-rc-once | 11 ----- projectroot/usr/lib/init/rc-once.sh | 25 +++++++++++ projectroot/usr/lib/systemd/system/rc-once.service | 15 +++++++ projectroot/usr/lib/systemd/systemd-rc-once | 51 ++++++++++++++++++++++ projectroot/usr/sbin/enable-rc-once | 11 +++++ rules/rc-once.make | 10 ++--- rules/rc-once.postinst | 2 +- 10 files changed, 108 insertions(+), 108 deletions(-) delete mode 100644 projectroot/lib/init/rc-once.sh delete mode 100644 projectroot/lib/systemd/system/rc-once.service delete mode 100644 projectroot/lib/systemd/systemd-rc-once delete mode 100644 projectroot/sbin/enable-rc-once create mode 100644 projectroot/usr/lib/init/rc-once.sh create mode 100644 projectroot/usr/lib/systemd/system/rc-once.service create mode 100644 projectroot/usr/lib/systemd/systemd-rc-once create mode 100644 projectroot/usr/sbin/enable-rc-once diff --git a/projectroot/lib/init/rc-once.sh b/projectroot/lib/init/rc-once.sh deleted file mode 100644 index 8689a32bc..000000000 --- a/projectroot/lib/init/rc-once.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/sh - -RC_ONCE_DIR=/etc/rc.once.d -DONE_DIR="$RC_ONCE_DIR/.done" -STAMP="$DONE_DIR/rc-once" - -run_rc_once() { - failed=0 - echo "running rc.once.d services..." - cd "$RC_ONCE_DIR" || exit 1 - mkdir -p "$DONE_DIR" - for script in *; do - test -x "$script" || continue - test -e "$DONE_DIR/$script" && continue - "$RC_ONCE_DIR/$script" - if [ $? -ne 0 ]; then - echo "running $script failed." - failed=1 - else - : > "$DONE_DIR/$script" - fi - done - return $failed -} - diff --git a/projectroot/lib/systemd/system/rc-once.service b/projectroot/lib/systemd/system/rc-once.service deleted file mode 100644 index 78f6f4c48..000000000 --- a/projectroot/lib/systemd/system/rc-once.service +++ /dev/null @@ -1,15 +0,0 @@ -[Unit] -Description=First boot services -DefaultDependencies=no -IgnoreOnIsolate=true -After=local-fs.target -Requires=local-fs.target -Before=system-update-cleanup.service -After=system-update.target - -[Service] -Type=oneshot -RemainAfterExit=no -ExecStart=/lib/systemd/systemd-rc-once -StandardOutput=syslog+console - diff --git a/projectroot/lib/systemd/systemd-rc-once b/projectroot/lib/systemd/systemd-rc-once deleted file mode 100644 index ff7f7d3dc..000000000 --- a/projectroot/lib/systemd/systemd-rc-once +++ /dev/null @@ -1,51 +0,0 @@ -#!/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 - - diff --git a/projectroot/sbin/enable-rc-once b/projectroot/sbin/enable-rc-once deleted file mode 100644 index d95c6cb4b..000000000 --- a/projectroot/sbin/enable-rc-once +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh -if [ -n "$1" ]; then - rm -f "$DESTDIR/etc/rc.once.d/.done/$1" -fi -rm -f "$DESTDIR/etc/rc.once.d/.done/rc-once" - -if [ -f "$DESTDIR/lib/systemd/system/rc-once.service" ]; then - if [ ! -e $DESTDIR/system-update ]; then - ln -sf etc/rc.once.d $DESTDIR/system-update - fi -fi diff --git a/projectroot/usr/lib/init/rc-once.sh b/projectroot/usr/lib/init/rc-once.sh new file mode 100644 index 000000000..8689a32bc --- /dev/null +++ b/projectroot/usr/lib/init/rc-once.sh @@ -0,0 +1,25 @@ +#!/bin/sh + +RC_ONCE_DIR=/etc/rc.once.d +DONE_DIR="$RC_ONCE_DIR/.done" +STAMP="$DONE_DIR/rc-once" + +run_rc_once() { + failed=0 + echo "running rc.once.d services..." + cd "$RC_ONCE_DIR" || exit 1 + mkdir -p "$DONE_DIR" + for script in *; do + test -x "$script" || continue + test -e "$DONE_DIR/$script" && continue + "$RC_ONCE_DIR/$script" + if [ $? -ne 0 ]; then + echo "running $script failed." + failed=1 + else + : > "$DONE_DIR/$script" + fi + done + return $failed +} + diff --git a/projectroot/usr/lib/systemd/system/rc-once.service b/projectroot/usr/lib/systemd/system/rc-once.service new file mode 100644 index 000000000..78f6f4c48 --- /dev/null +++ b/projectroot/usr/lib/systemd/system/rc-once.service @@ -0,0 +1,15 @@ +[Unit] +Description=First boot services +DefaultDependencies=no +IgnoreOnIsolate=true +After=local-fs.target +Requires=local-fs.target +Before=system-update-cleanup.service +After=system-update.target + +[Service] +Type=oneshot +RemainAfterExit=no +ExecStart=/lib/systemd/systemd-rc-once +StandardOutput=syslog+console + 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 + + diff --git a/projectroot/usr/sbin/enable-rc-once b/projectroot/usr/sbin/enable-rc-once new file mode 100644 index 000000000..892b1df44 --- /dev/null +++ b/projectroot/usr/sbin/enable-rc-once @@ -0,0 +1,11 @@ +#!/bin/sh +if [ -n "$1" ]; then + rm -f "$DESTDIR/etc/rc.once.d/.done/$1" +fi +rm -f "$DESTDIR/etc/rc.once.d/.done/rc-once" + +if [ -f "$DESTDIR/usr/lib/systemd/system/rc-once.service" ]; then + if [ ! -e $DESTDIR/system-update ]; then + ln -sf etc/rc.once.d $DESTDIR/system-update + fi +fi diff --git a/rules/rc-once.make b/rules/rc-once.make index dbee7d8d1..f452258af 100644 --- a/rules/rc-once.make +++ b/rules/rc-once.make @@ -32,8 +32,8 @@ $(STATEDIR)/rc-once.targetinstall: @$(call install_fixup, rc-once, AUTHOR, "Michael Olbrich ") @$(call install_fixup, rc-once, DESCRIPTION, missing) - @$(call install_alternative, rc-once, 0, 0, 0644, /lib/init/rc-once.sh) - @$(call install_alternative, rc-once, 0, 0, 0755, /sbin/enable-rc-once) + @$(call install_alternative, rc-once, 0, 0, 0644, /usr/lib/init/rc-once.sh) + @$(call install_alternative, rc-once, 0, 0, 0755, /usr/sbin/enable-rc-once) ifdef PTXCONF_INITMETHOD_BBINIT @$(call install_alternative, rc-once, 0, 0, 0755, /etc/init.d/rc-once) @@ -46,12 +46,12 @@ endif endif ifdef PTXCONF_INITMETHOD_SYSTEMD @$(call install_alternative, rc-once, 0, 0, 0755, \ - /lib/systemd/systemd-rc-once) + /usr/lib/systemd/systemd-rc-once) @$(call install_alternative, rc-once, 0, 0, 0644, \ - /lib/systemd/system/rc-once.service) + /usr/lib/systemd/system/rc-once.service) @$(call install_link, rc-once, ../rc-once.service, \ - /lib/systemd/system/system-update.target.wants/rc-once.service) + /usr/lib/systemd/system/system-update.target.wants/rc-once.service) endif @$(call install_copy, rc-once, 0, 0, 0755, /etc/rc.once.d) diff --git a/rules/rc-once.postinst b/rules/rc-once.postinst index 900cd4297..f970daab4 100644 --- a/rules/rc-once.postinst +++ b/rules/rc-once.postinst @@ -1,2 +1,2 @@ #!/bin/sh -$DESTDIR/sbin/enable-rc-once +$DESTDIR/usr/sbin/enable-rc-once -- cgit v1.2.3