fix: use --set N:VAR regexp idiom in hiperiso_boot for portability

The earlier hiperiso_boot function used:

  if regexp '.*/([^/]+)' "$iso_path" ; then
      set hiso_base="$1"
  fi

This relies on GRUB's positional $1..$9 capture groups being
visible inside the if-branch. While it parses, the modsrc's own
grub.cfg uses the explicit --set N:VAR form everywhere (e.g. the
FuryBSD/FreeNAS/TrueNAS regexp blocks); switching to that idiom
keeps hiperiso_boot consistent with the rest of the file and avoids
a class of bugs that would only surface on certain GRUB versions
where positional captures interact differently with control flow.
This commit is contained in:
2026-07-02 01:18:22 +03:00
parent 76fd8e860d
commit 1e6f9fd66f
+6 -5
View File
@@ -2534,12 +2534,13 @@ function hiperiso_boot {
fi
# Derive log_dir from ISO basename. GRUB script has no ${var##*/}
# bash pattern; replicate it with regexp: match ".*/" greedily then
# the final segment. If iso_path has no '/', hiso_base stays as the
# whole path (acceptable fallback).
# bash pattern; replicate it with regexp. Use --set N:VAR syntax
# (the same form the Ventoy modsrc uses elsewhere in this file) so
# the captured group is bound to a named variable in the same scope
# rather than to the positional $1 in the if-statement branch.
set hiso_base="$iso_path"
if regexp '.*/([^/]+)' "$iso_path" ; then
set hiso_base="$1"
if regexp --set 1:hiso_tail '.*/([^/]+)$' "$iso_path" ; then
set hiso_base="$hiso_tail"
fi
set hiso_log_dir="/hiperiso/logs/${hiso_base}/"