From 3565aa36fd7a25d9b6d23c3ad6f88a544d8253d9 Mon Sep 17 00:00:00 2001 From: George Danchev Date: Sun, 26 Jun 2011 20:51:16 +0000 Subject: [PATCH] added sketch sample, formatting --- releng/releng_check_isocontent | 58 +++++++++++++++++++++++++++++++++- releng/run_all | 13 ++++++-- 2 files changed, 67 insertions(+), 4 deletions(-) diff --git a/releng/releng_check_isocontent b/releng/releng_check_isocontent index 51e7861a..f96f3fb7 100755 --- a/releng/releng_check_isocontent +++ b/releng/releng_check_isocontent @@ -2,10 +2,17 @@ set -e -printf "NOT COMPLETED YET\n" +START_DIR_DONT_CHANGE=`pwd` +# required config items +XOR="" +DIR="" +IMG="" + +printf "\n$0: SCRIPT NOT COMPLETED YET\n" exit 100 + # Thomas: # xorriso provides built-in means for comparison: # -compare_r disk_path iso_rr_path @@ -30,4 +37,53 @@ exit 100 # xorriso -indev my.iso -find / vs. find input_dir # bsdtar -xf my.iso vs. input_dir + +Sketched by Thomas: +------------------------------------------------------------------------------ + + image_file=/tmp/... + on_disk=... + in_iso="$on_disk" + copy_on_disk=/tmp/... + + if test -e "$image_file" + then + echo "TEST ENVIRONMENT ERROR: Existing image_file target:" >&2 + ls -ld "$image_file" >&2 + exit 1 + fi + if test -e "$copy_on_disk" + then + echo "TEST ENVIRONMENT ERROR: Existing copy_on_disk target:" >&2 + ls -ld "$copy_on_disk" >&2 + exit 1 + fi + + # Produce simple image + xorriso \ + -for_backup \ + -outdev "$image_file" \ + -map "$on_disk" "$in_iso" + + # Copy from image to temporary disk tree + xorriso \ + -for_backup \ + -indev "$image_file" \ + -osirrox on \ + -extract "$in_iso" "$copy_on_disk" + + # Compare original disk tree and temporary one + diff -r "$on_disk" "$copy_on_disk" + if test "$?" -ne 0 + then + echo 'FAILURE !!!' + else + echo "Success." + fi + + # Clean up + rm -r "$copy_on_disk" "$image_file" + +------------------------------------------------------------------------------ + exit 0 diff --git a/releng/run_all b/releng/run_all index 85f8a266..4b209aad 100755 --- a/releng/run_all +++ b/releng/run_all @@ -17,15 +17,22 @@ E1=`date '+%s'` # require ^releng_, avoid running (your)self explcitly for s in `ls | grep ^releng_ | grep -v ${SELF} | sort`; do if [ -x ${s} ]; then - set +e printf "\n$0: Running ${s}..." - # -rc -clean are shared options amongst the all releng scripts T1=`date '+%s'` + set +e + # -rc -clean are shared options amongst the all releng scripts ./${s} -rc -clean 1>>${CLOG1} 2>>${CLOG2} RET=$? T2=`date '+%s'` let TS="${T2}-${T1}" - printf "done. ret: $RET; time: ${TS} sec." + case ${RET} in + 0) + printf "done in ${TS} sec. ok." + ;; + *) + printf "done in ${TS} sec. FAILED WITH EXIT CODE: $RET;" + ;; + esac set -e fi done