#31 treecompose-post.sh: keep all supported LANGs
Merged 7 years ago by walters. Opened 7 years ago by jlebon.
jlebon/fedora-atomic pr/add-locales-master  into  master

file modified
+46 -3
@@ -8,9 +8,52 @@ 

  # Work around https://github.com/systemd/systemd/issues/4082

  find /usr/lib/systemd/system/ -type f -exec sed -i -e '/^PrivateTmp=/d' -e '/^Protect\(Home\|System\)=/d' {} \;

  

+ # The loops below are too spammy otherwise...

+ set +x

+ 

  # See: https://bugzilla.redhat.com/show_bug.cgi?id=1051816

- KEEPLANG=en_US

- find /usr/share/locale -mindepth  1 -maxdepth 1 -type d -not -name "${KEEPLANG}" -exec rm -rf {} +

- localedef --list-archive | grep -a -v ^"${KEEPLANG}" | xargs localedef --delete-from-archive

+ # and: https://bugzilla.redhat.com/show_bug.cgi?id=1186757

+ KEEPLANGS="

+ pt_BR

+ fr_FR

+ de_DE

+ it_IT

+ ru_RU

+ es_ES

+ en_US

+ zh_CN

+ ja_JP

+ ko_KR

+ zh_TW

+ as_IN

+ bn_IN

+ gu_IN

+ hi_IN

+ kn_IN

+ ml_IN

+ mr_IN

+ or_IN

+ pa_IN

+ ta_IN

+ te_IN

+ "

+ 

+ find /usr/share/locale -mindepth 1 -maxdepth 1 -type d | while read locale; do

+     locale=$(basename $locale)

+     if ! grep -q "^$locale\$" <<< "$KEEPLANGS"; then

+         rm -rf "/usr/share/locale/$locale"

+     fi

+ done

+ 

+ localedef --list-archive | while read locale; do

+     lang=${locale%%.*}

+     lang=${lang%%@*}

+     if [[ $locale != *.utf8 ]] || ! grep -q "$lang" <<< "$KEEPLANGS"; then

Is there a literal *.utf8 locale? Did you mean something like

lang=${locale%%.}
charset=${locale%%@
}
if test ${charset} != utf8; then
continue
fi
...
?

+         localedef --delete-from-archive "$locale"

+     fi

+ done

+ 

+ set -x

+ 

  cp -f /usr/lib/locale/locale-archive /usr/lib/locale/locale-archive.tmpl

  build-locale-archive

In https://bugzilla.redhat.com/show_bug.cgi?id=1186757, it was
acknowledged that a just middle between deleting all the locales and
keeping them all was to only keep "supported" locales. There doesn't
seem to be such a list for Fedora, though RHEL does have one. So for
now, we piggyback on the RHEL definition as to what "supported" means.

As of right now, this increases the on-disk size of an F25 tree by 17M.
Its compressed size should be even more insignificant.

Is there a literal *.utf8 locale? Did you mean something like

lang=${locale%%.}
charset=${locale%%@
}
if test ${charset} != utf8; then
continue
fi
...
?

With double brackets, bash will treat the RHS as a pattern rather than a literal match.

Pull-Request has been merged by walters

7 years ago
Metadata