mirror of
https://github.com/Antynea/grub-btrfs.git
synced 2026-10-20 02:42:03 +08:00
Modify the function which is used to ignore a path. (#112)
Modify the function which is used to ignore a path. @ shouldn't be hardcoded. Create 2 separate functions to ignore a specific path or prefix path. In specific path, only exact paths are ignored. In prefix path, any path starting with the specified string will be ignored. e.g : if specific path = @, only @ snapshot will be ignored. if prefix path = @, all snapshots beginning with "@/..." will be ignored.
This commit is contained in:
+8
-2
@@ -80,6 +80,8 @@ show_snap_found=${GRUB_BTRFS_SHOW_SNAPSHOTS_FOUND:-"true"}
|
||||
show_total_snap_found=${GRUB_BTRFS_SHOW_TOTAL_SNAPSHOTS_FOUND:-"true"}
|
||||
## Ignore specific path during run "grub-mkconfig"
|
||||
ignore_specific_path=("${GRUB_BTRFS_IGNORE_SPECIFIC_PATH[@]}")
|
||||
## Ignore prefix path during run "grub-mkconfig"
|
||||
ignore_prefix_path=("${GRUB_BTRFS_IGNORE_PREFIX_PATH[@]}")
|
||||
## Snapper's config name
|
||||
snapper_config=${GRUB_BTRFS_SNAPPER_CONFIG:-"root"}
|
||||
## Override boot partition detection
|
||||
@@ -267,9 +269,13 @@ snapshot_list()
|
||||
|
||||
# ignore specific path during run "grub-mkconfig"
|
||||
if [ ! -z "${ignore_specific_path}" ] ; then
|
||||
[[ "${snap_path_name}" == "@" ]] && continue 2;
|
||||
for isp in ${ignore_specific_path[@]} ; do
|
||||
[[ "${snap_path_name}" == "${isp}" || "${snap_path_name}" == "${isp}"/* ]] && continue 2;
|
||||
[[ "${snap_path_name}" == "${isp}" ]] && continue 2;
|
||||
done
|
||||
fi
|
||||
if [ ! -z "${ignore_prefix_path}" ] ; then
|
||||
for isp in ${ignore_prefix_path[@]} ; do
|
||||
[[ "${snap_path_name}" == "${isp}"/* ]] && continue 2;
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user