Sorry to bother you again.
As was discussed in other threads, as I learned from @dalto that to be sure Grub will work properly I better use “hook” and not a script as I did (thought the script luckily worked for me), but I am always seeking the best.
After reading:
- Once installed, what do the EndeavourOS packages offer over bare Arch?
- Once installed, what do the EndeavourOS packages offer over bare Arch? - #44 by otherbarry
- Arch Wiki about hooks
- https://man.archlinux.org/man/alpm-hooks.5
I found that I have:
/etc/pacman.d/hooks/
empty folder.
/usr/share/libalpm/hooks/
has many “.hook” files including:
eos-grub-fix-initrd-generation.hook
eos-grub-update-after-kernel.hook
zz-snap-pac-grub-post.hook
So, according to my humble understanding I created a file called it grub_update.hook
that ‘supposedly’ runs grub-install
and grub-mkconfig -o /boot/grub/grub.cfg
if grub gets updated,…
The hook file grub_update.hook
is as follows:
[Trigger]
Operation = Install
Operation = Remove
Operation = Upgrade
Type = Package
Target = grub
[Action]
Description = Re-generate Grub if Updated
When = PostTransaction
Depends = grub
Exec = /bin/sh -c "/usr/bin/grub-install"
Exec = /bin/sh -c "/usr/bin/grub-mkconfig -o /boot/grub/grub.cfg"
I am on KDE Plasma, SSD, BTRFS, Snapper, BTRFS-Assistant, … just followed defaults during online installation.
Should I just copy this file to folder /usr/share/libalpm/hooks/
then restart so I am sure whenever Grub gets updated things will be fine?
Should I put sudo after “Exec =” (last 2 lines in file)?
As usual when it is something that critical I prefer to consult the experts instead of taking the risk of having unbootable system.
I appreciate your patience and support.
Is this OK and I can proceed copying the file to folder /usr/share/libalpm/hooks/
?