kiss-stj

My KISS Linux repo for software I use on my computers.
git clone https://git.stjo.hn/kiss-stj
Log | Files | Refs | README | LICENSE

commit 052421cee8a82691972bd2b8472a47de92460f20
parent adbefe9da346d03eb1e5493b39716ed1537c93ed
Author: St John Karp <contact@stjo.hn>
Date:   Thu, 21 Jul 2022 08:13:20 -0400

svc: Revert back to the original script for openntpd

I also made a modification that tries to ensure ntpd isn't actually
launched until there's an internet connection. Otherwise it tends
to stick and, depending on timing, you're stuck with the wrong time
until you manually restart the service.

Diffstat:
Mcore/svc/build | 8+++++---
1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/core/svc/build b/core/svc/build @@ -6,12 +6,17 @@ find . -type f -exec grep -l '/bin/' {} \+ | sed 's|/bin/|/usr/bin/|g' "$file" > _ mv -f _ "$file" done + # pgrep works better than pidof, especially when a daemon has # forked to the background. Neither is POSIX, so I don't suppose it matters. sed 's/pidof -o %PPID \$BIN/pgrep ^\$SERVICE\$/' svc.d/bare.sh > _ mv -f _ svc.d/bare.sh chmod +x svc.d/bare.sh +# Don't start ntpd until the network is up. +sed "s/if \[ -z \"\$PID\" \]/if [ -z \"\$PID\" ] \&\& (route | tail -n 1 | tr -s ' ' | cut -f 4 -d ' ' | grep -q U)/" svc.d/avail/ntpd > _ +mv -f _ svc.d/avail/ntpd + install -m 755 -D bin/service "$1/usr/bin/service" install -m 755 -D bin/svc "$1/usr/bin/svc" cp -r svc.d "$1/usr/bin/svc.d" @@ -21,9 +26,6 @@ cp -r svc.d "$1/usr/bin/svc.d" rm "$1/usr/bin/svc.d/default/crond" touch "$1/usr/bin/svc.d/avail/dhcpcd" install -D nldev "$1/usr/bin/svc.d/avail/nldev" -# Replace the custom script with defaults. -rm "$1/usr/bin/svc.d/avail/ntpd" "$1/usr/bin/svc.d/default/ntpd" -touch "$1/usr/bin/svc.d/avail/ntpd" touch "$1/usr/bin/svc.d/avail/pcscd" touch "$1/usr/bin/svc.d/avail/sdhcp" touch "$1/usr/bin/svc.d/avail/seatd"