diff --git a/btrfs-snapshots.sh b/btrfs-snapshots.sh index 92bd672..14ffb5d 100755 --- a/btrfs-snapshots.sh +++ b/btrfs-snapshots.sh @@ -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 diff --git a/install.sh b/install.sh index 51fb569..62f9998 100755 --- a/install.sh +++ b/install.sh @@ -3,3 +3,11 @@ for f in hourly daily weekly monthly; do sudo cp btrfs-snapshots.sh /etc/cron.$f/btrfs-snapshots; done +if ! test -e /etc/btrfs-snapshots.conf; then + cat > /etc/btrfs-snapshots.conf <