UPDATE:
automount in nemo is disabled, new udev rule:
Code:
KERNEL=="sd?1", ATTRS{serial}=="NA******", ATTRS{idVendor}=="0***", ATTRS{idProduct}=="2***", ACTION=="add", ENV{UDISKS_IGNORE}="1", PROGRAM="/path/to/script.sh"
KERNEL=="sd?1", ENV{ID_SERIAL_SHORT}=="S2***********", ACTION=="remove", PROGRAM="/path/to/script.sh"
Mounting/unmounting is done in the script.
At login the script is called as Startup-Program.
Here is the mounting/umounting part:
Code:
#!/bin/bash
MYNAME=michael
MOUNTPOINT=/media/michael/SeagateExpansionDrive
UUID="D8*************"
if [ ACTION=="add" ]
then
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
export XAUTHORITY=/home/${MYNAME}/.Xauthority
export DISPLAY=:0.0
fi
#Check wether Device is plugged in or removed
if [ $ACTION == "remove" ]
then
#Check if already unmounted
# if [ -e $MOUNTPOINT ]
# then
#Unmount and remove
umount $MOUNTPOINT
rmdir $MOUNTPOINT
# fi
exit 0
elif [ $ACTION == "add" ]
then
#Mount the drive
mkdir $MOUNTPOINT
mount -U $UUID $MOUNTPOINT
else
#mount the drive
mkdir $MOUNTPOINT
mount -U $UUID $MOUNTPOINT
fi
if [ ACTION=="add" ]
then
#Check if gxmessage is installed
if [ ! -e /usr/bin/gxmessage ]
then
apt-get install -y gxmessage
#checking if installation was succesful is done later
fi
fi
blkid |grep $UUID
if [ $? != 0 ]
then
#Hard Drive not mounted --> exit
exit 0
fi
Michael
Bookmarks