feat(script): Introduce dry-run option (#1)

This commit is contained in:
hygienic-books 2023-03-06 00:39:18 +01:00
parent 8fbf16bda0
commit 36cd7ea16d
3 changed files with 4 additions and 1 deletions

View File

@ -21,7 +21,7 @@ Get started like so:
sudo ln -s <repo>/pacman-zfs-snapshot.conf /etc/pacman-zfs-snapshot.conf sudo ln -s <repo>/pacman-zfs-snapshot.conf /etc/pacman-zfs-snapshot.conf
``` ```
Note that while you may choose arbitrary locations for symlinks the `pacman-zfs-snapshot.hook` file references `/usr/local/bin/pacman-zfs-snapshot`. Change that accordingly if you need to. Note that while you may choose arbitrary locations for symlinks the `pacman-zfs-snapshot.hook` file references `/usr/local/bin/pacman-zfs-snapshot`. Change that accordingly if you need to.
1. Adjust `pacman-zfs-snapshot.conf` to your liking 1. Adjust `pacman-zfs-snapshot.conf` to your liking. You may want to set `do_dry_run='true'` for a start and just reinstall a benign package to get a feel for what this hook would do.
1. For datasets you want auto-snapshotted add property `space.quico:auto-snapshot=true` 1. For datasets you want auto-snapshotted add property `space.quico:auto-snapshot=true`
``` ```
zfs set space.quico:auto-snapshot=true zpool/root/archlinux zfs set space.quico:auto-snapshot=true zpool/root/archlinux

View File

@ -1,3 +1,5 @@
do_dry_run='true'
# Pipe-separated list of kernel names. Will be matched against regular # Pipe-separated list of kernel names. Will be matched against regular
# expression ^this_var_here$. Snapshots taken before a pacman transaction on # expression ^this_var_here$. Snapshots taken before a pacman transaction on
# an important package have a separate retention from snapshots for trivial # an important package have a separate retention from snapshots for trivial

View File

@ -16,6 +16,7 @@ if [[ -r "${conf_file}" ]]; then
source "${conf_file}" source "${conf_file}"
fi fi
if [[ ! "${do_dry_run}" ]]; then do_dry_run='true'; fi
if [[ ! "${important_names}" ]]; then important_names='linux'; fi if [[ ! "${important_names}" ]]; then important_names='linux'; fi
if [[ ! "${snaps_trivial_keep}" ]]; then snaps_trivial_keep='5'; fi if [[ ! "${snaps_trivial_keep}" ]]; then snaps_trivial_keep='5'; fi
if [[ ! "${snaps_important_keep}" ]]; then snaps_important_keep='5'; fi if [[ ! "${snaps_important_keep}" ]]; then snaps_important_keep='5'; fi