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