#!/bin/bash
#  net/tool/rsync - rsync support

set -e


######
# Native dependencies

net_tool_rsync_client_packages=( rsync )


######
# Settings

net_tool_rsync_config_init() {
	lib_setting_vars rsync_verbose rsync_readable
	lib_setting_vars -ro rsync_partdir
}

net_tool_rsync_config_check() {
	rsync_verbose="${rsync_verbose:-false}"
	rsync_readable="${rsync_readable:-true}"
	rsync_partdir="${rsync_partdir:-.${package_name}-rsync-partials}"
}


######
# Private interface

rsync_options() {
	local var=$1

	list_append $var --partial-dir="$rsync_partdir"

	! $rsync_verbose || list_append $var -v
	! $pretend || list_append $var --dry-run
	! $rsync_readable || list_append $var --human-readable
	[ -z "$ssh_port" ] || list_append $var -e "ssh -p $ssh_port"
}


######
# Public interface

run_rsync() {
	local -a opts
	rsync_options opts
	pretend=false run rsync "${opts[@]}" "$@"
}

View the Script Reference Index


Generated on Tue Apr 25 21:21:08 PDT 2017 by mcsh i7 v0.18.0.