2012-10-06 11:08:44 +02:00
|
|
|
#!/bin/ash
|
2011-10-24 02:24:18 +02:00
|
|
|
|
|
|
|
# /oldroot depends on things inside /oldroot/run/archiso...
|
|
|
|
mkdir /oldrun
|
2012-03-16 03:43:58 +01:00
|
|
|
mount -n --move /oldroot/run /oldrun
|
2011-10-24 02:24:18 +02:00
|
|
|
|
|
|
|
# Unmount all mounts now.
|
2020-07-11 18:13:20 +02:00
|
|
|
umount "$(mount | awk '$3 ~/^\/oldroot/ {print $3}' | sort -r)"
|
2011-10-24 02:24:18 +02:00
|
|
|
|
|
|
|
# Remove all dm-snapshot devices.
|
|
|
|
dmsetup remove_all
|
|
|
|
|
2012-02-23 03:52:06 +01:00
|
|
|
# Remove all loopback devices.
|
|
|
|
for _lup in $(grep ^/dev/loop /oldrun/archiso/used_block_devices | tac); do
|
2020-07-11 18:13:20 +02:00
|
|
|
if ! losetup -d -- "${_lup}" 2> /dev/null; then
|
|
|
|
umount -d -- "${_lup}"
|
2011-10-24 02:24:18 +02:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
# Unmount the space used to store *.cow.
|
|
|
|
umount /oldrun/archiso/cowspace
|
|
|
|
|
|
|
|
# Unmount boot device if needed (no copytoram=y used)
|
2020-07-11 18:13:20 +02:00
|
|
|
if [ ! -d /oldrun/archiso/copytoram ]; then
|
|
|
|
if [ -d /oldrun/archiso/img_dev ]; then
|
2011-10-24 02:24:18 +02:00
|
|
|
umount /oldrun/archiso/img_dev
|
2012-02-23 03:52:06 +01:00
|
|
|
else
|
|
|
|
umount /oldrun/archiso/bootmnt
|
2011-10-24 02:24:18 +02:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
# reboot / poweroff / halt, depending on the argument passed by init
|
|
|
|
# if something invalid is passed, we halt
|
|
|
|
case "$1" in
|
|
|
|
reboot|poweroff|halt) "$1" -f ;;
|
|
|
|
*) halt -f;;
|
|
|
|
esac
|
2020-07-11 18:13:20 +02:00
|
|
|
|
|
|
|
# vim: set ft=sh:
|