rev |
line source |
domcox@0
|
1 #!/bin/sh
|
domcox@0
|
2 #
|
domcox@0
|
3 # Main CGI interface for Tazinst, the SliTaz installer.
|
domcox@0
|
4 #
|
domcox@2
|
5 # Copyright (C) 2012-2013 SliTaz GNU/Linux - BSD License
|
domcox@0
|
6 #
|
domcox@0
|
7 # Authors : Dominique Corbex <domcox@slitaz.org>
|
domcox@0
|
8 #
|
domcox@0
|
9
|
domcox@0
|
10
|
domcox@2
|
11 # restricted path
|
domcox@2
|
12 PATH="/usr/sbin:/usr/bin:/sbin:/bin"
|
domcox@0
|
13
|
domcox@2
|
14 VERSION=3.90
|
domcox@2
|
15
|
domcox@2
|
16 # panel location and theme
|
domcox@2
|
17 PANEL="/var/www/tazpanel"
|
domcox@2
|
18 STYLE="default"
|
domcox@2
|
19
|
domcox@2
|
20 # absolute paths to images
|
domcox@2
|
21 IMAGES="/styles/$STYLE/images"
|
domcox@2
|
22
|
domcox@2
|
23 # tazpanel config
|
domcox@2
|
24 [ -r /etc/slitaz/tazpanel.conf ] && . /etc/slitaz/tazpanel.conf
|
domcox@2
|
25
|
domcox@2
|
26 # include gettext helper script.
|
domcox@0
|
27 . /usr/bin/gettext.sh
|
domcox@0
|
28
|
domcox@2
|
29 # get parameters with GET, POST and FILE functions
|
domcox@2
|
30 . /usr/bin/httpd_helper.sh
|
domcox@0
|
31
|
domcox@2
|
32 # export package name for gettext.
|
domcox@2
|
33 TEXTDOMAIN='installer'
|
domcox@2
|
34 export TEXTDOMAIN
|
domcox@0
|
35
|
domcox@2
|
36 # tazinst required version
|
domcox@2
|
37 TAZINST_MINIMUM_VERSION="3.8"
|
domcox@2
|
38 TAZINST_MAXIMUM_VERSION="4.99"
|
domcox@0
|
39
|
domcox@2
|
40 # tazinst setup file
|
domcox@2
|
41 INSTFILE=/root/tazinst.conf
|
domcox@0
|
42
|
domcox@0
|
43
|
domcox@2
|
44 #-----------
|
domcox@2
|
45 # home page
|
domcox@2
|
46 #-----------
|
domcox@0
|
47
|
domcox@0
|
48 select_action()
|
domcox@0
|
49 {
|
domcox@2
|
50 comment "welcome message"
|
domcox@2
|
51 open_div_id "wrapper"
|
al@6
|
52 h4 $(gettext "Welcome to the Slitaz Installer!")
|
al@6
|
53 p $(gettext "The SliTaz Installer installs or upgrades SliTaz to a \
|
al@6
|
54 hard disk drive from a device like a Live-CD or LiveUSB key, from a SliTaz \
|
al@6
|
55 ISO file, or from the web by downloading an ISO file.")
|
al@6
|
56 h5 $(gettext "Which type of installation do you want to start?")
|
domcox@2
|
57 close_div
|
domcox@0
|
58 }
|
domcox@0
|
59
|
domcox@0
|
60 select_install()
|
domcox@0
|
61 {
|
domcox@2
|
62 comment "install message"
|
domcox@2
|
63 open_div_class "box"
|
al@6
|
64 h4 $(gettext "Install")
|
al@6
|
65 p $(gettext "Install SliTaz on a partition of your hard disk drive. If you \
|
al@6
|
66 decide to format your partition, all data will be lost. If you do not \
|
al@6
|
67 format, all data except for any existing /home directory will be removed, \
|
al@6
|
68 the home directory will be kept as is.")
|
al@6
|
69 p $(gettext "Before installation, you may need to create or resize \
|
al@6
|
70 partitions on your hard disk drive in order to make space for SliTaz \
|
al@6
|
71 GNU/Linux. You can graphically manage your partitions with Gparted")
|
domcox@2
|
72 close_div
|
al@6
|
73 button "install" \
|
al@6
|
74 "$(gettext 'Install SliTaz')" \
|
al@6
|
75 "$(gettext 'Proceed to a new SliTaz installation')"
|
domcox@0
|
76 }
|
domcox@0
|
77
|
domcox@0
|
78 select_upgrade()
|
domcox@0
|
79 {
|
domcox@2
|
80 comment "upgrade message"
|
domcox@2
|
81 open_div_class "box"
|
al@6
|
82 h4 $(gettext "Upgrade")
|
al@6
|
83 p $(gettext "Upgrade an already installed SliTaz system on your hard disk \
|
al@6
|
84 drive. Your /home /etc /var/www directories will be kept, all other \
|
al@6
|
85 directories will be removed. Any additional packages added to your old \
|
al@6
|
86 Slitaz system will be updated as long you have an active internet connection.")
|
domcox@2
|
87 close_div
|
al@6
|
88 button "upgrade" \
|
al@6
|
89 "$(gettext 'Upgrade SliTaz')" \
|
al@6
|
90 "$(gettext 'Upgrade an existing SliTaz system')"
|
domcox@2
|
91 }
|
domcox@0
|
92
|
domcox@2
|
93 #--------------------
|
domcox@2
|
94 # partitionning page
|
domcox@2
|
95 #--------------------
|
domcox@0
|
96
|
domcox@2
|
97 exec_gparted()
|
domcox@2
|
98 {
|
domcox@2
|
99 /bin/su - -c "exec env DISPLAY=':0.0' XAUTHORITY='/var/run/slim.auth' \
|
domcox@2
|
100 /usr/sbin/gparted"
|
domcox@0
|
101 }
|
domcox@0
|
102
|
domcox@0
|
103 select_gparted()
|
domcox@0
|
104 {
|
domcox@2
|
105 comment "gparted message"
|
al@6
|
106 h5 $(gettext "Partitioning")
|
domcox@2
|
107 open_div_class "box"
|
al@6
|
108 p $(gettext "On most used systems, the hard drive is already dedicated to \
|
al@6
|
109 partitions for Windows<sup>™</sup>, or Linux, or another operating \
|
al@6
|
110 system. You'll need to resize these partitions in order to make space for \
|
al@6
|
111 SliTaz GNU/Linux. SliTaz will co-exist with other operating systems already \
|
al@6
|
112 installed on your hard drive.")
|
al@6
|
113 p $(gettext "The amount of space needed depends on how much software you \
|
al@6
|
114 plan to install and how much space you require for users. It's conceivable \
|
al@6
|
115 that you could run a minimal SliTaz system in 300 megs or less, but 2 gigs \
|
al@6
|
116 is indeed more comfy.")
|
al@6
|
117 p $(gettext "A separate home partition, and a partition that will be used \
|
al@6
|
118 as Linux swap space may be created if needed. Slitaz detects and uses swap \
|
al@6
|
119 partitions automatically.")
|
domcox@2
|
120 close_div
|
domcox@2
|
121 open_div_class "box"
|
al@6
|
122 p $(gettext "You can graphically manage your partitions with GParted. \
|
al@6
|
123 GParted is a partition editor for graphically managing your disk partitions. \
|
al@6
|
124 GParted allows you to create, destroy, resize and copy partitions without \
|
al@6
|
125 data loss.")
|
al@6
|
126 p $(gettext "GParted supports ext2, ext3, ext4, linux swap, ntfs and fat32 \
|
al@6
|
127 filesystems right out of the box. Support for xjs, jfs, hfs and other \
|
al@6
|
128 filesystems is available as well but you first need to add drivers for these \
|
al@6
|
129 filesystems by installing the related packages xfsprogs, jfsutils, linux-hfs \
|
al@6
|
130 and so on.")
|
domcox@2
|
131 close_div
|
domcox@2
|
132 comment "launch GParted"
|
al@6
|
133 button "gparted" \
|
al@6
|
134 "$(gettext 'Execute GParted')" \
|
al@6
|
135 "$(gettext 'Launch GParted, the partition editor tool')"
|
al@6
|
136 h5 $(gettext "Continue installation")
|
al@6
|
137 p $(gettext "Once you've made room for SliTaz on your drive, you should be \
|
al@6
|
138 able to continue installation.")
|
domcox@0
|
139 }
|
domcox@0
|
140
|
domcox@2
|
141 #------------
|
domcox@2
|
142 # input page
|
domcox@2
|
143 #------------
|
domcox@2
|
144
|
domcox@2
|
145
|
domcox@2
|
146 select_source()
|
domcox@0
|
147 {
|
domcox@2
|
148 local media="$(/usr/sbin/tazinst get media "$INSTFILE")"
|
domcox@2
|
149 local source="$(/usr/sbin/tazinst get source "$INSTFILE")"
|
domcox@2
|
150 local list_media="$(/usr/sbin/tazinst list media)"
|
domcox@2
|
151
|
domcox@2
|
152 # default media
|
domcox@2
|
153 [ "$media" ] || media="$(tazinst list media | cut -d ' ' -f1)"
|
domcox@2
|
154 local error
|
domcox@2
|
155 comment "source selection"
|
domcox@2
|
156 # cdrom
|
domcox@2
|
157 if printf "$list_media" | grep -q "cdrom"; then
|
al@6
|
158 input_media "cdrom" \
|
al@6
|
159 "$media"
|
al@6
|
160 label_media "cdrom" \
|
al@6
|
161 "$(gettext 'LiveCD')" \
|
al@6
|
162 "$media" \
|
al@6
|
163 "$(gettext 'Use the SliTaz LiveCD')"
|
domcox@2
|
164 br
|
domcox@2
|
165 fi
|
domcox@2
|
166 # usb
|
domcox@2
|
167 if printf "$list_media" | grep -q "usb"; then
|
al@6
|
168 input_media "usb" \
|
al@6
|
169 "$media"
|
al@6
|
170 label_media "usb" \
|
al@6
|
171 "$(gettext 'LiveUSB:')" \
|
al@6
|
172 "$media" \
|
al@6
|
173 "$(gettext 'Enter the partition where SliTaz Live is located on your USB Key')"
|
domcox@2
|
174 error="$?"
|
al@6
|
175 select "$(/usr/sbin/tazinst list usb "$INSTFILE")" \
|
al@6
|
176 "$source" \
|
al@6
|
177 "SRC_USB"
|
al@6
|
178 error_msg "$error" \
|
al@6
|
179 "source" \
|
al@6
|
180 2
|
domcox@2
|
181 br
|
domcox@2
|
182 fi
|
domcox@2
|
183 # iso
|
al@6
|
184 input_media "iso" \
|
al@6
|
185 "$media"
|
al@6
|
186 label_media "iso" \
|
al@6
|
187 "$(gettext 'ISO file:')" \
|
al@6
|
188 "$media" \
|
al@6
|
189 "$(gettext 'Select a SliTaz ISO file located on a local disk')"
|
domcox@2
|
190 error="$?"
|
domcox@2
|
191 if [ "$media" == "iso" ]; then
|
al@6
|
192 input "text" \
|
al@6
|
193 "src_iso" \
|
al@6
|
194 "$source" "" \
|
al@6
|
195 "$(gettext 'Select an ISO or enter the full path to the ISO file')" \
|
domcox@2
|
196 "iso"
|
domcox@2
|
197 else
|
al@6
|
198 input "text" \
|
al@6
|
199 "src_iso" \
|
al@6
|
200 "" \
|
al@6
|
201 "none" \
|
al@6
|
202 "$(gettext 'Select an ISO or enter the full path to the ISO file')" \
|
domcox@2
|
203 "iso"
|
domcox@2
|
204 fi
|
al@6
|
205 datalist "$(/usr/sbin/tazinst list iso "$INSTFILE")" \
|
al@6
|
206 "src_iso"
|
al@6
|
207 error_msg "$error" \
|
al@6
|
208 "source"
|
domcox@2
|
209 br
|
domcox@2
|
210 # web
|
al@6
|
211 input_media "web" \
|
al@6
|
212 "$media"
|
al@6
|
213 label_media "web" \
|
al@6
|
214 "$(gettext 'Web:')" \
|
al@6
|
215 "$media" \
|
al@6
|
216 "$(gettext 'Select a SliTaz version on the Web')"
|
domcox@2
|
217 error="$?"
|
domcox@2
|
218
|
domcox@2
|
219 if [ "$media" == "web" ]; then
|
al@6
|
220 input "text" \
|
al@6
|
221 "src_web" \
|
al@6
|
222 "$source" "" \
|
al@6
|
223 "$(gettext 'Select a version or enter the full url to an ISO file')" \
|
domcox@2
|
224 "web"
|
domcox@2
|
225 else
|
al@6
|
226 input "text" \
|
al@6
|
227 "src_web" \
|
al@6
|
228 "" \
|
al@6
|
229 "none" \
|
al@6
|
230 "$(gettext 'Select a version or enter the full url to an ISO file')" \
|
domcox@2
|
231 "web"
|
domcox@2
|
232 fi
|
al@6
|
233 datalist "$(/usr/sbin/tazinst help web "$INSTFILE")" \
|
al@6
|
234 "src_web"
|
al@6
|
235 error_msg "$error" \
|
al@6
|
236 "source"
|
domcox@2
|
237 }
|
domcox@2
|
238
|
domcox@2
|
239 select_root_uuid()
|
domcox@2
|
240 {
|
domcox@2
|
241 local root_uuid="$(/usr/sbin/tazinst get root_uuid "$INSTFILE")"
|
domcox@2
|
242 local mode="$(/usr/sbin/tazinst get mode "$INSTFILE")"
|
domcox@2
|
243 comment "root_uuid selection"
|
domcox@2
|
244 if [ "$mode" == "upgrade" ]; then
|
al@6
|
245 label "root_uuid" \
|
al@6
|
246 "$(gettext 'Existing SliTaz partition to upgrade:')" \
|
al@6
|
247 "$(gettext 'Specify the partition containing the system to upgrade')"
|
domcox@2
|
248 error="$?"
|
domcox@2
|
249 else
|
al@6
|
250 label "root_uuid" \
|
al@6
|
251 "$(gettext 'Install Slitaz to partition:')" \
|
al@6
|
252 "$(gettext 'Specify the partition where to install SliTaz')"
|
domcox@2
|
253 error="$?"
|
domcox@2
|
254 fi
|
al@6
|
255 select "$(/usr/sbin/tazinst list uuid "$INSTFILE")" \
|
al@6
|
256 "$root_uuid" \
|
al@6
|
257 "ROOT_UUID" \
|
al@6
|
258 2
|
al@6
|
259 error_msg "$error" \
|
al@6
|
260 "root_uuid" \
|
al@6
|
261 2
|
domcox@2
|
262 br
|
domcox@2
|
263 }
|
domcox@2
|
264
|
domcox@2
|
265 select_root_format()
|
domcox@2
|
266 {
|
domcox@2
|
267 local root_format="$(/usr/sbin/tazinst get root_format "$INSTFILE")"
|
domcox@2
|
268 comment "root_format selection"
|
al@6
|
269 format "$(/usr/sbin/tazinst list format "$INSTFILE")" \
|
al@6
|
270 "$root_format" \
|
al@6
|
271 "ROOT_FORMAT"
|
domcox@2
|
272 }
|
domcox@2
|
273
|
domcox@2
|
274 select_options()
|
domcox@2
|
275 {
|
domcox@2
|
276 printf "<h4 id=\"options\">$(gettext 'Options')</h4>"
|
domcox@2
|
277 }
|
domcox@2
|
278
|
domcox@2
|
279 select_home_uuid()
|
domcox@2
|
280 {
|
domcox@2
|
281 local home_uuid="$(/usr/sbin/tazinst get home_uuid "$INSTFILE")"
|
domcox@2
|
282 comment "home_uuid selection"
|
al@6
|
283 h5 $(gettext "home partition")
|
al@6
|
284 label "home_uuid" \
|
al@6
|
285 "$(gettext 'Separate partition for /home:')" \
|
al@6
|
286 "$(gettext 'Specify the partition containing /home')"
|
al@6
|
287 select "$(/usr/sbin/tazinst list uuid "$INSTFILE")" \
|
al@6
|
288 "$home_uuid" \
|
al@6
|
289 "HOME_UUID" \
|
al@6
|
290 2
|
domcox@2
|
291 br
|
domcox@2
|
292 }
|
domcox@2
|
293
|
domcox@2
|
294 select_home_format()
|
domcox@2
|
295 {
|
domcox@2
|
296 local home_format="$(/usr/sbin/tazinst get home_format "$INSTFILE")"
|
domcox@2
|
297 comment "home_format selection"
|
al@6
|
298 format "$(/usr/sbin/tazinst list format "$INSTFILE")" \
|
al@6
|
299 "$home_format" \
|
al@6
|
300 "HOME_FORMAT"
|
domcox@2
|
301 }
|
domcox@2
|
302
|
domcox@2
|
303 select_hostname()
|
domcox@2
|
304 {
|
domcox@2
|
305 local hostname="$(/usr/sbin/tazinst get hostname "$INSTFILE")" error
|
domcox@2
|
306 comment "hostname selection"
|
al@6
|
307 h5 $(gettext "Hostname")
|
al@6
|
308 label "hostname" \
|
al@6
|
309 "$(gettext 'Set Hostname to:')" \
|
al@6
|
310 "$(gettext 'Hostname configuration allows you to specify the machine name')"
|
domcox@2
|
311 error=$?
|
al@6
|
312 input "text" \
|
al@6
|
313 "HOSTNAME" \
|
al@6
|
314 "$hostname" \
|
al@6
|
315 "" \
|
al@6
|
316 "$(gettext 'Name of your system')"
|
al@6
|
317 error_msg "$error" \
|
al@6
|
318 "hostname" \
|
al@6
|
319 2
|
domcox@2
|
320 }
|
domcox@2
|
321
|
domcox@2
|
322 select_root_pwd()
|
domcox@2
|
323 {
|
domcox@2
|
324 local root_pwd="$(/usr/sbin/tazinst get root_pwd "$INSTFILE")" error
|
domcox@2
|
325 comment "root_pwd selection"
|
al@6
|
326 h5 $(gettext "Root superuser")
|
al@6
|
327 label "root_pwd" \
|
al@6
|
328 "$(gettext 'Root passwd:')" \
|
al@6
|
329 "$(gettext 'Enter the password for root')"
|
domcox@2
|
330 error="$?"
|
al@6
|
331 input "text" \
|
al@6
|
332 "ROOT_PWD" \
|
al@6
|
333 "$root_pwd" \
|
al@6
|
334 "" \
|
al@6
|
335 "$(gettext 'Password of root')"
|
al@6
|
336 error_msg "$error" \
|
al@6
|
337 "root_pwd"
|
domcox@2
|
338 }
|
domcox@2
|
339
|
domcox@2
|
340 select_user_login()
|
domcox@2
|
341 {
|
domcox@2
|
342 local user_login="$(/usr/sbin/tazinst get user_login "$INSTFILE")" error
|
domcox@2
|
343 comment "user_login selection"
|
al@6
|
344 h5 $(gettext "User")
|
al@6
|
345 label "user_login" \
|
al@6
|
346 "$(gettext 'User login:')" \
|
al@6
|
347 "$(gettext 'Enter the name of the first user')"
|
domcox@2
|
348 error="$?"
|
al@6
|
349 input "text" \
|
al@6
|
350 "USER_LOGIN" \
|
al@6
|
351 "$user_login" \
|
al@6
|
352 "" \
|
domcox@2
|
353 "$(gettext 'Name of the first user')"
|
al@6
|
354 error_msg "$error" \
|
al@6
|
355 "user_login" \
|
al@6
|
356 2
|
domcox@2
|
357 br
|
domcox@2
|
358 }
|
domcox@2
|
359
|
domcox@2
|
360 select_user_pwd()
|
domcox@2
|
361 {
|
domcox@2
|
362 local user_pwd="$(/usr/sbin/tazinst get user_pwd "$INSTFILE")" error
|
al@6
|
363 label "user_pwd" \
|
al@6
|
364 "$(gettext 'User passwd:')" \
|
al@6
|
365 "$(gettext 'The password for default user')"
|
domcox@2
|
366 error="$?"
|
al@6
|
367 input "text" \
|
al@6
|
368 "USER_PWD" \
|
al@6
|
369 "$user_pwd" \
|
al@6
|
370 "" \
|
domcox@2
|
371 "$(gettext 'Password of the first user')"
|
al@6
|
372 error_msg "$error" \
|
al@6
|
373 "user_pwd"
|
domcox@2
|
374 }
|
domcox@2
|
375
|
domcox@2
|
376 select_bootloader()
|
domcox@2
|
377 {
|
domcox@2
|
378 local bootloader="$(/usr/sbin/tazinst get bootloader "$INSTFILE")" error
|
domcox@2
|
379 comment "bootloader selection"
|
al@6
|
380 h5 $(gettext "Bootloader")
|
al@6
|
381 input "checkbox" \
|
al@6
|
382 "bootloader" \
|
al@6
|
383 "auto" \
|
al@6
|
384 "$bootloader"
|
al@6
|
385 label "bootloader" \
|
al@6
|
386 "$(gettext 'Install a bootloader.')" \
|
al@6
|
387 "$(gettext "Usually you should answer yes, unless you want to install a \
|
domcox@2
|
388 bootloader by hand yourself.")"
|
domcox@2
|
389 error="$?"
|
al@6
|
390 error_msg "$error" \
|
al@6
|
391 "bootloader"
|
domcox@2
|
392 br
|
domcox@2
|
393 }
|
domcox@2
|
394
|
domcox@2
|
395 select_winboot()
|
domcox@2
|
396 {
|
domcox@2
|
397 local winboot="$(/usr/sbin/tazinst get winboot "$INSTFILE")" error
|
domcox@2
|
398 comment "winboot selection"
|
al@6
|
399 input "checkbox" \
|
al@6
|
400 "winboot" \
|
al@6
|
401 "auto" \
|
al@6
|
402 "$winboot"
|
al@6
|
403 label "winboot" \
|
al@6
|
404 "$(gettext 'Enable Windows Dual-Boot.')" \
|
al@6
|
405 "$(gettext "At start-up, you will be asked whether you want to boot into \
|
domcox@2
|
406 Windows™ or SliTaz GNU/Linux.")"
|
domcox@2
|
407 error="$?"
|
al@6
|
408 error_msg "$error" \
|
al@6
|
409 "winboot"
|
domcox@2
|
410 }
|
domcox@2
|
411
|
domcox@2
|
412 errors_msg()
|
domcox@2
|
413 {
|
domcox@2
|
414 if [ "$CHECK" ]; then
|
domcox@2
|
415 echo "<span class=\"alert\">"
|
al@6
|
416 p $(gettext "Errors found. Please check your settings.")
|
domcox@2
|
417 echo "</span>"
|
domcox@2
|
418 fi
|
domcox@2
|
419 }
|
domcox@2
|
420
|
domcox@2
|
421 select_settings()
|
domcox@2
|
422 {
|
domcox@2
|
423 local settings="$(/usr/sbin/tazinst get settings "$INSTFILE")"
|
domcox@2
|
424 CHECK=$(GET CHECK)
|
domcox@2
|
425 errors_msg
|
al@6
|
426 h4 $(gettext "Select source media:")
|
domcox@2
|
427 open_div_class "box"
|
domcox@2
|
428 open_div_class "media"
|
domcox@2
|
429 select_source
|
domcox@2
|
430 close_div
|
domcox@2
|
431 close_div
|
al@6
|
432 h4 $(gettext "Select destination")
|
domcox@2
|
433 open_div_class "box"
|
domcox@2
|
434 select_root_uuid
|
domcox@2
|
435 printf "$settings" | grep -q "root_format" \
|
domcox@2
|
436 && select_root_format
|
domcox@2
|
437 close_div
|
domcox@2
|
438 select_options
|
domcox@2
|
439 open_div_class "options"
|
domcox@2
|
440 printf "$settings" | grep -q "home_uuid" && select_home_uuid
|
domcox@2
|
441 printf "$settings" | grep -q "home_format" \
|
domcox@2
|
442 && select_home_format
|
domcox@2
|
443 printf "$settings" | grep -q "hostname" && select_hostname
|
domcox@2
|
444 printf "$settings" | grep -q "root_pwd" && select_root_pwd
|
domcox@2
|
445 printf "$settings" | grep -q "user_login" && select_user_login
|
domcox@2
|
446 printf "$settings" | grep -q "user_pwd" && select_user_pwd
|
domcox@2
|
447 close_div
|
domcox@2
|
448 open_div_class "bootloader"
|
domcox@2
|
449 printf "$settings" | grep -q "bootloader" && select_bootloader
|
domcox@2
|
450 printf "$settings" | grep -q "winboot" && select_winboot
|
domcox@2
|
451 close_div
|
domcox@2
|
452 br
|
domcox@2
|
453 }
|
domcox@2
|
454
|
domcox@2
|
455 #--------------
|
domcox@2
|
456 # execute page
|
domcox@2
|
457 #--------------
|
domcox@2
|
458
|
domcox@2
|
459 save_settings()
|
domcox@2
|
460 {
|
al@6
|
461 h5 $(gettext "Checking settings...")
|
domcox@2
|
462 # install type
|
domcox@2
|
463 /usr/sbin/tazinst set media "$(GET MEDIA)" "$INSTFILE"
|
domcox@2
|
464 # source File
|
domcox@2
|
465 case "$(/usr/sbin/tazinst get media "$INSTFILE")" in
|
domcox@2
|
466 usb)
|
domcox@2
|
467 /usr/sbin/tazinst set source "$(GET SRC_USB)" "$INSTFILE" ;;
|
domcox@2
|
468 iso)
|
domcox@2
|
469 /usr/sbin/tazinst set source "$(GET SRC_ISO)" "$INSTFILE" ;;
|
domcox@2
|
470 web)
|
domcox@2
|
471 /usr/sbin/tazinst set source "$(GET SRC_WEB)" "$INSTFILE" ;;
|
domcox@2
|
472 esac
|
domcox@2
|
473 # set defined url
|
domcox@2
|
474 [ $(GET URL) ] && SRC_WEB=$(GET URL)
|
domcox@2
|
475 # root Partition
|
domcox@2
|
476 /usr/sbin/tazinst set root_uuid "$(GET ROOT_UUID)" "$INSTFILE"
|
domcox@2
|
477 # format root partition
|
domcox@2
|
478 [ "$(GET ROOT_FORMAT)" ] \
|
domcox@2
|
479 && /usr/sbin/tazinst set root_format "$(GET ROOT_FORMAT)" "$INSTFILE" \
|
domcox@2
|
480 || /usr/sbin/tazinst unset root_format "$INSTFILE"
|
domcox@2
|
481 # home Partition
|
domcox@2
|
482 if [ "$(GET HOME_UUID)" ] ; then
|
domcox@2
|
483 /usr/sbin/tazinst set home_uuid "$(GET HOME_UUID)" "$INSTFILE"
|
domcox@2
|
484 [ "$(GET HOME_FORMAT)" ] \
|
domcox@2
|
485 && /usr/sbin/tazinst set home_format "$(GET HOME_FORMAT)" \
|
domcox@2
|
486 "$INSTFILE" \
|
domcox@2
|
487 || /usr/sbin/tazinst unset home_format "$INSTFILE"
|
domcox@2
|
488 else
|
domcox@2
|
489 /usr/sbin/tazinst unset home_uuid "$INSTFILE"
|
domcox@2
|
490 /usr/sbin/tazinst unset home_format "$INSTFILE"
|
domcox@2
|
491 fi
|
domcox@2
|
492 # hostname
|
domcox@2
|
493 /usr/sbin/tazinst set hostname "$(GET HOSTNAME)" "$INSTFILE"
|
domcox@2
|
494 # root pwd
|
domcox@2
|
495 /usr/sbin/tazinst set root_pwd "$(GET ROOT_PWD)" "$INSTFILE"
|
domcox@2
|
496 # user Login
|
domcox@2
|
497 /usr/sbin/tazinst set user_login "$(GET USER_LOGIN)" "$INSTFILE"
|
domcox@2
|
498 # user Pwd
|
domcox@2
|
499 /usr/sbin/tazinst set user_pwd "$(GET USER_PWD)" "$INSTFILE"
|
domcox@2
|
500 # win Dual-Boot
|
domcox@2
|
501 /usr/sbin/tazinst set winboot "$(GET WINBOOT)" "$INSTFILE"
|
domcox@2
|
502 # bootloader
|
domcox@2
|
503 if [ "$(GET BOOTLOADER)" == "auto" ]; then
|
domcox@2
|
504 /usr/sbin/tazinst set bootloader "auto" "$INSTFILE"
|
domcox@2
|
505 else
|
domcox@2
|
506 /usr/sbin/tazinst unset bootloader "$INSTFILE"
|
domcox@2
|
507 /usr/sbin/tazinst unset winboot "$INSTFILE"
|
domcox@2
|
508 fi
|
domcox@2
|
509 input_hidden "CHECK" "yes"
|
domcox@2
|
510 }
|
domcox@2
|
511
|
domcox@2
|
512 tazinst_run()
|
domcox@2
|
513 {
|
domcox@2
|
514 local mode="$(/usr/sbin/tazinst get mode "$INSTFILE")" error
|
domcox@2
|
515 h4 "Proceeding to: $mode"
|
domcox@2
|
516 /usr/sbin/tazinst execute "$INSTFILE" | /bin/busybox awk '{
|
domcox@2
|
517 num=$1+0
|
domcox@2
|
518 if (num>0 && num<=100){
|
domcox@2
|
519 print "<script type=\"text/javascript\">"
|
domcox@2
|
520 printf "document.write(\047<div id=\"progress\">"
|
domcox@2
|
521 printf "<img src=\"/styles/default/images/loader.gif\" />"
|
domcox@2
|
522 printf $1 "% " substr($0, length($1)+2, 40)
|
domcox@2
|
523 print "</div>\047)"
|
domcox@2
|
524 print "</script>"
|
domcox@2
|
525 }
|
domcox@2
|
526 }'
|
domcox@2
|
527 # end_of_install
|
domcox@2
|
528 if /usr/sbin/tazinst log | grep -q "x-x-" ; then
|
domcox@2
|
529 error=1
|
domcox@2
|
530 echo "<script type=\"text/javascript\">"
|
domcox@2
|
531 printf "document.write(\047<div id=\"progress\">"
|
domcox@2
|
532 printf "<img src=\"/styles/default/images/stop.png\" />"
|
al@6
|
533 printf "$(gettext 'Errors encountered.')"
|
domcox@2
|
534 printf "</div>\047)\n"
|
domcox@2
|
535 echo "</script>"
|
domcox@2
|
536 br
|
domcox@2
|
537 br
|
domcox@2
|
538 /usr/sbin/tazinst log | \
|
domcox@2
|
539 /bin/busybox awk '$1 == "-x-x-",$1 == "x-x-x"' | sed 's/-x-x-/ /' \
|
domcox@2
|
540 | grep -v "x-x-x"
|
domcox@2
|
541 else
|
domcox@2
|
542 error=0
|
domcox@2
|
543 echo "<script type=\"text/javascript\">"
|
domcox@2
|
544 printf "document.write(\047<div id=\"progress\">"
|
domcox@2
|
545 printf "<img src=\"/styles/default/images/tux.png\" />"
|
al@6
|
546 printf "$(gettext 'Process completed!')"
|
domcox@2
|
547 printf "</div>\047)\n"
|
domcox@2
|
548 echo "</script>"
|
domcox@2
|
549 br
|
domcox@2
|
550 br
|
domcox@2
|
551 br
|
al@6
|
552 p $(gettext "Installation is now finished, you can exit the installer \
|
al@6
|
553 or reboot on your new SliTaz GNU/Linux operating system.")
|
domcox@2
|
554 fi
|
domcox@2
|
555 return "$error"
|
domcox@2
|
556
|
domcox@2
|
557 }
|
domcox@2
|
558
|
domcox@2
|
559 tazinst_log()
|
domcox@2
|
560 {
|
al@6
|
561 h4 $(gettext "Tazinst log")
|
domcox@2
|
562 printf "<pre>$(/usr/sbin/tazinst log | sed 's/\%/ percent/g')</pre>"
|
domcox@2
|
563 }
|
domcox@2
|
564
|
domcox@2
|
565
|
domcox@2
|
566 #-----------------
|
domcox@2
|
567 # page navigation
|
domcox@2
|
568 #-----------------
|
domcox@2
|
569
|
domcox@2
|
570 display_mode()
|
domcox@2
|
571 {
|
domcox@2
|
572 local mode="$(/usr/sbin/tazinst get mode "$INSTFILE")"
|
domcox@2
|
573 case $mode in
|
domcox@0
|
574 install)
|
domcox@2
|
575 open_div_id "wrapper"
|
al@6
|
576 h4 $(gettext "Install SliTaz")
|
al@6
|
577 p $(gettext "You're going to install SliTaz on a partition of your \
|
al@6
|
578 hard disk drive. If you decide to format your HDD, all data will be \
|
al@6
|
579 lost. If you do not format, all data except for any existing /home \
|
al@6
|
580 directory will be removed, the home directory will be kept as is.")
|
domcox@2
|
581 close_div
|
domcox@0
|
582 ;;
|
domcox@0
|
583 upgrade)
|
domcox@2
|
584 open_div_id "wrapper"
|
al@6
|
585 h4 $(gettext "Upgrade SliTaz")
|
al@6
|
586 p $(gettext "You're going to upgrade an already installed SliTaz \
|
al@6
|
587 system on your hard disk drive. Your /home /etc /var/www directories \
|
al@6
|
588 will be kept, all other directories will be removed. Any additional \
|
al@6
|
589 packages added to your old Slitaz system will be updated as long you \
|
al@6
|
590 have an active internet connection.")
|
domcox@2
|
591 close_div
|
domcox@0
|
592 ;;
|
domcox@0
|
593 esac
|
domcox@0
|
594 }
|
domcox@0
|
595
|
domcox@2
|
596 moveto_page()
|
domcox@0
|
597 {
|
domcox@2
|
598 local back="$1" next="$2" back_msg next_msg
|
domcox@2
|
599 case "$back" in
|
domcox@2
|
600 partitioning)
|
domcox@2
|
601 back_msg=$(gettext 'Back to partitioning') ;;
|
domcox@2
|
602 input)
|
domcox@2
|
603 back_msg=$(gettext 'Back to entering settings') ;;
|
domcox@2
|
604 *)
|
domcox@2
|
605 back_msg=$(gettext 'Back to Installer Start Page') ;;
|
domcox@2
|
606 esac
|
domcox@2
|
607 case "$next" in
|
domcox@2
|
608 execute|run)
|
domcox@2
|
609 next_msg=$(gettext 'Proceed to SliTaz installation') ;;
|
domcox@2
|
610 reboot)
|
domcox@2
|
611 next_msg=$(gettext 'Installation complete. You can now restart') ;;
|
domcox@2
|
612 failed)
|
domcox@2
|
613 next_msg=$(gettext 'Installation failed. See log') ;;
|
domcox@2
|
614 input)
|
domcox@2
|
615 next_msg=$(gettext 'Continue installation.') ;;
|
domcox@2
|
616 *)
|
domcox@2
|
617 next_msg=$(gettext 'Back to Installer Start Page') ;;
|
domcox@2
|
618 esac
|
domcox@2
|
619 hr
|
al@6
|
620 input_hidden "page" \
|
al@6
|
621 "$next"
|
al@6
|
622 a "$back" \
|
al@6
|
623 "$SCRIPT_NAME?page=$back" \
|
al@6
|
624 "$back_msg"
|
al@6
|
625 input "submit" \
|
al@6
|
626 "" \
|
al@6
|
627 "$next_msg"
|
domcox@0
|
628 }
|
domcox@0
|
629
|
domcox@2
|
630 moveto_home()
|
domcox@0
|
631 {
|
domcox@2
|
632 local msg=$(gettext 'Back to Installer Start Page')
|
al@6
|
633 a "home" \
|
al@6
|
634 "$SCRIPT_NAME?page=home" \
|
al@6
|
635 "$msg"
|
domcox@0
|
636 }
|
domcox@0
|
637
|
domcox@0
|
638 page_redirection()
|
domcox@0
|
639 {
|
domcox@2
|
640 local page="$1"
|
domcox@2
|
641 cat <<EOT
|
domcox@0
|
642 <!DOCTYPE html>
|
domcox@0
|
643 <html>
|
domcox@0
|
644 <head>
|
domcox@0
|
645 <meta charset="utf-8">
|
domcox@0
|
646 <title>$(gettext "A web page that points a browser to a different page after \
|
domcox@0
|
647 2 seconds")</title>
|
domcox@0
|
648 <meta http-equiv="refresh" content="0; URL=$SCRIPT_NAME?page=$1">
|
domcox@0
|
649 <meta name="keywords" content="automatic redirection">
|
domcox@0
|
650 </head>
|
domcox@0
|
651 <body>
|
domcox@0
|
652 <p>$(gettext "If your browser doesn't automatically redirect within a few \
|
domcox@2
|
653 seconds, you may want to go there manually")
|
domcox@2
|
654 <a href="$SCRIPT_NAME?page=$page">$(gettext "here")</a></p>
|
domcox@0
|
655 </body>
|
domcox@0
|
656 </html>
|
domcox@0
|
657 EOT
|
domcox@0
|
658 }
|
domcox@0
|
659
|
domcox@2
|
660 #----------
|
domcox@2
|
661 # checking
|
domcox@2
|
662 #----------
|
domcox@2
|
663
|
domcox@0
|
664 check_ressources()
|
domcox@0
|
665 {
|
domcox@2
|
666 local errorcode=0
|
domcox@2
|
667 comment "check_ressources"
|
domcox@0
|
668 if ! [ -x /usr/sbin/tazinst ] ; then
|
al@6
|
669 h4 $(gettext "Tazinst Error")
|
al@6
|
670 p $(gettext "<strong>tazinst</strong>, the backend to slitaz-installer \
|
al@6
|
671 is missing. Any installation can not be done without tazinst.")
|
al@6
|
672 p $(gettext "Check tazinst permissions, or reinstall the \
|
al@6
|
673 slitaz-installer package.")
|
domcox@2
|
674 errorcode=1
|
domcox@0
|
675 else
|
domcox@2
|
676 # check tazinst minimum version
|
domcox@2
|
677 v=$(/usr/sbin/tazinst version | tr -d '[:alpha:]')
|
domcox@2
|
678 r=$TAZINST_MINIMUM_VERSION
|
domcox@2
|
679 if ! (echo "$v" | /bin/busybox awk -v r=$r \
|
domcox@2
|
680 '{v=$v+0}{ if (v < r) exit 1}') ; then
|
al@6
|
681 h4 $(gettext "Tazinst Error")
|
al@6
|
682 p $(gettext "<strong>tazinst</strong>, the slitaz-installer \
|
al@6
|
683 backend, is not at the minimum required version. Any installation \
|
al@6
|
684 cannot be done without tazinst.")
|
al@6
|
685 p $(gettext "Reinstall the slitaz-installer package, or use \
|
al@6
|
686 tazinst in CLI mode.")
|
domcox@2
|
687 errorcode=1
|
domcox@2
|
688 fi
|
domcox@2
|
689 # check tazinst maximum version
|
domcox@2
|
690 v=$(/usr/sbin/tazinst version | tr -d '[:alpha:]')
|
domcox@2
|
691 r=$TAZINST_MAXIMUM_VERSION
|
domcox@2
|
692 if ! (echo "$v" | /bin/busybox awk -v r=$r \
|
domcox@2
|
693 '{v=$v+0}{ if (v > r) exit 1}') ; then
|
al@6
|
694 h4 $(gettext "Tazinst Error")
|
al@6
|
695 p $(gettext "<strong>tazinst</strong>, the slitaz-installer \
|
al@6
|
696 backend, is at a higher version than the maximum authorized \
|
al@6
|
697 by the slitaz-installer. Any installation cannot be done.")
|
al@6
|
698 p $(gettext "Reinstall the slitaz-installer package, or use \
|
al@6
|
699 tazinst in CLI mode.")
|
domcox@2
|
700 errorcode=1
|
domcox@0
|
701 fi
|
domcox@0
|
702 fi
|
domcox@2
|
703 return $errorcode
|
domcox@0
|
704 }
|
domcox@0
|
705
|
domcox@2
|
706
|
domcox@2
|
707 #---------------
|
domcox@2
|
708 # html snippets
|
domcox@2
|
709 #---------------
|
domcox@2
|
710
|
domcox@2
|
711 br()
|
domcox@0
|
712 {
|
domcox@2
|
713 echo "<br />"
|
domcox@0
|
714 }
|
domcox@0
|
715
|
domcox@2
|
716 hr()
|
domcox@0
|
717 {
|
domcox@2
|
718 echo "<hr />"
|
domcox@0
|
719 }
|
domcox@0
|
720
|
domcox@2
|
721 comment()
|
domcox@0
|
722 {
|
al@6
|
723 echo "<!-- $@ -->"
|
domcox@2
|
724 }
|
domcox@2
|
725
|
domcox@2
|
726 a()
|
domcox@2
|
727 {
|
al@6
|
728 echo "<a class=\"button\" value=\"$1\" href=\"$2\">$3</a>"
|
domcox@2
|
729 }
|
domcox@2
|
730
|
domcox@2
|
731 open_div()
|
domcox@2
|
732 {
|
domcox@2
|
733 echo "<div>"
|
domcox@2
|
734 }
|
domcox@2
|
735
|
domcox@2
|
736 open_div_id()
|
domcox@2
|
737 {
|
domcox@2
|
738 echo "<div id=\"$1\">"
|
domcox@2
|
739 }
|
domcox@2
|
740
|
domcox@2
|
741 open_div_class()
|
domcox@2
|
742 {
|
domcox@2
|
743 echo "<div class=\"$1\">"
|
domcox@2
|
744 }
|
domcox@2
|
745
|
domcox@2
|
746 close_div()
|
domcox@2
|
747 {
|
domcox@2
|
748 echo "</div>"
|
domcox@2
|
749 }
|
domcox@2
|
750
|
domcox@2
|
751 p()
|
domcox@2
|
752 {
|
al@6
|
753 echo "<p>$@</p>"
|
domcox@2
|
754 }
|
domcox@2
|
755
|
domcox@2
|
756 h4()
|
domcox@2
|
757 {
|
al@6
|
758 echo "<h4>$@</h4>"
|
domcox@2
|
759 }
|
domcox@2
|
760
|
domcox@2
|
761 h5()
|
domcox@2
|
762 {
|
al@6
|
763 echo "<h5>$@</h5>"
|
domcox@2
|
764 }
|
domcox@2
|
765
|
domcox@2
|
766 label()
|
domcox@2
|
767 {
|
domcox@2
|
768 local setting="$1" label="$2" title="$3" name="$4" error=0
|
domcox@2
|
769 [ -z "$name" ] && name="$setting"
|
domcox@2
|
770 printf "<label for=\"$name\""
|
domcox@2
|
771 [ "$title" ] && echo " title=\"$title\">" || echo ">"
|
domcox@2
|
772 # display label in red in case of error
|
domcox@2
|
773 if [ "$CHECK" ]; then
|
domcox@2
|
774 /usr/sbin/tazinst check "$setting" "$INSTFILE"
|
domcox@2
|
775 error="$?"
|
domcox@2
|
776 [ "$error" -gt "0" ] && [ "$error" -lt "127" ] && \
|
domcox@2
|
777 printf "<span class=\"alert\">"
|
domcox@2
|
778 printf "$label"
|
domcox@2
|
779 [ "$error" -gt "0" ] && [ "$error" -lt "127" ] && \
|
domcox@2
|
780 printf "<sup>*</sup></span>"
|
domcox@2
|
781 else
|
domcox@2
|
782 printf "$label"
|
domcox@2
|
783 fi
|
domcox@2
|
784 echo "</label>"
|
domcox@2
|
785 return "$error"
|
domcox@2
|
786 }
|
domcox@2
|
787
|
domcox@2
|
788 label_media()
|
domcox@2
|
789 {
|
domcox@2
|
790 local id="$1" label="$2" media="$3" title="$4" retcode=0
|
domcox@2
|
791 if [ "$media" == "$id" ]; then
|
al@6
|
792 label "source" \
|
al@6
|
793 "$label" \
|
al@6
|
794 "$title" \
|
al@6
|
795 "$media"
|
domcox@2
|
796 retcode="$?"
|
domcox@2
|
797 else
|
domcox@2
|
798 printf "<label for=\"$id\""
|
domcox@2
|
799 [ "$title" ] && echo " title=\"$title\">" || echo ">"
|
domcox@2
|
800 echo "$label</label>"
|
domcox@2
|
801 fi
|
domcox@2
|
802 return "$retcode"
|
domcox@2
|
803 }
|
domcox@2
|
804
|
domcox@2
|
805 error_msg()
|
domcox@2
|
806 {
|
domcox@2
|
807 local error="$1" setting="$2" line="$3"
|
domcox@2
|
808 if [ "$CHECK" ]; then
|
domcox@2
|
809 if [ "$error" -gt "0" ]; then
|
domcox@2
|
810 [ "$error" -lt "128" ] && printf "<span class=\"alert\">" \
|
domcox@2
|
811 || printf "<span class=\"warning\">"
|
domcox@2
|
812 if [ "$line" ]; then
|
domcox@2
|
813 /usr/sbin/tazinst check "$setting" "$INSTFILE" 2>&1 | \
|
domcox@2
|
814 /bin/busybox awk -v LINE="$line" '{if (NR==LINE){print}}'
|
domcox@2
|
815 else
|
domcox@2
|
816 /usr/sbin/tazinst check "$setting" "$INSTFILE" 2>&1
|
domcox@2
|
817 fi
|
domcox@2
|
818 echo "</span>"
|
domcox@2
|
819 fi
|
domcox@2
|
820 fi
|
domcox@2
|
821 }
|
domcox@2
|
822
|
domcox@2
|
823 select()
|
domcox@2
|
824 {
|
al@6
|
825 local list="$1" selected="$2" name="$3" type="$4" none="$(gettext 'None')"
|
domcox@2
|
826 printf "$list" | /bin/busybox awk -v SELECTED="$selected" -v NONE="$none" \
|
domcox@2
|
827 -v NAME="$name" -v TYPE="$type" 'BEGIN{
|
domcox@2
|
828 TYPE=TYPE+0
|
domcox@2
|
829 print "<select name=\"" NAME "\">"
|
domcox@2
|
830 print "<option value=>< " NONE " ></option>"
|
domcox@2
|
831 }
|
domcox@2
|
832 {
|
domcox@2
|
833 printf "<option value=\"" $1 "\""
|
domcox@2
|
834 if ($1 == SELECTED) printf " selected"
|
domcox@2
|
835 if (TYPE == 0)
|
domcox@2
|
836 print ">" $0 "</option>"
|
domcox@2
|
837 if (TYPE == 1)
|
domcox@2
|
838 print ">" substr($0,12) "</option>"
|
domcox@2
|
839 if (TYPE == 2)
|
domcox@2
|
840 print ">" $2 "</option>"
|
domcox@2
|
841 }
|
domcox@2
|
842 END{
|
domcox@2
|
843 print "</select>"
|
domcox@2
|
844 }'
|
domcox@2
|
845 }
|
domcox@2
|
846
|
domcox@2
|
847 input()
|
domcox@2
|
848 {
|
domcox@2
|
849 local type="$1" name="$2" value="$3" selected="$4" help="$5" action="$6"
|
domcox@2
|
850 printf "<input type=\"$type\" id=\"$name\" list=\"list_$name\" "
|
domcox@2
|
851 printf "name=\"$(printf $name | tr [a-z] [A-Z])\" class=\"$type\" "
|
domcox@2
|
852 [ "$value" ] && printf "value=\"$value\" "
|
domcox@2
|
853 [ "$value" == "$selected" ] && printf "checked "
|
domcox@2
|
854 [ "$action" ] && printf \
|
domcox@2
|
855 "onInput=\"document.getElementById('$action').checked = true;\" "
|
domcox@2
|
856 [ "$help" ] && echo "placeholder=\"$help\" />" || echo "/>"
|
domcox@2
|
857 }
|
domcox@2
|
858
|
domcox@2
|
859 input_media()
|
domcox@2
|
860 {
|
domcox@2
|
861 local id="$1" media="$2"
|
domcox@2
|
862 echo -n "<input type=\"radio\" name=\"MEDIA\" value=\"$id\" id=\"$id\" "
|
al@6
|
863 echo "$([ "$media" == "$id" ] && echo 'checked') />"
|
domcox@2
|
864 }
|
domcox@2
|
865
|
domcox@2
|
866 input_hidden()
|
domcox@2
|
867 {
|
al@6
|
868 echo "<input type=\"hidden\" name=\"$1\" value=\"$2\" />"
|
domcox@2
|
869 }
|
domcox@2
|
870
|
domcox@2
|
871 datalist()
|
domcox@2
|
872 {
|
al@6
|
873 local list="$1" name="$2" none="$(gettext 'None')"
|
domcox@2
|
874 echo "<datalist id=\"list_$name\">"
|
domcox@2
|
875 # workaround for browsers that don’t support the datalist element..
|
domcox@2
|
876 echo "<select class=\"workaround\" id=\"sel_$name\" \
|
domcox@2
|
877 onChange='displaySelValue(\"sel_$name\",\"$name\")' \
|
domcox@2
|
878 onBlur='displaySelValue(\"sel_$name\",\"$name\")'>"
|
domcox@2
|
879 # workaround ..end
|
domcox@2
|
880 printf "$list" | /bin/busybox awk -v NONE="$none" 'BEGIN{
|
domcox@2
|
881 line=0
|
domcox@2
|
882 }
|
domcox@2
|
883 {
|
domcox@2
|
884 TEXT=$1
|
domcox@2
|
885 sub(".*/","",TEXT)
|
domcox@2
|
886 print "<option value=\"" $1 "\">" TEXT "</option>"
|
domcox@2
|
887 line++
|
domcox@2
|
888 }
|
domcox@2
|
889 END{
|
domcox@2
|
890 if (line < 1)
|
domcox@2
|
891 print "<option value=>< " NONE " ></option>"
|
domcox@2
|
892 }'
|
domcox@2
|
893 echo "</select>"
|
domcox@2
|
894 echo "</datalist>"
|
domcox@2
|
895 }
|
domcox@2
|
896
|
domcox@2
|
897 format()
|
domcox@2
|
898 {
|
al@6
|
899 list_fs="$1" selected="$2" name="$3" none="$(gettext 'Do not format')"
|
al@6
|
900 cat << EOT
|
al@6
|
901 <label for="$name" title="$(gettext "To format this partition, \
|
al@6
|
902 select a filesystem, usually it's safe to use ext4")">
|
al@6
|
903 $(gettext "Formatting option:")</label>
|
al@6
|
904 EOT
|
domcox@2
|
905 printf "$list_fs" | /bin/busybox awk -v SELECTED=$selected -v NONE="$none" \
|
domcox@2
|
906 -v NAME="$name" 'BEGIN{
|
domcox@2
|
907 RS=" "
|
domcox@2
|
908 print "<select name=\"" NAME "\">"
|
domcox@2
|
909 print "<option value=\"\">" NONE "</option>"
|
domcox@2
|
910 line=0
|
domcox@2
|
911 }
|
domcox@2
|
912 {
|
domcox@2
|
913 printf "<option value=\"" $1 "\""
|
domcox@2
|
914 if ($1 == SELECTED) printf " selected"
|
domcox@2
|
915 print ">" $0 "</option>"
|
domcox@2
|
916 line++
|
domcox@2
|
917 }
|
domcox@2
|
918 END{
|
domcox@2
|
919 if (line < 1)
|
domcox@2
|
920 print "<option value=>< " NONE " ></option>"
|
domcox@2
|
921 print "</select>"
|
domcox@2
|
922 }'
|
domcox@2
|
923 }
|
domcox@2
|
924
|
domcox@2
|
925 button()
|
domcox@2
|
926 {
|
domcox@2
|
927 local action="$1" msg="$2" title="$3"
|
domcox@2
|
928 echo "<a class=\"button\" href=\"$SCRIPT_NAME?page=$action\" \
|
domcox@2
|
929 title=\"$title\">$msg</a>"
|
domcox@0
|
930 }
|
domcox@0
|
931
|
domcox@0
|
932 form_start()
|
domcox@0
|
933 {
|
domcox@2
|
934 local name="$1"
|
domcox@0
|
935 cat <<EOT
|
domcox@2
|
936 <form name="Form_$name" method="get" onsubmit="return true" \
|
domcox@2
|
937 action="$SCRIPT_NAME">
|
domcox@0
|
938 EOT
|
domcox@0
|
939 }
|
domcox@0
|
940
|
domcox@0
|
941 form_end()
|
domcox@0
|
942 {
|
domcox@0
|
943 echo "</form>"
|
domcox@0
|
944 }
|
domcox@0
|
945
|
domcox@2
|
946 xhtml_header()
|
domcox@2
|
947 {
|
domcox@2
|
948 cat << EOT
|
domcox@2
|
949 <!DOCTYPE html>
|
domcox@2
|
950 <html xmlns="http://www.w3.org/1999/xhtml" lang="$(echo $LANG | cut -f1 -d_)">
|
domcox@2
|
951 <head>
|
domcox@2
|
952 <title>$(gettext "SliTaz Installer")</title>
|
domcox@2
|
953 <meta charset="utf-8" />
|
domcox@2
|
954 <link rel="shortcut icon" href="/styles/$STYLE/favicon.ico" />
|
domcox@2
|
955 <style type="text/css">
|
domcox@2
|
956 .box label {
|
domcox@2
|
957 display:inline-block;
|
domcox@2
|
958 vertical-align:middle;
|
domcox@2
|
959 width: 130px;
|
domcox@2
|
960 }
|
domcox@2
|
961 .media label {
|
domcox@2
|
962 display:inline-block;
|
domcox@2
|
963 vertical-align:middle;
|
domcox@2
|
964 width: 110px;
|
domcox@2
|
965 }
|
domcox@2
|
966 .options label {
|
domcox@2
|
967 display:inline-block;
|
domcox@2
|
968 vertical-align:middle;
|
domcox@2
|
969 width: 140px;
|
domcox@2
|
970 }
|
domcox@2
|
971 .box .text {
|
domcox@2
|
972 width: 350px;
|
domcox@2
|
973 }
|
domcox@2
|
974 input {margin-bottom:3px;}
|
domcox@2
|
975 span.alert {color: red}
|
domcox@2
|
976 span.warning { color: darkgray}
|
domcox@2
|
977 #progress {
|
domcox@2
|
978 background-color: #f8f8f8;
|
domcox@2
|
979 border: 1px solid #ddd;
|
domcox@2
|
980 color: #666;
|
domcox@2
|
981 cursor: progress;
|
domcox@2
|
982 position: absolute;
|
domcox@2
|
983 width: 348px;
|
domcox@2
|
984 padding: 4px 4px 2px;
|
domcox@2
|
985 }
|
domcox@2
|
986 </style>
|
domcox@2
|
987 <link rel="stylesheet" type="text/css" href="/styles/$STYLE/style.css" />
|
domcox@2
|
988 <!-- Function to hide the loading message when page is generated. -->
|
domcox@2
|
989 <script type="text/javascript">
|
domcox@2
|
990 function showProgress(){
|
domcox@2
|
991 document.getElementById("progress").style.display='none';
|
domcox@2
|
992 }
|
domcox@2
|
993 </script>
|
domcox@2
|
994 <!-- workaround for browsers that don’t support the datalist element -->
|
domcox@2
|
995 <style type="text/css">
|
domcox@2
|
996 .workaround {width: 110px;}
|
domcox@2
|
997 </style>
|
domcox@2
|
998 <script>
|
domcox@2
|
999 function displaySelValue(selectId,inputId)
|
domcox@2
|
1000 {
|
domcox@2
|
1001 var slct = document.getElementById(selectId);
|
domcox@2
|
1002 var input = document.getElementById(inputId);
|
domcox@2
|
1003 document.getElementById("src_iso").value="";
|
domcox@2
|
1004 document.getElementById("src_web").value="";
|
domcox@2
|
1005 if (inputId =="src_iso"){
|
domcox@2
|
1006 document.getElementById("iso").checked = true;
|
domcox@2
|
1007 }
|
domcox@2
|
1008 if (inputId =="src_web"){
|
domcox@2
|
1009 document.getElementById("web").checked = true;
|
domcox@2
|
1010 }
|
domcox@2
|
1011 input.value = slct.options[slct.selectedIndex].value;
|
domcox@2
|
1012
|
domcox@2
|
1013 }
|
domcox@2
|
1014 </script>
|
domcox@2
|
1015 <!-- workaround end -->
|
domcox@2
|
1016 </head>
|
domcox@2
|
1017 <body onload="showProgress()">
|
domcox@2
|
1018 </head>
|
domcox@2
|
1019 <body>
|
domcox@2
|
1020
|
domcox@2
|
1021 <!--
|
domcox@2
|
1022 <div id="header">
|
domcox@2
|
1023 <h1>$(gettext "SliTaz Installer")</h1>
|
domcox@2
|
1024 </div>
|
domcox@2
|
1025 -->
|
domcox@2
|
1026
|
domcox@2
|
1027 <!-- Page content -->
|
domcox@2
|
1028 <div id="content">
|
domcox@2
|
1029 EOT
|
domcox@2
|
1030 }
|
domcox@2
|
1031
|
domcox@2
|
1032 xhtml_footer()
|
domcox@2
|
1033 {
|
domcox@2
|
1034 cat << EOT
|
domcox@2
|
1035 <!-- End of content-->
|
domcox@2
|
1036 </div>
|
domcox@2
|
1037
|
domcox@2
|
1038 <div id="footer">
|
al@6
|
1039 $(gettext "Copyright") © 2012–2013
|
domcox@2
|
1040 <a href="http://www.slitaz.org/">SliTaz GNU/Linux</a>
|
al@6
|
1041 — <a href="/index.cgi?file=/usr/share/licenses/bsd.txt">
|
al@6
|
1042 $(gettext "BSD License")</a>
|
domcox@2
|
1043 </div>
|
domcox@2
|
1044
|
domcox@2
|
1045 </body>
|
domcox@2
|
1046 </html>
|
domcox@2
|
1047 EOT
|
domcox@2
|
1048 }
|
domcox@2
|
1049
|
domcox@2
|
1050
|
domcox@0
|
1051 #
|
domcox@2
|
1052 # main
|
domcox@0
|
1053 #
|
domcox@0
|
1054
|
domcox@2
|
1055 header
|
domcox@2
|
1056
|
domcox@0
|
1057 case "$(GET page)" in
|
domcox@0
|
1058 home)
|
domcox@0
|
1059 xhtml_header
|
domcox@0
|
1060 select_action
|
domcox@0
|
1061 select_install
|
domcox@0
|
1062 select_upgrade
|
domcox@0
|
1063 ;;
|
domcox@2
|
1064 install)
|
domcox@2
|
1065 xhtml_header
|
domcox@2
|
1066 /usr/sbin/tazinst set mode install "$INSTFILE"
|
domcox@2
|
1067 page_redirection partitioning
|
domcox@2
|
1068 ;;
|
domcox@0
|
1069 partitioning)
|
domcox@0
|
1070 xhtml_header
|
domcox@2
|
1071 form_start
|
domcox@2
|
1072 display_mode
|
domcox@0
|
1073 select_gparted
|
domcox@2
|
1074 moveto_page home input
|
domcox@2
|
1075 form_end
|
domcox@0
|
1076 ;;
|
domcox@0
|
1077 gparted)
|
domcox@2
|
1078 exec_gparted
|
domcox@2
|
1079 xhtml_header
|
domcox@0
|
1080 page_redirection partitioning
|
domcox@0
|
1081 ;;
|
domcox@0
|
1082 upgrade)
|
domcox@0
|
1083 xhtml_header
|
domcox@2
|
1084 /usr/sbin/tazinst set mode upgrade "$INSTFILE"
|
domcox@2
|
1085 page_redirection input
|
domcox@2
|
1086 ;;
|
domcox@2
|
1087 input)
|
domcox@2
|
1088 xhtml_header
|
domcox@2
|
1089 form_start
|
domcox@2
|
1090 display_mode
|
domcox@2
|
1091 select_settings
|
domcox@2
|
1092 moveto_page partitioning execute
|
domcox@0
|
1093 form_end
|
domcox@0
|
1094 ;;
|
domcox@2
|
1095 execute)
|
domcox@0
|
1096 xhtml_header
|
domcox@2
|
1097 form_start
|
domcox@2
|
1098 display_mode
|
domcox@2
|
1099 save_settings
|
domcox@2
|
1100 if ! (/usr/sbin/tazinst check all $INSTFILE > /dev/null); then
|
domcox@2
|
1101 page_redirection "input&CHECK=yes"
|
domcox@0
|
1102 else
|
domcox@2
|
1103 tazinst_run && moveto_page home reboot \
|
domcox@2
|
1104 || moveto_page input failed
|
domcox@0
|
1105 fi
|
domcox@2
|
1106 form_end
|
domcox@0
|
1107 ;;
|
domcox@0
|
1108 reboot)
|
domcox@2
|
1109 /usr/sbin/tazinst clean "$INSTFILE"
|
domcox@0
|
1110 reboot ;;
|
domcox@0
|
1111 failed)
|
domcox@0
|
1112 xhtml_header
|
domcox@2
|
1113 form_start
|
domcox@2
|
1114 tazinst_log
|
domcox@2
|
1115 moveto_home
|
domcox@2
|
1116 form_end
|
domcox@0
|
1117 ;;
|
domcox@0
|
1118 *)
|
domcox@0
|
1119 xhtml_header
|
domcox@0
|
1120 if check_ressources; then
|
domcox@2
|
1121 /usr/sbin/tazinst new "$INSTFILE"
|
domcox@0
|
1122 page_redirection home
|
domcox@0
|
1123 fi
|
domcox@0
|
1124 ;;
|
domcox@0
|
1125 esac
|
domcox@0
|
1126
|
domcox@0
|
1127 xhtml_footer
|
domcox@0
|
1128
|
domcox@0
|
1129 exit 0
|