diff --git a/diskimage_builder/elements/zypper-minimal/package-installs.yaml b/diskimage_builder/elements/zypper-minimal/package-installs.yaml index 4aaffdb2d..779c2adb5 100644 --- a/diskimage_builder/elements/zypper-minimal/package-installs.yaml +++ b/diskimage_builder/elements/zypper-minimal/package-installs.yaml @@ -1,5 +1,7 @@ # kernel kernel-default: +# locale support (we need LC_ALL=en_US.utf8) +glibc-locale: # And a few useful tools. Some are pulled # as dependencies but that may change so lets # be explicit. diff --git a/diskimage_builder/elements/zypper-minimal/post-install.d/01-locale-cleanup b/diskimage_builder/elements/zypper-minimal/post-install.d/01-locale-cleanup new file mode 100755 index 000000000..056f3472f --- /dev/null +++ b/diskimage_builder/elements/zypper-minimal/post-install.d/01-locale-cleanup @@ -0,0 +1,12 @@ +#!/bin/bash +# Only keep the minimum amount of locales to save disk space +# + +if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then + set -x +fi +set -eu +set -o pipefail + +find /usr/lib/locale -mindepth 1 -maxdepth 1 -type d 2>/dev/null | \ + grep -Ev '/(C.utf8|en_US|en_US.utf8)$' | xargs rm -rf