Compare commits

..

No commits in common. "97de482afa356b84068f177a81f1c3276838f21b" and "3a332225a049b4d38363c8f2a1665e79b59e4275" have entirely different histories.

View File

@ -118,7 +118,6 @@ if ! [ -z "$2" ] ; then
TITLE=" - $2" TITLE=" - $2"
fi fi
BASE=${BASE%/}/
DRIVE=${1} DRIVE=${1}
__BASE=$BASE __BASE=$BASE
@ -127,30 +126,22 @@ while true ; do
if [[ $INTERACTIVE || ! $DRIVE ]] ; then if [[ $INTERACTIVE || ! $DRIVE ]] ; then
INTERACTIVE=1 INTERACTIVE=1
echo "Select/toggle an option:" echo "Select/toggle an option:"
if [ -z $MULTI_STARTED ] ; then echo "0) Multi flash card mode is `[[ $MULTI ]] && echo "on" || echo "off"`"
if [[ $MULTI ]] ; then echo "1) Directoy description is: \"$TITLE\"."
echo "0) Multiple flash cards"
else
echo "0) Single flash card"
fi
else
echo "0) Build after this flash card: `[[ $LAST ]] && echo "yes" || echo "no"`"
fi
echo "1) Directoy description is: \"$TITLE\""
if [[ ! $DRIVE ]] ; then 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]:\")"
else else
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]:\")"
echo "Enter) Copy drive ${DRIVE}" echo "Enter) Copy drive ${DRIVE}"
fi fi
echo "2) Build" echo "2) Build."
if ! [ -z $COMPRESSOR ] ; then if ! [ -z $COMPRESSOR ] ; then
echo "3) Compresion is `[[ $COMPRESS ]] && echo "on" || echo "off"`" echo "3) Compresion is `[[ $COMPRESS ]] && echo "on" || echo "off"`"
echo "4) Quit" echo "4) Quit."
else else
echo "3) Quit" echo "3) Quit."
fi fi
read -ep ": " RES read -ep ": " RES
@ -159,11 +150,7 @@ while true ; do
case $RES in case $RES in
# toggle multi mode... # toggle multi mode...
0) 0)
if [ -z $MULTI_STARTED ] ; then MULTI=`[[ ! $MULTI ]] && echo 1 || echo ""`
MULTI=`[[ ! $MULTI ]] && echo 1 || echo ""`
else
LAST=`[[ ! $LAST ]] && echo 1 || echo ""`
fi
continue continue
;; ;;
1) 1)
@ -198,23 +185,22 @@ while true ; do
# new drive letter... # new drive letter...
*) *)
# explicit path given...
if [[ "${RES::1}" == "/" ]] \
|| [[ "${RES::2}" == "./" ]] \
|| [[ "${RES::2}" =~ [a-zA-Z]: ]] \
&& [ -e "$RES" ] ; then
BASE=
fi
DRIVE=$RES DRIVE=$RES
;; ;;
esac esac
fi fi
# explicit path given...
if [[ "${DRIVE::1}" == "/" ]] \
|| [[ "${DRIVE::2}" == "./" ]] \
|| [[ "${DRIVE::2}" =~ [a-zA-Z]: ]] \
&& [ -e "$DRIVE" ] ; then
BASE=
fi
# sanity check... # sanity check...
if ! [ -e "${BASE}${DRIVE}" ] ; then if ! [ -e "${BASE}/${DRIVE}" ] ; then
echo echo
echo "ERR: ${BASE}${DRIVE}: does not exist, nothing to copy." echo "ERR: ${BASE}/${DRIVE}: does not exist, nothing to copy."
echo echo
if [[ $INTERACTIVE || ! $DRIVE ]] ; then if [[ $INTERACTIVE || ! $DRIVE ]] ; then
continue continue
@ -238,24 +224,20 @@ while true ; do
else else
BASE_DIR="${DATE}${TITLE}/" BASE_DIR="${DATE}${TITLE}/"
DIR="${BASE_DIR}/${DATE}.${SCOUNT}" DIR="${BASE_DIR}/${DATE}.${SCOUNT}"
# get next dir index...
while [ -e *"$DIR"* ] ; do while [ -e *"$DIR"* ] ; do
COUNT=$((COUNT+1)) COUNT=$((COUNT+1))
SCOUNT=`printf "%03d" $COUNT` SCOUNT=`printf "%03d" $COUNT`
DIR="${BASE_DIR}/${DATE}.${SCOUNT}" DIR="${BASE_DIR}/${DATE}.${SCOUNT}"
done done
fi fi
MULTI_STARTED=1
# normalize paths... # normalize paths...
BASE_DIR="./- ${BASE_DIR}/" BASE_DIR="./- ${BASE_DIR}/"
DIR="./- $DIR/" DIR="./- $DIR/"
mkdir -vp "$DIR" mkdir -vp "$DIR"
echo "Copying files from ${BASE}${DRIVE} (~`du -hs "${BASE}${DRIVE}" | cut -f 1`)..." echo "Copying files from ${BASE}/${DRIVE} (~`du -hs "${BASE}/${DRIVE}" | cut -f 1`)..."
$COPY $COPYFLAGS ${BASE}${DRIVE}/* "$DIR" \ $COPY $COPYFLAGS ${BASE}/${DRIVE}/* "$DIR" \
2> >(tee "${DIR}"/copy-err.log) 2> >(tee "${DIR}"/copy-err.log)
# no errors -> remove log... # no errors -> remove log...
if ! [ -s "${DIR}/copy-err.log" ] ; then if ! [ -s "${DIR}/copy-err.log" ] ; then