Annotation of /trunk/installer/ncurses-gui/locales.sh
Parent Directory | Revision Log
Revision 1480 -
(hide annotations)
(download)
(as text)
Wed Aug 3 17:10:03 2011 UTC (12 years, 9 months ago) by niro
File MIME type: application/x-sh
File size: 2263 byte(s)
Wed Aug 3 17:10:03 2011 UTC (12 years, 9 months ago) by niro
File MIME type: application/x-sh
File size: 2263 byte(s)
-check if localedef --list-archive contains data or die
1 | niro | 1013 | # $Id$ |
2 | |||
3 | select_timezone_region() | ||
4 | { | ||
5 | niro | 1034 | local items=( $(${INSTALLER_DIR}/include/timezone.sh --regions) ) |
6 | niro | 1013 | local count=${#items[*]} |
7 | local i | ||
8 | |||
9 | dialog \ | ||
10 | --stdout \ | ||
11 | --colors \ | ||
12 | --title "Setup TZ-Data" \ | ||
13 | --backtitle "${TITLE}" \ | ||
14 | --menu "Select a Region" \ | ||
15 | 0 0 ${count} \ | ||
16 | $(for (( i=0; i<count; i++ )); do echo "${items[$i]} ."; done) | ||
17 | |||
18 | return $? | ||
19 | } | ||
20 | |||
21 | select_timezone_location() | ||
22 | { | ||
23 | niro | 1034 | local items=( $(${INSTALLER_DIR}/include/timezone.sh --locations ${TIMEZONE_REGION}) ) |
24 | niro | 1013 | local count=${#items[*]} |
25 | local i | ||
26 | |||
27 | dialog \ | ||
28 | --stdout \ | ||
29 | --colors \ | ||
30 | --title "Setup TZ-Data" \ | ||
31 | --backtitle "${TITLE}" \ | ||
32 | --menu "Select a Location" \ | ||
33 | 0 0 ${count} \ | ||
34 | $(for (( i=0; i<count; i++ )); do echo "${items[$i]} ."; done) | ||
35 | |||
36 | return $? | ||
37 | } | ||
38 | |||
39 | select_locale() | ||
40 | { | ||
41 | niro | 1480 | local items |
42 | local count | ||
43 | niro | 1013 | local i |
44 | niro | 1480 | local retval |
45 | niro | 1013 | |
46 | niro | 1480 | if [[ -z $(localedef --list-archive) ]] |
47 | then | ||
48 | echo "Error: No locales found on this system!" | ||
49 | retval=255 | ||
50 | else | ||
51 | items=( $(localedef --list-archive | grep $(${INSTALLER_DIR}/include/timezone.sh --get-code ${TIMEZONE_LOCATION})) ) | ||
52 | count=${#items[*]} | ||
53 | niro | 1013 | |
54 | niro | 1480 | dialog \ |
55 | --stdout \ | ||
56 | --colors \ | ||
57 | --backtitle "${TITLE}" \ | ||
58 | --menu "Select a default locale" \ | ||
59 | 0 0 ${count} \ | ||
60 | $(for (( i=0; i<count; i++ )); do echo "${items[$i]} ."; done) | ||
61 | retval=$? | ||
62 | fi | ||
63 | |||
64 | return ${retval} | ||
65 | niro | 1013 | } |
66 | |||
67 | rundialog_select_timezone_region() | ||
68 | { | ||
69 | TIMEZONE_REGION=$(select_timezone_region) | ||
70 | case $? in | ||
71 | -1) die "Error!" ;; | ||
72 | 255) die "aborted by user" ;; | ||
73 | |||
74 | 1) | ||
75 | rundialog_select_timezone_region | ||
76 | ;; | ||
77 | |||
78 | 0) export TIMEZONE_REGION ;; | ||
79 | esac | ||
80 | |||
81 | debug "TIMEZONE_REGION='${TIMEZONE_REGION}'" | ||
82 | } | ||
83 | |||
84 | rundialog_select_timezone_location() | ||
85 | { | ||
86 | TIMEZONE_LOCATION=$(select_timezone_location) | ||
87 | case $? in | ||
88 | -1) die "Error!" ;; | ||
89 | 255) die "aborted by user" ;; | ||
90 | |||
91 | 1) | ||
92 | rundialog_select_timezone_region | ||
93 | rundialog_select_timezone_location | ||
94 | ;; | ||
95 | |||
96 | 0) export TIMEZONE_LOCATION ;; | ||
97 | esac | ||
98 | |||
99 | debug "TIMEZONE_LOCATION='${TIMEZONE_LOCATION}'" | ||
100 | } | ||
101 | |||
102 | rundialog_select_locale() | ||
103 | { | ||
104 | LOCALE=$(select_locale) | ||
105 | case $? in | ||
106 | -1) die "Error!" ;; | ||
107 | 255) die "aborted by user" ;; | ||
108 | |||
109 | 1) | ||
110 | rundialog_select_timezone_location | ||
111 | rundialog_select_locale | ||
112 | ;; | ||
113 | |||
114 | 0) export LOCALE ;; | ||
115 | esac | ||
116 | |||
117 | debug "LOCALE='${LOCALE}'" | ||
118 | } | ||
119 | |||
120 | main_locales() | ||
121 | { | ||
122 | rundialog_select_timezone_region | ||
123 | rundialog_select_timezone_location | ||
124 | rundialog_select_locale | ||
125 | } |
Properties
Name | Value |
---|---|
svn:keywords | Id |