reworked permissions and added compression....

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2019-09-27 22:18:59 +03:00
parent 47a92dd0a0
commit 7356491b1d
2 changed files with 118 additions and 44 deletions

View File

@ -5,7 +5,8 @@ COUNT=1
TITLE=""
RSYNC=rsync
RSYNCFLAGS="-arptgoA --info=progress2,flist --human-readable"
#RSYNCFLAGS="-arptgoA --info=progress2,flist --human-readable"
RSYNCFLAGS="-arpt --info=progress2,flist --human-readable"
CP=cp
CPFLAGS=-Rpfv
@ -14,6 +15,10 @@ CPFLAGS=-Rpfv
COPY=$RSYNC
COPYFLAGS=$RSYNCFLAGS
COMPRESSOR=./compress-archive.sh
COMPRESS=1
# base mount dir...
# systems with /mnt
if [ -d /mnt ] ; then
@ -40,11 +45,20 @@ while true ; do
echo " single shoot."
echo " -l|-last last flash card in set, run"
echo " process-archive.sh after copying."
echo " -b|-base the base dir to look for drives in"
echo " -b|-base BASE the base dir to look for drives in"
echo " default: $BASE"
echo " --rsync use rsync (default)"
echo " --cp use cp"
# XXX add post-compression options...
if ! [ -z $COMPRESSOR ] ; then
echo " --compress toggle archive compression"
echo " default: `[[ $COMPRESS ]] && echo "on" || echo "off"`"
fi
# notes...
echo
if ! [ -z $COMPRESSOR ] ; then
echo "NOTE: the index is fully usable during the compression stage"
fi
echo "NOTE: cp under Cygwin may messup permissions, use rsync."
echo
exit
;;
@ -62,17 +76,24 @@ while true ; do
shift
;;
-b|-base|--base)
BASE=1
shift
BASE=$2
shift 2
;;
-cp|--cp)
COPY=cp
COPYFLAGS=-Rpfv
shift
break
;;
-rsync|--rsync)
COPY=$RSYNC
COPYFLAGS=$RSYNCFLAGS
shift
break
;;
-compress|--compress)
COMPRESS=`[[ $COMPRESS ]] && echo "" || echo 1`
shift
break
;;
*)
@ -100,10 +121,12 @@ while true ; do
echo "Enter) copy drive ${DRIVE}"
fi
echo "2) build."
# XXX compression...
#echo "3) compresion is `[[ $COMPRESS ]] && echo "on" || echo "off" `"
#echo "4) quit."
echo "3) quit."
if ! [ -z $COMPRESSOR ] ; then
echo "3) compresion is `[[ $COMPRESS ]] && echo "on" || echo "off"`"
echo "4) quit."
else
echo "3) quit."
fi
read -p ": " RES
case $RES in
@ -130,13 +153,15 @@ while true ; do
LAST=1
break
;;
# 3)
# COMPRESS=`[[ ! $COMPRESS ]] && echo 1 || echo ""`
# continue
# ;;
# 4)
3)
if ! [ -z $COMPRESSOR ] ; then
COMPRESS=`[[ ! $COMPRESS ]] && echo 1 || echo ""`
else
exit
fi
continue
;;
4)
exit
;;
@ -147,6 +172,17 @@ while true ; do
esac
fi
# sanity check...
if ! [ -e "${BASE}/${DRIVE}" ] ; then
echo
echo "ERR: ${BASE}/${DRIVE}: does not exist, nothing to copy."
echo
if [[ $INTERACTIVE || ! $DRIVE ]] ; then
continue
fi
exit
fi
# XXX do a real three digit count...
# single flash card...
SCOUNT=`printf "%03d" $COUNT`
@ -196,12 +232,13 @@ if [[ ! $MULTI || $LAST ]] ; then
echo "Building archive: done."
fi
# XXX post processing -- compress archive...
#if [[ $COMPRESS ]] ; then
# echo "Compressing archive..."
# ./compress-archive.sh "$BASE_DIR"
# echo "Compressing archive: done."
#fi
if [[ $COMPRESS ]] ; then
echo "Compressing archive..."
${COMPRESSOR} "$BASE_DIR"
echo "Compressing archive: done."
fi
echo "`basename "$0"`: done."
# vim:set nowrap :

