-
Notifications
You must be signed in to change notification settings - Fork 144
Enable ntp if autodetect ntpd or timesyncd #597
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
7ce500c
b33ce6a
5b5a103
5f15761
2373511
aede596
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -39,6 +39,9 @@ SMALL= | |
| SANITIZE=no | ||
| STATUSARG= | ||
| OPENSSL= | ||
| NTPD= | ||
| CHRONYD= | ||
| TIMESYNCD= | ||
|
|
||
| DHCPCD_DEFS=dhcpcd-definitions.conf | ||
|
|
||
|
|
@@ -77,6 +80,10 @@ for x do | |
| --enable-seccomp) SECCOMP=yes;; | ||
| --disable-ntp) NTP=no;; | ||
| --enable-ntp) NTP=yes;; | ||
| --disable-ntpd) NTPD=no;; | ||
| --enable-ntpd) NTPD=yes; NTP=yes;; | ||
| --disable-timesyncd) TIMESYNCD=no;; | ||
| --enable-timesyncd) TIMESYNCD=yes; NTP=yes;; | ||
| --privsepuser) PRIVSEP_USER=$var;; | ||
| --prefix) PREFIX=$var;prefix=$var;; # prefix is set for autotools compat | ||
| --sysconfdir) SYSCONFDIR=$var;; | ||
|
|
@@ -1698,41 +1705,68 @@ echo "STATUSARG= $STATUSARG" >>config.mk | |
|
|
||
| HOOKS= | ||
| if ! $HOOKSET; then | ||
| printf "Checking for ntpd ... " | ||
| NTPD=$(_which ntpd) | ||
| if [ -n "$NTPD" ]; then | ||
| echo "$NTPD (50-ntp.conf)" | ||
| else | ||
| echo "not found" | ||
| fi | ||
| printf "Checking for chronyd ... " | ||
| CHRONYD=$(_which chronyd) | ||
| if [ -n "$CHRONYD" ]; then | ||
| echo "$CHRONYD (50-ntp.conf)" | ||
| else | ||
| echo "not found" | ||
| fi | ||
| if [ -n "$NTPD" ] || [ -n "$CHRONYD" ]; then | ||
| HOOKS="$HOOKS${HOOKS:+ }50-ntp.conf" | ||
| fi | ||
| # Warn if both are detected | ||
| if [ -n "$NTPD" ] && [ -n "$CHRONYD" ]; then | ||
| echo "NTP will default to $NTPD" | ||
| fi | ||
| if ! [ "$NTP" = "no" ]; then | ||
| printf "Checking for ntpd ... " | ||
| if [ -z "$NTPD" ]; then | ||
| # if not explicitly set enable/disable, try to autodetect | ||
|
|
||
| NTPD_PATH=$(_which ntpd) | ||
| if [ -n "$NTPD_PATH" ]; then | ||
| NTPD=yes | ||
| NTP=yes | ||
| echo "$NTPD_PATH (Selecting 50-ntp.conf)" | ||
| else | ||
| echo "not found" | ||
| fi | ||
| printf "Checking for chronyd ... " | ||
| CHRONYD_PATH=$(_which chronyd) | ||
| if [ -n "$CHRONYD_PATH" ]; then | ||
| NTPD=yes | ||
| NTP=yes | ||
| echo "$CHRONYD_PATH (Selecting 50-ntp.conf)" | ||
| else | ||
| echo "not found" | ||
| fi | ||
|
|
||
| # Warn if both are detected | ||
| if [ -n "$NTPD_PATH" ] && [ -n "$CHRONYD_PATH" ]; then | ||
| echo "NTP will default to $NTPD_PATH" | ||
| fi | ||
| elif [ "$NTPD" = "no" ]; then | ||
| echo "skipped" | ||
| else | ||
| echo "selected via --enable-ntpd (Selecting 50-ntp.conf)" | ||
| fi | ||
|
|
||
| printf "Checking for timesyncd ... " | ||
| TIMESYNCD= | ||
| for x in /usr/lib/systemd/systemd-timesyncd; do | ||
| if [ -x "$x" ]; then | ||
| TIMESYNCD=$x | ||
| break | ||
| printf "Checking for timesyncd ... " | ||
| if [ -z "$TIMESYNCD" ]; then | ||
| TIMESYNCD_PATH= | ||
| for x in /usr/lib/systemd/systemd-timesyncd; do | ||
| if [ -x "$x" ]; then | ||
| TIMESYNCD=yes | ||
| TIMESYNCD_PATH=$x | ||
| NTP=yes | ||
| break | ||
| fi | ||
|
Comment on lines
+1742
to
+1750
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Check the same timesyncd path that the shipped hook uses. The autodetect loop only probes Proposed fix- for x in /usr/lib/systemd/systemd-timesyncd; do
+ for x in /lib/systemd/systemd-timesyncd \
+ /usr/lib/systemd/systemd-timesyncd; do🤖 Prompt for AI Agents
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should update the timesyncd.conf as well, have it check both paths. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chainGood idea! Let me check the current content of 🏁 Script executed: Length of output: 1505
1. - for x in /usr/lib/systemd/systemd-timesyncd; do
+ for x in /lib/systemd/systemd-timesyncd \
+ /usr/lib/systemd/systemd-timesyncd; do2. -if [ ! -x /lib/systemd/systemd-timesyncd ]; then
- return
-fi
+if [ ! -x /lib/systemd/systemd-timesyncd ] && \
+ [ ! -x /usr/lib/systemd/systemd-timesyncd ]; then
+ return
+fiThis keeps |
||
| done | ||
| if [ "$TIMESYNCD" = "yes" ]; then | ||
| echo "$TIMESYNCD_PATH (Selecting 50-timesyncd.conf)" | ||
| else | ||
| echo "not found" | ||
| fi | ||
| elif [ "$TIMESYNCD" = "no" ]; then | ||
| echo "skipped" | ||
| else | ||
| echo "selected via --enable-timesyncd (Selecting 50-timesyncd.conf)" | ||
| fi | ||
|
|
||
| # Choose hook based on enabled time service | ||
| if [ "$NTPD" = "yes" ]; then | ||
| HOOKS="$HOOKS${HOOKS:+ }50-ntp.conf" | ||
| fi | ||
| if [ "$TIMESYNCD" = "yes" ]; then | ||
| HOOKS="$HOOKS${HOOKS:+ }50-timesyncd.conf" | ||
| fi | ||
| done | ||
| if [ -n "$TIMESYNCD" ]; then | ||
| echo "$TIMESYNCD" | ||
| HOOKS="$HOOKS${HOOKS:+ }50-timesyncd.conf" | ||
| else | ||
| echo "not found" | ||
| fi | ||
|
|
||
| printf "Checking for ypbind ... " | ||
|
|
@@ -1790,9 +1824,19 @@ if ! $HOOKSET; then | |
| fi | ||
| fi | ||
| fi | ||
| if [ "$NTP" = yes ]; then | ||
| # --enable-ntp | ||
|
|
||
| if [ -z "$NTP" ]; then | ||
| if [ "$NTPD" = "yes" ] || [ "$TIMESYNCD" = "yes" ]; then | ||
| NTP=yes | ||
| fi | ||
| fi | ||
| if [ "$NTP" = "yes" ]; then | ||
| # --enable-ntp or ntp/timesyncd service was autodetected | ||
| echo "Enabling NTP support" | ||
| echo "UNCOMMENT_NTP= yes" >>$CONFIG_MK | ||
| else | ||
| # --disable-ntp | ||
| echo "NTP support is disabled" | ||
| fi | ||
|
|
||
| echo >>$CONFIG_H | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.