ok, actually i found a more elegant way of dealing with this issue
(which might be great especially for newbies). first create a udev-rule
to have your wd-passport node is created at the same spot (in my case
it's /dev/wdpassport) every time you plug it in and also so that a
script is executed which puts a tray-icon in place with which you can
spin-down your wdpassport.

here's my udev rule (simply replace ATTRS{model} with whatever fits your
wdpassport)

/etc/udev/rules.d/95-wdpassport.rules
----------------------------------------------------
KERNEL=="sd?1",SUBSYSTEMS=="scsi", ATTRS{model}=="1200BEVExternal 
",SYMLINK+="wdpassport", RUN+="/usr/local/bin/wdp"


and here's the script

/usr/local/bin/wdp
----------------------------------------------------
#!/bin/bash
# Put a notification-icon into the system tray
if DISPLAY=:0. sudo -H -u insert_your_username_here! zenity --notification 
--window-icon=/usr/share/pixmaps/wdumount.png --text="WD Passport is currently 
plugged in." ; then
echo "the icon should be in place now"
else echo "zenity error..." ;
fi

# If you click the icon you're presented the choice of safely removing WD 
Passport
if DISPLAY=:0. sudo -H -u insert_your_username_here! zenity --question --text 
"Do you really want to remove WD Passport (/dev/wdpassport)?" ; then
        echo "icon clicked"
                LOCATION=$(mount | grep "WD Passport")
                if [ ${#LOCATION} != "0" ] ; then
                        pumount /dev/wdpassport 2> ~/wdp.log
                fi      
                if scsi-spin -d /dev/wdpassport 2>> ~/wdp.log ; then
                DISPLAY=:0. sudo -H -u insert_your_username_here! zenity --info 
--text="Success!\n\nWD Passport can be safely removed now."
        exit;
         else
                ERRORS=$(cat ~/wdp.log)
           DISPLAY=:0. sudo -H -u insert_your_username_here! zenity --warning 
--text="$ERRORS\n\nSorry, it seems things are screwed up badly (or WD Passport 
is simply not connected anymore)."
      fi
  else echo "cancel button was hit..."
        wdp ;
fi

-- 
not proper dismounting for WD passport harddrive (making noise when unplug)
https://bugs.launchpad.net/bugs/117713
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to