diff options
Diffstat (limited to 'adelie-build-txz')
-rwxr-xr-x | adelie-build-txz | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/adelie-build-txz b/adelie-build-txz index 15d81bf..4387af2 100755 --- a/adelie-build-txz +++ b/adelie-build-txz @@ -57,7 +57,6 @@ usage() { printf 'Default VERSION: %s\n' $def_ver } - while [ -n "$1" ]; do case $1 in -a | --arch) @@ -75,6 +74,13 @@ while [ -n "$1" ]; do shift readonly MY_VER=$1 ;; + -c | --cache) + shift + readonly MY_CACHE=$1 + ;; + --no-cache) + unset def_cache + ;; *) usage >&2 exit 127 @@ -83,6 +89,9 @@ while [ -n "$1" ]; do shift done +[ -d /etc/apk/cache ] && def_cache=/etc/apk/cache +[ -z "${MY_ARCH}" -o "${MY_ARCH}" = "${def_arch}" ] || unset def_cache + set -a readonly ARCH=${MY_ARCH:-$def_arch} readonly LDARCH=${LDARCH:-$ARCH} @@ -90,6 +99,7 @@ readonly PHASE=${MY_PHASE:-all} readonly VERSION=${MY_VER:-$def_ver} readonly APKVER=${MY_APKVER:-$VERSION} readonly URL=${MY_URL:-https://distfiles.adelielinux.org/adelie/$VERSION/} +readonly CACHE=${MY_CACHE:-$def_cache} set +a ensure_commands @@ -132,6 +142,7 @@ install_pkgs() { mknod rootfs-$ARCH/dev/urandom c 1 9 mkdir -p rootfs-$ARCH/usr/sbin apk --arch $ARCH \ + ${CACHE:+--cache-dir "${CACHE}"} \ -X "$URL/system/$EXTRA_MIRROR" \ -X "$URL/user/$EXTRA_MIRROR" \ -U --root rootfs-$ARCH --initdb add $PACKAGES $ARCH_PKGS |