Make borg optional args configurable

dev
hk 2017-05-20 15:09:20 +02:00
parent a2d796492d
commit c40dab72aa
2 changed files with 50 additions and 5 deletions

View File

@ -31,9 +31,19 @@ borg_backup () {
EXCLUDE_CMD+=( --exclude "${EXCLUDE}" ) EXCLUDE_CMD+=( --exclude "${EXCLUDE}" )
done done
${BORG} create --info --stats --list --filter AME \ if [[ -z ${BORG_BACKUP_ARGS[@]} ]]; then
--compression lz4 \ BORG_BACKUP_ARGS=(
--numeric-owner \ --info
--stats
--list
--filter AME
--compression lz4
--numeric-owner
)
fi
${BORG} create \
"${BORG_BACKUP_ARGS[@]}" \
"${BORG_REPO}"::"{hostname}-$(date -u +'%Y%m%dT%H%M%SZ')" \ "${BORG_REPO}"::"{hostname}-$(date -u +'%Y%m%dT%H%M%SZ')" \
"${PATHS[@]}" \ "${PATHS[@]}" \
"${EXCLUDE_CMD[@]}" "${EXCLUDE_CMD[@]}"
@ -43,7 +53,17 @@ borg_prune () {
# Use --prefix to limit pruning to this hostname's archives only, just in # Use --prefix to limit pruning to this hostname's archives only, just in
# case you for some reason use the same repository for several hosts (not # case you for some reason use the same repository for several hosts (not
# recommended) # recommended)
${BORG} prune --info --stats --list \
if [[ -z ${BORG_PRUNE_ARGS[@]} ]]; then
BORG_PRUNE_ARGS=(
--info
--stats
--list
)
fi
${BORG} prune \
"${BORG_PRUNE_ARGS[@]}" \
--prefix "{hostname}-" \ --prefix "{hostname}-" \
--keep-daily=${KEEP_DAILY} \ --keep-daily=${KEEP_DAILY} \
--keep-weekly=${KEEP_WEEKLY} \ --keep-weekly=${KEEP_WEEKLY} \
@ -53,7 +73,13 @@ borg_prune () {
} }
borg_verify () { borg_verify () {
${BORG} check --info "${BORG_REPO}" if [[ -z ${BORG_CHECK_ARGS[@]} ]]; then
BORG_CHECK_ARGS=(
--info
)
fi
${BORG} check "${BORG_CHECK_ARGS[@]}" "${BORG_REPO}"
} }
borg_unlock () { borg_unlock () {

View File

@ -18,3 +18,22 @@ KEEP_DAILY=31
KEEP_WEEKLY=0 KEEP_WEEKLY=0
KEEP_MONTHLY=24 KEEP_MONTHLY=24
KEEP_YEARLY=5 KEEP_YEARLY=5
# Optional arguments to the different borg commands.
# The current default values are listed. Modify if needed.
#BORG_BACKUP_ARGS=(
# --info
# --stats
# --list
# --filter AME
# --compression lz4
# --numeric-owner
#)
#BORG_PRUNE_ARGS=(
# --info
# --stats
# --list
#)
#BORG_CHECK_ARGS=(
# --info
#)