[projects/geninitrd] avoid ls -l errors if ROOT is unset
glen
glen at pld-linux.org
Tue Dec 24 02:06:58 CET 2013
commit e4f493e70d27c821a2511ff17e74e42f015ee662
Author: Elan Ruusamäe <glen at delfi.ee>
Date: Tue Dec 24 03:04:59 2013 +0200
avoid ls -l errors if ROOT is unset
geninitrd | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/geninitrd b/geninitrd
index 53bb1be..c26cbcc 100755
--- 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
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/projects/geninitrd.git/commitdiff/e4f493e70d27c821a2511ff17e74e42f015ee662
More information about the pld-cvs-commit
mailing list