tazinst annotate installer.cgi @ rev 69

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