View File

@ -5,7 +5,8 @@ COUNT=1
TITLE=""
RSYNC=rsync
RSYNCFLAGS="-arptgoA --info=progress2,flist --human-readable"
#RSYNCFLAGS="-arptgoA --info=progress2,flist --human-readable"
RSYNCFLAGS="-arpt --info=progress2,flist --human-readable"
CP=cp
CPFLAGS=-Rpfv
@ -14,6 +15,10 @@ CPFLAGS=-Rpfv
COPY=$RSYNC
COPYFLAGS=$RSYNCFLAGS
COMPRESSOR=./compress-archive.sh
COMPRESS=1
# base mount dir...
# systems with /mnt
if [ -d /mnt ] ; then
@ -40,11 +45,20 @@ while true ; do
echo " single shoot."
echo " -l|-last last flash card in set, run"
echo " process-archive.sh after copying."
echo " -b|-base the base dir to look for drives in"
echo " -b|-base BASE the base dir to look for drives in"
echo " default: $BASE"
echo " --rsync use rsync (default)"
echo " --cp use cp"
# XXX add post-compression options...
if ! [ -z $COMPRESSOR ] ; then
echo " --compress toggle archive compression"
echo " default: `[[ $COMPRESS ]] && echo "on" || echo "off"`"
fi
# notes...
echo
if ! [ -z $COMPRESSOR ] ; then
echo "NOTE: the index is fully usable during the compression stage"
fi
echo "NOTE: cp under Cygwin may messup permissions, use rsync."
echo
exit
;;
@ -62,17 +76,24 @@ while true ; do
shift
;;
-b|-base|--base)
BASE=1
shift
BASE=$2
shift 2
;;
-cp|--cp)
COPY=cp
COPYFLAGS=-Rpfv
shift
break
;;
-rsync|--rsync)
COPY=$RSYNC
COPYFLAGS=$RSYNCFLAGS
shift
break
;;
-compress|--compress)
COMPRESS=`[[ $COMPRESS ]] && echo "" || echo 1`
shift
break
;;
*)
@ -100,10 +121,12 @@ while true ; do
echo "Enter) copy drive ${DRIVE}"
fi
echo "2) build."
# XXX compression...
#echo "3) compresion is `[[ $COMPRESS ]] && echo "on" || echo "off" `"
#echo "4) quit."
echo "3) quit."
if ! [ -z $COMPRESSOR ] ; then
echo "3) compresion is `[[ $COMPRESS ]] && echo "on" || echo "off"`"
echo "4) quit."
else
echo "3) quit."
fi
read -p ": " RES
case $RES in
@ -130,13 +153,15 @@ while true ; do
LAST=1
break
;;
# 3)
# COMPRESS=`[[ ! $COMPRESS ]] && echo 1 || echo ""`
# continue
# ;;
# 4)
3)
if ! [ -z $COMPRESSOR ] ; then
COMPRESS=`[[ ! $COMPRESS ]] && echo 1 || echo ""`
else
exit
fi
continue
;;
4)
exit
;;
@ -147,6 +172,17 @@ while true ; do
esac
fi
# sanity check...
if ! [ -e "${BASE}/${DRIVE}" ] ; then
echo
echo "ERR: ${BASE}/${DRIVE}: does not exist, nothing to copy."
echo
if [[ $INTERACTIVE || ! $DRIVE ]] ; then
continue
fi
exit
fi
# XXX do a real three digit count...
# single flash card...
SCOUNT=`printf "%03d" $COUNT`
@ -196,12 +232,13 @@ if [[ ! $MULTI || $LAST ]] ; then
echo "Building archive: done."
fi
# XXX post processing -- compress archive...
#if [[ $COMPRESS ]] ; then
# echo "Compressing archive..."
# ./compress-archive.sh "$BASE_DIR"
# echo "Compressing archive: done."
#fi
if [[ $COMPRESS ]] ; then
echo "Compressing archive..."
${COMPRESSOR} "$BASE_DIR"
echo "Compressing archive: done."
fi
echo "`basename "$0"`: done."
# vim:set nowrap :