Skip to content

Commit

Permalink
Improve support for snap paths starting with .btrfs/... in case of ha…
Browse files Browse the repository at this point in the history
…ving some BTRFS volume mounted and named / only.
  • Loading branch information
AM-SoFT Support authored and ams-tschoening committed Oct 31, 2022
1 parent 701158e commit f02124b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions btrfs-auto-snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -570,8 +570,8 @@ btrfs_snaps_rm_if()
# it's somewhat safe to remove based on conventions.
snaps="$(btrfs subvolume list -g -o -s --sort=gen "${i}")"
paths="$(echo "${snaps}" | sort -r -n -k 4 | awk '{print $NF}')"
paths="$(echo "${paths}" | sed "\#/${DEF_SNAPS_DIR}/#!d")"
paths="$(echo "${paths}" | sed -r "s!^.+/${DEF_SNAPS_DIR}/!${i}/${DEF_SNAPS_DIR}/!")"
paths="$(echo "${paths}" | sed -r "\#/?${DEF_SNAPS_DIR}/#!d")"
paths="$(echo "${paths}" | sed -r "s!^(.+/)?${DEF_SNAPS_DIR}/!${i}/${DEF_SNAPS_DIR}/!")"
paths="$(echo "${paths}" | sed -r "s!^//${DEF_SNAPS_DIR}/!/${DEF_SNAPS_DIR}/!")"
paths="$(echo "${paths}" | sed -r "\#/${DEF_SNAPS_DIR}/${snap_patt}#!d")"
paths="$(echo "${paths}" | tail -n "+$((keep + 1))")"
Expand Down

0 comments on commit f02124b

Please sign in to comment.