From 8e3e27dbbaaa3c259132019b78c418440f3ff123 Mon Sep 17 00:00:00 2001 From: Jan De Landtsheer Date: Fri, 5 Sep 2025 16:20:05 +0200 Subject: [PATCH] Add NTP configuration and improve APK directory handling - Add ntpd.conf with Google NTP servers in Zero-OS customization - Preserve APK directories (/var/cache/apk, /lib/apk/db) but clean files for apk update capability - Create /var/lib/ntp directory for drift file - Comprehensive Zero-OS customization: passwordless root, branding, NTP config --- scripts/lib/initramfs.sh | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/scripts/lib/initramfs.sh b/scripts/lib/initramfs.sh index b5ee1b7..1a2d1d7 100644 --- a/scripts/lib/initramfs.sh +++ b/scripts/lib/initramfs.sh @@ -604,11 +604,40 @@ EOF Zero-OS \r \m Built on \l +EOF + + # Create ntpd.conf pointing to Google NTP servers + log_info "Creating ntpd.conf with Google NTP servers" + cat > "${initramfs_dir}/etc/ntpd.conf" << 'EOF' +# Zero-OS NTP Configuration +# Using Google public NTP servers for reliable time sync + +server time.google.com iburst +server time1.google.com iburst +server time2.google.com iburst +server time3.google.com iburst + +# Fallback to Google IP addresses +server 216.239.35.0 iburst +server 216.239.35.4 iburst + +# Restrict access (security) +restrict default kod nomodify notrap nopeer noquery +restrict -6 default kod nomodify notrap nopeer noquery +restrict 127.0.0.1 +restrict -6 ::1 + +# Drift file for time stability +driftfile /var/lib/ntp/ntp.drift EOF # Set proper permissions safe_execute chmod 644 "${initramfs_dir}/etc/motd" safe_execute chmod 644 "${initramfs_dir}/etc/issue" + safe_execute chmod 644 "${initramfs_dir}/etc/ntpd.conf" + + # Create ntp drift directory + safe_mkdir "${initramfs_dir}/var/lib/ntp" log_info "Zero-OS customization complete" }