You are not logged in.
Is there a way to check the sequence of hooks located in /etc/pacman.d/hooks and /usr/share/libalpm/hooks without executing pacman?
I tried to sort the files and this is almost the exact sequence pacman uses:
(ls -1 /etc/pacman.d/hooks && ls -1 /usr/share/libalpm/hooks) | sort
00-prevent-interruption-pre.hook
05-etckeeper-pre-install.hook
05-snap-pac-a-pre-config-sys.hook
05-snap-pac-pre.hook
10-snap-pac-removal.hook
20-systemd-sysusers.hook
30-systemd-binfmt.hook
30-systemd-catalog.hook
30-systemd-daemon-reload.hook
30-systemd-hwdb.hook
30-systemd-sysctl.hook
30-systemd-tmpfiles.hook
30-systemd-udev-reload.hook
30-systemd-update.hook
30-update-mime-database.hook
40-fontconfig-config.hook
40-update-ca-trust.hook
60-depmod.hook
60-mkinitcpio-remove.hook
70-dkms-install.hook
70-dkms-upgrade.hook
71-dkms-remove.hook
90-mkinitcpio-install.hook
dbus-reload.hook
dconf-update.hook
detect-old-perl-modules.hook
firejail-update.hook
fontconfig-32.hook
fontconfig.hook
gconf-install.hook
gconf-remove.hook
gdk-pixbuf-query-loaders.hook
gdm-theme.hook
ghc-register.hook
ghc-unregister.hook
gio-querymodules-32.hook
gio-querymodules.hook
glib-compile-schemas.hook
grub-update.hook
gtk4-querymodules.hook
gtk-query-immodules-2.0.hook
gtk-query-immodules-3.0.hook
gtk-update-icon-cache.hook
gvfsd.hook
link-running-kernel-modules.hook
mirrorupgrade.hook
paccache-old.hook
paccache-uninstalled.hook
pkgfile-db-refresh.hook
save-packages.hook
texinfo-install.hook
texinfo-remove.hook
unbound-trusted-key.hook
update-desktop-database.hook
update-vlc-plugin-cache.hook
vimdoc.hook
vivaldi-upgrade.hook
xorg-mkfontscale.hook
zz_snap-pac-grub-post.hook
zz-snap-pac-post.hook
zz-snap-pac-postz-config-sys.hook
zzz-etckeeper-post-install.hook
zzz-prevent-interruption-post.hook
However, I had to rename zz_snap-pac-grub-post.hook to zz-snap-pac-grub-post.hook. If I use _ then it won't be executed before zz-snap-pac-post.hook:
...
update-vlc-plugin-cache.hook
vimdoc.hook
vivaldi-upgrade.hook
xorg-mkfontscale.hook
zz-snap-pac-grub-post.hook
zz-snap-pac-post.hook
zz-snap-pac-postz-config-sys.hook
zzz-etckeeper-post-install.hook
zzz-prevent-interruption-post.hook
It looks like the sorting is different in the shell compared to the pacman code.
I tried to check the pacman source code, but it's to complicated for me. Maybe someone knows how to do the same sorting in the shell. I would like to be able to list the hooks and rename the hooks if not in proper order instead of executing pacman and making changes to the system.
This is not a bug or an issue. It's just something that bothers me long time because I need to have a few hooks executed before or after other hooks.
Offline
sort -d?
But if you are naming hooks and are authoring multiple that need to work togethre, you should be deliberately swapping out hyphens for underscores seemingly randomly for ordering purposes. It's confusing as hell. Pick a prefix that will be shared between all the hooks that you need to work together, and add a number or other easily and obviously sorted bit after the shared prefix, i.g., <pkgname>_01_do_first, <pkgname>_02_do_second. Don't try to be "creative" alternating between hypens and underscores.
Last edited by Trilby (2022-06-09 16:13:11)
"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" - Richard Stallman
Offline
sort -d generates similar output. The _ is sorted before -, but pacman executes the hook with - first.
The problem is that some of the hooks are provided by (AUR) packages. I need to rename etckeeper and snap-pac-grub hooks. They are using zz_ naming scheme.
Edit: A pacman parameter to show the hook sort order would be nice.
Last edited by zed123 (2022-06-09 16:28:29)
Offline
pacman/libalpm sorting doesn't respect your locale settings (so it's the same for everyone). Try running sort with LC_COLLATE=C.
Offline
I use LC_COLLATE=C and with this setting "_" comes before after "-".
Edit: Jinxed.
Last edited by schard (2022-06-09 18:10:48)
Offline
I use LC_COLLATE=C and with this setting "_" comes before "-".
Edit: Jinxed.
I have the same sort order on my machine if I don't specify LC_COLLATE. The issue is, pacman executes the hook with zz_... after the hook with zz-...
Offline