Fix manual snapshots not used

This commit is contained in:
Tibo De Peuter 2024-02-06 16:01:32 +01:00
parent 0578879c54
commit 6b4daed099

View file

@ -111,7 +111,7 @@ fi
# Working snapshots # Working snapshots
# Find snapshots # Find snapshots
snapshots="$( find "/mnt/${dataset}/.zfs/snapshot"/* -maxdepth 0 -name 'auto*' -type d | sed -E 's/.*-([0-9]{4}-[0-9]{2}-[0-9]{2}_[0-9]{2}-[0-9]{2})/\1\t&/' | sort -n | cut -f 2- | xargs -n1 basename )" snapshots="$( find "/mnt/${dataset}/.zfs/snapshot"/* -maxdepth 0 -type d | sed -E 's/.*-([0-9]{4}-[0-9]{2}-[0-9]{2}_[0-9]{2}-[0-9]{2})/\1\t&/' | sort -n | cut -f 2- | xargs -n1 basename )"
# Use the two latest snapshots # Use the two latest snapshots
from_snapshot="$( tail -n2 <<< "${snapshots}" | head -n1 )" from_snapshot="$( tail -n2 <<< "${snapshots}" | head -n1 )"
to_snapshot="$( tail -n2 <<< "${snapshots}" | tail -n1 )" to_snapshot="$( tail -n2 <<< "${snapshots}" | tail -n1 )"