Default to C.UTF-8 locale and deprecate /etc/debootstrap/locale.gen, DEFAULT_LOCALES... mika/c-utf8
authorMichael Prokop <mika@grml.org>
Wed, 21 Aug 2019 15:21:16 +0000 (17:21 +0200)
committerMichael Prokop <mika@grml.org>
Wed, 21 Aug 2019 20:13:36 +0000 (22:13 +0200)
Closes: #125

Makefile
chroot-script
config
debian/grml-debootstrap.maintscript
grml-debootstrap
grml-debootstrap.8.txt
locale.gen [deleted file]

index f4bd866..e208753 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -41,7 +41,6 @@ install:
        mkdir -p $(DESTDIR)/usr/share/zsh/vendor-completions
        install -m 644 config           $(DESTDIR)/etc/debootstrap/
        install -m 644 devices.tar.gz   $(DESTDIR)/etc/debootstrap/
-       install -m 644 locale.gen       $(DESTDIR)/etc/debootstrap/
        install -m 644 packages         $(DESTDIR)/etc/debootstrap/
        install -m 755 chroot-script    $(DESTDIR)/etc/debootstrap/
        install -m 755 grml-debootstrap $(DESTDIR)/usr/sbin/
index 68514e0..8feccfa 100755 (executable)
@@ -442,15 +442,15 @@ EOF
 
 # set default locales {{{
 default_locales() {
-  if [ -n "$DEFAULT_LOCALES" ] ; then
-    if ! [ -x /usr/sbin/update-locale ] ; then
-      echo "Warning: update-locale executable not available (no locales package installed?)"
-      echo "Ignoring request to run update-locale for $DEFAULT_LOCALES therefore"
-      return 0
-    fi
-
-    /usr/sbin/update-locale LANGUAGE="$DEFAULT_LANGUAGE" LANG="$DEFAULT_LOCALES"
+  if ! [ -x "$(command -v update-locale)" ] ; then
+    echo "Warning: update-locale executable not available (no locales package installed?)"
+    echo "Ignoring request to run update-locale for C.UTF-8 therefore"
+    return 0
   fi
+
+  echo "Setting C.UTF-8 as default LANG"
+  /usr/sbin/update-locale LANG='C.UTF-8'
+  echo 'locales locales/default_environment_locale select C.UTF-8' | debconf-set-selections
 }
 # }}}
 
diff --git a/config b/config
index 6477acf..72020b2 100644 (file)
--- a/config
+++ b/config
 # Default: 'console-data'.
 # RECONFIGURE='console-data'
 
-# Generate locales using /etc/debootstrap/locale.gen configuration file.
-# Default: 'yes'
-# LOCALES='no'
-
-# locales (LANG) that should be used as default.
-# Default: 'en_US.UTF-8'
-# DEFAULT_LOCALES='en_US.UTF-8'
-
-# locales (LANGUAGE) that should be used as default.
-# Default: 'en_US:en'
-# DEFAULT_LANGUAGE='en_US:en'
-
 # Use /usr/share/zoneinfo/$TIMEZONE for /etc/localtime + set /etc/timezone.
 # Default: 'Europe/Vienna'
 # TIMEZONE='Europe/Vienna'
index a60be94..8ced748 100644 (file)
@@ -1 +1,2 @@
 rm_conffile /etc/zsh/completion.d/_grml-debootstrap 0.86~
+rm_conffile /etc/debootstrap/locale.gen 0.89~
index 1dd6550..7246c45 100755 (executable)
@@ -54,8 +54,6 @@ MNTPOINT="/mnt/debootstrap.$$"
 [ -n "$DEBCONF" ] || DEBCONF='yes'
 [ -n "$DEBIAN_FRONTEND" ] || DEBIAN_FRONTEND='noninteractive'
 [ -n "$DEBOOTSTRAP" ] || DEBOOTSTRAP='debootstrap'
-[ -n "$DEFAULT_LANGUAGE" ] || DEFAULT_LANGUAGE='en_US:en'
-[ -n "$DEFAULT_LOCALES" ] || DEFAULT_LOCALES='en_US.UTF-8'
 [ -n "$DISK_IDENTIFIER" ] || DISK_IDENTIFIER='26ada0c0-1165-4098-884d-aafd2220c2c6'
 [ -n "$EXTRAPACKAGES" ] || EXTRAPACKAGES='yes'
 [ -n "$FALLBACK_MIRROR" ] || FALLBACK_MIRROR='http://deb.debian.org/debian'
@@ -64,7 +62,6 @@ MNTPOINT="/mnt/debootstrap.$$"
 [ -n "$HOSTNAME" ] || HOSTNAME='grml'
 [ -n "$INITRD" ] || INITRD='yes'
 [ -n "$INSTALL_NOTES" ] || INSTALL_NOTES='/etc/debootstrap/install_notes'
-[ -n "$LOCALES" ] || LOCALES='yes'
 [ -n "$MIRROR" ] || MIRROR="$FALLBACK_MIRROR"
 [ -n "$MKFS" ] || MKFS='mkfs.ext4'
 [ -n "$MKFS_OPTS" ] || MKFS_OPTS=''
@@ -580,6 +577,23 @@ done
 [ "$_opt_contrib" ]             && COMPONENTS="$COMPONENTS contrib"
 [ "$_opt_non_free" ]            && COMPONENTS="$COMPONENTS non-free"
 
