]> git.pld-linux.org Git - projects/geninitrd.git/commitdiff
avoid ls -l errors if ROOT is unset
authorElan Ruusamäe <glen@delfi.ee>
Tue, 24 Dec 2013 01:04:59 +0000 (03:04 +0200)
committerElan Ruusamäe <glen@delfi.ee>
Tue, 24 Dec 2013 01:04:59 +0000 (03:04 +0200)
geninitrd

index 53bb1be9c7702100d9e60121e5e3e609ea83203f..c26cbcc6fae4286dbe430a4456293169f76ae489 100755 (executable)
--- a/geninitrd
+++ b/geninitrd
@@ -826,7 +826,7 @@ initrd_gen_setrootdev() {
                if [ "${ROOT##/dev/}" != "${ROOT}" ]; then
                        rootnr="$(busybox awk -v rootnode="${ROOT##/dev/}" '$4 == rootnode { print 256 * $1 + $2 }' /proc/partitions)"
                        # fallback to ls
-                       if [ -z "$rootnr" ]; then
+                       if [ -z "$rootnr" -a -e "$ROOT" ]; then
                                rootnr="$(busybox ls -lL ${ROOT} | busybox awk '{if (/^b/) { print 256 * $3 + $4; }}')"
                        fi
                        if [ -n "$rootnr" ]; then
This page took 0.397966 seconds and 4 git commands to generate.