Preserve APK directories in aggressive cleanup for apk update capability
- Keep /var/cache/apk and /lib/apk/db directories but clean files inside - Allows running 'apk update' in Zero-OS when needed - Clean cache files and database files but preserve directory structure - Maintains package management functionality while minimizing size
This commit is contained in:
@@ -240,12 +240,26 @@ function alpine_aggressive_cleanup() {
|
||||
log_info "Removing static libraries"
|
||||
find "${initramfs_dir}" -name "*.a" -type f -delete 2>/dev/null || true
|
||||
|
||||
# Remove APK cache and database backup
|
||||
log_info "Removing APK cache and database backup"
|
||||
safe_rmdir "${initramfs_dir}/var/cache/apk"
|
||||
safe_rmdir "${initramfs_dir}/lib/apk/db"
|
||||
# Clean APK cache and databases but keep directories for apk update capability
|
||||
log_info "Cleaning APK cache and databases (keeping directories for apk update)"
|
||||
|
||||
# Clean cache files but keep directory structure
|
||||
if [[ -d "${initramfs_dir}/var/cache/apk" ]]; then
|
||||
find "${initramfs_dir}/var/cache/apk" -type f -delete 2>/dev/null || true
|
||||
log_info "✓ Cleaned APK cache files (directory preserved)"
|
||||
fi
|
||||
|
||||
# Clean database files but keep directories for apk functionality
|
||||
if [[ -d "${initramfs_dir}/lib/apk/db" ]]; then
|
||||
find "${initramfs_dir}/lib/apk/db" -type f -delete 2>/dev/null || true
|
||||
log_info "✓ Cleaned APK database files (directory preserved)"
|
||||
fi
|
||||
|
||||
# Remove old backup files
|
||||
find "${initramfs_dir}/var/lib/apk" -name "*.old" -delete 2>/dev/null || true
|
||||
|
||||
log_info "APK directories preserved for 'apk update' functionality"
|
||||
|
||||
# Remove kernel source and headers if present
|
||||
log_info "Removing kernel development files"
|
||||
safe_rmdir "${initramfs_dir}/usr/src"
|
||||
|
||||
Reference in New Issue
Block a user