[type/__localedef] glibc: Also delete aliases when removing a locale

This commit is contained in:
Dennis Camera 2020-11-14 09:54:01 +01:00
parent 575bb62dc5
commit eeb9871919
2 changed files with 18 additions and 2 deletions

View File

@ -84,8 +84,19 @@ in
EOF
;;
(absent)
localename=$(format_locale "${lang}" "$(gnu_normalize_codeset "${codeset}")" "${modifier}")
printf "localedef --delete-from-archive '%s'\n" "${localename}"
main_localename=$(format_locale "${lang}" "$(gnu_normalize_codeset "${codeset}")" "${modifier}")
cat <<-EOF
while read -r _alias _localename
do
if test "\${_localename}" = '$(format_locale "${lang}" "${codeset}")'
then
localedef --delete-from-archive "\${_alias}"
fi
done <'${aliasfile}'
localedef --delete-from-archive '${main_localename}'
EOF
;;
esac
;;

View File

@ -13,6 +13,11 @@ This cdist type allows you to define locales on the system using
On systems that don't support definition of new locales, the type will raise an
error.
**NB:** This type respects the glibc ``locale.alias`` file,
i.e. it defines alias locales or deletes aliases of a locale when it is removed.
It is not possible, however, to use alias names to define locales or only remove
certain aliases of a locale.
OPTIONAL PARAMETERS
-------------------