Comment 13 for bug 1168742

Revision history for this message
rogue-spectre (rogue-spectre) wrote : Re: Disks are not unmounted when physical eject button is used

Update to Phil Wright solution, for a more general context

1 - Create a udev rules file '/etc/udev/rules.d/61-sr-change.rules' and add the line :

KERNEL=="sr*", ACTION=="change", RUN+="/usr/local/bin/sr_change.sh %n"

2 - And create the script '/usr/local/bin/sr_change.sh' :

#!/bin/sh

if [ $# -eq 1 ]
then
        source=/dev/sr$1
else
        source=/dev/sr0
fi

dvd+rw-mediainfo $source > /dev/null
n=$?

 if [ "$n" -eq '251' ] then
        umount $source
 fi
exit 0