diff options
author | Holger Levsen <holger@layer-acht.org> | 2012-12-10 15:55:49 +0100 |
---|---|---|
committer | Holger Levsen <holger@layer-acht.org> | 2012-12-10 15:55:49 +0100 |
commit | 12c556edf81953e4c3f0d87188bc599e5b75fc09 (patch) | |
tree | 756cf955aac43754b2263a436064f056d5ece5e0 | |
parent | 9f0924521d0e6c38a95618eafc5657e62f867daf (diff) | |
download | jenkins.debian.net-12c556edf81953e4c3f0d87188bc599e5b75fc09.tar.xz |
save printf output in variables
-rwxr-xr-x | bin/g-i-installation.sh | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/bin/g-i-installation.sh b/bin/g-i-installation.sh index f1485375..e2bd0fab 100755 --- a/bin/g-i-installation.sh +++ b/bin/g-i-installation.sh @@ -162,10 +162,11 @@ monitor_installation() { # # break if qemu-system has finished # - vncsnapshot -quiet -allowblank $DISPLAY snapshot_$(printf "%06d" $NR).jpg 2>/dev/null || touch $RESULTS/qemu_quit + 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 - convert snapshot_$(printf "%06d" $NR).jpg snapshot_$(printf "%06d" $NR).ppm - rm snapshot_$(printf "%06d" $NR).jpg + convert snapshot_${PRINTF_NR}.jpg snapshot_${PRINTF_NR}.ppm + rm snapshot_${PRINTF_NR}.jpg else echo "could not take vncsnapshot, no qemu running on $DISPLAY" break @@ -181,15 +182,16 @@ monitor_installation() { # take a screenshot for later publishing if [ $(($NR % 100)) -eq 0 ] ; then set -x - cp snapshot_$(printf "%06d" $NR).ppm snapshot_$(printf "%06d" $NR).ppm.bak + cp snapshot_${PRINTF_NR}.ppm snapshot_${PRINTF_NR}.ppm.bak # if this screenshot is the same as the one 400 screenshots ago, let stop this if [ $NR -gt 400 ] ; then # from help let: "Exit Status: If the last ARG evaluates to 0, let returns 1; let returns 0 otherwise." let OLD=NR-400 - if diff -q snapshot_$(printf "%06d" $NR).ppm snapshot_$(printf "%06d" $OLD).ppm ; then - echo ERROR snapshot_$(printf "%06d" $NR).ppm snapshot_$(printf "%06d" $OLD).ppm match, ending installation. - cp snapshot_$(printf "%06d" $OLD).ppm snapshot_$(printf "%06d" $OLD).ppm.bak - ls -la snapshot_$(printf "%06d" $NR).ppm snapshot_$(printf "%06d" $OLD).ppm + PRINTF_OLD=$(printf "%06d" $OLD) + if diff -q snapshot_${PRINTF_NR}.ppm snapshot_${PRINTF_OLD}.ppm ; then + echo ERROR snapshot_${PRINTF_NR}.ppm snapshot_${PRINTF_OLD}.ppm match, ending installation. + cp snapshot_${PRINTF_OLD}.ppm snapshot_${PRINTF_OLD}.ppm.bak + ls -la snapshot_${PRINTF_NR}.ppm snapshot_${PRINTF_OLD}.ppm figlet "Installation hangs." break fi @@ -209,7 +211,8 @@ monitor_installation() { else let NR=NR-1 fi - cp snapshot_$(printf "%06d" $NR).ppm snapshot_$(printf "%06d" $NR).ppm.bak + PRINTF_NR=$(printf "%06d" $NR) + cp snapshot_${PRINTF_NR}.ppm snapshot_${PRINTF_NR}.ppm.bak } trap cleanup_all INT TERM EXIT |