summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas K. Hüttel <dilfridge@gentoo.org>2020-07-26 20:36:37 +0300
committerAndreas K. Hüttel <dilfridge@gentoo.org>2020-07-26 20:36:37 +0300
commit8d707a9d314b8843608da773a072d2bcdce3eb35 (patch)
tree01845e5fe3f502031cea4fe32fd8438c5d38fb09
parentMinor output fix (diff)
downloadlocale-gen-8d707a9d314b8843608da773a072d2bcdce3eb35.tar.gz
locale-gen-8d707a9d314b8843608da773a072d2bcdce3eb35.tar.bz2
locale-gen-8d707a9d314b8843608da773a072d2bcdce3eb35.zip
Rework C.UTF-8 insertion logic
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
-rwxr-xr-xlocale-gen24
1 files changed, 8 insertions, 16 deletions
diff --git a/locale-gen b/locale-gen
index 7741aa7..f740d70 100755
--- a/locale-gen
+++ b/locale-gen
@@ -189,26 +189,11 @@ if [[ -z ${locales_to_generate} ]] && [[ -e ${CONFIG} ]] ; then
ewarn "Some might be filtered, but you must fix it."
locales_to_generate=$(echo "${locales_to_generate}" | uniq)
fi
-
- if echo ${locales_to_generate} | grep -vq 'C.UTF-8' ; then
- if [[ -z ${locales_to_generate} ]] ; then
- locales_to_generate='C.UTF-8 UTF-8'
- else
- locales_to_generate=$(echo "${locales_to_generate}" ; echo -n 'C.UTF-8 UTF-8')
- fi
- CUTF_ADDED="true"
- fi
fi
if [[ -z ${locales_to_generate} ]] ; then
[[ ${QUIET} -eq 0 ]] && [[ -z ${JUST_LIST} ]] && \
- ewarn "No locales found, keeping locale archive"
- exit 0
-fi
-
-if [[ ${locales_to_generate} == "C.UTF-8 UTF-8" ]] && [[ -n ${CUTF_ADDED} ]] ; then
- [[ ${QUIET} -eq 0 ]] && [[ -z ${JUST_LIST} ]] && \
- ewarn "No locales found, keeping locale archive"
+ ewarn "No locales to generate found, keeping locale archive"
exit 0
fi
@@ -241,6 +226,13 @@ locales_disp=$(echo "${locales_to_generate}" | sed \
-e ' /@/ s:[[:space:]]*\([^@[:space:]]*\)\([^[:space:]]*\)[[:space:]]\+\([^[:space:]]*\):\1.\3\2:' \
-e '/^[^@]*$/s:[[:space:]]*\([^.[:space:]]*\)\([^[:space:]]*\)[[:space:]]\+\([^[:space:]]*\):\1.\3:')
+# Now check the normalized version for C.UTF-8, and add it if not present
+if echo ${locales_disp} | grep -vq 'C.UTF-8' ; then
+ locales_to_generate=$(echo "${locales_to_generate}" ; echo -n 'C.UTF-8 UTF-8')
+ locales_disp=$(echo "${locales_disp}" ; echo -n 'C.UTF-8')
+ CUTF_ADDED="true"
+fi
+
eval declare -a locales_disp=(${locales_disp})
eval declare -a locales_to_generate=(${locales_to_generate})
total=$(( ${#locales_to_generate[*]} / 2 ))