Merge branch 'master' of bitbucket.org:MoonQ/q-tools

This commit is contained in:
Ville Rantanen
2023-03-09 09:29:56 +02:00

View File

@@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
VERSION="20190820" VERSION="20230307"
function helpexit() { function helpexit() {
BS=$( basename "$0" ) BS=$( basename "$0" )
@@ -81,6 +81,10 @@ for ((i=1; i<=${#@}; i++)) {
} }
[[ ${#FOLDERS[@]} -eq 0 ]] && FOLDERS+=( "." ) [[ ${#FOLDERS[@]} -eq 0 ]] && FOLDERS+=( "." )
which pv &>/dev/null || { echo pv command missing; exit 1; } which pv &>/dev/null || { echo pv command missing; exit 1; }
if tar --version | grep -q GNU; then
SORTFILES="--sort=name"
fi
export IFS=$'\n' export IFS=$'\n'
REALFOLDERS=( $( listfolders "${FOLDERS[@]}" ) ) REALFOLDERS=( $( listfolders "${FOLDERS[@]}" ) )
echo $R'Existing files will be overwritten!'$Z echo $R'Existing files will be overwritten!'$Z
@@ -104,7 +108,7 @@ for d in "${REALFOLDERS[@]}"; do
printf "$d" printf "$d"
SIZE=$( find "$d" -type f -printf %s"\n" | count_size "$d" ) SIZE=$( find "$d" -type f -printf %s"\n" | count_size "$d" )
printf "\n" printf "\n"
eval "tar cvv --index-file=\"$d.${SUFFIX}.lst\" \"$d\" | \ eval "tar cvv $SORTFILES --index-file=\"$d.${SUFFIX}.lst\" \"$d\" | \
pv -s \"$SIZE\" $COMPRESSCMD > \"$d.${SUFFIX}\"" && { pv -s \"$SIZE\" $COMPRESSCMD > \"$d.${SUFFIX}\"" && {
# tar exists okay # tar exists okay
NEWEST="$( awk '{ print $4 " " $5 }' "$d.${SUFFIX}.lst" | sort | tail -n 1 )" NEWEST="$( awk '{ print $4 " " $5 }' "$d.${SUFFIX}.lst" | sort | tail -n 1 )"