use openrsync to copy files, duh
This commit is contained in:
parent
8f485ccb4f
commit
7d6e339e08
@ -128,6 +128,7 @@ diff(1),
|
||||
encrypt(1),
|
||||
fw\_update(1),
|
||||
ksh(1),
|
||||
openrsync(1),
|
||||
pkg\_add(1),
|
||||
pkg\_delete(1),
|
||||
pkg\_info(1),
|
||||
|
36
boxctl.sh
36
boxctl.sh
@ -27,6 +27,7 @@ SNAPSHOT=""
|
||||
FORCE=0
|
||||
SSH_CTL_PATH="/tmp/boxctl-%r@%h:%p"
|
||||
SSH_OPTS="-o ControlMaster=auto -o ControlPersist=60s -o ControlPath=${SSH_CTL_PATH}"
|
||||
RSYNC_OPTS="--rsync-path=/usr/bin/openrsync -Dlrt"
|
||||
|
||||
while getopts "fh:mnu:sv" arg; do
|
||||
case $arg in
|
||||
@ -98,6 +99,27 @@ expand_v() {
|
||||
fi
|
||||
}
|
||||
|
||||
rsync_verbose() {
|
||||
local _opt=""
|
||||
if [ $VERBOSITY -ge 2 ]; then
|
||||
_opt="$V"
|
||||
fi
|
||||
|
||||
if [ $DRY == 1 ]; then
|
||||
echo openrsync ${RSYNC_OPTS} $_opt "$1" "$2"
|
||||
else
|
||||
openrsync ${RSYNC_OPTS} $_opt "$1" "$2"
|
||||
fi
|
||||
}
|
||||
|
||||
rsync_quiet() {
|
||||
if [ $DRY == 1 ]; then
|
||||
echo openrsync ${RSYNC_OPTS} "$1" "$2"
|
||||
else
|
||||
openrsync ${RSYNC_OPTS} "$1" "$2" >/dev/null
|
||||
fi
|
||||
}
|
||||
|
||||
ssh_verbose() {
|
||||
local _opt=""
|
||||
if [ $VERBOSITY -ge 4 ]; then
|
||||
@ -141,6 +163,18 @@ scp_quiet() {
|
||||
}
|
||||
|
||||
|
||||
_rsync() {
|
||||
local _src _dest
|
||||
_src=$1
|
||||
_dest="$(dirname $2)"
|
||||
|
||||
if [ $VERBOSITY -gt 2 ]; then
|
||||
rsync_verbose "$_src" "$_dest"
|
||||
else
|
||||
rsync_quiet "$_src" "$_dest"
|
||||
fi
|
||||
}
|
||||
|
||||
_scp() {
|
||||
local _src _dest
|
||||
_src=$1
|
||||
@ -215,7 +249,7 @@ EOF
|
||||
msg 2 "\t\tchmod ${_mode} $_dest"
|
||||
|
||||
_ssh ${RUN_USER}@${SERVER} "mkdir -p ${_dir}"
|
||||
_scp $_src "${RUN_USER}@${SERVER}:$_dest"
|
||||
_rsync $_src "${RUN_USER}@${SERVER}:$_dest"
|
||||
_ssh ${RUN_USER}@${SERVER} "/sbin/chown ${_owner}:${_group} \
|
||||
$_dest; /bin/chmod ${_mode} $_dest"
|
||||
done
|
||||
|
@ -116,6 +116,7 @@ the run.
|
||||
.Xr encrypt 1 ,
|
||||
.Xr fw_update 1 ,
|
||||
.Xr ksh 1 ,
|
||||
.Xr openrsync 1 ,
|
||||
.Xr pkg_add 1 ,
|
||||
.Xr pkg_delete 1 ,
|
||||
.Xr pkg_info 1 ,
|
||||
|
Loading…
Reference in New Issue
Block a user