dad3cadcb9bbed7b112ff70d7fee2a332a683710
[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 . /scripts/live-functions
24
25 log_begin_msg "Setting timezone..."
26
27 # live-initramfs script
28
29 if [ -n "${TIMEZONE}" ]; then
30     area="$(echo ${TIMEZONE} | cut -f1 -d '/')"
31     zone="$(echo ${TIMEZONE} | cut -f2 -d '/')"
32     chroot /root debconf-communicate -fnoninteractive live-initramfs > /dev/null <<EOF
33 set tzdata/Areas $area
34 set tzdata/Zones/$area $zone
35 EOF
36     cp -f /root/usr/share/zoneinfo/${area}/${zone} /root/etc/localtime
37 else
38     chroot /root debconf-communicate -fnoninteractive live-initramfs > /dev/null <<EOF
39 set tzdata/Areas Etc
40 set tzdata/Zones/Etc UTC
41 EOF
42     cp -f /root/usr/share/zoneinfo/UTC /root/etc/localtime
43 fi
44
45 if [ -n "${UTC}" ]
46 then
47         sed -i -e "s/UTC=.*/UTC=${UTC}/" /root/etc/default/rcS
48 fi
49
50 log_end_msg