X-Git-Url: http://git.grml.org/?a=blobdiff_plain;ds=sidebyside;f=grml2usb;h=3e9475e06214d3b05d19037ba1aef7ef6aca4e09;hb=afcc7b22dfdecb49ca05ac4cb8758cd98889ef4f;hp=3c7bfb3554b795018974bd309bc1e5681d9a9f05;hpb=b323675a7c19865adb94340fe15180037823301b;p=grml2usb.git diff --git a/grml2usb b/grml2usb index 3c7bfb3..3e9475e 100755 --- a/grml2usb +++ b/grml2usb @@ -894,13 +894,18 @@ def check_for_usbdevice(device): """ usbdevice = re.match(r'/dev/(.*?)\d*$', device).group(1) - usbdevice = os.path.realpath('/sys/class/block/' + usbdevice + '/removable') - if os.path.isfile(usbdevice): - is_usb = open(usbdevice).readline() - if is_usb == "1": + # newer systems: + usbdev = os.path.realpath('/sys/class/block/' + usbdevice + '/removable') + if not os.path.isfile(usbdev): + # Ubuntu with kernel 2.6.24 for example: + usbdev = os.path.realpath('/sys/block/' + usbdevice + '/removable') + + if os.path.isfile(usbdev): + is_usb = open(usbdev).readline() + if is_usb.find("1"): return 0 - else: - return 1 + + return 1 def check_for_fat(partition):