1 |
philantrop 08/04/26 17:22:09 |
2 |
|
3 |
Added: kdialog-3.5.9-kdeeject-186028.patch |
4 |
Log: |
5 |
Added a patch to fix ejecting by using HAL (if the necessary tools are installed). Fixes bug 186028. |
6 |
(Portage version: 2.1.5_rc6) |
7 |
|
8 |
Revision Changes Path |
9 |
1.1 kde-base/kdialog/files/kdialog-3.5.9-kdeeject-186028.patch |
10 |
|
11 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/kde-base/kdialog/files/kdialog-3.5.9-kdeeject-186028.patch?rev=1.1&view=markup |
12 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/kde-base/kdialog/files/kdialog-3.5.9-kdeeject-186028.patch?rev=1.1&content-type=text/plain |
13 |
|
14 |
Index: kdialog-3.5.9-kdeeject-186028.patch |
15 |
=================================================================== |
16 |
diff -Naur kdialog-3.5.9.orig/kdeeject/kdeeject kdialog-3.5.9/kdeeject/kdeeject |
17 |
--- kdialog-3.5.9.orig/kdeeject/kdeeject 2006-10-01 19:31:56.000000000 +0200 |
18 |
+++ kdialog-3.5.9/kdeeject/kdeeject 2008-04-26 19:00:44.000000000 +0200 |
19 |
@@ -4,6 +4,11 @@ |
20 |
# |
21 |
# Copyright GPL v2 by David Faure <david@××××××××××××.com> |
22 |
# |
23 |
+error() { |
24 |
+ kdialog --title "KDE Eject" --error "$1" |
25 |
+ exit 1 |
26 |
+} |
27 |
+ |
28 |
if test $# -ge 1 -a "$1" != "--help"; then |
29 |
quiet=0 |
30 |
if test "$1" = "-q"; then |
31 |
@@ -22,10 +27,39 @@ |
32 |
cdcontrol -f $dev eject >/dev/null 2>&1 |
33 |
;; |
34 |
*) |
35 |
- # Warning, it has to be either eject 2.0.x or >=2.1.5 |
36 |
- # Otherwise it doesn't work as expected (it requires a |
37 |
- # fstab entry for no reason). |
38 |
- eject $1 >/dev/null 2>&1 |
39 |
+ # check if HAL userland tools are installed |
40 |
+ if test -x `which hal-find-by-property`; then |
41 |
+ HAL_major=`hal-find-by-property --version | cut -d " " -f 2 | cut -d. -f1` |
42 |
+ HAL_minor=`hal-find-by-property --version | cut -d " " -f 2 | cut -d. -f2` |
43 |
+ # HAL umount and eject method exist only for HAL >= 0.5 |
44 |
+ if test $HAL_major -eq 0 -a $HAL_minor -ge 5 -o $HAL_major -gt 0; then |
45 |
+ # Try to find the UDi from the device name |
46 |
+ BLOCK_UDI=$(hal-find-by-property --key block.device --string "$1" | head -1) |
47 |
+ [ -n "$BLOCK_UDI" ] || error "Can't find UDI for URL $1" |
48 |
+ STORAGE_UDI=$(hal-get-property --udi $BLOCK_UDI --key block.storage_device) |
49 |
+ [ -n "$STORAGE_UDI" ] || error "Can't find device for volume $BLOCK_UDI" |
50 |
+ |
51 |
+ # Unmount each device volume |
52 |
+ for VOLUME_UDI in $(hal-find-by-property --key block.storage_device --string $STORAGE_UDI); do |
53 |
+ [ $(hal-get-property --udi $VOLUME_UDI --key block.is_volume) = true ] || continue |
54 |
+ [ $(hal-get-property --udi $VOLUME_UDI --key volume.is_mounted) = true ] || continue |
55 |
+ ERROR=$(dcop kded mediamanager unmount $VOLUME_UDI) |
56 |
+ |
57 |
+ if test -n "$ERROR"; then |
58 |
+ # try to use directly DBUS method in case mediamanager failed |
59 |
+ ERROR=$(dbus-send --system --dest=org.freedesktop.Hal "$VOLUME_UDI" org.freedesktop.Hal.Device.Volume.Unmount array:string:"" >/dev/null 2>&1) |
60 |
+ [ -n "$ERROR" ] && error "$ERROR" |
61 |
+ fi |
62 |
+ done |
63 |
+ dbus-send --system --dest=org.freedesktop.Hal "$BLOCK_UDI" org.freedesktop.Hal.Device.Volume.Eject array:string:"" >/dev/null 2>&1 |
64 |
+ fi |
65 |
+ else |
66 |
+ # fallback to the old eject method |
67 |
+ # Warning, it has to be either eject 2.0.x or >=2.1.5 |
68 |
+ # Otherwise it doesn't work as expected (it requires a |
69 |
+ # fstab entry for no reason). |
70 |
+ eject $1 >/dev/null 2>&1 |
71 |
+ fi |
72 |
;; |
73 |
esac |
74 |
if test $? -eq 0; then |
75 |
|
76 |
|
77 |
|
78 |
-- |
79 |
gentoo-commits@l.g.o mailing list |