summaryrefslogblamecommitdiffstats
path: root/rsync.sh
blob: a77d681cfa6fd1083c3f4b92f479ec49efd0ce5d (plain) (tree)









































                                                                    
##
# systr_rsync_normal <src> <dst> [<link>]
#
# Perform normal rsync operations to transfer files to or from the
# repository.  If <link> is set, it is used as the --link-dest value
# for rsync.  This function is polymorphic for both local and remote
# repositories.
##
function systr_rsync_normal
{
    if [ $# -lt 2 ]; then
        echo "Fatal: too few arguments to systr_rsync_normal"
        exit 1
    fi

    src="$1"
    dst="$2"

    if [ $# -gt 2 ]; then
        link="--link-dest=\"$3\""
    else
        link=""
    fi

    if [[ "$remote" == "" ]]; then
        rsync -az --info=progress2 --info=stats2 \
            --delete --exclude='*.systr' \
            $link \
            "$src" "$dst"
    else
        if [[ "$src" == "." ]]; then
            dst="$remote:$dst"
        else
            src="$remote:$src"
        fi

        rsync -az -e ssh --info=progress2 --info=stats2 \
            --delete --exclude='*.systr' \
            $link \
            "$src" "$dst"
    fi
}