Comment 1 for bug 1182489

Revision history for this message
Daniel Manrique (roadmr) wrote :

Looks like the resource logic is a bit naive: if I don't see "Does write DVD media", then I blindly assume the requested drive exists and can't write.

The resource is expressed as a one-liner:

for media in CD DVD; do wodim -prcap 2>/dev/null | grep -q -i "Does write $media" && echo "$media: writable" || echo "$media: readonly"; done

This could be expanded to:

for media in CD DVD; do
    if wodim -prcap 2>/dev/null | grep -q -i "Does write $media"; then
            echo "$media: writable"
       else
            echo "$media: readonly"
    fi
done

And then amended to be:

for media in CD DVD; do
    if wodim -prcap 2>/dev/null | grep -q -i "Does write $media"; then
            echo "$media: writable"
    elif wodim -prcap 2>/dev/null | grep -q -i "Does not write $media"; then
            echo "$media: readonly"
    fi
done

I checked this against a non-writable DVD device and I get:

CD: readonly
DVD: readonly

Then I tested on a driveless (netbook) system:
ubuntu@201010-6646:~$ bash /tmp/test.sh
ubuntu@201010-6646:~$