Check and install rsync if missing
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
#!/bin/bash
|
||||
|
||||
toolName=backup
|
||||
toolBin=rsync
|
||||
|
||||
# Get script working directory
|
||||
# (when called from a different directory)
|
||||
WDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >>/dev/null 2>&1 && pwd )"
|
||||
APTOPT=
|
||||
CONFIG=0
|
||||
CONFIG_FILE_NAME="${toolName}.cfg"
|
||||
CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example"
|
||||
@@ -15,7 +17,12 @@ step_config() {
|
||||
CONFIG=1
|
||||
else
|
||||
echoerr " [E] Check output for errors"
|
||||
# End if no configuration file exists
|
||||
[ $DRY -eq 0 ] && return -1
|
||||
fi
|
||||
|
||||
[ $QUIET -ne 0 ] && APTOPT="-y"
|
||||
return 0
|
||||
}
|
||||
|
||||
step_1_info() {
|
||||
@@ -146,14 +153,30 @@ step_3() {
|
||||
exit 1
|
||||
fi
|
||||
|
||||
checkInstalled
|
||||
exep "mv -f ${buTarget}/${buLog}0.log /tmp/${buLog}1.log 2>/dev/null"
|
||||
exep "rsync -avxHAX --delete --info=stats2 ${buExcludes[*]} ${tmpSource} ${tmpTarget} > /tmp/${buLog}0.log"
|
||||
exep "$toolBin -avxHAX --delete --info=stats2 ${buExcludes[*]} ${tmpSource} ${tmpTarget} > /tmp/${buLog}0.log"
|
||||
|
||||
exe mv -f /tmp/${buLog}*.log ${buTarget}
|
||||
exe sync
|
||||
exep "mount -o ro,remount '${buTarget}' >>/dev/null 2>&1"
|
||||
}
|
||||
|
||||
VERSION_SEQREV=10
|
||||
step_100_info() { echo "Install $toolBin"; }
|
||||
step_100_alias() { ALIAS="install"; }
|
||||
step_100() {
|
||||
exe apt update
|
||||
exe apt install $toolBin $APTOPT
|
||||
}
|
||||
|
||||
checkInstalled() {
|
||||
command -v $toolBin >>/dev/null
|
||||
if [ $? -ne 0 ] ; then
|
||||
step install
|
||||
fi
|
||||
toolBin="$(command -v $toolBin)"
|
||||
}
|
||||
|
||||
VERSION_SEQREV=12
|
||||
. /usr/local/bin/sequencer.sh
|
||||
|
||||
|
Reference in New Issue
Block a user