qvm-block: detect read-only devices

This commit is contained in:
Marek Marczykowski-Górecki 2013-10-01 04:19:14 +02:00
parent 0bf30e0426
commit 23ea1ebe19

View File

@ -29,6 +29,11 @@ if [ "$MAJOR" -eq 7 -a ! -d /sys/$DEVPATH/loop ]; then
exit 0 exit 0
fi fi
# Check if device is read-only
if [ "`cat /sys/$DEVPATH/ro`" -eq 1 ]; then
MODE=r
fi
# Special case for CD # Special case for CD
if [ "$ID_TYPE" = "cd" ]; then if [ "$ID_TYPE" = "cd" ]; then
if [ "$ID_CDROM_MEDIA" != "1" ]; then if [ "$ID_CDROM_MEDIA" != "1" ]; then