mirror of
https://git.sr.ht/~magic_rb/dotfiles
synced 2024-11-25 17:46:14 +01:00
Make use of rolling_datasets
on omen
Signed-off-by: magic_rb <richard@brezak.sk>
This commit is contained in:
parent
52a6d7d312
commit
f59ae5dc71
|
@ -81,22 +81,7 @@
|
||||||
unitConfig.DefaultDependencies = "no";
|
unitConfig.DefaultDependencies = "no";
|
||||||
serviceConfig.Type = "oneshot";
|
serviceConfig.Type = "oneshot";
|
||||||
script = ''
|
script = ''
|
||||||
generation="$(zfs get :generation omen-ssd/ephemeral/home -H -o value)"
|
${pkgs.rolling_datasets}/bin/roll_dataset "omen-ssd/ephemeral/home" "10"
|
||||||
dataset="omen-ssd/ephemeral/home"
|
|
||||||
generation="$(("$generation" + 1))"
|
|
||||||
zfs set ":generation=$generation" "$dataset"
|
|
||||||
zfs send "$dataset" | zfs recv "$dataset/$generation"
|
|
||||||
zfs rollback "$dataset@blank" && echo "rollback complete"
|
|
||||||
|
|
||||||
|
|
||||||
while IFS="\n" read gen
|
|
||||||
do
|
|
||||||
echo "$gen < $(("$generation" - 10))"
|
|
||||||
if [ "$gen" -lt "$(("$generation" - 10))" ]; then
|
|
||||||
zfs destroy -r "$dataset/$gen"
|
|
||||||
echo "destroyed "
|
|
||||||
fi
|
|
||||||
done <<< "$(zfs list "omen-ssd/ephemeral/home" -t filesystem -r -H -o name | xargs -I {} ${pkgs.runtimeShell} -c 'echo "$1" | rev | cut -f 1 -d "/" | rev' sh {} | grep -v home)"
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue