tazinst annotate installer.cgi @ rev 103

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