On Fri, Jun 25, 2004 at 12:41:53AM -0400, Joey Hess wrote:
> Osamu Aoki wrote:
> > Are you thinking like:
...
> Yes, something like that..
...
> I'd say this is unnecessaty, stderr is already intercepted.
...
> Luckily all stderr is sent to /var/log/messages anyway.

Hmmm... Interesting. 

> Let's get it working, and then later make it pretty. That's not hard
> to do, and I'm sure someone will eventally add a progress bar for it.

OK:  Here is one.  Let me check this when I come back home later.
At least ALT-F4 will give you progress.

--- cdrom-detect.postinst.org   1970-01-01 01:00:00.000000000 +0100
+++ cdrom-detect.postinst       2004-06-26 13:54:47.000000000 +0200
@@ -40,11 +40,29 @@
     fi
     for device in $devices
     do
-        if mount -t iso9660 -o ro,exec $device /cdrom 2>/dev/null
+        if mount -t iso9660 -o ro,exec $device /cdrom
         then
+            log "CDROM-mount succeeded: device=$device"
             mounted=1
            db_set cdrom-detect/cdrom_device $device
             break
+        else
+            log "CDROM-mount failed (error=$?): device=$device"
+            log "Unmounting CD just to be sure."
+            umount /cdrom || true
+            log "Waiting 1 second and trying it again."
+            sleep 1
+            if mount -t iso9660 -o ro,exec $device /cdrom
+            then
+                log "CDROM-mount succeeded: device=$device"
+                mounted=1
+                db_set cdrom-detect/cdrom_device $device
+                break
+            else
+                log "CDROM-mount failed again (error=$?): device=$device"
+                log "Unmounting CD just to be sure and giving it up."
+                umount /cdrom || true
+            fi
         fi
     done
 
@@ -111,8 +129,13 @@
        fi
        if mount -t iso9660 -o ro,exec $device /cdrom
        then
+            log "CDROM-mount succeeded: device=$device"
            mounted=1
            break
+        else
+            log "CDROM-mount failed (error=$?): device=$device"
+            log "Unmounting CD just to be sure and giving it up."
+            umount /cdrom || true
        fi
     else
        fail

Attachment: signature.asc
Description: Digital signature

Reply via email to