Contents of /trunk/installer/include/timezone.sh
Parent Directory | Revision Log
Revision 1024 -
(show annotations)
(download)
(as text)
Sun May 30 17:40:21 2010 UTC (14 years, 4 months ago) by niro
File MIME type: application/x-sh
File size: 925 byte(s)
Sun May 30 17:40:21 2010 UTC (14 years, 4 months ago) by niro
File MIME type: application/x-sh
File size: 925 byte(s)
-fixed header
1 | #!/bin/bash |
2 | # $Id$ |
3 | |
4 | checklist() |
5 | { |
6 | local i |
7 | local item="$1" |
8 | |
9 | for i in ${LOCALE_LIST} |
10 | do |
11 | [[ ${i} = ${item} ]] && return 1 |
12 | done |
13 | |
14 | return 0 |
15 | } |
16 | |
17 | |
18 | while read code coordinates tz comments |
19 | do |
20 | # excludes |
21 | case ${code} in |
22 | \#*|'') continue ;; |
23 | esac |
24 | |
25 | region="${tz%%/*}" |
26 | location="${tz#*/}" |
27 | |
28 | if [[ $1 = --regions ]] |
29 | then |
30 | if checklist "${region}" |
31 | then |
32 | LOCALE_LIST="${LOCALE_LIST} ${region}" |
33 | fi |
34 | |
35 | elif [[ $1 = --locations ]] |
36 | then |
37 | [[ ${region} != $2 ]] && continue |
38 | if checklist "${location}" |
39 | then |
40 | LOCALE_LIST="${LOCALE_LIST} ${location}" |
41 | fi |
42 | |
43 | elif [[ $1 = --get-code ]] |
44 | then |
45 | [[ ${location} != $2 ]] && continue |
46 | # location is the same, so print the code |
47 | echo "${code}" |
48 | |
49 | elif [[ -z $1 ]] |
50 | then |
51 | echo "${tz}|${comments}" |
52 | fi |
53 | |
54 | done << EOF |
55 | $(cat /usr/share/zoneinfo/zone.tab | sort) |
56 | EOF |
57 | |
58 | |
59 | if [[ $1 = --regions ]] || [[ $1 = --locations ]] |
60 | then |
61 | for i in ${LOCALE_LIST} |
62 | do |
63 | echo "${i}" |
64 | done | sort |
65 | fi |
Properties
Name | Value |
---|---|
svn:executable | * |