1#!/usr/bin/env zsh23opts=4: ${DOAS:="doas"}5while getopts "hn" opt; do6 case $opt in7 h)8 echo "usage: $0 SRC_DIR DEST_DIR [-n]"9 exit 010 ;;11 n)12 opts=($opts --dry-run)13 ;;14 esac15done16shift $((OPTIND-1))1718src=${1:-"/"}19dest=${2:-"tei::backup/sys/$(hostname)/"}2021if [ -f "$src/.rsync.files" ]; then22 opts=($opts --files-from $src/.rsync.files)23fi24if [ -f "$src/.rsync.exclude" ]; then25 opts=($opts --exclude-from $src/.rsync.exclude)26fi27if [ -f "$src/.rsync.include" ]; then28 opts=($opts --include-from $src/.rsync.include)29fi30if [ -f "$src/.rsync.filter" ]; then31 opts=($opts --filter="merge $src/.rsync.filter")32fi3334echo $opts35echo $dest36$DOAS rsync --archive --one-file-system --inplace --hard-links \37 --human-readable --numeric-ids --delete --delete-excluded \38 --acls --xattrs --sparse \39 --itemize-changes --verbose --progress \40 --exclude='*~' --exclude=__pycache__ \41 $opts $src $dest4243function() {44 function() {45 }46}