add new locale logic

This commit is contained in:
Tobias Powalowski 2023-03-01 12:18:09 +01:00
parent b979366e27
commit 9f29e4c004
3 changed files with 27 additions and 6 deletions

View file

@ -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
}

View file

@ -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

View file

@ -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