mirror of
https://github.com/Antynea/grub-btrfs.git
synced 2026-03-04 13:05:00 +08:00
Add filter snapper's snapshot (#158)
- Add filter to ignore snapper's snapshot "type or description" during run "grub-mkconfig"
- Two new variables available in the config file:
# Ignore specific type of snapper's snapshot during run "grub-mkconfig".
# Type = single, pre or post.
# Default: ("")
GRUB_BTRFS_IGNORE_SNAPPER_TYPE=("")
# Ignore specific description of snapper's snapshot during run "grub-mkconfig".
# Default: ("")
GRUB_BTRFS_IGNORE_SNAPPER_DESCRIPTION=("")
This commit is contained in:
@@ -296,6 +296,18 @@ snapshot_list()
|
||||
if [[ "$snapper_id" == "$id" ]]; then
|
||||
local snapper_type=$(trim "${snapper_types[$j]}")
|
||||
local snapper_description=$(trim "${snapper_descriptions[$j]}")
|
||||
|
||||
# ignore snapper_type or snapper_description during run "grub-mkconfig"
|
||||
if [ ! -z "${GRUB_BTRFS_IGNORE_SNAPPER_TYPE}" ] ; then
|
||||
for ist in ${GRUB_BTRFS_IGNORE_SNAPPER_TYPE[@]} ; do
|
||||
[[ "${snapper_type}" == "${ist}" ]] && continue 3;
|
||||
done
|
||||
fi
|
||||
if [ ! -z "${GRUB_BTRFS_IGNORE_SNAPPER_DESCRIPTION}" ] ; then
|
||||
for isd in ${GRUB_BTRFS_IGNORE_SNAPPER_DESCRIPTION[@]} ; do
|
||||
[[ "${snapper_description}" == "${isd}" ]] && continue 3;
|
||||
done
|
||||
fi
|
||||
printf -v entry "%-${max_entry_length}s | %-${max_type_length}s | %s" "$entry" "$snapper_type" "$snapper_description"
|
||||
break
|
||||
fi
|
||||
|
||||
9
config
9
config
@@ -74,6 +74,15 @@ GRUB_BTRFS_IGNORE_SPECIFIC_PATH=("@")
|
||||
# Default: ("var/lib/docker" "@var/lib/docker" "@/var/lib/docker")
|
||||
GRUB_BTRFS_IGNORE_PREFIX_PATH=("var/lib/docker" "@var/lib/docker" "@/var/lib/docker")
|
||||
|
||||
# Ignore specific type of snapper's snapshot during run "grub-mkconfig".
|
||||
# Type = single, pre, post.
|
||||
# Default: ("")
|
||||
GRUB_BTRFS_IGNORE_SNAPPER_TYPE=("")
|
||||
|
||||
# Ignore specific description of snapper's snapshot during run "grub-mkconfig".
|
||||
# Default: ("")
|
||||
GRUB_BTRFS_IGNORE_SNAPPER_DESCRIPTION=("")
|
||||
|
||||
# By default "grub-btrfs" automatically detects your boot partition,
|
||||
# either located at the system root or on a separate partition,
|
||||
# but cannot detect if it is in a subvolume.
|
||||
|
||||
Reference in New Issue
Block a user