summaryrefslogtreecommitdiffstats
path: root/kdeeject
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-09-03 09:14:57 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-09-03 09:14:57 +0000
commit27856879bf962f178d88e79144e37a47e731b122 (patch)
treea3bd3f489b755cd2941e7c53b90d12d6bfd4fbe3 /kdeeject
parentc5228d52f504d6d2c0fefdd625ec08ebb8e91f85 (diff)
downloadtdebase-27856879bf962f178d88e79144e37a47e731b122.tar.gz
tdebase-27856879bf962f178d88e79144e37a47e731b122.zip
* Massive import of OpenSUSE patches, primarily for bugfixes
* Added some infrastructure created by OpenSUSE to allow for future addition of the Kickoff menu as an option * Minor Slackware compilation fixes git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1171255 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kdeeject')
-rwxr-xr-xkdeeject/kdeeject42
1 files changed, 33 insertions, 9 deletions
diff --git a/kdeeject/kdeeject b/kdeeject/kdeeject
index 71079794d..34e61097e 100755
--- a/kdeeject/kdeeject
+++ b/kdeeject/kdeeject
@@ -4,12 +4,38 @@
#
# Copyright GPL v2 by David Faure <[email protected]>
#
-if test $# -ge 1 -a "$1" != "--help"; then
- quiet=0
- if test "$1" = "-q"; then
- quiet=1
- shift
- fi
+quiet=0
+if test "$1" = "-q"; then
+ quiet=1
+ shift
+fi
+
+if test "$1" = "--help"; then
+ echo "Usage: $0 <name> where name is a device or a mountpoint."
+ exit 0
+fi
+
+if test -z "$1"; then
+ for dev in /dev/cdrom /dev/dvd /dev/dvdram /dev/cdrecorder; do
+ if test -e $dev; then
+ lp=`readlink $dev`
+ if test -n "$lp"; then
+ device=/dev/$lp
+ else
+ device=$dev
+ fi
+ break
+ fi
+ done
+else
+ device=$1
+fi
+
+udi=`dcop kded mediamanager properties $device 2>/dev/null | head -n 1 `
+if test -n "$udi"; then
+ dcop kded mediamanager unmount "$udi" >/dev/null 2>&1
+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`
@@ -34,7 +60,5 @@ if test $# -ge 1 -a "$1" != "--help"; then
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