Browse Source

rc: removed waste as switch_root never returns

0.2-maint
Alejandro Mery 14 years ago
parent
commit
2266f345c2
2 changed files with 11 additions and 46 deletions
  1. +8
    -28
      initramfs/etc_rc.d_rc.switchroot.sh
  2. +3
    -18
      initramfs/init.sh

+ 8
- 28
initramfs/etc_rc.d_rc.switchroot.sh

@ -16,32 +16,12 @@
. /etc/rc.d/functions.in
. /etc/conf/idunn
case "$1" in
stop)
title "Stoping network interfaces"
check unet down
status
title "Stoping network interfaces"
check unet down
status
title "Moving special filesystems"
for x in dev sys proc; do
check mount -o move "/$x" "$rootfs/$x"
done
status
;;
revive)
title "Moving special filesystems back"
for x in dev sys proc; do
check mount -o move "$rootfs/$x" "/$x"
done
status
title "Restarting network interfaces"
check unet up
status
title "Restarting Supervisor"
check start-stop-daemon -S -b -x /usr/bin/runsvdir -- /var/service/
status
;;
esac
title "Moving special filesystems"
for x in dev sys proc; do
check mount -o move "/$x" "$rootfs/$x"
done
status

+ 3
- 18
initramfs/init.sh

@ -63,27 +63,12 @@ while true; do
echo "switch_root in progress, you will be disconnected now." | wall
# stop services
/etc/rc.d/rc.shutdown 2>&1 | tee -a $LOG
/etc/rc.d/rc.shutdown
# terminate the rest
/etc/rc.d/rc.switchroot stop 2>&1 | tee -a $LOG
/etc/rc.d/rc.switchroot stop
# and proceed
exec switch_root -c /dev/console "$rootfs" "$init" $initopt 2>&1 >> $LOG
errno=$?
# outch! what are we doing here?
if [ ! -s $LOG ]; then
# the world is gone, time to panic
exit $errno
else
cat <<-EOT >> $LOG
switch_root failed returning $errno
EOT
rm -f /var/run/.idunn-resume
/etc/rc.d/rc.switchroot revive 2>&1 | tee -a $LOG
fi
exec switch_root -c /dev/console "$rootfs" "$init" $initopt
fi
done

Loading…
Cancel
Save