#
# Author: Miquel van Smoorenburg, <miquels@drinkel.nl.mugnet.org>
#
-# $Id$
# Set the path.
PATH=/sbin:/bin:/usr/bin:/usr/sbin
trap "echo" INT SEGV QUIT TERM
set +e
-emit pld.shutdown-started
-emit starting JOB=shutdown
-emit started JOB=shutdown
-
rc_splash "reboot"
# Kill all processes.
UMOUNT_IGNORE="/ $UMOUNT_IGNORE"
fi
remaining=$(awk -v ig="^($UMOUNT_IGNORE)$" 'BEGIN { gsub(/[\t ]+/, "|", ig); } \
- $3 !~ /^(proc|loopfs|devpts|devtmpfs|shm|iso9660|ramfs|tmpfs|sysfs|securityfs|squashfs)$/ \
+ $3 !~ /^(proc|loopfs|devpts|devtmpfs|shm|iso9660|ramfs|tmpfs|cgroup|cgroup2|sysfs|securityfs|squashfs)$/ \
&& $1 !~ /^(none|\/dev\/root)$/ \
&& $2 !~ ig {print $2}' /proc/mounts)
while [ -n "$remaining" -a "$retry" -gt 0 ]; do
- show "Unmounting file systems"; busy
- ERRORS=$(umount -a $force -t noproc 2>&1); rc=$?
+ for mnt in $remaining; do
+ run_cmd "$(nls 'Umounting file system: %s' $mnt)" umount $force -R $mnt
+
+ # we might had unmounted /usr, recheck $TPUT availability
+ # but well. we need tput only for show() and busy() (ok() and fail() messages are already cached)
+ # TODO: look ahead the messages?
+ if is_yes "$TPUT"; then
+ TPUT=
+ rc_gettext_init
+ fi
+ done
+
+ show "Unmounting remainging file systems"; busy
+ ERRORS=$(umount -a $force -t noproc,nosysfs,notmpfs,nodevpts,nodevtmpfs 2>&1); rc=$?
# we might had unmounted /usr, recheck $TPUT availability
# but well. we need tput only for show() and busy() (ok() and fail() messages are already cached)
ok
else
fail
- [ -n "$ERRORS" ] && echo "$ERRORS"
+ if [ -n "$ERRORS" ]; then
+ nls "Umount errors:"
+ echo "$ERRORS"
+ fi
fi
sleep 2
remaining=$(awk -v ig="^($UMOUNT_IGNORE)$" 'BEGIN { gsub(/[\t ]+/, "|", ig); } \
- $3 !~ /^(proc|loopfs|devpts|devtmpfs|shm|iso9660|ramfs|tmpfs|sysfs|securityfs|squashfs)$/ \
+ $3 !~ /^(proc|loopfs|devpts|devtmpfs|shm|iso9660|ramfs|tmpfs|cgroup|cgroup2|sysfs|securityfs|squashfs)$/ \
&& $1 !~ /^(none|\/dev\/root)$/ \
&& $2 !~ ig {print $2}' /proc/mounts)
[ -z "$remaining" ] && break
if [ -x /sbin/vgchange ]; then
lvmversion=$(LC_ALL=C /sbin/vgchange --version 2>/dev/null | awk '/LVM version:/{if ($3 >= 2) print "2"}')
if [ "$lvmversion" = "2" ]; then
- lvmsysinit="--sysinit"
+ lvmsysinit="--sysinit --noudevsync"
else
lvmsysinit=""
fi
[ -x /sbin/poweroff-ups ] && /sbin/poweroff-ups
fi
fi
- [ "$previous" != "unknown" ] && eval halt -d -p -f
+ [ "$previous" != "unknown" ] && halt -d -p -f
else
show "Please stand by while rebooting the $_rebootwhat"; ok
if [ -f /fastboot ]; then
show "On the next boot fsck will be skipped."; ok
fi
- # not really sure where thse events should go
- emit stopped JOB=shutdown
- emit stopping JOB=shutdown
-
if [ -x /sbin/kexec ] && [ "$kexec_loaded" = "1" ]; then
show "Will now restart with kexec"
/sbin/kexec -e
fail
fi
- [ "$previous" != "unknown" ] && eval reboot -d -f
+ [ "$previous" != "unknown" ] && reboot -d -f
fi