-
Notifications
You must be signed in to change notification settings - Fork 4
/
tzsetup
executable file
·61 lines (54 loc) · 1.8 KB
/
tzsetup
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#! /bin/sh
set -e
. /usr/share/debconf/confmodule
db_capb backup
/usr/lib/ubiquity/tzsetup/tzsetup
if [ -z "$UBIQUITY_OEM_USER_CONFIG" ]; then
# Set the timezone in the live system. (Cloned-and-hacked from
# tzsetup/post-base-installer.d/05tzsetup.)
db_get time/zone
zone="$RET"
if [ ! -e /usr/share/zoneinfo/$zone ]; then
logger -t tzsetup "Warning: ignoring invalid time zone '$zone'"
exit 0
fi
echo "$zone" > /etc/timezone
rm -f /etc/localtime
cp -f /usr/share/zoneinfo/$zone /etc/localtime
fi
if [ "$TZSETUP_NO_LOCALECHOOSER" ]; then
exit 0
fi
# Reconfigure locale according to the selected country. We rely on
# ubiquity/plugins/ubi-timezone.py having set debian-installer/country for
# us.
db_get debian-installer/country
country="$RET"
if (db_get mirror/country && [ -z "$RET" ]) || \
(db_fget mirror/country seen && [ "$RET" = false ]); then
db_set mirror/country "$country" || true
fi
db_get localechooser/languagelist
requested_lang="$RET"
case $requested_lang in
pt|pt_*|zh_*)
# Portuguese and Chinese are special cases; selecting a different
# location may imply a different dialect of the language. We will
# handle these separately (see scripts/localechooser-apply).
;;
*)
db_get debian-installer/locale
newlocale="$(echo "$RET" | sed "s/_[A-Z][A-Z]*/_$country/")"
if grep -q "^${newlocale%%[.@]*}[.@ ]" /usr/share/i18n/SUPPORTED; then
db_set debian-installer/locale "$newlocale"
db_fset debian-installer/locale seen true
# Let localechooser know that we're using the same language as
# before, so that it doesn't set a default country again.
db_fset localechooser/languagelist seen false
rm -f /var/lib/localechooser/preseeded
PATH="/usr/lib/ubiquity/localechooser:$PATH" \
OVERRIDE_SHOW_ALL_LANGUAGES=1 \
/usr/lib/ubiquity/localechooser/localechooser
fi
;;
esac