#! /bin/sh #---------------------------------------------------------------------------- # system-devices-umount-cdrom - umount cdrom # # Creation : 2003-07-19 fm # Last Update: $Id$ # # Copyright (c) 2003-@@YEAR@@ the eisfair team, team(at)eisfair(dot)org # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. #---------------------------------------------------------------------------- . /var/install/include/eislib CHOOSE=/var/install/bin/choose echo mountpath=/media/cdrom # If you are still having problems to unmount your CDROM medium you # can use fuser command to kill all related processes using your device. # fuser -mk ${mountpath} # --------------------------------------------------------------------------- # show oprions # --------------------------------------------------------------------------- show_options() { CD_1_1='umount' CD_2_1="\"umount - force\"" CD_3_1="\"umount - eject\"" CD_4_1="\"umount - force - eject\"" export CD_1_1 export CD_2_1 export CD_3_1 export CD_4_1 CD_TITLE='umount CD or DVD with options' CD_FLAGS='--indent 12 --spread' CD_COLS='40' CD_QUESTION='Select' CD_ROWS=4 export CD_TITLE export CD_FLAGS export CD_COLS export CD_QUESTION export CD_ROWS _ask_tmpfile=$(/bin/mktemp -t XXXXXXXXXXXXX) ${CHOOSE} CD 1 > ${_ask_tmpfile} rc=${?} read answer < ${_ask_tmpfile} rm -f ${_ask_tmpfile} # if ask break, ask returned 255 if [ ${rc} = 255 ] then answer=0 fi case ${answer} in '') exit 0 ;; 0) exit 127 ;; 1) umount ${mountpath} um_ret=${?} ;; 2) fuser -mk ${mountpath} umount ${mountpath} um_ret=${?} ;; 3) eject ${mountpath} um_ret=${?} ;; 4) fuser -mk ${mountpath} eject ${mountpath} um_ret=${?} ;; esac } # --------------------------------------------------------------------------- # main # --------------------------------------------------------------------------- if ! mount | grep -q '/cdrom' then mecho -n "${mountpath} " mecho --warn "not mounted." echo anykey exit 0 fi show_options echo if [ ${um_ret} -eq 0 ] then mecho --info "umount successful." else mecho --error "umount failed." fi echo anykey exit 0 # --------------------------------------------------------------------------- # end # ---------------------------------------------------------------------------