From 63a0342a56559dd779f9cc5e2962291647bc1b29 Mon Sep 17 00:00:00 2001 From: Hunter Presnall Date: Tue, 14 Jul 2020 16:54:06 -0400 Subject: [PATCH] Use APK cache if available on the host system --- alpine-make-vm-image | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/alpine-make-vm-image b/alpine-make-vm-image index 6596883..d47c197 100755 --- a/alpine-make-vm-image +++ b/alpine-make-vm-image @@ -447,6 +447,11 @@ else dump_alpine_keys etc/apk/keys/ fi +# Use APK cache if available. +if [ -L /etc/apk/cache ]; then + ln -s "$(realpath /etc/apk/cache)" etc/apk/cache +fi + _apk add --root . --update-cache --initdb alpine-base prepare_chroot . @@ -493,6 +498,11 @@ if [ "$PACKAGES" ]; then _apk add --root . $PACKAGES fi +#----------------------------------------------------------------------- +if [ -L /etc/apk/cache ]; then + rm etc/apk/cache >/dev/null 2>&1 +fi + #----------------------------------------------------------------------- if [ "$SCRIPT" ]; then script_name="${SCRIPT##*/}"