Skip to content

Commit

Permalink
Default to C.UTF-8 locale and deprecate /etc/debootstrap/locale.gen, …
Browse files Browse the repository at this point in the history
…DEFAULT_LOCALES, LOCALES + DEFAULT_LANGUAGE (WIP)

Closes: #125
  • Loading branch information
mika committed Aug 21, 2019
1 parent 2b7cd25 commit 1bd9006
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 40 deletions.
1 change: 0 additions & 1 deletion Makefile
Expand Up @@ -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/
Expand Down
16 changes: 8 additions & 8 deletions chroot-script
Expand Up @@ -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
}
# }}}

Expand Down
12 changes: 0 additions & 12 deletions config
Expand Up @@ -179,18 +179,6 @@
# 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'
Expand Down
1 change: 1 addition & 0 deletions debian/grml-debootstrap.maintscript
@@ -1 +1,2 @@
rm_conffile /etc/zsh/completion.d/_grml-debootstrap 0.86~
rm_conffile /etc/debootstrap/locale.gen 0.89~
26 changes: 17 additions & 9 deletions grml-debootstrap
Expand Up @@ -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'
Expand All @@ -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=''
Expand Down Expand Up @@ -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."
Expand Down Expand Up @@ -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"
Expand All @@ -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"
Expand Down Expand Up @@ -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 )

Expand Down
4 changes: 0 additions & 4 deletions grml-debootstrap.8.txt
Expand Up @@ -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
Expand Down
6 changes: 0 additions & 6 deletions locale.gen

This file was deleted.

0 comments on commit 1bd9006

Please sign in to comment.