diff options
Diffstat (limited to 'tdeeject')
-rwxr-xr-x | tdeeject/tdeeject | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/tdeeject/tdeeject b/tdeeject/tdeeject index 7adb15570..da64451fd 100755 --- a/tdeeject/tdeeject +++ b/tdeeject/tdeeject @@ -1,6 +1,6 @@ #!/bin/sh # Script used by kdesktop to eject a removable media (CDROM/Tape/SCSI/Floppy) -# Relies on the 'eject' program, 'cdcontrol' on *BSD +# Relies on the 'eject' program, 'cdcontrol' on FreeBSD # # Copyright GPL v2 by David Faure <david@mandrakesoft.com> # @@ -43,6 +43,22 @@ case "$OS" in OpenBSD) cdio -f $device eject #>/dev/null 2>&1 ;; + NetBSD) + dev=$1 + if [ -h $1 ]; then + dev=$(readlink $dev 2> /dev/null) || dev=$1; + fi + case $(sysctl -n kern.rawpartition 2> /dev/null) in + 2) rapw=c ;; + 3) rapw=d ;; + esac + rdev=$(echo $dev | sed -E -e 's#(/dev/)#1r#; s#[a-z]$#'$rawp'#') + if [ -e $rdev]; then + eject $rdev >/dev/null 2>&1 + else + eject $dev >/dev/null 2>&1 + fi + ;; *BSD) dev=`echo $device | sed -E -e 's#/dev/##' -e 's/([0-9])./\1/'` cdcontrol -f $dev eject #>/dev/null 2>&1 |