From c0713aeaafe58c1f5884f8739ca08e1e2be735d0 Mon Sep 17 00:00:00 2001 From: Pierre Neidhardt Date: Tue, 10 Mar 2020 11:26:06 +0100 Subject: [PATCH] local/bin/rmirror: Add -i option to ignore cvs files. local/bin/btrfs-snap-all: Use it. --- .local/bin/btrfs-snap-all | 2 +- .local/bin/rmirror | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.local/bin/btrfs-snap-all b/.local/bin/btrfs-snap-all index 22465af2..10d6735e 100755 --- a/.local/bin/btrfs-snap-all +++ b/.local/bin/btrfs-snap-all @@ -45,7 +45,7 @@ snap () { # $1=fs $2=subvol local last=$(find "$fs/.snapshots/$subvol" -maxdepth 1 | tail -1) $OPT_GIT_GC && git_gc "$fs/subvol" - $OPT_PREVIEW && rmirror "$fs/$subvol" "$last" + $OPT_PREVIEW && rmirror -i "$fs/$subvol" "$last" echo -n "==> Snapshot '$fs/${subvol}'? (y/N) " read -r choice diff --git a/.local/bin/rmirror b/.local/bin/rmirror index 47ab9625..444837ca 100755 --- a/.local/bin/rmirror +++ b/.local/bin/rmirror @@ -12,6 +12,7 @@ A dry-run is made by default. Options: + -i: Ignore CVS fils (.git and .gitignore'd files). -p: Process. -s: Ignore dates when comparing files. @@ -23,8 +24,11 @@ EOF ## replacing -a with -lr. flags="-a" opt_dry="-n" -while getopts ":hps" opt; do +opt_cvs_ignore="" +while getopts ":ihps" opt; do case $opt in + i) + opt_cvs_ignore="--cvs-exclude" ;; h) usage exit ;; @@ -45,4 +49,4 @@ shift $(($OPTIND - 1)) [ "$1" = "-h" ] && usage && exit [ "$1" = "--" ] && shift -rsync $opt_dry -iv $flags --size-only --delete --exclude="/lost+found" --exclude="/.Trash*" --progress -- "$1"/ "$2" +rsync $opt_dry -iv $flags --size-only --delete --exclude="/lost+found" --exclude="/.Trash*" $opt_cvs_ignore --progress -- "$1"/ "$2"