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