Fix APK database preservation and add NTP configuration

- Preserve essential APK database files in /lib/apk/db for apk update functionality
- Only remove cache archives and backup files, not core database structure
- Add ntpd.conf with Google NTP servers for reliable time synchronization
- Create /var/lib/ntp directory for drift file
- Fixes 'Unable to lock database' error in Zero-OS
This commit is contained in:
2025-09-05 16:22:38 +02:00
parent 8e3e27dbba
commit 5727edf455

View File

@@ -240,8 +240,8 @@ function alpine_aggressive_cleanup() {
log_info "Removing static libraries" log_info "Removing static libraries"
find "${initramfs_dir}" -name "*.a" -type f -delete 2>/dev/null || true find "${initramfs_dir}" -name "*.a" -type f -delete 2>/dev/null || true
# Clean APK cache and databases but keep directories for apk update capability # Clean APK cache but preserve essential database files for apk update capability
log_info "Cleaning APK cache and databases (keeping directories for apk update)" log_info "Cleaning APK cache and non-essential databases (preserving apk update capability)"
# Clean cache files but keep directory structure # Clean cache files but keep directory structure
if [[ -d "${initramfs_dir}/var/cache/apk" ]]; then if [[ -d "${initramfs_dir}/var/cache/apk" ]]; then
@@ -249,16 +249,21 @@ function alpine_aggressive_cleanup() {
log_info "✓ Cleaned APK cache files (directory preserved)" log_info "✓ Cleaned APK cache files (directory preserved)"
fi fi
# Clean database files but keep directories for apk functionality # Only remove specific database files, not the core ones needed for apk to function
if [[ -d "${initramfs_dir}/lib/apk/db" ]]; then if [[ -d "${initramfs_dir}/lib/apk/db" ]]; then
find "${initramfs_dir}/lib/apk/db" -type f -delete 2>/dev/null || true # Remove only download cache and backup files, keep essential database structure
log_info "✓ Cleaned APK database files (directory preserved)" find "${initramfs_dir}/lib/apk/db" -name "*.tar.gz" -delete 2>/dev/null || true
find "${initramfs_dir}/lib/apk/db" -name "*.old" -delete 2>/dev/null || true
log_info "✓ Cleaned APK cache archives (essential database preserved)"
fi fi
# Remove old backup files # Clean old backup files in var/lib/apk but preserve world file
find "${initramfs_dir}/var/lib/apk" -name "*.old" -delete 2>/dev/null || true if [[ -d "${initramfs_dir}/var/lib/apk" ]]; then
find "${initramfs_dir}/var/lib/apk" -name "*.old" -delete 2>/dev/null || true
log_info "✓ Cleaned APK backup files (world file preserved)"
fi
log_info "APK directories preserved for 'apk update' functionality" log_info "APK database preserved for 'apk update' functionality"
# Remove kernel source and headers if present # Remove kernel source and headers if present
log_info "Removing kernel development files" log_info "Removing kernel development files"