From 85f3b4c22854000d54b447623f9e393280ecdc1b Mon Sep 17 00:00:00 2001 From: Holger Levsen Date: Wed, 19 Dec 2012 13:21:03 +0100 Subject: make code more robust --- bin/g-i-installation.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'bin') diff --git a/bin/g-i-installation.sh b/bin/g-i-installation.sh index 5cc50788..1e9bcf9e 100755 --- a/bin/g-i-installation.sh +++ b/bin/g-i-installation.sh @@ -55,7 +55,7 @@ fetch_if_newer() { file="$1" curlopts="-L" - if [ -f $file ] ; then + if [ -f "$file" ] ; then curlopts="$curlopts -z $file" fi curl $curlopts -o $file $url @@ -247,7 +247,7 @@ monitor_system() { # PRINTF_NR=$(printf "%06d" $NR) vncsnapshot -quiet -allowblank $DISPLAY snapshot_${PRINTF_NR}.jpg 2>/dev/null || touch $RESULTS/qemu_quit - if [ ! -f $RESULTS/qemu_quit ] ; then + if [ ! -f "$RESULTS/qemu_quit" ] ; then convert snapshot_${PRINTF_NR}.jpg snapshot_${PRINTF_NR}.ppm rm snapshot_${PRINTF_NR}.jpg else @@ -288,11 +288,11 @@ monitor_system() { echo "QEMU was powered down, continuing." backup_screenshot break - elif [ ! -z $STACK_LINE ] ; then + elif [ ! -z "$STACK_LINE" ] ; then echo "WARNING: got a stack-trace, probably on power-down." backup_screenshot break - elif [ ! -z $TRIGGERED ] ; then + elif [ ! -z "$TRIGGERED" ] ; then echo ERROR snapshot_${PRINTF_NR}.ppm snapshot_${PRINTF_OLD}.ppm match, ending installation. ls -la snapshot_${PRINTF_NR}.ppm snapshot_${PRINTF_OLD}.ppm figlet "Installation hangs." @@ -312,7 +312,7 @@ monitor_system() { if [ $NR -eq $MAX_RUNS ] ; then echo Warning: running for 6h, forceing termination. fi - if [ -f $RESULTS/qemu_quit ] ; then + if [ -f "$RESULTS/qemu_quit" ] ; then let NR=NR-2 rm $RESULTS/qemu_quit else @@ -327,7 +327,7 @@ trap cleanup_all INT TERM EXIT # # if there is a CD image... # -if [ ! -z $IMAGE ] ; then +if [ ! -z "$IMAGE" ] ; then fetch_if_newer "$IMAGE" "$URL" sudo mkdir -p $IMAGE_MNT @@ -362,7 +362,7 @@ case $JOB_NAME in # kill qemu and image # sudo kill -9 $(ps fax | grep [q]emu-system | grep ${NAME}_preseed.cfg 2>/dev/null | awk '{print $1}') || true - if [ ! -z $IMAGE ] ; then + if [ ! -z "$IMAGE" ] ; then sudo umount -l $IMAGE_MNT || true fi boot_system -- cgit v1.2.3-54-g00ecf