summaryrefslogtreecommitdiffstats
path: root/abs/core/linhes-live/etc/live-shutdown
diff options
context:
space:
mode:
Diffstat (limited to 'abs/core/linhes-live/etc/live-shutdown')
-rw-r--r--abs/core/linhes-live/etc/live-shutdown66
1 files changed, 53 insertions, 13 deletions
diff --git a/abs/core/linhes-live/etc/live-shutdown b/abs/core/linhes-live/etc/live-shutdown
index 807ec47..b6a8378 100644
--- a/abs/core/linhes-live/etc/live-shutdown
+++ b/abs/core/linhes-live/etc/live-shutdown
@@ -9,12 +9,12 @@ f_saveclock ()
f_swapoff ()
{
############################# Include session saving functions
- . /opt/linhes-live/session-save/shutdown2
- if [ -f /tmp/checkse ]; then
- . /tmp/checkse
- else
- checkse
- fi
+# . /opt/linhes-live/session-save/shutdown2
+# if [ -f /tmp/checkse ]; then
+# . /tmp/checkse
+# else
+# checkse
+# fi
if [ -n "${saving}" ] && ! session_save; then
echo
@@ -37,14 +37,54 @@ f_swapoff ()
f_remountro ()
{
- if [ -n "${ejectdev}" ]; then
- echo "Ejecting live CD"
- eject ${ejectdev}
- echo "========================================"
- echo "It's safe to switch the computer off now"
- echo -ne "Press Enter to continue"
- read junk
+ bootdev=`cat /.livesys/bootdevice`
+ echo "Boot device was $bootdev"
+ #bootdev=`basename $bootdev`
+ for i in `ls /dev/cd/*`
+ do
+ cdrom=`readlink -f $i`
+ if [ x$cdrom = x$bootdev ]
+ then
+ ejectdev=$cdrom
+ break
+ fi
+
+ done
+ lspci |grep -q VMware
+ if [ ! $? = 0 ]
+ then
+ if [ -n "${ejectdev}" ]
+ then
+ echo "Ejecting CD $ejectdev"
+ eject ${ejectdev}
+ echo "========================================"
+ echo "Tray will retract after 10 seconds"
+ for timer in `seq -w 10 -1 0`
+ do
+ #echo -n $timer '\x08'
+ echo -ne "\t"$timer '\010\010\010\010'
+ sleep 1
+ done
+ echo
+ echo "========================================"
+ eject -t ${ejectdev}
+ echo
+ echo "It's safe to switch the computer off now"
+ #echo -ne "Press Enter to continue"
+ #read junk
+ else
+ echo "Boot device is not a cdrom, no need to eject"
+ fi
+ else
+ echo "VMWARE detected, not ejecting the CD"
fi
}
+#Preloads these commands so we can eject the CD.
+#
+seq --help >/dev/null 2>&1
+eject --help >/dev/null 2>&1
+halt --help >/dev/null 2>&1
+poweroff --help >/dev/null 2>&1
+reboot --help >/dev/null 2>&1
# End