r1193 - in glibc-package/trunk/debian: . debhelper.in
Author: barbier
Date: 2006-02-19 22:05:01 +0000 (Sun, 19 Feb 2006)
New Revision: 1193
Modified:
glibc-package/trunk/debian/changelog
glibc-package/trunk/debian/debhelper.in/locales.config
glibc-package/trunk/debian/debhelper.in/locales.postinst
glibc-package/trunk/debian/debhelper.in/locales.templates
Log:
Add an "All locales" option to the locales/locales_to_be_generated
template. When it is selected, /etc/locale.gen is a symlink to
/usr/share/i18n/SUPPORTED. (Closes: #321580, #323013)
Modified: glibc-package/trunk/debian/changelog
===================================================================
--- glibc-package/trunk/debian/changelog 2006-02-19 01:24:27 UTC (rev 1192)
+++ glibc-package/trunk/debian/changelog 2006-02-19 22:05:01 UTC (rev 1193)
@@ -17,7 +17,10 @@
* Fix thousand separator for de_CH, and let other Swiss locales copy
de_CH for LC_NUMERIC and LC_MONETARY sections. (Closes: #345481)
* Apply a patch from Fedora to define AM/PM strings in cy_GB and en_GB
- locales. (Closes: #240901))
+ locales. (Closes: #240901)
+ * Add an "All locales" option to the locales/locales_to_be_generated
+ template. When it is selected, /etc/locale.gen is a symlink to
+ /usr/share/i18n/SUPPORTED. (Closes: #321580, #323013)
[ Clint Adams ]
* Add hurd-getresuid-dyslexia.diff (fixes incorrect ordering of
Modified: glibc-package/trunk/debian/debhelper.in/locales.config
===================================================================
--- glibc-package/trunk/debian/debhelper.in/locales.config 2006-02-19 01:24:27 UTC (rev 1192)
+++ glibc-package/trunk/debian/debhelper.in/locales.config 2006-02-19 22:05:01 UTC (rev 1193)
@@ -7,7 +7,11 @@
# Initializes debconf default values from the ones found in
# configuration files
-if [ -e /etc/locale.gen ]; then
+SELECTED_LOCALES=
+if [ -L /etc/locale.gen ] && [ "$(readlink /etc/locale.gen)" = /usr/share/i18n/SUPPORTED ]; then
+ SELECTED_LOCALES="All locales"
+ LG=/dev/null
+elif [ -e /etc/locale.gen ]; then
LG=/etc/locale.gen
# Debconf templates in locales < 2.3.2 were completely different,
# the locales/locales_to_be_generated question could have a "Leave alone"
@@ -16,20 +20,21 @@
grep -q "Leave alone" $LG && sed -e '/^Leave alone/d' $LG > $LG.tmp && mv $LG.tmp $LG
SELECTED_LOCALES=$(LC_ALL=C sed -e '/^[a-zA-Z]/!d' $LG | tr '\n' ',' | sed -e 's/,/, /g' -e 's/, *$//')
- db_set locales/locales_to_be_generated "${SELECTED_LOCALES}"
else
LG=/dev/null
fi
+DEFAULT_ENVIRONMENT=None
if [ -e /etc/environment ]; then
- db_set locales/default_environment_locale $(awk 'BEGIN {lang="None"} /^LANG=/ {gsub("\"", ""); sub("LANG=", ""); lang=$0;} END {print lang}' /etc/environment)
-else
- db_set locales/default_environment_locale None
+ DEFAULT_ENVIRONMENT=$(awk 'BEGIN {lang="None"} /^LANG=/ {gsub("\"", ""); sub("LANG=", ""); lang=$0;} END {print lang}' /etc/environment)
fi
# Add a newline in case /etc/locale.gen has no trailing newline at EOF
SUPPORTED_LOCALES="
__SUPPORTED_LOCALES__"
SUPPORTED_LOCALES=$( (cat $LG && echo "$SUPPORTED_LOCALES") | LC_ALL=C sed -e '/^[a-zA-Z]/!d' | LC_ALL=C sort -u | tr '\n' ',' | sed -e 's/,/, /g' -e 's/, *$//')
+
+db_set locales/locales_to_be_generated "${SELECTED_LOCALES}"
+db_set locales/default_environment_locale "$DEFAULT_ENVIRONMENT"
db_subst locales/locales_to_be_generated locales "${SUPPORTED_LOCALES}"
STATE=1
@@ -42,9 +47,17 @@
db_input medium locales/locales_to_be_generated || true
;;
2)
- db_get locales/locales_to_be_generated && DEFAULT_LOCALES=$(echo $RET | sed -e 's/None,*//g' -e 's/ [^ ]*,/,/g' -e 's/ [^ ]*$//')
-
- if test -n "$DEFAULT_LOCALES"; then
+ db_get locales/locales_to_be_generated || RET=
+ case ",$RET," in
+ ",None,")
+ RET=
+ ;;
+ ",All locales,")
+ RET=$SUPPORTED_LOCALES
+ ;;
+ esac
+ DEFAULT_LOCALES=$(echo $RET | sed -e 's/ [^ ]*,/,/g' -e 's/ [^ ]*$//')
+ if [ -n "$DEFAULT_LOCALES" ]; then
db_subst locales/default_environment_locale locales $DEFAULT_LOCALES
db_input medium locales/default_environment_locale || true
fi
Modified: glibc-package/trunk/debian/debhelper.in/locales.postinst
===================================================================
--- glibc-package/trunk/debian/debhelper.in/locales.postinst 2006-02-19 01:24:27 UTC (rev 1192)
+++ glibc-package/trunk/debian/debhelper.in/locales.postinst 2006-02-19 22:05:01 UTC (rev 1193)
@@ -13,14 +13,19 @@
db_get locales/default_environment_locale && SELECTED="$RET"
if [ -n "$SELECTED_LOCALES" ]; then
- if [ -e $LG ]; then
- # Comment previous defined locales
- LC_ALL=C sed -e 's/^[a-zA-Z]/#&/' $LG > $LG.tmp || true
- mv -f $LG.tmp $LG
- last=`tail -n 1 "$LG"`
- if test -n "$last"; then echo >> $LG; fi
+ if [ "$SELECTED_LOCALES" = "All locales" ]; then
+ [ -e $LG ] && rm -f $LG
+ ln -s /usr/share/i18n/SUPPORTED $LG
else
- cat > $LG << EOF
+ [ -L $LG ] && [ "$(readlink $LG)" = /usr/share/i18n/SUPPORTED ] && rm -f $LG
+ if [ -e $LG ]; then
+ # Comment previous defined locales
+ LC_ALL=C sed -e 's/^[a-zA-Z]/#&/' $LG > $LG.tmp || true
+ mv -f $LG.tmp $LG
+ last=`tail -n 1 "$LG"`
+ if test -n "$last"; then echo >> $LG; fi
+ else
+ cat > $LG << EOF
# This file lists locales that you wish to have built. You can find a list
# of valid supported locales at /usr/share/i18n/SUPPORTED. Other
# combinations are possible, but may not be well tested. If you change
@@ -28,26 +33,29 @@
#
EOF
+ fi
+ list=`echo $SELECTED_LOCALES | sed -e 's/, /,/g'`
+ save_IFS=$IFS
+ IFS=,
+ for locale in $list; do
+ if grep -q "^$locale *\$" $LG; then
+ # This locale has already been inserted, do nothing
+ :
+ elif grep -q "^#$locale *\$" $LG; then
+ # Uncomment previous defined locales
+ sed -e "s,#$locale *\$,$locale," $LG > $LG.tmp || true
+ mv -f $LG.tmp $LG
+ else
+ # Add a new locale
+ echo $locale >> $LG
+ fi
+ done
+ IFS=$save_IFS
fi
- list=`echo $SELECTED_LOCALES | sed -e 's/, /,/g'`
- save_IFS=$IFS
- IFS=,
- for locale in $list; do
- if grep -q "^$locale *\$" $LG; then
- # This locale has already been inserted, do nothing
- :
- elif grep -q "^#$locale *\$" $LG; then
- # Uncomment previous defined locales
- sed -e "s,#$locale *\$,$locale," $LG > $LG.tmp || true
- mv -f $LG.tmp $LG
- else
- # Add a new locale
- echo $locale >> $LG
- fi
- done
- IFS=$save_IFS
else
- if [ -e $LG ]; then
+ if [ -L $LG ]; then
+ rm -f $LG
+ elif [ -e $LG ]; then
LC_ALL=C sed -e 's/^[a-zA-Z]/#&/' $LG > $LG.tmp || true
mv -f $LG.tmp $LG
fi
@@ -73,11 +81,6 @@
rm -f $EE.tmp
fi
-# We remove a relic of the past /usr/doc/<package> symlinks.
-# This script should keep at least until sarge release.
-if [ -L "/usr/doc/locales" ]; then
- rm -f "/usr/doc/locales"
-fi
-
#DEBHELPER#
+exit 0
Modified: glibc-package/trunk/debian/debhelper.in/locales.templates
===================================================================
--- glibc-package/trunk/debian/debhelper.in/locales.templates 2006-02-19 01:24:27 UTC (rev 1192)
+++ glibc-package/trunk/debian/debhelper.in/locales.templates 2006-02-19 22:05:01 UTC (rev 1193)
@@ -1,6 +1,6 @@
Template: locales/locales_to_be_generated
Type: multiselect
-Choices: ${locales}
+__Choices: All locales, ${locales}
_Description: Locales to be generated:
Locale is a framework to switch between multiple languages for users who can
select to use their language, country, characters, collation order, etc.
@@ -8,6 +8,9 @@
Choose which locales to generate. The selection will be saved to
`/etc/locale.gen', which you can also edit manually (you need to run
`locale-gen' afterwards).
+ .
+ When `All locales' is selected, /etc/locale.gen will be set as a symlink to
+ /usr/share/i18n/SUPPORTED.
Template: locales/default_environment_locale
Type: select
Reply to: