Releasing debian version 1.236.2-1.
[live-boot-grml.git] / scripts / live-bottom / 02timezone
1 #!/bin/sh
2
3 #set -e
4
5 # initramfs-tools header
6
7 PREREQ=""
8
9 prereqs()
10 {
11         echo "${PREREQ}"
12 }
13
14 case "${1}" in
15         prereqs)
16                 prereqs
17                 exit 0
18                 ;;
19 esac
20
21 # live-initramfs header
22
23 if [ -n "${NOTIMEZONE}" ]
24 then
25         exit 0
26 fi
27
28 . /scripts/live-functions
29
30 log_begin_msg "Setting timezone"
31
32 # live-initramfs script
33
34 if [ -n "${TIMEZONE}" ]
35 then
36         area="$(echo ${TIMEZONE} | cut -f1 -d '/')"
37         zone="$(echo ${TIMEZONE} | cut -f2 -d '/')"
38
39 chroot /root debconf-communicate -fnoninteractive live-initramfs > /dev/null << EOF
40 set tzdata/Areas ${area}
41 set tzdata/Zones/${area} ${zone}
42 EOF
43
44         cp -f /root/usr/share/zoneinfo/${area}/${zone} /root/etc/localtime
45 else
46
47 chroot /root debconf-communicate -fnoninteractive live-initramfs > /dev/null << EOF
48 set tzdata/Areas Etc
49 set tzdata/Zones/Etc UTC
50 EOF
51
52         cp -f /root/usr/share/zoneinfo/UTC /root/etc/localtime
53 fi
54
55 if [ -n "${UTC}" ]
56 then
57         sed -i -e "s/UTC=.*/UTC=${UTC}/" /root/etc/default/rcS
58 fi
59
60 log_end_msg