From 21e0cfadb17a1a90a94a537520bc3737c43a78ce Mon Sep 17 00:00:00 2001 From: James Meyer Date: Thu, 10 Jan 2013 16:11:11 -0600 Subject: add support for ejecting the CD after install --- build_tools/archiso/archiso/archiso_shutdown | 33 ++++++++++++++++++++++ build_tools/archiso/archiso/hooks/archiso_shutdown | 1 + .../archiso/mythvantage/root-image/etc/rc.local | 4 ++- 3 files changed, 37 insertions(+), 1 deletion(-) diff --git a/build_tools/archiso/archiso/archiso_shutdown b/build_tools/archiso/archiso/archiso_shutdown index 85cce59..e61b7f9 100644 --- a/build_tools/archiso/archiso/archiso_shutdown +++ b/build_tools/archiso/archiso/archiso_shutdown @@ -32,6 +32,39 @@ if [[ ! -d /oldrun/archiso/copytoram ]]; then fi fi + +#JM +#This is where the reboot would go +echo "------------------------" +#bootdev is created in rc.local on startup +bootdev=$( cat /bootdev.txt ) +if [ -f /proc/sys/dev/cdrom/info ] +then + cdroms=$( cat /proc/sys/dev/cdrom/info | { while read a b c; do + #echo $a $b $c + if [ "${a}" = "drive" -a "${b}" = "name:" ]; then + echo ${c} + break + fi + done + } ) + for d in ${cdroms} + do + if [ "/dev/${d}" = "${bootdev}" ] + then + echo "Boot device is a cdrom, ejecting..." + eject ${bootdev} + break + fi + done +fi +echo "------------------------" +sleep 1 +# + + + + # reboot / poweroff / halt, depending on the argument passed by init # if something invalid is passed, we halt case "$1" in diff --git a/build_tools/archiso/archiso/hooks/archiso_shutdown b/build_tools/archiso/archiso/hooks/archiso_shutdown index 24e4103..64295c1 100644 --- a/build_tools/archiso/archiso/hooks/archiso_shutdown +++ b/build_tools/archiso/archiso/hooks/archiso_shutdown @@ -12,6 +12,7 @@ run_hook () cp /bin/mount /run/initramfs/bin/ cp /sbin/dmsetup /run/initramfs/sbin/ cp /sbin/losetup /run/initramfs/sbin/ + if [[ -x /bin/nbd-client ]]; then cp /bin/nbd-client /run/initramfs/bin/ fi diff --git a/build_tools/archiso/mythvantage/root-image/etc/rc.local b/build_tools/archiso/mythvantage/root-image/etc/rc.local index b6ea57e..6e49dc1 100755 --- a/build_tools/archiso/mythvantage/root-image/etc/rc.local +++ b/build_tools/archiso/mythvantage/root-image/etc/rc.local @@ -23,7 +23,9 @@ function install_db { } - +#set bootdev.txt for shutdown eject in archiso_shutdown +mount|grep bootmnt|cut -f1 -d" " > /run/initramfs/bootdev.txt +cp -f /usr/bin/eject /run/initramfs/usr/bin/eject #check to see if mysql is running stat_busy "Checking Mysql" -- cgit v0.12