zinit: stabilize ntp/network/getty runtime
Some checks failed
Build Zero OS Initramfs / build (push) Has been cancelled
Build Zero OS Initramfs / test-matrix (qemu, basic) (push) Has been cancelled
Build Zero OS Initramfs / test-matrix (qemu, serial) (push) Has been cancelled

• ntp: robust /etc/ntp.conf symlink, safe defaults, avoid nounset, keep BusyBox CLI -p usage

• network: wrap dhcpcd to create dhcpcd user/group if missing; run as root if needed

• console: set getty console to 115200 vt100
This commit is contained in:
2025-09-08 23:54:14 +02:00
parent 652d38abb1
commit 9aecfe26ac
8 changed files with 38 additions and 11 deletions

View File

@@ -1,10 +1,24 @@
#!/bin/sh
set -e
ntp_flags=$(grep -o 'ntp=.*' /proc/cmdline | sed 's/^ntp=//')
# Ensure /etc/ntp.conf exists for tools/hooks expecting it
if [ -f /etc/ntpd.conf ] && [ ! -e /etc/ntp.conf ]; then
ln -sf /etc/ntpd.conf /etc/ntp.conf
fi
# dhcpcd hook may write into /var/lib/ntp
mkdir -p /var/lib/ntp
# Extract ntp=... from kernel cmdline if present
ntp_flags=""
params=""
if [ -n "$ntp_flags" ]; then
params=$(echo "-p $ntp_flags" | sed s/,/' -p '/g)
if [ -n "" ]; then
# Convert comma-separated list into multiple -p args
params="-p "
else
# Sensible defaults when no ntp= is provided
params="-p time.google.com -p time1.google.com -p time2.google.com -p time3.google.com"
fi
exec ntpd -n $params
# BusyBox ntpd uses -p servers on CLI; /etc/ntp.conf symlink above helps alternative daemons.
exec ntpd -n