aboutsummaryrefslogtreecommitdiff
path: root/bootstrap.d/12-locale.sh
diff options
context:
space:
mode:
authorVincent Knecht <vincent.knecht@mailoo.org>2016-03-12 00:54:23 +0100
committerVincent Knecht <vincent.knecht@mailoo.org>2016-03-12 00:54:23 +0100
commit061173da65b0b6061d7fa46066c69737bc4957fe (patch)
treec472df2edb495adb8e0a9012de5bb14242865f82 /bootstrap.d/12-locale.sh
parent54acc1e70a3e357d0c60e4d9a9afd99077edce84 (diff)
parent80185bd93dd9eecb1b41ef8ac9a186aff19ab33e (diff)
downloadrpi2-gen-image-061173da65b0b6061d7fa46066c69737bc4957fe.tar.gz
rpi2-gen-image-061173da65b0b6061d7fa46066c69737bc4957fe.tar.bz2
rpi2-gen-image-061173da65b0b6061d7fa46066c69737bc4957fe.zip
Added ENABLE_SPLITFS option to produce distinct /boot/firmware and root images
Diffstat (limited to 'bootstrap.d/12-locale.sh')
-rw-r--r--bootstrap.d/12-locale.sh52
1 files changed, 52 insertions, 0 deletions
diff --git a/bootstrap.d/12-locale.sh b/bootstrap.d/12-locale.sh
new file mode 100644
index 0000000..de1ecc9
--- /dev/null
+++ b/bootstrap.d/12-locale.sh
@@ -0,0 +1,52 @@
+#
+# Setup locales and keyboard settings
+#
+
+. ./functions.sh
+
+# Set up timezone
+echo ${TIMEZONE} >$R/etc/timezone
+chroot_exec dpkg-reconfigure -f noninteractive tzdata
+
+# Set up default locale and keyboard configuration
+if [ "$ENABLE_MINBASE" = false ] ; then
+ # Set locale choice in debconf db, even though dpkg-reconfigure ignores and overwrites them due to some bug
+ # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=684134 https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=685957
+ # ... so we have to set locales manually
+ if [ "$DEFLOCAL" = "en_US.UTF-8" ] ; then
+ chroot_exec echo "locales locales/locales_to_be_generated multiselect ${DEFLOCAL} UTF-8" | debconf-set-selections
+ else
+ # en_US.UTF-8 should be available anyway : https://www.debian.org/doc/manuals/debian-reference/ch08.en.html#_the_reconfiguration_of_the_locale
+ chroot_exec echo "locales locales/locales_to_be_generated multiselect en_US.UTF-8 UTF-8, ${DEFLOCAL} UTF-8" | debconf-set-selections
+ chroot_exec sed -i "/en_US.UTF-8/s/^#//" /etc/locale.gen
+ fi
+ chroot_exec sed -i "/${DEFLOCAL}/s/^#//" /etc/locale.gen
+ chroot_exec echo "locales locales/default_environment_locale select ${DEFLOCAL}" | debconf-set-selections
+ chroot_exec locale-gen
+ chroot_exec update-locale LANG=${DEFLOCAL}
+
+ # Keyboard configuration, if requested
+ if [ "$XKBMODEL" != "" ] ; then
+ chroot_exec sed -i "s/^XKBMODEL.*/XKBMODEL=\"${XKBMODEL}\"/" /etc/default/keyboard
+ fi
+ if [ "$XKBLAYOUT" != "" ] ; then
+ chroot_exec sed -i "s/^XKBLAYOUT.*/XKBLAYOUT=\"${XKBLAYOUT}\"/" /etc/default/keyboard
+ fi
+ if [ "$XKBVARIANT" != "" ] ; then
+ chroot_exec sed -i "s/^XKBVARIANT.*/XKBVARIANT=\"${XKBVARIANT}\"/" /etc/default/keyboard
+ fi
+ if [ "$XKBOPTIONS" != "" ] ; then
+ chroot_exec sed -i "s/^XKBOPTIONS.*/XKBOPTIONS=\"${XKBOPTIONS}\"/" /etc/default/keyboard
+ fi
+ chroot_exec dpkg-reconfigure -f noninteractive keyboard-configuration
+ # Set up font console
+ case "${DEFLOCAL}" in
+ *UTF-8)
+ chroot_exec sed -i 's/^CHARMAP.*/CHARMAP="UTF-8"/' /etc/default/console-setup
+ ;;
+ *)
+ chroot_exec sed -i 's/^CHARMAP.*/CHARMAP="guess"/' /etc/default/console-setup
+ ;;
+ esac
+ chroot_exec dpkg-reconfigure -f noninteractive console-setup
+fi