From 1770fe4e56aaae431d072d618d50af8f25a8f9d8 Mon Sep 17 00:00:00 2001 From: Jarno Rankinen Date: Fri, 7 Aug 2020 06:58:16 +0300 Subject: [PATCH] Separate config file Started implementing separate config file. Needs to be copied/linked manually to /etc/snapsh.conf --- snapsh | 16 +++++++++++----- snapsh.conf | 25 +++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 5 deletions(-) create mode 100644 snapsh.conf diff --git a/snapsh b/snapsh index c389931..45b254b 100755 --- a/snapsh +++ b/snapsh @@ -18,13 +18,19 @@ # Environment set up: -TOPLEVEL="/root/btrfs-toplevel" -SNAPSHOTS_LOCATION="/root/btrfs-toplevel/snapshots" +if [[ -e /etc/snapsh.conf ]]; then + . /etc/snapsh.conf +else + TOPLEVEL="/root/btrfs-toplevel" + SNAPSHOTS_LOCATION="/root/btrfs-toplevel/snapshots" + TIMESTAMP="$(date +%Y.%m.%d-%H.%M.%S)" + SUBVOLUME="root" + DESCRIPTION="" +fi + +## In case of problems, define the path to the 'btrfs' executable here BTRFS_EXECUTABLE=$(which btrfs) -TIMESTAMP=$(date +%Y.%m.%d-%H:%M:%S) -SUBVOLUME="root" -DESCRIPTION="" diff --git a/snapsh.conf b/snapsh.conf new file mode 100644 index 0000000..ac3f6e0 --- /dev/null +++ b/snapsh.conf @@ -0,0 +1,25 @@ +## Snapsh requires the toplevel (subvolid=5) mounted somewhere +## You can define your mount point here. +## Default: "/root/btrfs-toplevel" +TOPLEVEL="/root/btrfs-toplevel" + +## You should create a subvolume for snapshots. Snapsh will do this +## automatically, define the subvolume here. It is recommended +## to have the subvolume directly under the btrfs root (id=5) +## Use the full path +## Default: "/root/" +SNAPSHOTS_LOCATION="/root/btrfs-toplevel/snapshots" + +## Timestamp format. See 'date --help' for formatting options. +## This will only be used for the name of the snapshot (=subvolume) +## created. E.g. with default setting snapshots will be created as +## "/root/btrfs-toplevel/snapshots/root_snapshot_2020_07_31-01.59.23" +## Default: $(date +%Y.%m.%d-%H.%M.%S) +TIMESTAMP="$(date +%Y.%m.%d-%H.%M.%S)" + + + +## Experimental: +## Define the list of subvolumes to be handled by snapsh here. +## Defaut: (root home) +SUBVOLUMES=(root home) \ No newline at end of file