When
.Nm
runs, it loads
-.Pa @SYSCONFDIR@/dhcpcd.enter-hook ,
+.Pa @SYSCONFDIR@/dhcpcd/enter-hook ,
any scripts found in
+.Pa @SYSCONFDIR@/dhcpcd/enter-hooks.d ,
+in lexical order, any scripts found in
.Pa @HOOKDIR@
-in lexical order, then finally
-.Pa @SYSCONFDIR@/dhcpcd.exit-hook .
+in lexical order, any scripts found in
+.Pa @SYSCONFDIR@/dhcpcd/exit-hooks.d .
+in lexical order, and then finally
+.Pa @SYSCONFDIR@/dhcpcd/exit-hook .
.Sh SEE ALSO
.Xr dhcpcd 8
.Sh AUTHORS
# /etc/resolv.conf how they want and stop the system scripts ever updating it.
for hook in \
@SYSCONFDIR@/dhcpcd.enter-hook \
+ @SYSCONFDIR@/dhcpcd/enter-hook \
+ @SYSCONFDIR@/dhcpcd/enter-hooks.d/* \
@HOOKDIR@/* \
+ @SYSCONFDIR@/dhcpcd/exit-hooks.d/*
+ @SYSCONFDIR@/dhcpcd/exit-hook
@SYSCONFDIR@/dhcpcd.exit-hook
do
case "$hook" in
${INSTALL} -m ${MANMODE} ${MAN8} ${DESTDIR}${MANDIR}/man8
_confinstall:
- ${INSTALL} -d ${DESTDIR}${SYSCONFDIR}
+ ${INSTALL} -d ${DESTDIR}${SYSCONFDIR}/dhcpcd
+ # Copy existig config to new location if not present
+ if ! [ -e ${DESTDIR}${SYSCONFDIR}/dhcpcd/dhcpcd.conf ] && \
+ [ -e ${DESTDIR}${SYSCONFDIR}/dhcpcd.conf ]; then \
+ mv ${DESTDIR}${SYSCONFDIR}/dhcpcd.conf \
+ ${DESTDIR}${SYSCONFDIR}/dhcpcd; \
+ fi
# Install a new default config if not present
- if ! [ -e ${DESTDIR}${SYSCONFDIR}/dhcpcd.conf ]; then \
- ${INSTALL} -m ${CONFMODE} dhcpcd.conf ${DESTDIR}${SYSCONFDIR}; \
+ if ! [ -e ${DESTDIR}${SYSCONFDIR}/dhcpcd/dhcpcd.conf ]; then \
+ ${INSTALL} -m ${CONFMODE} dhcpcd.conf \
+ ${DESTDIR}${SYSCONFDIR}/dhcpcd; \
if [ "${UNCOMMENT_NTP}" = yes ]; then \
${SED} -i \
-e 's/#option ntp_servers/option ntp_servers/' \
- ${DESTDIR}/${SYSCONFDIR}/dhcpcd.conf; \
+ ${DESTDIR}/${SYSCONFDIR}/dhcpcd/dhcpcd.conf; \
fi; \
fi
#endif
#ifndef CONFIG
-# define CONFIG SYSCONFDIR "/" PACKAGE ".conf"
+# define CONFIG SYSCONFDIR "/" PACKAGE "/" PACKAGE ".conf"
+#endif
+#ifndef CONFIG_OLD
+# define CONFIG_OLD SYSCONFDIR "/" PACKAGE ".conf"
#endif
#ifndef SCRIPT
# define SCRIPT LIBEXECDIR "/" PACKAGE "-run-hooks"
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd May 8, 2025
+.Dd June 16, 2025
.Dt DHCPCD 8
.Os
.Sh NAME
be listed in
.Fl Fl allowinterfaces
or have an interface directive in
-.Pa @SYSCONFDIR@/dhcpcd.conf .
+.Pa @SYSCONFDIR@/dhcpcd/dhcpcd.conf .
.Ss Hooking into events
.Nm
runs
.Li RFC 1035 .
.It Fl f , Fl Fl config Ar file
Specify a config to load instead of
-.Pa @SYSCONFDIR@/dhcpcd.conf .
+.Pa @SYSCONFDIR@/dhcpcd/dhcpcd.conf .
.Nm
always processes the config file before any command line options.
.It Fl h , Fl Fl hostname Ar hostname
accordingly.
.Sh FILES
.Bl -ohang
-.It Pa @SYSCONFDIR@/dhcpcd.conf
+.It Pa @SYSCONFDIR@/dhcpcd/dhcpcd.conf
Configuration file for dhcpcd.
If you always use the same options, put them here.
+.It Pa @SYSCONFDIR@/dhcpcd.conf
+Old configuration file for dhcpcd used if one in the new location does not exist.
.It Pa @SCRIPT@
Bourne shell script that is run to configure or de-configure an interface.
.It Pa @LIBDIR@/dhcpcd/dev
/* Parse our options file */
buflen = dhcp_readfile(ctx, ctx->cffile, buf, sizeof(buf));
+ /* If we can't find the config file in the new location,
+ * retry the old location. */
+ if (buflen == -1 && errno == ENOENT &&
+ strcmp(ctx->cffile, CONFIG) == 0)
+ {
+ const int olderrno = errno;
+ buflen = dhcp_readfile(ctx, CONFIG_OLD, buf, sizeof(buf));
+ errno = olderrno;
+ }
+
if (buflen == -1) {
/* dhcpcd can continue without it, but no DNS options
* would be requested ... */