diff options
| author | JP Appel <jeanpierre.appel01@gmail.com> | 2026-04-06 11:34:23 -0400 |
|---|---|---|
| committer | JP Appel <jeanpierre.appel01@gmail.com> | 2026-04-06 11:34:23 -0400 |
| commit | 03598ce54cb9f56d56d65eef5731e9fdc12e5164 (patch) | |
| tree | 452632ddc92ef00589161574e1c40d30c25e7647 | |
| parent | cc9b8850dfcf6bb9c07965b7d923904a23ad72ef (diff) | |
Add check for rsync implementation
| -rwxr-xr-x | scripts/edusync | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/scripts/edusync b/scripts/edusync index a0da2c9..f9f2f10 100755 --- a/scripts/edusync +++ b/scripts/edusync @@ -3,6 +3,16 @@ year="$(date '+%Y')" usage="Usage: $0 <command> [-r <remote>] [-y <year>]" +rsync_flags="" +if !command rsync >/dev/null 2>&1; then + echo "Missing 'rsync' program" >2 + exit 2 +elif rsync --version | grep "openrsync" >/dev/null 2>&1; then + rsync_flags="-aiuvzP" +else + rsync_flags="-aiuvzCP" +fi + print_help() { cat << EOF $usage @@ -64,12 +74,12 @@ find_remote(){ push_data(){ local lroot="$1" - rsync -aiuvzCP --exclude-from="$lroot/.syncignore" "$lroot/$year" "$remote_root" + rsync $rsync_flags --exclude-from="$lroot/.syncignore" "$lroot/$year" "$remote_root" } pull_data(){ local lroot="$1" - rsync -aiuvzCP "$remote_root/$year" "$lroot" + rsync $rsync_flags "$remote_root/$year" "$lroot" } check_requirements |
