----- On May 5, 2022, at 7:02 PM, Oskari Pirhonen xxc3ncore...@gmail.com wrote:
> On Thu, May 05, 2022 at 10:24:56AM -0400, Mathieu Desnoyers wrote: [...] > > Instead of creating a separate function, would it be better to let > `version_sort()` accept an argument/set of arguments? > >> + >> version_test_numeric () >> { >> version_test_numeric_a="$1" >> diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in >> index ca068038e..8178318f5 100644 >> --- a/util/grub.d/10_linux.in >> +++ b/util/grub.d/10_linux.in >> @@ -195,9 +195,15 @@ title_correction_code= >> # yet, so it's empty. In a submenu it will be equal to '\t' (one tab). >> submenu_indentation="" >> >> +# Perform a reverse version sort on the entire list. >> +# Temporarily replace the '.old' suffix by ' 1' and append ' 2' for all >> +# other files to order the '.old' files after their non-old counterpart >> +# in reverse-sorted order. >> + >> +reverse_sorted_list=$(echo $list | tr ' ' '\n' | sed -e 's/\.old$/ 1/' -e '/ >> 1$/! s/$/ 2/' | version_reverse_sort | sed -e 's/ 1$/.old/' -e 's/ 2$//') > > That way you could do something like this instead: > > ... | version_sort -r | ... > > - Oskari > Done (for next version of patch), Thanks! Mathieu >> + >> is_top_level=true >> -while [ "x$list" != "x" ] ; do >> - linux=`version_find_latest $list` >> +for linux in $reverse_sorted_list; do >> gettext_printf "Found linux image: %s\n" "$linux" >&2 >> basename=`basename $linux` >> dirname=`dirname $linux` >> @@ -293,8 +299,6 @@ while [ "x$list" != "x" ] ; do >> linux_entry "${OS}" "${version}" recovery \ >> "${GRUB_CMDLINE_LINUX_RECOVERY} ${GRUB_CMDLINE_LINUX}" >> fi >> - >> - list=`echo $list | tr ' ' '\n' | fgrep -vx "$linux" | tr '\n' ' '` >> done >> >> # If at least one kernel was found, then we need to >> -- >> 2.30.2 >> >> >> _______________________________________________ >> Grub-devel mailing list >> Grub-devel@gnu.org >> https://lists.gnu.org/mailman/listinfo/grub-devel > > _______________________________________________ > Grub-devel mailing list > Grub-devel@gnu.org > https://lists.gnu.org/mailman/listinfo/grub-devel -- Mathieu Desnoyers EfficiOS Inc. http://www.efficios.com _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel