|
|
|
@ -1,10 +1,21 @@ |
|
|
|
|
#!/bin/bash -e |
|
|
|
|
|
|
|
|
|
if test -e /etc/btrfs-snapshot.conf; then |
|
|
|
|
. /etc/btrfs-snapshot.conf |
|
|
|
|
fi |
|
|
|
|
if test -e ~/.btrfs-snapshot; then |
|
|
|
|
. ~/.btrfs-snapshot |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
HOURLY_DEL=25 |
|
|
|
|
DAILY_DEL=8 |
|
|
|
|
WEEKLY_DEL=5 |
|
|
|
|
MONTHLY_DEL= |
|
|
|
|
BTRFS_VOLUMES=${BTRFS_VOLUMES:-$(awk '!/^#/ && $3=="btrfs" {print $2}' /etc/fstab | tr '\n' ' ' | sed 's, $,,')} |
|
|
|
|
TMP_MNT=${TMP_MNT:-/var/tmp/btrfs-backup} |
|
|
|
|
|
|
|
|
|
vols=() |
|
|
|
|
del= |
|
|
|
|
del=${DEL} |
|
|
|
|
dryrun=0 |
|
|
|
|
periodity=${0%/*} |
|
|
|
|
periodity=${periodity##*/} |
|
|
|
@ -14,10 +25,10 @@ else |
|
|
|
|
periodity= |
|
|
|
|
fi |
|
|
|
|
case "$periodity" in |
|
|
|
|
(.hourly) del=25;; |
|
|
|
|
(.daily) del=8;; |
|
|
|
|
(.weekly) del=5;; |
|
|
|
|
(.monthly);; |
|
|
|
|
(.hourly) del=${HOURLY_DEL};; |
|
|
|
|
(.daily) del=${DAILY_DEL};; |
|
|
|
|
(.weekly) del=${WEEKLY_DEL};; |
|
|
|
|
(.monthly) del=${MONTHLY_DEL};; |
|
|
|
|
esac |
|
|
|
|
while test $# -gt 0; do |
|
|
|
|
case "$1" in |
|
|
|
|