From: Michael Prokop Date: Mon, 17 May 2010 10:04:46 +0000 (+0200) Subject: Make sure tests work with dash as well. X-Git-Url: http://git.grml.org/?p=grml-unittests.git;a=commitdiff_plain;h=30600052dc7c9c15a0639f3417d75b70e36cef81;hp=980f66f4a42c6a3562c9c4b360a0a0e0f96fa829 Make sure tests work with dash as well. If dash is used as /bin/sh then $RANDOM isn't set. Running all the runit.sh scripts using zsh as well addresses this issue, also check for $RANDOM in framework.sh so we exit before running into obscure error messages. --- diff --git a/autoconfig/runit.sh b/autoconfig/runit.sh index 99e2799..a10e732 100755 --- a/autoconfig/runit.sh +++ b/autoconfig/runit.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/zsh . $FRAMEWORK diff --git a/framework.sh b/framework.sh index ca18dba..292820b 100644 --- a/framework.sh +++ b/framework.sh @@ -35,6 +35,12 @@ trap bailout QUIT INT EXIT COMMON_PORT=0 STATUS_PORT=0 +# $RANDOM is not set in dash +if [ -z "$RANDOM" ] ; then + echo "Variable \$RANDOM not set, can not choose random port. Exiting.">&2 + bailout +fi + while [ $COMMON_PORT -lt 1024 ] || [ $STATUS_PORT -lt 1024 ] ; do COMMON_PORT=$RANDOM STATUS_PORT=$RANDOM diff --git a/grml2hd/runit.sh b/grml2hd/runit.sh index db99029..75ef364 100755 --- a/grml2hd/runit.sh +++ b/grml2hd/runit.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/zsh for i in grub lilo ; do PARENT=$$ $i/runit.sh diff --git a/grml2usb/runit.sh b/grml2usb/runit.sh index b787e69..0c8e7ff 100755 --- a/grml2usb/runit.sh +++ b/grml2usb/runit.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/zsh . $FRAMEWORK diff --git a/lvm/runit.sh b/lvm/runit.sh index e72269a..8034380 100755 --- a/lvm/runit.sh +++ b/lvm/runit.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/zsh . $FRAMEWORK