Compare commits

..

2 Commits

Author SHA1 Message Date
ebbc553576 cleanup...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2024-03-06 16:53:07 +03:00
f857c6e456 a bit more paranoid virification...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2024-03-06 16:47:11 +03:00

View File

@ -16,6 +16,9 @@ CPFLAGS=-Rpfv
# override default... # override default...
COPY=$RSYNC COPY=$RSYNC
COPYFLAGS=$RSYNCFLAGS COPYFLAGS=$RSYNCFLAGS
VERIFY=$RSYNC
VERIFYFLAGS=-n $RSYNCFLAGS
COMPRESSOR=./compress-archive.sh COMPRESSOR=./compress-archive.sh
COMPRESS=1 COMPRESS=1
@ -254,15 +257,51 @@ while true ; do
mkdir -vp "$DIR" mkdir -vp "$DIR"
echo "Copying files from ${BASE}${DRIVE} (~`du -hs "${BASE}${DRIVE}" | cut -f 1`)..." while true ; do
$COPY $COPYFLAGS ${BASE}${DRIVE}/* "$DIR" \ echo "Copying files from ${BASE}${DRIVE} (~`du -hs "${BASE}${DRIVE}" | cut -f 1`)..."
2> >(tee "${DIR}"/copy-err.log) $COPY $COPYFLAGS ${BASE}${DRIVE}/* "$DIR" \
# no errors -> remove log... 2> >(tee "${DIR}"/copy-err.log)
if ! [ -s "${DIR}/copy-err.log" ] ; then # no errors -> remove log...
rm -f "${DIR}"/copy-err.log if ! [ -s "${DIR}/copy-err.log" ] ; then
fi rm -f "${DIR}"/copy-err.log
echo "Copying files: done." fi
echo "Copying files: done."
# verify copy...
# XXX make this more generic...
if ! [ -z $VERIFY ] ; then
echo "Verifying copied files..."
$VERIFY $VERIFYFLAGS ${BASE}${DRIVE}/* "$DIR" \
> >(tee "${DIR}"/verification-err.log)
if ! [ -s "${DIR}/verification-err.log" ] ; then
rm -f "${DIR}"/verification-err.log
else
echo
echo "WARNING: found mismatching files"
echo " (see: "${DIR}"/verification-err.log)"
echo
while true; do
read -ep "[R]etry, [c]ontinue, or Ctrl-C to cancel: " ACTION
ACTION=`echo ${ACTION,,} | xargs`
if [[ $ACTION =~ [rc] ]] \
|| [ -z $ACTION ] ; then
break
fi
echo "Unknown input: \"$ACTION\""
done
if [[ $ACTION == "c" ]] ; then
break
else
continue
fi
fi
echo "Verifification: done."
break
# no verification defined...
else
break
fi
done
# exit interactive mode... # exit interactive mode...
if [[ ! $MULTI || ! $INTERACTIVE || $LAST ]] ; then if [[ ! $MULTI || ! $INTERACTIVE || $LAST ]] ; then