Contents of /tags/installer-simple-0_4_90_20140108_1/functions/common-dialogs.sh
Parent Directory | Revision Log
Revision 2395 -
(show annotations)
(download)
(as text)
Tue Jan 7 12:59:51 2014 UTC (10 years, 8 months ago) by niro
Original Path: trunk/installer-simple/functions/common-dialogs.sh
File MIME type: application/x-sh
File size: 3753 byte(s)
Tue Jan 7 12:59:51 2014 UTC (10 years, 8 months ago) by niro
Original Path: trunk/installer-simple/functions/common-dialogs.sh
File MIME type: application/x-sh
File size: 3753 byte(s)
-added infobox() function to print infoboxes
1 | # $Id$ |
2 | |
3 | OK_LABEL=$"Next" |
4 | CANCEL_LABEL=$"Back" |
5 | |
6 | # common dialog boxes |
7 | messagebox() |
8 | { |
9 | local header |
10 | local text |
11 | local height |
12 | local width |
13 | |
14 | # very basic getops |
15 | local OPTIND opt |
16 | while getopts ":h:y:x:" opt |
17 | do |
18 | case ${opt} in |
19 | h) header="${OPTARG}" ;; |
20 | y) height="${OPTARG}" ;; |
21 | x) width="${OPTARG}" ;; |
22 | esac |
23 | done |
24 | shift $((OPTIND-1)) |
25 | text="$@" |
26 | |
27 | #[[ -z ${header} ]] && die "no header given" |
28 | [[ -z ${text} ]] && die "no text given" |
29 | [[ -z ${height} ]] && height=8 |
30 | [[ -z ${width} ]] && width=70 |
31 | |
32 | [[ -z ${OK_LABEL} ]] && OK_LABEL="Next" |
33 | |
34 | dialog \ |
35 | --colors \ |
36 | --title "${header}" \ |
37 | --backtitle "${TITLE}" \ |
38 | --ok-label "${OK_LABEL}" \ |
39 | --msgbox "${text}" "${height}" "${width}" |
40 | } |
41 | |
42 | infobox() |
43 | { |
44 | local header |
45 | local text |
46 | local height |
47 | local width |
48 | |
49 | # very basic getops |
50 | local OPTIND opt |
51 | while getopts ":h:y:x:" opt |
52 | do |
53 | case ${opt} in |
54 | h) header="${OPTARG}" ;; |
55 | y) height="${OPTARG}" ;; |
56 | x) width="${OPTARG}" ;; |
57 | esac |
58 | done |
59 | shift $((OPTIND-1)) |
60 | text="$@" |
61 | |
62 | #[[ -z ${header} ]] && die "no header given" |
63 | [[ -z ${text} ]] && die "no text given" |
64 | [[ -z ${height} ]] && height=3 |
65 | [[ -z ${width} ]] && width=70 |
66 | |
67 | dialog \ |
68 | --colors \ |
69 | --title "${header}" \ |
70 | --backtitle "${TITLE}" \ |
71 | --infobox "${text}" "${height}" "${width}" |
72 | } |
73 | |
74 | inputbox() |
75 | { |
76 | local header |
77 | local text |
78 | local height |
79 | local width |
80 | |
81 | # very basic getops |
82 | local OPTIND opt |
83 | while getopts ":h:y:x:" opt |
84 | do |
85 | case ${opt} in |
86 | h) header="${OPTARG}" ;; |
87 | y) height="${OPTARG}" ;; |
88 | x) width="${OPTARG}" ;; |
89 | esac |
90 | done |
91 | shift $((OPTIND-1)) |
92 | text="$@" |
93 | |
94 | #[[ -z ${header} ]] && die "no header given" |
95 | [[ -z ${text} ]] && die "no text given" |
96 | [[ -z ${height} ]] && height=0 |
97 | [[ -z ${width} ]] && width=0 |
98 | |
99 | dialog \ |
100 | --stdout \ |
101 | --colors \ |
102 | --title "${header}" \ |
103 | --backtitle "${TITLE}" \ |
104 | --inputbox "${text}" "${height}" "${width}" |
105 | } |
106 | |
107 | passwordbox() |
108 | { |
109 | local header |
110 | local text |
111 | local height |
112 | local width |
113 | |
114 | # very basic getops |
115 | local OPTIND opt |
116 | while getopts ":h:y:x:" opt |
117 | do |
118 | case ${opt} in |
119 | h) header="${OPTARG}" ;; |
120 | y) height="${OPTARG}" ;; |
121 | x) width="${OPTARG}" ;; |
122 | esac |
123 | done |
124 | shift $((OPTIND-1)) |
125 | text="$@" |
126 | |
127 | #[[ -z ${header} ]] && die "no header given" |
128 | [[ -z ${text} ]] && die "no text given" |
129 | [[ -z ${height} ]] && height=0 |
130 | [[ -z ${width} ]] && width=0 |
131 | |
132 | dialog \ |
133 | --stdout \ |
134 | --colors \ |
135 | --title "${header}" \ |
136 | --backtitle "${TITLE}" \ |
137 | --insecure \ |
138 | --passwordbox "${text}" "${height}" "${width}" |
139 | } |
140 | |
141 | gaugebox() |
142 | { |
143 | local header |
144 | local text |
145 | local height |
146 | local width |
147 | |
148 | # very basic getops |
149 | local OPTIND opt |
150 | while getopts ":h:y:x:" opt |
151 | do |
152 | case ${opt} in |
153 | h) header="${OPTARG}" ;; |
154 | y) height="${OPTARG}" ;; |
155 | x) width="${OPTARG}" ;; |
156 | esac |
157 | done |
158 | shift $((OPTIND-1)) |
159 | text="$@" |
160 | |
161 | #[[ -z ${header} ]] && die "no header given" |
162 | [[ -z ${text} ]] && die "no text given" |
163 | [[ -z ${height} ]] && height=0 |
164 | [[ -z ${width} ]] && width=70 |
165 | |
166 | dialog \ |
167 | --colors \ |
168 | --title "${header}" \ |
169 | --backtitle "${TITLE}" \ |
170 | --gauge "${text}" "${height}" "${width}" |
171 | } |
172 | |
173 | yesnobox() |
174 | { |
175 | local header |
176 | local text |
177 | local height |
178 | local width |
179 | |
180 | # very basic getops |
181 | local OPTIND opt |
182 | while getopts ":h:y:x:" opt |
183 | do |
184 | case ${opt} in |
185 | h) header="${OPTARG}" ;; |
186 | y) height="${OPTARG}" ;; |
187 | x) width="${OPTARG}" ;; |
188 | esac |
189 | done |
190 | shift $((OPTIND-1)) |
191 | text="$@" |
192 | |
193 | #[[ -z ${header} ]] && die "no header given" |
194 | [[ -z ${text} ]] && die "no text given" |
195 | [[ -z ${height} ]] && height=0 |
196 | [[ -z ${width} ]] && width=0 |
197 | |
198 | dialog \ |
199 | --colors \ |
200 | --title "${header}" \ |
201 | --backtitle "${TITLE}" \ |
202 | --defaultno \ |
203 | --yesno "${text}" "${height}" "${width}" |
204 | } |
205 | |
206 | welcome() { messagebox "Welcome" "Welcome to the ${DEFAULT_TITLE}.\n\n\nPress [Enter] to continue." 10 45; } |
207 | finish() { OK_LABEL="Exit" messagebox "Finish" "Installation was successfully finished." 10 40; } |