made verification optional (default: on)

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2024-03-08 05:51:35 +03:00
parent 21e7bae205
commit 77677ea1dd

View File

@ -66,6 +66,7 @@ while true ; do
echo " default: $BASE" echo " default: $BASE"
echo " --rsync use rsync (default)" echo " --rsync use rsync (default)"
echo " --cp use cp" echo " --cp use cp"
echo " --no-verify skip copy verification"
if ! [ -z $COMPRESSOR ] ; then if ! [ -z $COMPRESSOR ] ; then
echo " --compress toggle archive compression" echo " --compress toggle archive compression"
echo " default: `[[ $COMPRESS ]] && echo "on" || echo "off"`" echo " default: `[[ $COMPRESS ]] && echo "on" || echo "off"`"
@ -108,6 +109,11 @@ while true ; do
shift shift
break break
;; ;;
-no-verify|--no-verify)
SKIP_VERIFY=1
shift
break
;;
-compress|--compress) -compress|--compress)
COMPRESS=`[[ $COMPRESS ]] && echo "" || echo 1` COMPRESS=`[[ $COMPRESS ]] && echo "" || echo 1`
shift shift
@ -142,21 +148,31 @@ while true ; do
echo "0) Build after this flash card: `[[ $LAST ]] && echo "yes" || echo "no"`" echo "0) Build after this flash card: `[[ $LAST ]] && echo "yes" || echo "no"`"
fi fi
echo "1) Directoy description is: \"$TITLE\"" echo "1) Directoy description is: \"$TITLE\""
if [[ ! $DRIVE ]] ; then echo "a-z|name) Type a drive letter, mount name in $BASE or path and start"
echo "a-z|name) Type a drive letter, mount name in $BASE or path and start" echo " (paths must start with \"/\", \"./\" or \"[A-Z]:\")"
echo " (paths must start with \"/\", \"./\" or \"[A-Z]:\")" if [[ $DRIVE ]] ; then
else
echo "a-z|name) Type a drive letter, mount name in $BASE or path and start"
echo " (paths must start with \"/\", \"./\" or \"[A-Z]:\")"
echo "Enter) Copy drive ${DRIVE}" echo "Enter) Copy drive ${DRIVE}"
fi fi
echo "2) Build" echo "2) Build"
if ! [ -z $COMPRESSOR ] ; then
echo "3) Compresion is `[[ $COMPRESS ]] && echo "on" || echo "off"`" # dynamic options...
echo "4) Quit" i=3
else OPTION_VERIFICATION=
echo "3) Quit" if ! [ -z $VERIFY ] ; then
echo "$i) Verification is `[[ $SKIP_VERIFY ]] && echo "off" || echo "on"`"
OPTION_VERIFICATION=$i
i=$(( i + 1 ))
fi fi
OPTION_COMPRESSION=
if ! [ -z $COMPRESSOR ] ; then
echo "$i) Compresion is `[[ $COMPRESS ]] && echo "on" || echo "off"`"
OPTION_COMPRESSION=$i
i=$(( i + 1 ))
fi
echo "$i) Quit"
OPTION_QUIT=$i
read -ep ": " RES read -ep ": " RES
# NOTE: we can't use letters here as they will shadow # NOTE: we can't use letters here as they will shadow
@ -189,15 +205,17 @@ while true ; do
LAST=1 LAST=1
break break
;; ;;
3)
if ! [ -z $COMPRESSOR ] ; then # dynamic option handlers...
COMPRESS=`[[ ! $COMPRESS ]] && echo 1 || echo ""` "$OPTION_VERIFICATION")
else SKIP_VERIFY=`[[ ! $SKIP_VERIFY ]] && echo 1 || echo ""`
exit
fi
continue continue
;; ;;
4) "$OPTION_COMPRESSION")
COMPRESS=`[[ ! $COMPRESS ]] && echo 1 || echo ""`
continue
;;
"$OPTION_QUIT")
exit exit
;; ;;
@ -271,7 +289,7 @@ while true ; do
# verify copy... # verify copy...
# XXX make this more generic... # XXX make this more generic...
if ! [ -z $VERIFY ] ; then if ! [ $SKIP_VERIFY ] && ! [ -z $VERIFY ] ; then
echo "Verifying copied files..." echo "Verifying copied files..."
$VERIFY $VERIFYFLAGS ${BASE}${DRIVE}/* "$DIR" \ $VERIFY $VERIFYFLAGS ${BASE}${DRIVE}/* "$DIR" \
> >(tee "${DIR}"/verification-err.log) > >(tee "${DIR}"/verification-err.log)