summaryrefslogtreecommitdiffstats
path: root/tdeeject
diff options
context:
space:
mode:
authorOBATA Akio <obache@wizdas.com>2019-04-06 16:49:26 +0900
committerSlávek Banko <slavek.banko@axis.cz>2019-08-18 15:36:50 +0200
commit4741832142e091d641fb8a90607b4595accb905d (patch)
tree31f31b6389635adc523c7a33f873a9562e1adadb /tdeeject
parent0aaebc24cd00c9dd833c16dd14d1814948baac38 (diff)
downloadtdebase-4741832142e091d641fb8a90607b4595accb905d.tar.gz
tdebase-4741832142e091d641fb8a90607b4595accb905d.zip
Revive NetBSD support
Catch up to TDE and OS changes Signed-off-by: OBATA Akio <obache@wizdas.com> (cherry picked from commit 2a88ec3c02ab46c8b816cfa348ea53075f57a59c)
Diffstat (limited to 'tdeeject')
-rwxr-xr-xtdeeject/tdeeject18
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