diff options
author | Holger Levsen <holger@layer-acht.org> | 2012-12-19 13:21:03 +0100 |
---|---|---|
committer | Holger Levsen <holger@layer-acht.org> | 2012-12-19 13:21:03 +0100 |
commit | 85f3b4c22854000d54b447623f9e393280ecdc1b (patch) | |
tree | 95dd1a03c89be8a4ae1d7cb5bb5fa17a0e5057da | |
parent | 28dbf57aefc251e2a75ce99e85cdef82dbbd385a (diff) | |
download | jenkins.debian.net-85f3b4c22854000d54b447623f9e393280ecdc1b.tar.xz |
make code more robust
-rwxr-xr-x | bin/g-i-installation.sh | 14 |
1 files changed, 7 insertions, 7 deletions
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 |