root/morphix/trunk/gfxboot-grub/dia_install.inc

Revision 2, 6.6 kB (checked in by nextime, 2 years ago)

Initial import, branching from morphix svn

Line 
1 % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2 %
3 % Install mode selection dialog.
4 %
5 % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
6
7
8 % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
9 % Some global vars.
10 %
11 /install.last    0 def
12
13 /install.option 255 string def
14
15 % install types
16 /.inst_cdrom    0 def
17 /.inst_slp      1 def
18 /.inst_ftp      2 def
19 /.inst_http     3 def
20 /.inst_nfs      4 def
21 /.inst_smb      5 def
22 /.inst_hd       6 def
23
24
25 % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
26 % Build install mode list.
27 %
28 % ( ) ==> ( )
29 %
30 /install.init {
31   /xmenu.install .xm_size array def
32
33   /xmenu xmenu.install def
34
35   xmenu .xm_current 0 put
36
37   % see install types (.inst_*)
38   xmenu .xm_list [ is_dvd { "DVD" } { "CD-ROM" } ifelse "SLP" "FTP" "HTTP" "NFS" "SMB" txt_harddisk ] put
39
40   pmenu.init
41 } def
42
43
44 % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
45 % Update install mode.
46 %
47 % ( ) ==> ( )
48 %
49 /install.update {
50   /xmenu xmenu.install def
51
52   xmenu .xm_current get dup .inst_cdrom eq exch .inst_slp eq or {
53     /install.last xmenu .xm_current get def
54
55     install.option install.last .inst_cdrom eq { "" } { "install=slp" } ifelse strcpy
56
57     /window.action actRedrawPanel def
58
59     pmenu.update
60   } {
61     install.dialog
62   }
63   ifelse
64 } def
65
66
67 % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
68 % Show install menu.
69 %
70 % ( ) => ( )
71 %
72 /panel.install {
73   "install_src" help.setcontext
74
75   window.xmenu
76   dup .xmenu xmenu.install put
77   dup .xmenu.update /install.update put
78   dup window.init
79       window.show
80 } def
81
82
83 % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
84 % Return width of panel entry.
85 %
86 % ( ) => ( width )
87 %
88 /panel.install.width {
89   /xmenu xmenu.install def
90
91   pmenu.width
92 } def
93
94
95 % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
96 % Redraw panel entry.
97 %
98 % ( panel ) => ( )
99 %
100 /panel.install.update {
101   /xmenu xmenu.install def
102
103   pmenu.panel.update
104 } def
105
106
107 % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
108 % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
109
110
111 /install.dialog {
112
113   /dia window.dialog def
114
115   xmenu .xm_current get
116
117   dup .inst_hd eq {
118     input.dialog.hd {
119       /dia input.dialog.hd def
120     } {
121       /input.dialog.hd window.dialog def
122       /dia input.dialog.hd def
123
124       dia .dont_free 1 put
125
126       dia .title txt_harddisk_title put
127       dia .text "" put
128
129       % Must all be of same size!
130       dia .ed.list 2 array put
131       dia .ed.buffer.list [ 63 string 127 string ] put
132       dia .ed.text.list [ txt_hd_diskdevice txt_directory ] put
133
134       dia .ed.focus 0 put
135     } ifelse
136   } if
137
138   dup .inst_ftp eq {
139     input.dialog.ftp {
140       /dia input.dialog.ftp def
141     } {
142       /input.dialog.ftp window.dialog def
143       /dia input.dialog.ftp def
144
145       dia .dont_free 1 put
146
147       dia .title txt_ftp_title put
148       dia .text "" put
149
150       % Must all be of same size!
151       dia .ed.list 4 array put
152       dia .ed.buffer.list [ 63 string 127 string 31 string 31 string ] put
153       dia .ed.text.list [ txt_server txt_directory txt_user1 txt_password ] put
154
155       dia .ed.focus 0 put
156     } ifelse
157   } if
158
159   dup .inst_http eq {
160     input.dialog.http {
161       /dia input.dialog.http def
162     } {
163       /input.dialog.http window.dialog def
164       /dia input.dialog.http def
165
166       dia .dont_free 1 put
167
168       dia .title txt_http_title put
169       dia .text "" put
170
171       % Must all be of same size!
172       dia .ed.list 2 array put
173       dia .ed.buffer.list [ 63 string 127 string ] put
174       dia .ed.text.list [ txt_server txt_directory ] put
175
176       dia .ed.focus 0 put
177     } ifelse
178   } if
179
180   dup .inst_nfs eq {
181     input.dialog.nfs {
182       /dia input.dialog.nfs def
183     } {
184       /input.dialog.nfs window.dialog def
185       /dia input.dialog.nfs def
186
187       dia .dont_free 1 put
188
189       dia .title txt_nfs_title put
190       dia .text "" put
191
192       % Must all be of same size!
193       dia .ed.list 2 array put
194       dia .ed.buffer.list [ 63 string 127 string ] put
195       dia .ed.text.list [ txt_server txt_directory ] put
196
197       dia .ed.focus 0 put
198     } ifelse
199   } if
200
201   dup .inst_smb eq {
202     input.dialog.smb {
203       /dia input.dialog.smb def
204     } {
205       /input.dialog.smb window.dialog def
206       /dia input.dialog.smb def
207
208       dia .dont_free 1 put
209
210       dia .title txt_smb_title put
211       dia .text "" put
212
213       % Must all be of same size!
214       dia .ed.list 4 array put
215       dia .ed.buffer.list [ 63 string 127 string 31 string 31 string ] put
216       dia .ed.text.list [ txt_server txt_directory txt_user2 txt_password ] put
217
218       dia .ed.focus 0 put
219     } ifelse
220   } if
221
222   pop
223
224   dia .ed.width 240 put
225
226   dia .buttons [
227     button.ok button.default actInstallOK actNoClose or button.setaction
228     button.cancel button.notdefault actInstallCancel button.setaction
229   ] put
230
231   dia window.init
232   dia window.show
233
234 } def
235
236
237
238 /install.ok {
239   /xmenu xmenu.install def
240
241   window.done
242
243   /install.last xmenu .xm_current get def
244
245   /window.action actRedrawPanel def
246
247   pmenu.update
248
249   xmenu .xm_current get
250
251   dup .inst_hd eq {
252     input.dialog.hd .ed.buffer.list get
253     dup 1 get dup 0 get '/' eq { 1 add } if
254     exch 0 get dup 0 get '/' eq { 1 add } if
255     "install=hd://%s/%s" install.option sprintf
256   } if
257
258   dup .inst_ftp eq {
259     input.dialog.ftp .ed.buffer.list get
260
261     "install=ftp://" install.option sprintf
262
263     % add user name & password
264     dup 2 get "" ne {
265       dup 2 get "%s" install.option dup length add sprintf
266       dup 3 get "" ne {
267         dup 3 get ":%s" install.option dup length add sprintf
268       } if
269       "@" install.option dup length add sprintf
270     } if
271
272     dup 1 get exch 0 get "%s/%s" install.option dup length add sprintf
273   } if
274
275   dup .inst_http eq {
276     input.dialog.http .ed.buffer.list get
277     dup 1 get dup 0 get '/' eq { 1 add } if
278     exch 0 get
279     "install=http://%s/%s" install.option sprintf
280   } if
281
282   dup .inst_nfs eq {
283     input.dialog.nfs .ed.buffer.list get
284     dup 1 get dup 0 get '/' eq { 1 add } if
285     exch 0 get
286     "install=nfs://%s/%s" install.option sprintf
287   } if
288
289   dup .inst_smb eq {
290     input.dialog.smb .ed.buffer.list get
291
292     "install=smb://" install.option sprintf
293
294     % add user name & password
295     dup 2 get "" ne {
296       dup 2 get "%s" install.option dup length add sprintf
297       dup 3 get "" ne {
298         dup 3 get ":%s" install.option dup length add sprintf
299       } if
300       "@" install.option dup length add sprintf
301     } if
302
303     dup 1 get exch 0 get "%s/%s" install.option dup length add sprintf
304   } if
305
306   pop
307
308 } def
309
310
311 /install.cancel {
312   /xmenu xmenu.install def
313
314   xmenu .xm_current install.last put
315
316 %  /window.action actRedrawPanel def
317 %  pmenu.update
318 } def
319
Note: See TracBrowser for help on using the browser.