NetworkConfiguration / dhcpcd

DHCP / IPv4LL / IPv6RA / DHCPv6 client.
https://roy.marples.name/projects/dhcpcd
BSD 2-Clause "Simplified" License
347 stars 111 forks source link

Offer --non-* options #275

Open jidanni opened 10 months ago

jidanni commented 10 months ago

man page says

dhcpcd always processes the config file before any command line options.

OK, then please also e.g., a --non-persistent command line option, to override any persistent found in the config file, in case we don't want to replace that file.

Same with other options.

Also allow non- options in the config file.

rsmarples commented 10 months ago

You can use dhcpcd -k which will remove configuration and stop dhcpcd which has the same effect.

Is this not sufficient? I would also like to understand why you don't want to change the supplied config file?

jidanni commented 10 months ago

I want to start it, not stop it.

On Debian I have installed the minimal dhcpcd-base package. It comes with /etc/dhcpcd.conf . In that file there are some lines I wish to override. But there is no way to override them from the command line. That means I must modify /etc/dhcpcd.conf and start maintaining my own version. I could avoid having to do that if I could override just one little line from it via the command line.

OK, I have come up with a hack.

Dcf=/tmp/dhcpcd.conf
sed '/persistent/s/^/#JIDANNI off /' /etc/dhcpcd.conf > $Dcf
dhcpcd --config $Dcf ...

all because there was no way to override that line via the command line.

Never mind 'persistent' or not. It is just an example of a line in /etc/dhcpcd.conf that cannot be overridden from the command line.

rsmarples commented 10 months ago

OK. So the persistence only occurs when dhcpcd is stopping or exiting. If the persistent option is there then dhcpcd will keep configuration active. If it's not or dhcpcd is stopped by the -k flag or SIGALRM then the configuration is removed from the interface.

Everything in the stock config can be overridden on the command line because you use the command line to stop dhcpcd.

jidanni commented 10 months ago

I am just saying, with things like persistence, one can turn them on via the command line, but one cannot turn them off via the command line.

Never mind that I mentioned the persistence option. It could be any option.

I'm talking about when I want to start dhcpcd. Not when I want to stop it.