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
This commit is contained in:
2025-09-05 16:20:05 +02:00
parent 8121698c71
commit 8e3e27dbba

View File

@@ -604,11 +604,40 @@ EOF
Zero-OS \r \m Zero-OS \r \m
Built on \l 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 EOF
# Set proper permissions # Set proper permissions
safe_execute chmod 644 "${initramfs_dir}/etc/motd" safe_execute chmod 644 "${initramfs_dir}/etc/motd"
safe_execute chmod 644 "${initramfs_dir}/etc/issue" 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" log_info "Zero-OS customization complete"
} }