summaryrefslogtreecommitdiffstats
path: root/kdeeject
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commit4aed2c8219774f5d797760606b8489a92ddc5163 (patch)
tree3f8c130f7d269626bf6a9447407ef6c35954426a /kdeeject
downloadtdebase-4aed2c8219774f5d797760606b8489a92ddc5163.tar.gz
tdebase-4aed2c8219774f5d797760606b8489a92ddc5163.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kdeeject')
-rw-r--r--kdeeject/Makefile.am1
-rwxr-xr-xkdeeject/kdeeject40
2 files changed, 41 insertions, 0 deletions
diff --git a/kdeeject/Makefile.am b/kdeeject/Makefile.am
new file mode 100644
index 000000000..9c4e42c8d
--- /dev/null
+++ b/kdeeject/Makefile.am
@@ -0,0 +1 @@
+bin_SCRIPTS = kdeeject
diff --git a/kdeeject/kdeeject b/kdeeject/kdeeject
new file mode 100755
index 000000000..1b55b73d4
--- /dev/null
+++ b/kdeeject/kdeeject
@@ -0,0 +1,40 @@
+#!/bin/sh
+# Script used by kdesktop to eject a removable media (CDROM/Tape/SCSI/Floppy)
+# Relies on the 'eject' program, 'cdcontrol' on *BSD
+#
+# Copyright GPL v2 by David Faure <david@mandrakesoft.com>
+#
+if test $# -ge 1 -a "$1" != "--help"; then
+ quiet=0
+ if test "$1" = "-q"; then
+ quiet=1
+ shift
+ fi
+ # Checking for stuff in the PATH is ugly with sh.
+ # I guess this is the reason for making this a kde app...
+ OS=`uname -s`
+ case "$OS" in
+ OpenBSD)
+ cdio -f $1 eject >/dev/null 2>&1
+ ;;
+ *BSD)
+ dev=`echo $1 | sed -E -e 's#/dev/##' -e 's/([0-9])./\1/'`
+ cdcontrol -f $dev eject >/dev/null 2>&1
+ ;;
+ *)
+ # Warning, it has to be either eject 2.0.x or >=2.1.5
+ # Otherwise it doesn't work as expected (it requires a
+ # fstab entry for no reason).
+ eject $1 >/dev/null 2>&1
+ ;;
+ esac
+ if test $? -eq 0; then
+ dcop kdesktop default refreshIcons
+ exit 0
+ elif test $quiet -eq 0; then
+ kdialog --title "KDE Eject" --error "Eject $1 failed!"
+ fi
+else
+ kdialog --title "KDE Eject" --msgbox "Usage: $0 <name> where name is a device or a mountpoint."
+fi
+exit 1