##// END OF EJS Templates
Fixed timezone setting
Daniel Kraemer -
r605:c2b6e4a512a6
parent child
Show More
@@ -1,58 +1,66
1 #
1 #
2 # Setup Locales and keyboard settings
2 # Setup Locales and keyboard settings
3 #
3 #
4
4
5 # Load utility functions
5 # Load utility functions
6 . ./functions.sh
6 . ./functions.sh
7
7
8 # Install and setup timezone
8 # Install and setup timezone
9 echo "${TIMEZONE}" > "${ETC_DIR}/timezone"
9 echo "${TIMEZONE}" > "${ETC_DIR}/timezone"
10 if [ -f "${ETC_DIR}/localtime" ]; then
11 # 1. If 11-apt.sh upgrades the package 'tzdata', '/etc/localtime' was created
12 # because 'dpkg-reconfigure -f noninteractive tzdata' was executed by apt-get.
13 # 2. If '/etc/localtime' exists, our execution of 'dpkg-reconfigure -f noninteractive tzdata'
14 # will ignore the our timezone set in '/etc/timezone'.
15 # 3. Removing /etc/localtime will solve this.
16 rm -f "${ETC_DIR}/localtime"
17 fi
10 chroot_exec dpkg-reconfigure -f noninteractive tzdata
18 chroot_exec dpkg-reconfigure -f noninteractive tzdata
11
19
12 # Install and setup default locale and keyboard configuration
20 # Install and setup default locale and keyboard configuration
13 if [ "$(echo "$APT_INCLUDES" | grep ",locales")" ] ; then
21 if [ "$(echo "$APT_INCLUDES" | grep ",locales")" ] ; then
14 # Set locale choice in debconf db, even though dpkg-reconfigure ignores and overwrites them due to some bug
22 # Set locale choice in debconf db, even though dpkg-reconfigure ignores and overwrites them due to some bug
15 # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=684134 https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=685957
23 # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=684134 https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=685957
16 # ... so we have to set locales manually
24 # ... so we have to set locales manually
17 if [ "$DEFLOCAL" = "en_US.UTF-8" ] ; then
25 if [ "$DEFLOCAL" = "en_US.UTF-8" ] ; then
18 chroot_exec echo "locales locales/locales_to_be_generated multiselect ${DEFLOCAL} UTF-8" | debconf-set-selections
26 chroot_exec echo "locales locales/locales_to_be_generated multiselect ${DEFLOCAL} UTF-8" | debconf-set-selections
19 else
27 else
20 # en_US.UTF-8 should be available anyway : https://www.debian.org/doc/manuals/debian-reference/ch08.en.html#_the_reconfiguration_of_the_locale
28 # en_US.UTF-8 should be available anyway : https://www.debian.org/doc/manuals/debian-reference/ch08.en.html#_the_reconfiguration_of_the_locale
21 chroot_exec echo "locales locales/locales_to_be_generated multiselect en_US.UTF-8 UTF-8, ${DEFLOCAL} UTF-8" | debconf-set-selections
29 chroot_exec echo "locales locales/locales_to_be_generated multiselect en_US.UTF-8 UTF-8, ${DEFLOCAL} UTF-8" | debconf-set-selections
22 sed -i "/en_US.UTF-8/s/^#//" "${ETC_DIR}/locale.gen"
30 sed -i "/en_US.UTF-8/s/^#//" "${ETC_DIR}/locale.gen"
23 fi
31 fi
24
32
25 sed -i "/${DEFLOCAL}/s/^#//" "${ETC_DIR}/locale.gen"
33 sed -i "/${DEFLOCAL}/s/^#//" "${ETC_DIR}/locale.gen"
26 chroot_exec echo "locales locales/default_environment_locale select ${DEFLOCAL}" | debconf-set-selections
34 chroot_exec echo "locales locales/default_environment_locale select ${DEFLOCAL}" | debconf-set-selections
27 chroot_exec locale-gen
35 chroot_exec locale-gen
28 chroot_exec update-locale LANG="${DEFLOCAL}"
36 chroot_exec update-locale LANG="${DEFLOCAL}"
29
37
30 # Install and setup default keyboard configuration
38 # Install and setup default keyboard configuration
31 if [ "$XKB_MODEL" != "" ] ; then
39 if [ "$XKB_MODEL" != "" ] ; then
32 sed -i "s/^XKBMODEL.*/XKBMODEL=\"${XKB_MODEL}\"/" "${ETC_DIR}/default/keyboard"
40 sed -i "s/^XKBMODEL.*/XKBMODEL=\"${XKB_MODEL}\"/" "${ETC_DIR}/default/keyboard"
33 fi
41 fi
34 if [ "$XKB_LAYOUT" != "" ] ; then
42 if [ "$XKB_LAYOUT" != "" ] ; then
35 sed -i "s/^XKBLAYOUT.*/XKBLAYOUT=\"${XKB_LAYOUT}\"/" "${ETC_DIR}/default/keyboard"
43 sed -i "s/^XKBLAYOUT.*/XKBLAYOUT=\"${XKB_LAYOUT}\"/" "${ETC_DIR}/default/keyboard"
36 fi
44 fi
37 if [ "$XKB_VARIANT" != "" ] ; then
45 if [ "$XKB_VARIANT" != "" ] ; then
38 sed -i "s/^XKBVARIANT.*/XKBVARIANT=\"${XKB_VARIANT}\"/" "${ETC_DIR}/default/keyboard"
46 sed -i "s/^XKBVARIANT.*/XKBVARIANT=\"${XKB_VARIANT}\"/" "${ETC_DIR}/default/keyboard"
39 fi
47 fi
40 if [ "$XKB_OPTIONS" != "" ] ; then
48 if [ "$XKB_OPTIONS" != "" ] ; then
41 sed -i "s/^XKBOPTIONS.*/XKBOPTIONS=\"${XKB_OPTIONS}\"/" "${ETC_DIR}/default/keyboard"
49 sed -i "s/^XKBOPTIONS.*/XKBOPTIONS=\"${XKB_OPTIONS}\"/" "${ETC_DIR}/default/keyboard"
42 fi
50 fi
43 chroot_exec dpkg-reconfigure -f noninteractive keyboard-configuration
51 chroot_exec dpkg-reconfigure -f noninteractive keyboard-configuration
44
52
45 # Install and setup font console
53 # Install and setup font console
46 case "${DEFLOCAL}" in
54 case "${DEFLOCAL}" in
47 *UTF-8)
55 *UTF-8)
48 sed -i 's/^CHARMAP.*/CHARMAP="UTF-8"/' "${ETC_DIR}/default/console-setup"
56 sed -i 's/^CHARMAP.*/CHARMAP="UTF-8"/' "${ETC_DIR}/default/console-setup"
49 ;;
57 ;;
50 *)
58 *)
51 sed -i 's/^CHARMAP.*/CHARMAP="guess"/' "${ETC_DIR}/default/console-setup"
59 sed -i 's/^CHARMAP.*/CHARMAP="guess"/' "${ETC_DIR}/default/console-setup"
52 ;;
60 ;;
53 esac
61 esac
54 chroot_exec dpkg-reconfigure -f noninteractive console-setup
62 chroot_exec dpkg-reconfigure -f noninteractive console-setup
55 else # (no locales were installed)
63 else # (no locales were installed)
56 # Install POSIX default locale
64 # Install POSIX default locale
57 install_readonly files/locales/locale "${ETC_DIR}/default/locale"
65 install_readonly files/locales/locale "${ETC_DIR}/default/locale"
58 fi
66 fi
General Comments 0
Vous devez vous connecter pour laisser un commentaire. Se connecter maintenant