Contents of /trunk/installer-simple/functions/common-dialogs.sh
Parent Directory | Revision Log
Revision 2393 -
(show annotations)
(download)
(as text)
Tue Jan 7 12:56:52 2014 UTC (10 years, 8 months ago) by niro
File MIME type: application/x-sh
File size: 3194 byte(s)
Tue Jan 7 12:56:52 2014 UTC (10 years, 8 months ago) by niro
File MIME type: application/x-sh
File size: 3194 byte(s)
-empty headers are allowed
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=0 |
30 | [[ -z ${width} ]] && width=0 |
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 | inputbox() |
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=0 |
65 | [[ -z ${width} ]] && width=0 |
66 | |
67 | dialog \ |
68 | --stdout \ |
69 | --colors \ |
70 | --title "${header}" \ |
71 | --backtitle "${TITLE}" \ |
72 | --inputbox "${text}" "${height}" "${width}" |
73 | } |
74 | |
75 | passwordbox() |
76 | { |
77 | local header |
78 | local text |
79 | local height |
80 | local width |
81 | |
82 | # very basic getops |
83 | local OPTIND opt |
84 | while getopts ":h:y:x:" opt |
85 | do |
86 | case ${opt} in |
87 | h) header="${OPTARG}" ;; |
88 | y) height="${OPTARG}" ;; |
89 | x) width="${OPTARG}" ;; |
90 | esac |
91 | done |
92 | shift $((OPTIND-1)) |
93 | text="$@" |
94 | |
95 | #[[ -z ${header} ]] && die "no header given" |
96 | [[ -z ${text} ]] && die "no text given" |
97 | [[ -z ${height} ]] && height=0 |
98 | [[ -z ${width} ]] && width=0 |
99 | |
100 | dialog \ |
101 | --stdout \ |
102 | --colors \ |
103 | --title "${header}" \ |
104 | --backtitle "${TITLE}" \ |
105 | --insecure \ |
106 | --passwordbox "${text}" "${height}" "${width}" |
107 | } |
108 | |
109 | gaugebox() |
110 | { |
111 | local header |
112 | local text |
113 | local height |
114 | local width |
115 | |
116 | # very basic getops |
117 | local OPTIND opt |
118 | while getopts ":h:y:x:" opt |
119 | do |
120 | case ${opt} in |
121 | h) header="${OPTARG}" ;; |
122 | y) height="${OPTARG}" ;; |
123 | x) width="${OPTARG}" ;; |
124 | esac |
125 | done |
126 | shift $((OPTIND-1)) |
127 | text="$@" |
128 | |
129 | #[[ -z ${header} ]] && die "no header given" |
130 | [[ -z ${text} ]] && die "no text given" |
131 | [[ -z ${height} ]] && height=0 |
132 | [[ -z ${width} ]] && width=0 |
133 | |
134 | dialog \ |
135 | --colors \ |
136 | --title "${header}" \ |
137 | --backtitle "${TITLE}" \ |
138 | --gauge "${text}" "${height}" "${width}" |
139 | } |
140 | |
141 | yesnobox() |
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=0 |
165 | |
166 | dialog \ |
167 | --colors \ |
168 | --title "${header}" \ |
169 | --backtitle "${TITLE}" \ |
170 | --defaultno \ |
171 | --yesno "${text}" "${height}" "${width}" |
172 | } |
173 | |
174 | welcome() { messagebox "Welcome" "Welcome to the ${DEFAULT_TITLE}.\n\n\nPress [Enter] to continue." 10 45; } |
175 | finish() { OK_LABEL="Exit" messagebox "Finish" "Installation was successfully finished." 10 40; } |