From bfeb9d9e99945dd634b457253cdd4f65cc752b27 Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Sun, 23 Jul 2017 14:35:07 +0200 Subject: [PATCH] zypper: Clean caches and don't cache packages locally For builds inside the infra, we don't want to pack the cache inside the image (as it might be different at the time the image runs). In an opensuse-minimal image this saves about 10MB of image size. Change-Id: I5ecabd46f0a662798bda3e4468395ad8308d0055 --- .../zypper/post-install.d/98-zypper-clean-cache | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100755 diskimage_builder/elements/zypper/post-install.d/98-zypper-clean-cache diff --git a/diskimage_builder/elements/zypper/post-install.d/98-zypper-clean-cache b/diskimage_builder/elements/zypper/post-install.d/98-zypper-clean-cache new file mode 100755 index 000000000..d313fb23c --- /dev/null +++ b/diskimage_builder/elements/zypper/post-install.d/98-zypper-clean-cache @@ -0,0 +1,10 @@ +#!/bin/bash + +if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then + set -x +fi +set -eu +set -o pipefail + +# clean all locally cached metadata +sudo zypper clean -a