Browse Source

init: moved killall and umount logic to rc.shutdown

0.2-maint
Alejandro Mery 15 years ago
parent
commit
4d647b754e
2 changed files with 28 additions and 25 deletions
  1. +25
    -0
      initramfs/etc_rc.d_rc.shutdown.sh
  2. +3
    -25
      initramfs/init.sh

+ 25
- 0
initramfs/etc_rc.d_rc.shutdown.sh

@ -13,6 +13,13 @@
# GNU General Public License can be found in the file COPYING.
# --- SDE-COPYRIGHT-NOTE-END ---
if [ "x$1" = "x-u" ]; then
do_umount=yes
shift
else
do_umount=
fi
. /etc/rc.d/functions.in
title "Stopping services"
@ -23,3 +30,21 @@ status
title "Stopping supervisor"
check start-stop-daemon -K -s HUP -x /usr/bin/runsvdir
status
for x in TERM:3 KILL:1; do
y="${x%:*}" z="${x#*:}"
title "Sending $y signal to all lingering processes (${z}s)"
check killall5 -s $y
sleep $z
status
done
if [ -n "$do_umount" ]; then
grep '^/' /proc/mounts | cut -d' ' -f2 | tac | while read x; do
title "Unmounting $x"
check umount -r "$x"
status
done
umount -ar
fi

+ 3
- 25
initramfs/init.sh

@ -3,7 +3,7 @@
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
#
# Filename: target/idunn/initramfs/init.sh
# Copyright (C) 2008 The OpenSDE Project
# Copyright (C) 2008 - 2009 The OpenSDE Project
#
# More information can be found in the files COPYING and README.
#
@ -26,24 +26,7 @@ shutoff_handler() {
ln -s / /var/run/init.lock 2> /dev/null || return
# stop services
/etc/rc.d/rc.shutdown
# terminate the rest
sleep 1
killall5 -s TERM
sleep 2
# unmount stuff
grep '^/' /proc/mounts | cut -d' ' -f2 | tac | while read x; do
umount -r "$x"
done
# kill'em all
killall5 -s KILL
sleep 1
# an umount the rest
umount -ar
/etc/rc.d/rc.shutdown -u
case "$1" in
USR1) halt -f ;;
@ -78,18 +61,13 @@ while true; do
/etc/rc.d/rc.shutdown 2>&1 | tee -a $LOG
# terminate the rest
sleep 1
killall5 -s TERM
sleep 2
killall5 -s KILL
/etc/rc.d/rc.switchroot stop 2>&1 | tee -a $LOG
# and proceed
exec switch_root -c /dev/console "$rootfs" "$init" $initopt 2>&1 >> $LOG
errno=$?
# outch!
# outch! what are we doing here?
if [ ! -s $LOG ]; then
# the world is gone, time to panic
exit $errno

Loading…
Cancel
Save