summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Bächler <thomas@archlinux.org>2009-09-30 17:59:23 +0200
committerThomas Bächler <thomas@archlinux.org>2009-09-30 17:59:23 +0200
commit540664b91daf6d603e26693cc7723765b7f242ff (patch)
treeb6efac0fc5ea9a95eab1781232045d6ba200fe72
parent19613eb947f676350afdf559a79213fb319819f3 (diff)
downloadmkinitcpio-540664b91daf6d603e26693cc7723765b7f242ff.tar.gz
mkinitcpio-540664b91daf6d603e26693cc7723765b7f242ff.tar.xz
rootdelay check: Fix compatibility with other sh implementations than dash and make it more reliable
The old implementation failed on bash and failed on both if rootdelay was not a number. The logic is now as follows: If "$rootdelay"="", then [ -z "${rootdelay}" ] is true If not, then the part after the || is executed - if ${rootdelay} is not a number, or is <0, then [ ${rootdelay} -ge 0 ] fails, and the test will return true due to the !. The previous implementation failed here, because [ ! ${rootdelay} -ge 0 ] returns false on error, while ! [ ${rootdelay} -ge 0 ] returns true on error.
-rw-r--r--init2
1 files changed, 1 insertions, 1 deletions
diff --git a/init b/init
index c44904c..0ea8750 100644
--- a/init
+++ b/init
@@ -64,7 +64,7 @@ for m in ${MODULES}; do
done
# If rootdelay is empty or not a non-negative integer, set it to 10
-if [ -z "${rootdelay}" -o ! "${rootdelay}" -ge 0 ]; then
+if [ -z "${rootdelay}" ] || ! [ "${rootdelay}" -ge 0 ]; then
export rootdelay=10
fi
# We'll wait for the root device, so make sure klibc doesn't