eject static binary and support

pull/5/head
Tomas M 2012-11-09 11:05:42 -06:00
parent a8297a21ff
commit 022a985b6e
3 changed files with 23 additions and 8 deletions

4
TODO
View File

@ -1,4 +1,4 @@
* copy DOC/* to Live Kit created * copy DOC/* to Live Kit created
* describe meaning of special files in bundles * describe meaning of special files in bundles
* support from=slax.iso
* bootinst.sh - if extlinux is not found, echo error msg. * noatime mount option for aufs?

View File

@ -78,19 +78,32 @@ if [ "$1" = "--init" ]; then
# then free up loop mounts, backwards # then free up loop mounts, backwards
tac /proc/mounts | grep loop | cut -d " " -f 2 | while read LINE; do tac /proc/mounts | grep loop | cut -d " " -f 2 | while read LINE; do
umount $LINE >/dev/console 2>&1 umount $LINE >/dev/console 2>&1 || \
umount -l $LINE umount -l $LINE
done done
# and free up memory mounts, backwards # remember from which device we are started, do it now before we lose it
DEVICE="$(cat /proc/mounts | grep /memory/data | grep /dev/ | cut -d " " -f 1)"
# free up memory mounts, backwards
tac /proc/mounts | grep memory | cut -d " " -f 2 | while read LINE; do tac /proc/mounts | grep memory | cut -d " " -f 2 | while read LINE; do
umount $LINE >/dev/console 2>&1 umount $LINE >/dev/console 2>&1
if [ $? -ne 0 ]; then
mount -o remount,ro $LINE >/dev/console 2>&1
umount -l $LINE umount -l $LINE
fi
done done
# make sure the data directory is at least remounted read-only, # eject cdrom device if we were running from it
# if the previous unmount failed due to some busy err for i in $(cat /proc/sys/dev/cdrom/info | grep name); do
mount -o remount,ro /memory/data >/dev/console 2>/dev/null if [ "$DEVICE" = "/dev/$i" ]; then
echo "Attemptiong to eject /dev/$i..." >/dev/console
eject /dev/$i
echo "CD/DVD tray will close in 6 seconds..." >/dev/console
sleep 6
eject -t /dev/$i
fi
done
# and finally, last chance to run some commands by hand # and finally, last chance to run some commands by hand
if grep -q debug /proc/cmdline; then if grep -q debug /proc/cmdline; then
@ -98,6 +111,7 @@ if [ "$1" = "--init" ]; then
setsid sh -c 'exec sh < /dev/tty1 >/dev/tty1 2>&1' setsid sh -c 'exec sh < /dev/tty1 >/dev/tty1 2>&1'
fi fi
cat /lib/command >/dev/console
$(cat /lib/command 2>/dev/null) $(cat /lib/command 2>/dev/null)
reboot -f reboot -f
fi fi

View File

@ -26,3 +26,4 @@ fi
ln -f busybox-$MYARCH ./busybox ln -f busybox-$MYARCH ./busybox
ln -f mount.ntfs-3g-$MYARCH ./mount.ntfs-3g ln -f mount.ntfs-3g-$MYARCH ./mount.ntfs-3g
ln -f mount.dynfilefs-$MYARCH ./mount.dynfilefs ln -f mount.dynfilefs-$MYARCH ./mount.dynfilefs
ln -f eject-$MYARCH ./eject