Arch Linux

Please read this before reporting a bug:

Do NOT report bugs when a package is just outdated, or it is in Unsupported. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!

FS#60310 - [dhcpcd] Hooks dir should be changed

Attached to Project: Arch Linux
Opened by Kim Scarborough (chowbok) - Thursday, 04 October 2018, 23:27 GMT
Last edited by Doug Newgard (Scimmia) - Thursday, 11 October 2018, 16:27 GMT
Task Type Feature Request
Category Packages: Core
Status Assigned
Assigned To Ronald van Haren (pressh)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 0
Private No


Currently, dhcpcd hook scripts need to be added to /usr/lib/dhcpcd/dhcpcd-hooks/, and also edited there if changes are needed. This doesn't seem to be in keeping with standard Arch practice. Can HOOKDIR be changed in to /etc/dhcpcd-hooks? (Note that you can't just change the libexec location configure argument, as this also controls the location of the dhcpcd-run-hooks.)
This task depends upon

Comment by Kim Scarborough (chowbok) - Thursday, 04 October 2018, 23:28 GMT
"controls the location of the dhcpcd-run-hooks script", I meant to type.
Comment by Doug Newgard (Scimmia) - Monday, 08 October 2018, 06:12 GMT
The man page indicates that /etc/dhcpcd.enter-hook should be used for this.
Comment by Kim Scarborough (chowbok) - Monday, 08 October 2018, 15:44 GMT
That won't work for changing the location of the included hooks, only for defining variables and custom hooks.
Comment by Doug Newgard (Scimmia) - Monday, 08 October 2018, 16:06 GMT
of course it won't work for "changing the location of the included hooks". Nobody suggested that. You can normally override things like this by providing a hook with the same name in /etc. Does that not work?
Comment by Kim Scarborough (chowbok) - Monday, 08 October 2018, 16:49 GMT
No, I don't think that will work, because some hooks have to run before or after particular defined hooks. Right now as it's configured, it runs hook scripts in the following order:


So if you want to run an extra hook, say the wpa_supplicant hook, you have to copy or symlink it to /usr/lib/dhcpcd/dhcpcd-hooks/. It seems to me that we should avoid having to edit things in /usr/lib, and it's pretty easy to redefine the one variable so that the hooks directory is in /etc/dhcpcd-hooks instead.
Comment by Roy Marples (rsmarples) - Saturday, 05 January 2019, 10:47 GMT
You could do this in /etc/dhcpcd.enter-hook

# Run the wpa_supplicant hook
. /usr/lib/dhcpcd/dhcpcd-hooks/10-wpa_supplicant

But really, I only wrote the wpa_supplicant hook because wpa_supplicant didn't have a means of hotplugging interfaces - so I fixed wpa_supplicant.
Starting with wpa_supplicant-2.6 it can be compiled with CONFIG_MATCH_IFACE (no idea if this is enabled in Arch). It can then be started like so:
wpa_supplicant -B -M -c/etc/wpa_supplicant.conf

And voila, wpa_supplicant hot plugs all wireless interfaces from one config file, giving you the same functionality as the dhcpcd hook.