local/bin/rmirror: Add -i option to ignore cvs files.

local/bin/btrfs-snap-all: Use it.
master
Pierre Neidhardt 2020-03-10 11:26:06 +01:00
parent 3beaadeb06
commit c0713aeaaf
2 changed files with 7 additions and 3 deletions

View File

@ -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

View File

@ -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"