+# variable checks
+if [ -n "${LOCALES:-}" ] ; then
+  ewarn "Deprecation NOTE: LOCALES handling is deprecated, please customize locale handling via post scripts instead."
+fi
+
+if [ -n "${DEFAULT_LOCALES:-}" ] ; then
+  ewarn "Deprecation NOTE: DEFAULT_LOCALES handling is deprecated, please customize locale handling via post scripts instead."
+fi
+
+if [ -n "${DEFAULT_DEFAULT_LANGUAGE:-}" ] ; then
+  ewarn "Deprecation NOTE: DEFAULT_DEFAULT_LANGUAGE handling is deprecated, please customize locale handling via post scripts instead."
+fi
+
+if [ -r "${CONFFILES:-}"/locale.gen ] ; then
+  ewarn "Deprecation NOTE: ${CONFFILES}/locale.gen handling is deprecated, please customize locale handling via post scripts instead."
+fi
+
 # command line option checks
 if [ "$_opt_scripts_set" ] ; then
   ewarn "Deprecation NOTE: --scripts option is deprecated, please switch to --post-scripts instead."
@@ -1621,8 +1635,6 @@ preparechroot() {
   [ -n "$DEBCONF" ]             && echo "DEBCONF='$(sed "s,','\\\\'',g" <<<"${DEBCONF}")'"                         >> "$CHROOT_VARIABLES"
   [ -n "$DEBIAN_FRONTEND" ]     && echo "DEBIAN_FRONTEND='$(sed "s,','\\\\'',g" <<<"${DEBIAN_FRONTEND}")'"         >> "$CHROOT_VARIABLES"
   [ -n "$DEBOOTSTRAP" ]         && echo "DEBOOTSTRAP='$(sed "s,','\\\\'',g" <<<"${DEBOOTSTRAP}")'"                 >> "$CHROOT_VARIABLES"
-  [ -n "$DEFAULT_LOCALES" ]     && echo "DEFAULT_LOCALES='$(sed "s,','\\\\'',g" <<<"${DEFAULT_LOCALES}")'"         >> "$CHROOT_VARIABLES"
-  [ -n "$DEFAULT_LANGUAGE" ]    && echo "DEFAULT_LANGUAGE='$(sed "s,','\\\\'',g" <<<"${DEFAULT_LANGUAGE}")'"       >> "$CHROOT_VARIABLES"
   [ -n "$EXTRAPACKAGES" ]       && echo "EXTRAPACKAGES='$(sed "s,','\\\\'',g" <<<"${EXTRAPACKAGES}")'"             >> "$CHROOT_VARIABLES"
   [ -n "$EFI" ]                 && echo "EFI='$(sed "s,','\\\\'',g" <<<"${EFI}")'"                                 >> "$CHROOT_VARIABLES"
   [ -n "$FALLBACK_MIRROR" ]     && echo "FALLBACK_MIRROR='$(sed "s,','\\\\'',g" <<<"${FALLBACK_MIRROR}")'"         >> "$CHROOT_VARIABLES"
@@ -1635,7 +1647,6 @@ preparechroot() {
   [ -n "$ISODIR" ]              && echo "ISODIR='$(sed "s,','\\\\'',g" <<<"${ISO}")'"                              >> "$CHROOT_VARIABLES"
   [ -n "$ISO" ]                 && echo "ISO='$(sed "s,','\\\\'',g" <<<"${ISO}")'"                                 >> "$CHROOT_VARIABLES"
   [ -n "$KEEP_SRC_LIST" ]       && echo "KEEP_SRC_LIST='$(sed "s,','\\\\'',g" <<<"${KEEP_SRC_LIST}")'"             >> "$CHROOT_VARIABLES"
-  [ -n "$LOCALES" ]             && echo "LOCALES='$(sed "s,','\\\\'',g" <<<"${LOCALES}")'"                         >> "$CHROOT_VARIABLES"
   [ -n "$MIRROR" ]              && echo "MIRROR='$(sed "s,','\\\\'',g" <<<"${MIRROR}")'"                           >> "$CHROOT_VARIABLES"
   [ -n "$MKFS" ]                && echo "MKFS='$(sed "s,','\\\\'',g" <<<"${MKFS}")'"                               >> "$CHROOT_VARIABLES"
   [ -n "$NOPASSWORD" ]          && echo "NOPASSWORD=\"true\""                                                      >> "$CHROOT_VARIABLES"
@@ -1699,9 +1710,6 @@ preparechroot() {
   # make sure we can access network [relevant for cdebootstrap/mmdebstrap]
   [ -f "${MNTPOINT}"/etc/resolv.conf ] || cp $VERBOSE /etc/resolv.conf "${MNTPOINT}"/etc/resolv.conf
 
-  # setup default locales
-  [ -n "$LOCALES" ] && cp $VERBOSE "${CONFFILES}"/locale.gen "${MNTPOINT}"/etc/locale.gen
-
   # MAKEDEV is just a forking bomb crap, let's do it on our own instead :)
   ( cd "${MNTPOINT}"/dev && tar zxf /etc/debootstrap/devices.tar.gz )
 
index 5f909bc..168b929 100644 (file)
@@ -347,10 +347,6 @@ line arguments.
 The script executed within the new Debian system as soon as the main system
 has been installed via [c]debootstrap.
 
-  /etc/debootstrap/locale.gen
-
-Defines the default locales used for generating locales via locale-gen.
-
   /etc/debootstrap/packages
 
 Defines the software packages which should be installed in the new
diff --git a/locale.gen b/locale.gen
deleted file mode 100644 (file)
index e9f28ba..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-# This file lists locales that you wish to have built. You can find a list
-# of valid supported locales at /usr/share/i18n/SUPPORTED, and you can add
-# user defined locales to /usr/local/share/i18n/SUPPORTED. If you change
-# this file, you need to rerun locale-gen.
-
-en_US.UTF-8 UTF-8