mirror of
https://git.sr.ht/~magic_rb/dotfiles
synced 2024-11-22 08:04:20 +01:00
Support changing the number of datasets to keep in rolling_datasets
Signed-off-by: magic_rb <richard@brezak.sk>
This commit is contained in:
parent
85db381a7e
commit
52a6d7d312
|
@ -8,6 +8,7 @@ if [[ "$#" != 3 ]] ; then
|
|||
fi
|
||||
|
||||
dataset="$1"
|
||||
to_keep="$2"
|
||||
|
||||
generation="$(zfs get :generation "$dataset" -H -o value)"
|
||||
generation="$(("$generation" + 1))"
|
||||
|
@ -18,8 +19,8 @@ zfs rollback "$dataset@blank" && echo "rollback complete"
|
|||
|
||||
while IFS="\n" read gen
|
||||
do
|
||||
printf "$gen < $(("$generation" - 10)) => "
|
||||
if [ "$gen" -lt "$(("$generation" - 10))" ]; then
|
||||
printf "$gen < $(("$generation" - "$to_keep")) => "
|
||||
if [ "$gen" -lt "$(("$generation" - "$to_keep"))" ]; then
|
||||
zfs destroy -r "$dataset/$gen"
|
||||
echo "destroyed"
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue