diff options
author | OBATA Akio <[email protected]> | 2019-04-06 16:49:26 +0900 |
---|---|---|
committer | OBATA Akio <[email protected]> | 2019-08-18 14:45:26 +0900 |
commit | 2a88ec3c02ab46c8b816cfa348ea53075f57a59c (patch) | |
tree | e7029145d265a0a6a31601a1eb476a719d6dd4b5 /tdeeject | |
parent | df19ff6b7dc7adcdb88e86d50d9d88d622a09d88 (diff) | |
download | tdebase-2a88ec3c02ab46c8b816cfa348ea53075f57a59c.tar.gz tdebase-2a88ec3c02ab46c8b816cfa348ea53075f57a59c.zip |
Revive NetBSD support
Catch up to TDE and OS changes
Signed-off-by: OBATA Akio <[email protected]>
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 <[email protected]> # @@ -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 |