[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

duplicity in 90fallback and possible fixes

I have ubuntu 20.04.x on /dev/sda2, have grub installed there,
gentoo on /dev/sda4, kernel in /boot/vmlinuz there.

During the run of update-grub, gentoo is found twice.

Which is due to lines 15,16 in

-the most recent version available at-

for kernpat in /vmlinuz /vmlinux /boot/vmlinuz /boot/vmlinux "/boot/vmlinuz*" \
	        "/boot/vmlinux*" "/vmlinuz*" "/vmlinux*" "/kernel-*" "/boot/kernel-*"; do

I see two possible ways to fix this
1. "add four question signs on the proper places"
for kernpat in /vmlinuz /vmlinux /boot/vmlinuz /boot/vmlinux "/boot/vmlinuz?*" \
	        "/boot/vmlinux?*" "/vmlinuz?*" "/vmlinux?*" "/kernel-*" "/boot/kernel-*"; do

this leaves the original spirit in which the program was written intact,
finalizes the probable intention of the author or authors of this part
of program and is kind of educational at the same time; the program size
grows by 4 bytes

2. "fully rely on asterisks"
for kernpat in "/boot/vmlinuz*" \
	        "/boot/vmlinux*" "/vmlinuz*" "/vmlinux*" "/kernel-*" "/boot/kernel-*"; do

this achieves the same functional result as 1. The historical
locations of kernel in the filesystem - /vmlinuz, /vmlinux - are
somehow lost with this fix, the script length is reduced by some
20 or so bytes with the above change.

3. "fully rely on asterisks and join the two lines"
for kernpat in "/boot/vmlinuz*" "/boot/vmlinux*" "/vmlinuz*" "/vmlinux*" "/kernel-*" "/boot/kernel-*"; do

this shifts the line numbering in the rest of the program by one
in addition to what is written in 2

4. "rebalance the lines and put the asterisk variant in the order I prefer"
for kernpat in "/vmlinux*" "/vmlinuz*" "/boot/vmlinux*" "/boot/vmlinuz*" \
	        "/kernel-*" "/boot/kernel-*"; do

4 seems to be the best option.

Reply to: