Add SNAP_SYNC_EXCLUDE to exclude some configurations

Fixes #11.
This commit is contained in:
James Barnett
2017-01-28 06:26:12 -06:00
parent ad0362a136
commit 01b7237e11
2 changed files with 16 additions and 1 deletions

View File

@@ -46,6 +46,9 @@ place. Example:
The timer included is weekly. Edit both files to your taste.
You can exclude a configuration from backup by setting `SNAP_SYNC_EXCLUDE=yes`
in your snapper configuration file.
## Example command line usage
### No arguments

View File

@@ -135,6 +135,8 @@ selected_configs=${selected_configs:-$SNAPPER_CONFIGS}
# Initial configuration of where backup directories are
for x in $selected_configs; do
SNAP_SYNC_EXCLUDE=no
if [[ -f "/etc/snapper/configs/$x" ]]; then
source /etc/snapper/configs/$x
else
@@ -142,6 +144,10 @@ for x in $selected_configs; do
exit 1
fi
if [[ $SNAP_SYNC_EXCLUDE == "yes" ]]; then
continue
fi
old_num=$(snapper -c "$x" list -t single | awk '/'"$selected_uuid"'/ {print $1}')
old_snap=$SUBVOLUME/.snapshots/$old_num/snapshot
@@ -166,7 +172,7 @@ done
# Actual backing up
for x in $selected_configs; do
printf "\n"
SNAP_SYNC_EXCLUDE=no
if [[ -f "/etc/snapper/configs/$x" ]]; then
source /etc/snapper/configs/$x
@@ -175,6 +181,12 @@ for x in $selected_configs; do
exit 1
fi
if [[ $SNAP_SYNC_EXCLUDE == "yes" ]]; then
continue
fi
printf "\n"
old_num=$(snapper -c "$x" list -t single | awk '/'"$selected_uuid"'/ {print $1}')
old_snap=$SUBVOLUME/.snapshots/$old_num/snapshot