In /usr/sbin/mkboot grubcheck(), grub is tested for by the line: [ "$(qpkg -nc sys-apps/grub)" = "sys-apps/grub *" ] This is a big time-waster, because it crawls the entire portage tree. If your portage tree is mounted via NFS, this is painful... A better solution is: [ "$(qpkg -I -nc sys-apps/grub)" = "sys-apps/grub" ] An updated version of debianutils-1.16.7-gentoo.patch will be attached. Reproducible: Always Steps to Reproduce: 1. Use mkboot, usually via kernel's make install 2. 3. Actual Results: It finds grub (slowly) Expected Results: Find grub (quickly)
Created attachment 14976 [details, diff] Make mkboot not read the whole portage tree This is a modified version of debianutils-1.16.7-gentoo.patch in the current portage tree which makes the grubcheck() function of mkboot much faster.
I bumped up against this but in a worse form - It's not just slow, it doesn't work. The line [ "$(qpkg -I -nc sys-apps/grub)" = "sys-apps/grub" ] Fails to detect my grub because I also have grub-static installed, which causes qpkg to return sys-apps/grub * sys-apps/grub-static which fails the test.
Quick correction - I typoed [ "$(qpkg -nc sys-apps/grub)" = "sys-apps/grub *" ] Is the line that doesn't work [ "$(qpkg -I -nc sys-apps/grub)" = "sys-apps/grub" ] does work.
if [ -x /usr/bin/qpkg ] ; then [ "$(qpkg -I -nc sys-apps/grub)" = "sys-apps/grub" ] else return 1 fi This never returns zero! At least it should be: if [ -x /usr/bin/qpkg ] ; then [ "$(qpkg -I -nc sys-apps/grub)" = "sys-apps/grub" ] && return 0 else return 1 fi But it cannot fail just because gentoolkit is not installed, and there's the grub-static problem... Summing up, why don't we simply have if [ -f /boot/grub/grub.conf ] ; then return 0 else return 1 fi
As /boot might not be mounted ...
Anyhow, use portageq and not quickpkg.