From 9f29e4c004daabb29c121ee6b609c04c6ca18774 Mon Sep 17 00:00:00 2001 From: Tobias Powalowski Date: Wed, 1 Mar 2023 12:18:09 +0100 Subject: [PATCH] add new locale logic --- usr/lib/archboot/container.sh | 10 +++++++--- .../update-installer/update-installer.sh | 6 +++++- usr/lib/initcpio/install/archboot_base_common | 17 +++++++++++++++-- 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/usr/lib/archboot/container.sh b/usr/lib/archboot/container.sh index 443942cb5..eea816d71 100644 --- a/usr/lib/archboot/container.sh +++ b/usr/lib/archboot/container.sh @@ -62,10 +62,14 @@ _clean_container() { if [[ "${_CLEANUP_CONTAINER}" == "1" ]]; then echo "Cleaning container, delete not needed files from ${1}..." rm -r "${1}"/usr/include - rm -r "${1}"/usr/share/{aclocal,applications,audit,awk,common-lisp,emacs,et,fish,gdb,gettext,gettext-[0-9]*,glib-[0-9]*,gnupg,gtk-doc,iana-etc,icons,icu,keyutils,libalpm,libgpg-error,makepkg-template,misc,mkinitcpio,pixmaps,pkgconfig,screen,smartmontools,ss,tabset,vala,xml,zoneinfo-leaps,man,doc,info,i18n,xtables} + rm -r "${1}"/usr/share/{aclocal,applications,audit,awk,common-lisp,emacs,et,fish,gdb,gettext,gettext-[0-9]*,glib-[0-9]*,gnupg,gtk-doc,iana-etc,icons,icu,keyutils,libalpm,libgpg-error,makepkg-template,misc,mkinitcpio,pixmaps,pkgconfig,screen,smartmontools,ss,tabset,vala,xml,zoneinfo-leaps,man,doc,info,xtables} rm -r "${1}"/usr/lib/{audit,awk,binfmt.d,cmake,dracut,e2fsprogs,engines-[0-9]*,environment.d,gawk,getconf,gettext,girepository-[0-9]*,glib-[0-9]*,gnupg,gssproxy,icu,krb5,ldscripts,libnl,pkgconfig,python[0-9]*,rsync,sasl2,siconv,tar,xfsprogs,xtables} - find ${1}/usr/share/locale/ ! -path '*/de/*' ! -path '*/en_US/*' ! -path '*/fr/*' ! -path '*/es/*' ! -path '*/pt/*' ! -path '*/ru/*' -delete &>/dev/null - find ${1}/usr/share/locale/ -name 'gdbm*' -delete &>/dev/null + # locale cleaning + find ${1}/usr/share/locale/ ! -path '*/de/*' ! -path '*/en/*' ! -path '*/fr/*' \ + ! -path '*/es/*' ! -path '*/pt/*' ! -path '*/ru/*' -delete &>/dev/null + find ${1}/usr/share/i18n/locales ! -name 'de_DE' ! -name 'en_US' ! -name 'fr_FR' \ + ! -name 'es_ES' ! -name 'pt_PT' ! -name 'ru_RU' -delete &>/dev/null + find ${1}/usr/share/i18n/charmaps ! -name 'UTF-8.gz' -delete &>/dev/null fi } diff --git a/usr/lib/archboot/update-installer/update-installer.sh b/usr/lib/archboot/update-installer/update-installer.sh index 9748ccc89..00fc26658 100644 --- a/usr/lib/archboot/update-installer/update-installer.sh +++ b/usr/lib/archboot/update-installer/update-installer.sh @@ -319,7 +319,11 @@ _prepare_graphic() { echo "Removing not used icons..." rm -rf /usr/share/icons/breeze-dark echo "Cleanup locale and i18n..." - rm -rf /usr/share/{locale,i18n} + find ${1}/usr/share/locale/ ! -path '*/de/*' ! -path '*/en/*' ! -path '*/fr/*' \ + ! -path '*/es/*' ! -path '*/pt/*' ! -path '*/ru/*' -delete &>/dev/null + find ${1}/usr/share/i18n/locales ! -name 'de_DE' ! -name 'en_US' ! -name 'fr_FR' \ + ! -name 'es_ES' ! -name 'pt_PT' ! -name 'ru_RU' -delete &>/dev/null + find ${1}/usr/share/i18n/charmaps ! -name 'UTF-8.gz' -delete &>/dev/null fi systemd-sysusers >/dev/tty7 2>&1 systemd-tmpfiles --create >/dev/tty7 2>&1 diff --git a/usr/lib/initcpio/install/archboot_base_common b/usr/lib/initcpio/install/archboot_base_common index c35eb7558..209890b1d 100644 --- a/usr/lib/initcpio/install/archboot_base_common +++ b/usr/lib/initcpio/install/archboot_base_common @@ -59,10 +59,23 @@ build () map add_full_dir /usr/lib/coreutils /usr/lib/cryptsetup \ /usr/lib/gconv /usr/share/readline - ### make archinstall happy, add /etc/locale.gen + ### add locale support + add_binary locale-gen add_file /etc/locale.gen add_file /usr/lib/locale/locale-archive - add_full_dir /usr/share/locale + _LANG="en de es fr pt ru" + for i in ${_LANG}; do + add_full_dir /usr/share/locale/${i} + done + _LANG="en_US de_DE es_ES fr_FR pt_PT ru_RU" + for i in ${_LANG}; do + add_file /usr/share/i18n/locales/${i} + done + add_file /usr/share/i18n/charmaps/UTF-8.gz + for i in $(find ${1}/usr/share/locale/ -type -f ! -name 'gdbm*' ! -name 'bfd*' \ + ! -name 'gettext*' ! -name 'gas*' ! -name 'gold' ! -name 'gprof*' -name 'ld*' ! -name 'opcodes*'; do + add_file ${i} + done ### add bash configuration # add bash-completion