Comment 1 for bug 600740

Revision history for this message
Stéphane Graber (stgraber) wrote :

I commited (to the packaging branch) a similar change using udisks (when present), checking for the "removable" flag.
If set to 0 for the device we're about to eject, it skips the eject call and the prompt.

Diff below:
=== modified file 'debian/casper.init'
--- debian/casper.init 2011-12-14 18:28:01 +0000
+++ debian/casper.init 2011-12-14 20:35:12 +0000
@@ -93,6 +93,14 @@
         cache_path "$path"
     done

+ # If the device isn't marked as removable, skip the prompt
+ if which udisks > /dev/null; then
+ device="$(grep " /cdrom " /proc/mounts | cut -d' ' -f1)" || device=
+ if [ -n "$device" ] && [ "$(udisks --show-info $device | grep removable | awk '{print $NF}')" = "0" ]; then
+ return 0
+ fi
+ fi
+
     eject -p -m /cdrom >/dev/null 2>&1

     [ "$prompt" ] || return 0