Skip to content

Commit

Permalink
configure: add --enable-ntp
Browse files Browse the repository at this point in the history
It just uncomments the option to request ntp_servers in dhcpcd.conf.
Fixes #331.
  • Loading branch information
rsmarples committed Jun 15, 2024
1 parent a15ba19 commit 127c0b7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
7 changes: 7 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ STATIC=
DEVS=
EMBEDDED=
AUTH=
NTP=
POLL=
SMALL=
SANITIZE=no
Expand Down Expand Up @@ -74,6 +75,8 @@ for x do
--enable-privsep) PRIVSEP=yes;;
--disable-seccomp) SECCOMP=no;;
--enable-seccomp) SECCOMP=yes;;
--disable-ntp) NTP=no;;
--enable-ntp) NTP=yes;;
--privsepuser) PRIVSEP_USER=$var;;
--prefix) PREFIX=$var;prefix=$var;; # prefix is set for autotools compat
--sysconfdir) SYSCONFDIR=$var;;
Expand Down Expand Up @@ -1943,6 +1946,10 @@ if ! $HOOKSET; then
fi
fi
fi
if [ "$NTP" = yes ]; then
# --enable-ntp
echo "UNCOMMENT_NTP= yes" >>$CONFIG_MK
fi

echo >>$CONFIG_H
echo "#endif /*CONFIG_H*/">>$CONFIG_H
Expand Down
10 changes: 8 additions & 2 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,14 @@ _maninstall: ${MAN5} ${MAN8}
_confinstall:
${INSTALL} -d ${DESTDIR}${SYSCONFDIR}
# Install a new default config if not present
test -e ${DESTDIR}${SYSCONFDIR}/dhcpcd.conf || \
${INSTALL} -m ${CONFMODE} dhcpcd.conf ${DESTDIR}${SYSCONFDIR}
if ! [ -e ${DESTDIR}${SYSCONFDIR}/dhcpcd.conf ]; then \
${INSTALL} -m ${CONFMODE} dhcpcd.conf ${DESTDIR}${SYSCONFDIR}; \
if [ "${UNCOMMENT_NTP}" = yes ]; then \
${SED} -i \
-e 's/#option ntp_servers/option ntp_servers/' \
${DESTDIR}/${SYSCONFDIR}/dhcpcd.conf; \
fi; \
fi

eginstall:

Expand Down

2 comments on commit 127c0b7

@perkelix
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honnestly, this commit really doesn't solve anything. Configure already includes the NTP or timesyncd hook if the correspoding binary is found at build time but, without the corresponding option commented out, we're not doing anything with the hook. If the key concern is BSD, at least auto-uncommenting for timesyncd would be desirable.

@rsmarples
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So there are two issues here. Firstly is which NTP hook do we want to install and secondly even if a hook is installed should we enable the option to request ntp servers by default?
You can already control which hooks are installed using configure so the last step is controlling the un-commenting the default value.

Please sign in to comment.