blob: 4ed8f842774d06b9cb8a46da336a34544e6687bf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
$NetBSD: patch-bc,v 1.5 2008/01/04 21:05:57 markd Exp $
--- kdeeject/kdeeject.orig 2006-10-02 06:31:56.000000000 +1300
+++ kdeeject/kdeeject
@@ -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>
#
@@ -17,10 +17,26 @@ if test $# -ge 1 -a "$1" != "--help"; th
OpenBSD)
cdio -f $1 eject >/dev/null 2>&1
;;
- *BSD)
+ FreeBSD)
dev=`echo $1 | sed -E -e 's#/dev/##' -e 's/([0-9])./\1/'`
cdcontrol -f $dev 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) rawp=c ;;
+ 3) rawp=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
+ ;;
*)
# Warning, it has to be either eject 2.0.x or >=2.1.5
# Otherwise it doesn't work as expected (it requires a
|