Improve removable_dev() in 9990-misc-helpers.sh when /sys/block/ is empty
authorRaphaël Hertzog <hertzog@debian.org>
Thu, 12 Jan 2017 15:31:05 +0000 (16:31 +0100)
committerRaphaël Hertzog <hertzog@debian.org>
Thu, 12 Jan 2017 15:34:32 +0000 (16:34 +0100)
Closes: #847802

components/9990-misc-helpers.sh
debian/changelog

index 1a06ccf..ee53b16 100755 (executable)
@@ -1169,6 +1169,10 @@ removable_dev ()
 
        for sysblock in $(echo /sys/block/* | tr ' ' '\n' | grep -vE "/(loop|ram|dm-|fd)")
        do
+               if [ ! -d "${sysblock}" ]; then
+                       continue
+               fi
+
                dev_ok=
                if [ "$(cat ${sysblock}/removable)" = "1" ]
                then
@@ -1214,6 +1218,10 @@ non_removable_dev ()
 
        for sysblock in $(echo /sys/block/* | tr ' ' '\n' | grep -vE "/(loop|ram|dm-|fd)")
        do
+               if [ ! -d "${sysblock}" ]; then
+                       continue
+               fi
+
                if [ "$(cat ${sysblock}/removable)" = "0" ]
                then
                        case "${output_format}" in
index acae698..0504232 100644 (file)
@@ -4,6 +4,8 @@ live-boot (1:20170112) unstable; urgency=medium
   * Team upload.
   * Fix nodhcp option to actually force DHCP off. Closes: #785345
     Thanks to Frank Lillo for the report and Evgeni Golov for the patch.
+  * Improve 9990-misc-helpers.sh when /sys/block/ is empty.
+    Closes: #847802
 
   [ Kristian Klausen ]
   * Add "nls_ascii" module in the initrd so that we can access FAT