6 |
# common dialog boxes |
# common dialog boxes |
7 |
messagebox() |
messagebox() |
8 |
{ |
{ |
9 |
local header="$1" |
local header |
10 |
local text="$2" |
local text |
11 |
local height="$3" |
local height |
12 |
local width="$4" |
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" |
#[[ -z ${header} ]] && die "no header given" |
28 |
[[ -z ${text} ]] && die "no text given" |
[[ -z ${text} ]] && die "no text given" |
29 |
[[ -z ${height} ]] && height=0 |
[[ -z ${height} ]] && height=8 |
30 |
[[ -z ${width} ]] && width=0 |
[[ -z ${width} ]] && width=70 |
31 |
|
|
32 |
[[ -z ${OK_LABEL} ]] && OK_LABEL="Next" |
[[ -z ${OK_LABEL} ]] && OK_LABEL="Next" |
33 |
|
|
39 |
--msgbox "${text}" "${height}" "${width}" |
--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() |
inputbox() |
75 |
{ |
{ |
76 |
local header="$1" |
local header |
77 |
local text="$2" |
local text |
78 |
local height="$3" |
local height |
79 |
local width="$4" |
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" |
#[[ -z ${header} ]] && die "no header given" |
95 |
[[ -z ${text} ]] && die "no text given" |
[[ -z ${text} ]] && die "no text given" |
96 |
[[ -z ${height} ]] && height=0 |
[[ -z ${height} ]] && height=0 |
97 |
[[ -z ${width} ]] && width=0 |
[[ -z ${width} ]] && width=0 |
106 |
|
|
107 |
passwordbox() |
passwordbox() |
108 |
{ |
{ |
109 |
local header="$1" |
local header |
110 |
local text="$2" |
local text |
111 |
local height="$3" |
local height |
112 |
local width="$4" |
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" |
#[[ -z ${header} ]] && die "no header given" |
128 |
[[ -z ${text} ]] && die "no text given" |
[[ -z ${text} ]] && die "no text given" |
129 |
[[ -z ${height} ]] && height=0 |
[[ -z ${height} ]] && height=0 |
130 |
[[ -z ${width} ]] && width=0 |
[[ -z ${width} ]] && width=0 |
138 |
--passwordbox "${text}" "${height}" "${width}" |
--passwordbox "${text}" "${height}" "${width}" |
139 |
} |
} |
140 |
|
|
141 |
gauge() |
gaugebox() |
142 |
{ |
{ |
143 |
local header="$1" |
local header |
144 |
local text="$2" |
local text |
145 |
local height="$3" |
local height |
146 |
local width="$4" |
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" |
#[[ -z ${header} ]] && die "no header given" |
162 |
[[ -z ${text} ]] && die "no text given" |
[[ -z ${text} ]] && die "no text given" |
163 |
[[ -z ${height} ]] && height=0 |
[[ -z ${height} ]] && height=0 |
164 |
[[ -z ${width} ]] && width=0 |
[[ -z ${width} ]] && width=70 |
165 |
|
|
166 |
dialog \ |
dialog \ |
167 |
--colors \ |
--colors \ |
170 |
--gauge "${text}" "${height}" "${width}" |
--gauge "${text}" "${height}" "${width}" |
171 |
} |
} |
172 |
|
|
173 |
yesno() |
yesnobox() |
174 |
{ |
{ |
175 |
local header="$1" |
local header |
176 |
local text="$2" |
local text |
177 |
local height="$3" |
local height |
178 |
local width="$4" |
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" |
#[[ -z ${header} ]] && die "no header given" |
194 |
[[ -z ${text} ]] && die "no text given" |
[[ -z ${text} ]] && die "no text given" |
195 |
[[ -z ${height} ]] && height=0 |
[[ -z ${height} ]] && height=0 |
196 |
[[ -z ${width} ]] && width=0 |
[[ -z ${width} ]] && width=0 |