Magellan Linux

Annotation of /trunk/installer-simple/functions/common-dialogs.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2393 - (hide annotations) (download) (as text)
Tue Jan 7 12:56:52 2014 UTC (10 years, 4 months ago) by niro
File MIME type: application/x-sh
File size: 3194 byte(s)
-empty headers are allowed
1 niro 2337 # $Id$
2    
3 niro 2389 OK_LABEL=$"Next"
4     CANCEL_LABEL=$"Back"
5    
6 niro 2337 # common dialog boxes
7     messagebox()
8     {
9 niro 2392 local header
10     local text
11     local height
12     local width
13 niro 2337
14 niro 2392 # 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 niro 2393 #[[ -z ${header} ]] && die "no header given"
28 niro 2337 [[ -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 niro 2392 local header
45     local text
46     local height
47     local width
48 niro 2337
49 niro 2392 # 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 niro 2393 #[[ -z ${header} ]] && die "no header given"
63 niro 2337 [[ -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 niro 2392 local header
78     local text
79     local height
80     local width
81 niro 2337
82 niro 2392 # 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 niro 2393 #[[ -z ${header} ]] && die "no header given"
96 niro 2337 [[ -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 niro 2390 gaugebox()
110 niro 2337 {
111 niro 2392 local header
112     local text
113     local height
114     local width
115 niro 2337
116 niro 2392 # 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 niro 2393 #[[ -z ${header} ]] && die "no header given"
130 niro 2337 [[ -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 niro 2391 yesnobox()
142 niro 2337 {
143 niro 2392 local header
144     local text
145     local height
146     local width
147 niro 2337
148 niro 2392 # 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 niro 2393 #[[ -z ${header} ]] && die "no header given"
162 niro 2337 [[ -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; }