slitaz-tools rev 668
tazinst: add web frontend (warning: needs latest httpd_helper.sh from Busybox)
author | Dominique Corbex <domcox@slitaz.org> |
---|---|
date | Thu Aug 18 17:04:16 2011 +0200 (2011-08-18) |
parents | b88f5042481a |
children | 7f28451bb0b9 |
files | Makefile installer/cgi/installer.cgi installer/cgi/style.css installer/installer.sh rootfs/usr/share/applications/slitaz-installer.desktop |
line diff
1.1 --- a/Makefile Wed Aug 17 22:03:26 2011 +0200 1.2 +++ b/Makefile Thu Aug 18 17:04:16 2011 +0200 1.3 @@ -101,9 +101,9 @@ 1.4 install -m 0755 tinyutils/soundconf $(DESTDIR)$(PREFIX)/sbin 1.5 install -m 0755 tinyutils/setmixer $(DESTDIR)$(PREFIX)/sbin 1.6 # Installer's 1.7 - install -m 0777 -d $(DESTDIR)$(PREFIX)/share/slitaz/messages/en 1.8 - install -m 0755 installer/slitaz-installer $(DESTDIR)$(PREFIX)/bin 1.9 - install -m 0644 messages/en/installer.msg \ 1.10 +# install -m 0777 -d $(DESTDIR)$(PREFIX)/share/slitaz/messages/en 1.11 +# install -m 0755 installer/slitaz-installer $(DESTDIR)$(PREFIX)/bin 1.12 +# install -m 0644 messages/en/installer.msg \ 1.13 $(DESTDIR)$(PREFIX)/share/slitaz/messages/en 1.14 # tazinst 1.15 install -m 0755 installer/tazinst $(DESTDIR)$(PREFIX)/sbin 1.16 @@ -114,6 +114,10 @@ 1.17 $(DESTDIR)$(PREFIX)/share/locale/$$l/LC_MESSAGES; \ 1.18 done \ 1.19 done 1.20 + # installer.cgi 1.21 + install -m 0755 installer/installer.sh $(DESTDIR)$(PREFIX)/sbin 1.22 + install -m 0777 -d /var/www/installer 1.23 + install -m 0755 installer/cgi/* /var/www/installer 1.24 # slitaz-tools i18n 1.25 for l in $(LINGUAS); \ 1.26 do \
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/installer/cgi/installer.cgi Thu Aug 18 17:04:16 2011 +0200 2.3 @@ -0,0 +1,711 @@ 2.4 +#!/bin/sh 2.5 +# 2.6 +# Main CGI interface for Tazinst, the SliTaz installer. 2.7 +# 2.8 +# Copyright (C) 2011 SliTaz GNU/Linux - BSD License 2.9 +# 2.10 +# Authors : Dominique Corbex <domcox@slitaz.org> 2.11 +# 2.12 + 2.13 +VERSION="0.10" 2.14 + 2.15 +# Get parameters with GET, POST and FILE functions 2.16 +. /usr/bin/httpd_helper.sh 2.17 +header 2.18 + 2.19 +# Include gettext helper script. 2.20 +. /usr/bin/gettext.sh 2.21 + 2.22 +# Export package name for gettext. 2.23 +TEXTDOMAIN='installer' 2.24 +export TEXTDOMAIN 2.25 + 2.26 +TITLE="SliTaz Installer" 2.27 + 2.28 +# Tazinst required version 2.29 +TAZINST_REQUIRED_VERSION="3.3" 2.30 + 2.31 +# Tazinst setup file 2.32 +INSTFILE=/var/lib/tazinst.conf 2.33 + 2.34 +get_config() 2.35 +{ 2.36 + [ -r /etc/slitaz/installer.conf ] && . /etc/slitaz/installer.conf 2.37 +} 2.38 + 2.39 +read_setup() 2.40 +{ 2.41 + [ -e "$INSTFILE" ] && . $INSTFILE || gettext "Tazinst setup file not found!" 2.42 +} 2.43 + 2.44 +write_setup() 2.45 +{ 2.46 + if [ -e "$INSTFILE" ]; then 2.47 + # Read vars from URL 2.48 + read_query_string GET 2.49 + # Install type 2.50 + INST_TYPE=$GET_INST_TYPE 2.51 + # Source File 2.52 + case "$INST_TYPE" in 2.53 + usb) 2.54 + SRC_FILE=$GET_SRC_USB ;; 2.55 + iso) 2.56 + SRC_FILE=$GET_SRC_ISO ;; 2.57 + web) 2.58 + SRC_FILE=$GET_SRC_WEB ;; 2.59 + esac 2.60 + SRC_FILE=$(echo "$SRC_FILE" | sed 's/\//\\\//'g) 2.61 + [ -n $GET_URL ] && SRC_WEB=$GET_URL 2.62 + # Main Partition 2.63 + TGT_PARTITION=$(echo "$GET_TGT_PARTITION" | sed 's/\//\\\//'g) 2.64 + [ -n "$GET_MAIN_FMT" ] && TGT_FS=$GET_MAIN_FS || TGT_FS="" 2.65 + # Home Partition 2.66 + if [ -n "$GET_HOME_SPLIT" ] ; then 2.67 + TGT_HOME=$(echo "$GET_HOME_PART" | sed 's/\//\\\//'g) 2.68 + [ -n "$GET_HOME_FMT" ] && TGT_HOME_FS=$GET_HOME_FS 2.69 + else 2.70 + TGT_HOME="" 2.71 + TGT_HOME_FS="" 2.72 + fi 2.73 + # Hostname 2.74 + TGT_HOSTNAME=$GET_TGT_HOSTNAME 2.75 + # Root pwd 2.76 + TGT_ROOT_PWD=$GET_TGT_ROOT_PWD 2.77 + # User Login 2.78 + TGT_USER=$GET_TGT_USER 2.79 + # User Pwd 2.80 + TGT_USER_PWD=$GET_TGT_USER_PWD 2.81 + # Grub 2.82 + TGT_GRUB=$GET_TGT_GRUB 2.83 + [ "$TGT_GRUB" == "yes" ] || TGT_GRUB=no 2.84 + # Win Dual-Boot 2.85 + TGT_WINBOOT=$GET_TGT_WINBOOT 2.86 + 2.87 + # Save changes to INSTFILE 2.88 + sed -i s/"^INST_TYPE=.*"/"INST_TYPE=\"$INST_TYPE\"/" $INSTFILE 2.89 + sed -i s/"^SRC_FILE=.*"/"SRC_FILE=\"$SRC_FILE\"/" $INSTFILE 2.90 + sed -i s/"^TGT_PARTITION=.*"/"TGT_PARTITION=\"$TGT_PARTITION\"/" $INSTFILE 2.91 + sed -i s/"^TGT_FS=.*"/"TGT_FS=\"$TGT_FS\"/" $INSTFILE 2.92 + sed -i s/"^TGT_HOME=.*"/"TGT_HOME=\"$TGT_HOME\"/" $INSTFILE 2.93 + sed -i s/"^TGT_HOME_FS=.*"/"TGT_HOME_FS=\"$TGT_HOME_FS\"/" $INSTFILE 2.94 + sed -i s/"^TGT_HOSTNAME=.*"/"TGT_HOSTNAME=\"$TGT_HOSTNAME\"/" $INSTFILE 2.95 + sed -i s/"^TGT_ROOT_PWD=.*"/"TGT_ROOT_PWD=\"$TGT_ROOT_PWD\"/" $INSTFILE 2.96 + sed -i s/"^TGT_USER=.*"/"TGT_USER=\"$TGT_USER\"/" $INSTFILE 2.97 + sed -i s/"^TGT_USER_PWD=.*"/"TGT_USER_PWD=\"$TGT_USER_PWD\"/" $INSTFILE 2.98 + sed -i s/"^TGT_GRUB=.*"/"TGT_GRUB=\"$TGT_GRUB\"/" $INSTFILE 2.99 + sed -i s/"^TGT_WINBOOT=.*"/"TGT_WINBOOT=\"$TGT_WINBOOT\"/" $INSTFILE 2.100 + fi 2.101 +} 2.102 + 2.103 +check_setup() 2.104 +{ 2.105 + local ret 2.106 + IFS=$'\n' 2.107 + for line in $(tazinst check $INSTFILE; ret=$?) 2.108 + do 2.109 + line=$(echo $line | sed 's/\[1m//g') 2.110 + line=$(echo $line | sed 's/\[0m//g') 2.111 + line=$(echo $line | sed 's/\s/\ /g') 2.112 + line=$(echo $line | sed 's/</\</g') 2.113 + line=$(echo $line | sed 's/>/\>/g') 2.114 + echo "<font color=\"red\">$line<br /></font>" 2.115 + done 2.116 + unset IFS 2.117 + return $ret 2.118 +} 2.119 + 2.120 +select_action() 2.121 +{ 2.122 + cat <<EOT 2.123 +<div id="wrapper"> 2.124 + <h2>$(gettext "SliTaz Installer")</h2> 2.125 + <p>$(gettext "The SliTaz Installer installs or upgrade SliTaz to a hard disk 2.126 + drive from a device like a Live-CD or LiveUSB key, from a SliTaz ISO file, or 2.127 + from the web by downloading an ISO file.")<p> 2.128 +</div> 2.129 +EOT 2.130 +} 2.131 + 2.132 +select_gparted() 2.133 +{ 2.134 + cat <<EOT 2.135 +<table> 2.136 +<tr> 2.137 + <td>$(gettext "Before installation, you'll may need to resize partitions 2.138 +on your hard disk drive in order to make space for SlItaz GNU/Linux.")</td> 2.139 +</tr> 2.140 +<tr> 2.141 + <td><a class="button" href="$SCRIPT_NAME?page=gparted">$(gettext "Launch GParted")</a></td> 2.142 +</tr> 2.143 +</table> 2.144 +EOT 2.145 +} 2.146 + 2.147 +select_install() 2.148 +{ 2.149 + cat <<EOT 2.150 +</table> 2.151 +<form method="get" action="$SCRIPT_NAME"> 2.152 +<table> 2.153 +<tr> 2.154 + <td><h4>$(gettext "Install")</h4></td> 2.155 +</tr> 2.156 +<tr> 2.157 + <td>$(gettext "Install SliTaz on a partition of your hard disk drive. If 2.158 + you decide to format your HDD, all data will be lost. If you do not 2.159 + format, all data except for any existing /home directory will be removed, 2.160 + the home directory will be kept as is.")</td> 2.161 +</tr> 2.162 +<tr> 2.163 + <td><a class="button" href="$SCRIPT_NAME?page=install">$(gettext "Install SliTaz")</a></td> 2.164 +</tr> 2.165 +</table> 2.166 +EOT 2.167 +} 2.168 + 2.169 +select_upgrade() 2.170 +{ 2.171 + cat <<EOT 2.172 +<table> 2.173 +<tr> 2.174 + <td><h4>$(gettext "Upgrade")</h4></td> 2.175 +</tr> 2.176 +<tr> 2.177 + <td>$(gettext "Upgrade an already installed SliTaz system on your hard disk 2.178 + drive. Your /home /etc /var/www directories will be kept, all other directories 2.179 + will be removed. Any additional package added to your old Slitaz system 2.180 + will be updated as long you have an active internet connection.")</td> 2.181 +</tr> 2.182 +<tr> 2.183 + <td><a class="button" href="$SCRIPT_NAME?page=upgrade">$(gettext "Upgrade SliTaz")</a></td> 2.184 +</tr> 2.185 +</table> 2.186 +</form> 2.187 +EOT 2.188 +} 2.189 + 2.190 +display_action() 2.191 +{ 2.192 + case $1 in 2.193 + install) 2.194 + cat << EOT 2.195 +<div id="wrapper"> 2.196 +<h3>$(gettext "Install SliTaz")</h3> 2.197 +<p>$(gettext "You're going to install SliTaz on a partition of your hard disk drive. If 2.198 + you decide to format your HDD, all data will be lost. If you do not 2.199 + format, all data except for any existing /home directory will be removed, 2.200 + the home directory will be kept as is.")<p> 2.201 +</div> 2.202 +<input type="hidden" name="INST_ACTION" value="$1"> 2.203 +EOT 2.204 + ;; 2.205 + upgrade) 2.206 + cat << EOT 2.207 +<div id="wrapper"> 2.208 +<h2>$(gettext "Upgrade SliTaz")</h2> 2.209 +<p>$(gettext "You're going to upgrade an already installed SliTaz system on your hard disk 2.210 + drive. Your /home /etc /var/www directories will be kept, all other directories 2.211 + will be removed. Any additional package added to your old Slitaz system 2.212 + will be updated as long you have an active internet connection.")<p> 2.213 +</div> 2.214 +<input type="hidden" name="INST_ACTION" value="$1"> 2.215 +EOT 2.216 + ;; 2.217 + esac 2.218 +} 2.219 + 2.220 +select_source() 2.221 +{ 2.222 + cat <<EOT 2.223 +<a name="source"></a> 2.224 +<h4>$(gettext "Source")</h4> 2.225 + <table> 2.226 + <tr> 2.227 + <td><input type="radio" name="INST_TYPE" value="cdrom" $([ "$INST_TYPE" == "cdrom" ] && echo "checked") id="cdrom" /> 2.228 + <label for="cdrom">$(gettext "LiveCD")</td></label> 2.229 + </tr> 2.230 + <tr> 2.231 + <td><input type="radio" name="INST_TYPE" value="usb" $([ "$INST_TYPE" == "usb" ] && echo "checked") id="usb" /> 2.232 + <label for="usb">$(gettext "LiveUSB"):</label> 2.233 + <select name="SRC_USB"> 2.234 +EOT 2.235 + # List disks if plugged USB device 2.236 + usb=0 2.237 + if [ -d /proc/scsi/usb-storage ]; then 2.238 + for DEV in /sys/block/sd* ; do 2.239 + if readlink $DEV | grep -q usb; then 2.240 + DEV=$(basename $DEV) 2.241 + if [ -d /sys/block/${DEV}/${DEV}1 ]; then 2.242 + for i in $(fdisk -l /dev/$DEV | awk '/^\/dev/ {printf "%s ", $1}') ; do 2.243 + echo "<option value='$i' $([ "$i" == "$SRC_FILE" ] && echo "selected") >$i</option>" 2.244 + usb=$usb+1 2.245 + done 2.246 + fi 2.247 + fi 2.248 + done 2.249 + fi 2.250 + if [ $usb -lt 1 ]; then 2.251 + echo "<option value="">$(gettext "Not found")</option>" 2.252 + fi 2.253 + cat << EOT 2.254 + </select> 2.255 + </td> 2.256 + </tr> 2.257 + <tr> 2.258 + <td><input type="radio" name="INST_TYPE" value="iso" $([ "$INST_TYPE" == "iso" ] && echo "checked") id="iso" /> 2.259 + <label for="iso">$(gettext "ISO file"):</label> 2.260 + <input type="url" size="50" name="SRC_ISO" $([ "$INST_TYPE" == "iso" ] && echo -e "value=\"$SRC_FILE\"") placeholder="$(gettext "Full path to the ISO image file")" /> 2.261 + </td> 2.262 + </tr> 2.263 + <tr> 2.264 + <td><input type="radio" name="INST_TYPE" value="web" $([ "$INST_TYPE" == "web" ] && echo "checked" id="web") /> 2.265 + <label for="web">$(gettext "Web"): 2.266 + <a class="button" href="$SCRIPT_NAME?page=$GET_page&SRC_WEB=stable">$(gettext "Stable")</a> 2.267 + <a class="button" href="$SCRIPT_NAME?page=$GET_page&SRC_WEB=cooking">$(gettext "Cooking")</a> 2.268 + $(gettext "URL:")</label> 2.269 +EOT 2.270 + case $GET_SRC_WEB in 2.271 + stable|cooking) 2.272 + GET_SRC_WEB=$(tazinst showurl $GET_SRC_WEB) ;; 2.273 + *) 2.274 + [ "$INST_TYPE" == "web" ] && GET_SRC_WEB=$SRC_FILE ;; 2.275 + esac 2.276 +cat <<EOT 2.277 + <input type="url" size="55" name="SRC_WEB" value="$GET_SRC_WEB" placeholder="$(gettext "Full url to an ISO image file")" /></td> 2.278 + </tr> 2.279 + </table> 2.280 +EOT 2.281 +} 2.282 + 2.283 +select_partition() 2.284 +{ 2.285 +cat <<EOT 2.286 +<a name="partition"></a> 2.287 +<h4></span>$(gettext "Main Partition")</h4> 2.288 +<table> 2.289 +<tr><td> 2.290 + $(gettext "Partition to use:") 2.291 + <select name="TGT_PARTITION"> 2.292 +EOT 2.293 + # List partitions 2.294 + if fdisk -l | grep -q ^/dev/ ; then 2.295 + for i in `blkid | cut -d ":" -f 1`; do 2.296 + echo "<option value='$i' $([ "$i" == "$TGT_PARTITION" ] && echo "selected")>$i</option>" 2.297 + done 2.298 + else 2.299 + echo "<option value="">$(gettext "Not found")</option>" 2.300 + fi 2.301 + cat << EOT 2.302 + </select> 2.303 + <br /> 2.304 + <input type="checkbox" name="MAIN_FMT" value="yes" $([ -n "$TGT_FS" ] && echo "checked") id="mainfs" /> 2.305 + <label for="mainfs">$(gettext "Format partition as"):</label> 2.306 + <select name="MAIN_FS"> 2.307 +EOT 2.308 + scan_mkfs 2.309 + for i in $FS 2.310 + do 2.311 + echo "<option value='$i' $([ "$i" == "$TGT_FS" ] && echo "selected")>$i</option>" 2.312 + done 2.313 + cat <<EOT 2.314 +</select> 2.315 +</td></tr> 2.316 +</table> 2.317 +EOT 2.318 +} 2.319 + 2.320 +select_old_slitaz() 2.321 +{ 2.322 +cat <<EOT 2.323 +<a name="partition"></a> 2.324 +<h4></span>$(gettext "Existing SliTaz Partition")</h4> 2.325 +<table> 2.326 +<tr><td> 2.327 + $(gettext "Partition in use:") 2.328 + <select name="TGT_PARTITION"> 2.329 +EOT 2.330 + # List partitions 2.331 + if fdisk -l | grep -q ^/dev/ ; then 2.332 + for i in `blkid | cut -d ":" -f 1`; do 2.333 + echo "<option value='$i' $([ "$i" == "$TGT_PARTITION" ] && echo "selected")>$i</option>" 2.334 + done 2.335 + else 2.336 + echo "<option value="">$(gettext "Not found")</option>" 2.337 + fi 2.338 + cat <<EOT 2.339 +</select> 2.340 +</td></tr> 2.341 +</table> 2.342 +EOT 2.343 +} 2.344 + 2.345 +select_home() 2.346 +{ 2.347 + cat <<EOT 2.348 +<a name="home"></a> 2.349 +<h4>$(gettext "Home partition")</h4> 2.350 +<input type="checkbox" name="HOME_SPLIT" value="yes" $([ -n "$TGT_HOME" ] && echo "checked") id="homepart" /> 2.351 + <label for="homepart">$(gettext "Use a separate partition for /home:")</label> 2.352 + <select name="HOME_PART"> 2.353 +EOT 2.354 + # List disk if plugged USB device 2.355 + if fdisk -l | grep -q ^/dev/ ; then 2.356 + for i in `blkid | cut -d ":" -f 1`; do 2.357 + echo "<option value='$i' $([ "$i" == "$TGT_HOME" ] && echo "selected")>$i</option>" 2.358 + done 2.359 + else 2.360 + echo "<option value="">$(gettext "Not found")</option>" 2.361 + fi 2.362 +cat <<EOT 2.363 + </select> 2.364 + 2.365 + <input type="checkbox" name="HOME_FMT" value="yes" $([ -n "$TGT_HOME_FS" ] && echo "checked") id="homefs" /> 2.366 + <label for="homefs">$(gettext "Format partition as:")</label> 2.367 + <select name="HOME_FS">" 2.368 +EOT 2.369 + for i in $FS 2.370 + do 2.371 + echo "<option value='$i' $([ "$i" == "$TGT_HOME_FS" ] && echo "selected")>$i</option>" 2.372 + done 2.373 + echo "</select>" 2.374 +} 2.375 + 2.376 +select_hostname() 2.377 +{ 2.378 +cat << EOT 2.379 +<a name="hostname"></a> 2.380 +<h4>$(gettext "Host")</h4> 2.381 +$(gettext "Hostname:") 2.382 +<input type="text" name="TGT_HOSTNAME" value="$TGT_HOSTNAME" placeholder="$(gettext "Name of your system")" /> 2.383 +EOT 2.384 +} 2.385 + 2.386 +select_root() 2.387 +{ 2.388 +cat << EOT 2.389 +<a name="root"></a> 2.390 +<h4>$(gettext "Root")</h4> 2.391 +$(gettext "Root passwd:") 2.392 +<input type="text" name="TGT_ROOT_PWD" value="$TGT_ROOT_PWD" placeholder="$(gettext "Password of root")" /> 2.393 +EOT 2.394 +} 2.395 + 2.396 +select_user() 2.397 +{ 2.398 +cat << EOT 2.399 +<a name="user"></a> 2.400 +<h4>$(gettext "User")</h4> 2.401 +$(gettext "User login:") 2.402 +<input type="text" name="TGT_USER" value="$TGT_USER" placeholder="$(gettext "Name of the first user")" /> 2.403 +$(gettext "User passwd:") 2.404 +<input type="text" name="TGT_USER_PWD" value="$TGT_USER_PWD" placeholder="$(gettext "Password of the first user")" /> 2.405 +EOT 2.406 +} 2.407 + 2.408 +select_grub() 2.409 +{ 2.410 +cat << EOT 2.411 +<a name="grub"></a> 2.412 +<h4>$(gettext "Grub")</h4> 2.413 +<input type="checkbox" name="TGT_GRUB" value="yes" $([ "$TGT_GRUB" == "yes" ] && echo "checked") id="grub" /> 2.414 +<label for="grub">$(gettext "Install Grub bootloader")<br /></label> 2.415 +<input type="checkbox" name="TGT_WINBOOT" value="auto" $([ -n "$TGT_WINBOOT" ] && echo "checked") id="dualboot" /> 2.416 +<label for="dualboot">$(gettext "Enable Windows Dual-Boot")</label> 2.417 +EOT 2.418 +} 2.419 + 2.420 +moveto_page() 2.421 +{ 2.422 + case $1 in 2.423 + *) 2.424 + page=home 2.425 + title1=$(gettext "Back to Home") ;; 2.426 + esac 2.427 + case $2 in 2.428 + write|run) 2.429 + title2=$(gettext "Proceed to SliTaz installation") ;; 2.430 + reboot) 2.431 + title2=$(gettext "Installation complete. You can now restart (reboot)") ;; 2.432 + failed) 2.433 + title2=$(gettext "Installation failed. See log") ;; 2.434 + *) 2.435 + page=home 2.436 + title2=$(gettext "Back to Home") ;; 2.437 + esac 2.438 + cat <<EOT 2.439 +<script type="text/javascript"> 2.440 + function SubmitForm() { 2.441 + var r=confirm("$(gettext "Do you really want to continue?")"); 2.442 + if (r==true) 2.443 + { 2.444 + document.ConfigForm.submit(); 2.445 + } 2.446 + } 2.447 +</script> 2.448 +<hr /> 2.449 +<input type="hidden" name="page" value="$2" /> 2.450 +<a class="button" value="$1" href="$SCRIPT_NAME?page=$1" >$title1</a> 2.451 +<a class="button" value="$2" onclick="SubmitForm()">$title2</a> 2.452 +EOT 2.453 +} 2.454 + 2.455 +page_redirection() 2.456 +{ 2.457 + cat <<EOT 2.458 +<html> 2.459 +<head> 2.460 +<title>$(gettext "A web page that points a browser to a different page after 2 seconds")</title> 2.461 +<meta http-equiv="refresh" content="0; URL=$SCRIPT_NAME?page=$1"> 2.462 +<meta name="keywords" content="automatic redirection"> 2.463 +</head> 2.464 +<body> 2.465 +$(gettext "If your browser doesn't automatically go there within a few seconds, 2.466 +you may want to go manually to ") 2.467 +<a href="$SCRIPT_NAME?page=$1">$1</a> 2.468 +</body> 2.469 +</html> 2.470 +EOT 2.471 +} 2.472 + 2.473 +check_ressources() 2.474 +{ 2.475 + local code 2.476 + code=0 2.477 + # Check tazinst 2.478 + if ! tazinst usage | grep -q Usage: ; then 2.479 + cat <<EOT 2.480 +<h3>$(gettext "Tazinst Error")</h3> 2.481 +<p><strong>tazinst</strong>, $(gettext "the lightweight SliTaz HDD installer 2.482 +is missing. Any installation can't be done without tazinst.")</p> 2.483 +<p>$(gettext "Check tazinst' permissions, or reinstall the slitaz-tools package:")</p> 2.484 +<code># tazpkg get-install slitaz-tools --forced</code> 2.485 +EOT 2.486 + code=1 2.487 + else 2.488 + # Check tazinst required version 2.489 + v=$(tazinst version | tr -d '[:alpha:]') 2.490 + r=$TAZINST_REQUIRED_VERSION 2.491 + if ! (echo "$v" | awk -v r=$r '{v=$v+0}{ if (v < r) exit 1}') ; then 2.492 + cat <<EOT 2.493 +<h3>$(gettext "Tazinst Error")</h3> 2.494 +<p><strong>tazinst</strong> ($v) $(gettext "is not at the required version ($r), 2.495 +use tazinst in a xterm or reinstall the slitaz-tools package:")</p> 2.496 +<code># tazpkg get-install slitaz-tools --forced</code> 2.497 +EOT 2.498 + code=1 2.499 + fi 2.500 + # Check setup file 2.501 + if [ ! -e "$INSTFILE" ]; then 2.502 + gettext "Creating setup file $INSTFILE." 2.503 + tazinst new $INSTFILE 2.504 + fi 2.505 + if [ ! -e "$INSTFILE" ]; then 2.506 + cat <<EOT 2.507 +<h3>$(gettext "Setup File Error")</h3> 2.508 +<p>$(gettext "The setup file <strong>$INSTFILE</strong> doesn't exists.")</p> 2.509 +EOT 2.510 + code=1 2.511 + else 2.512 + if [ ! -r $INSTFILE ]; then 2.513 + cat <<EOT 2.514 +<h3>$(gettext "Setup File Error")</h3> 2.515 +<p>$(gettext "The setup file <strong>$INSTFILE</strong> is not readable. 2.516 +Check permissions and ownership.")</p> 2.517 +EOT 2.518 + code=1 2.519 + fi 2.520 + fi 2.521 + fi 2.522 + return $code 2.523 +} 2.524 + 2.525 +run_tazinst() 2.526 +{ 2.527 + echo "<h4>$(gettext "Proceeding:")</h4>" 2.528 + table_start 2.529 + tazinst $GET_INST_ACTION $INSTFILE | \ 2.530 + awk '{print "<tr><td><tt>" $0 "</tt></td></tr>"}' 2.531 + table_end 2.532 + return $(grep -c "cancelled on error" $INSTFILE) 2.533 +} 2.534 + 2.535 +tazinst_log() 2.536 +{ 2.537 + echo "<pre>" 2.538 + tazinst log 2.539 + echo "</pre>" 2.540 +} 2.541 + 2.542 +scan_mkfs() 2.543 +{ 2.544 + for path in /bin /sbin /usr/bin /usr/sbin 2.545 + do 2.546 + [ -e $path/mkfs.btrfs ] && FS=btrfs 2.547 + [ -e $path/mkfs.cramfs ] && FS="$FS cramfs" 2.548 + [ -e $path/mkfs.ext2 ] && FS="$FS ext2" 2.549 + [ -e $path/mkfs.ext3 ] && FS="$FS ext3" 2.550 + [ -e $path/mkfs.ext4 ] && FS="$FS ext4" 2.551 + [ -e $path/mkfs.vfat ] && FS="$FS fat32" 2.552 + [ -e $path/mkfs.jfs ] && FS="$FS jfs" 2.553 + [ -e $path/mkfs.minix ] && FS="$FS minix" 2.554 + [ -e $path/mkfs.ntfs ] && FS="$FS ntfs" 2.555 + [ -e $path/mkfs.reiserfs ] && FS="$FS reiserfs" 2.556 + [ -e $path/mkfs.xfs ] && FS="$FS xfs" 2.557 + done 2.558 +} 2.559 + 2.560 +xhtml_header() 2.561 +{ 2.562 + cat <<EOT 2.563 +<!DOCTYPE html> 2.564 +<html xmlns="http://www.w3.org/1999/xhtml"> 2.565 +<head> 2.566 + <title>$TITLE</title> 2.567 + <meta charset="utf-8" /> 2.568 + <link rel="shortcut icon" href="/styles/default/favicon.ico" /> 2.569 + <link rel="stylesheet" type="text/css" href="style.css" /> 2.570 + <!-- Function to hide the loading message when page is generated. --> 2.571 + <script type="text/javascript"> 2.572 + function showLoading(){ 2.573 + document.getElementById("loading").style.display='none'; 2.574 + } 2.575 + </script> 2.576 +</head> 2.577 +<body onload="showLoading()"> 2.578 + 2.579 +<!-- Page content --> 2.580 +<div id="content"> 2.581 +EOT 2.582 +} 2.583 + 2.584 +xhtml_footer() 2.585 +{ 2.586 +cat <<EOT 2.587 + 2.588 +<!-- End of content--> 2.589 +</div> 2.590 + 2.591 +<div id="footer"> 2.592 + Copyright © 2011 2.593 + <a href="http://www.slitaz.org/">SliTaz GNU/Linux</a> 2.594 + - <a href="/index.cgi?file=/usr/share/licenses/bsd.txt">BSD License</a> 2.595 +</div> 2.596 + 2.597 +</body> 2.598 +</html> 2.599 +EOT 2.600 +} 2.601 + 2.602 +table_start() { 2.603 + cat << EOT 2.604 +<table> 2.605 + <tbody> 2.606 +EOT 2.607 +} 2.608 + 2.609 +table_end () { 2.610 + cat << EOT 2.611 + </tbody> 2.612 +</table> 2.613 +EOT 2.614 + 2.615 +} 2.616 + 2.617 +form_start() 2.618 +{ 2.619 + cat <<EOT 2.620 +<form name="ConfigForm" method="get" action="$SCRIPT_NAME"> 2.621 +EOT 2.622 +} 2.623 + 2.624 +form_end() 2.625 +{ 2.626 + echo "</form>" 2.627 +} 2.628 + 2.629 +# 2.630 +# Main 2.631 +# 2.632 +get_config 2.633 + 2.634 +read_query_string GET 2.635 + 2.636 +# 2.637 +# Pages 2.638 +# 2.639 + 2.640 +case "$GET_page" in 2.641 + gparted) 2.642 + gparted 2.643 + xhtml_header 2.644 + page_redirection home 2.645 + ;; 2.646 + install) 2.647 + read_setup 2.648 + xhtml_header 2.649 + form_start 2.650 + display_action install 2.651 + check_setup 2.652 + select_source 2.653 + select_partition 2.654 + select_home 2.655 + select_hostname 2.656 + select_root 2.657 + select_user 2.658 + select_grub 2.659 + moveto_page home write 2.660 + form_end 2.661 + ;; 2.662 + upgrade) 2.663 + read_setup 2.664 + xhtml_header 2.665 + form_start 2.666 + display_action upgrade 2.667 + check_setup 2.668 + select_source 2.669 + select_old_slitaz 2.670 + select_grub 2.671 + moveto_page home write 2.672 + form_end 2.673 + ;; 2.674 + write) 2.675 + write_setup 2.676 + xhtml_header 2.677 + if ! (tazinst check $INSTFILE); then 2.678 + page_redirection $GET_INST_ACTION 2.679 + else 2.680 + read_setup 2.681 + form_start 2.682 + display_action $GET_INST_ACTION 2.683 + if run_tazinst; then 2.684 + moveto_page home reboot 2.685 + else 2.686 + moveto_page home failed 2.687 + fi 2.688 + form_end 2.689 + fi 2.690 + ;; 2.691 + reboot) 2.692 + reboot ;; 2.693 + home) 2.694 + xhtml_header 2.695 + select_action 2.696 + select_gparted 2.697 + select_install 2.698 + select_upgrade 2.699 + ;; 2.700 + failed) 2.701 + xhtml_header 2.702 + display_log 2.703 + ;; 2.704 + *) 2.705 + xhtml_header 2.706 + if check_ressources; then 2.707 + page_redirection home 2.708 + fi 2.709 + ;; 2.710 +esac 2.711 + 2.712 +xhtml_footer 2.713 + 2.714 +exit 0
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/installer/cgi/style.css Thu Aug 18 17:04:16 2011 +0200 3.3 @@ -0,0 +1,274 @@ 3.4 +/* 3.5 + * CSS style for TazPanel - (C) 2011 SliTaz GNU/Linux 3.6 + * 3.7 +*/ 3.8 + 3.9 +/* To always have a scroll bar */ 3.10 +html { 3.11 + min-height: 102%; 3.12 +} 3.13 + 3.14 +body { 3.15 + background: #ffffff; 3.16 + color: black; 3.17 + font: 13px sans-serif, vernada, arial; 3.18 + margin: 25px 0 0; 3.19 +} 3.20 + 3.21 +h1 { color: #d66018; padding: 6px 0 0 20px; font-size: 180%; } 3.22 +h2 { color: #444; margin: 10px 0 10px; font-size: 150%; } 3.23 +h3 { color: #666; font-size: 140%; } 3.24 +h4 { color: #888; font-size: 120%; margin: 10px 0 5px; } 3.25 +img { border: 0pt none; vertical-align: middle; padding: 0px 6px 2px 0;} 3.26 +p { margin: 10px 0; } 3.27 +ul { list-style-type: square; } 3.28 +li { padding: 4px 0; } 3.29 +a { text-decoration: none; color: #666; } 3.30 +a:hover { color: #000; } 3.31 + 3.32 +/* Header and main title */ 3.33 + 3.34 +#header { 3.35 + height: 42px; 3.36 + border-bottom: 1px dotted #ddd; 3.37 +} 3.38 + 3.39 +/* Desktop gui style bar */ 3.40 + 3.41 +#toolbar { 3.42 + position: fixed; 3.43 + top: 0; 3.44 + left: 0; 3.45 + height: 24px; 3.46 + width: 100%; 3.47 + padding: 0; 3.48 + background-color: #f1efeb; 3.49 + border-bottom: 1px solid #c1baad; 3.50 + z-index: 200; 3.51 + cursor: default; 3.52 +} 3.53 + 3.54 +#menu { margin: 4px 8px; } 3.55 +#menu a { padding: 2px 4px; color: #000; 3.56 + cursor: default; } 3.57 +#menu a:hover { color: #444; } 3.58 +#icons { margin: 2px 8px; float: right; } 3.59 +#icons img { padding: 0; } 3.60 + 3.61 +#loading { 3.62 + /* font-weight: bold; */ 3.63 + background-color: #f8f8f8; 3.64 + border: 1px solid #ddd; 3.65 + color: #666; 3.66 + cursor: progress; 3.67 + position: fixed; 3.68 + top: 92px; 3.69 + right: 120px; 3.70 + width: 248px; 3.71 + padding: 4px 4px 2px; 3.72 +} 3.73 + 3.74 +/* Blocks */ 3.75 + 3.76 +#block { float: left; } 3.77 + 3.78 +/* Sidebar menus */ 3.79 + 3.80 +#sidebar { 3.81 + position: fixed; 3.82 + top: 92px; 3.83 + right: 5px; 3.84 + width: 116px; 3.85 +} 3.86 + 3.87 +#sidebar a { 3.88 + display: block; 3.89 + padding: 0px 0 0px 12px; 3.90 + margin: 0; 3.91 +} 3.92 + 3.93 +#sidebar a.active { 3.94 + color: #000; 3.95 + font-weight: bold; 3.96 +} 3.97 + 3.98 +#sidebar h4 { margin: 0 0 2px 12px; } 3.99 +#sidebar ul { list-style-type: none; padding: 0; } 3.100 + 3.101 +/* Content */ 3.102 + 3.103 +#content { margin: 20px; } 3.104 +#content-sidebar { margin: 20px 120px 20px 20px; } 3.105 +#wrapper { margin: 10px 0 20px; } 3.106 + 3.107 +#actions { 3.108 + height: 20px; 3.109 + margin: 16px 0; 3.110 +} 3.111 + 3.112 +#actions p { margin: 6px 0; } 3.113 + 3.114 +.search { 3.115 + position: absolute; 3.116 + right: 40px; 3.117 + top: 23px; 3.118 +} 3.119 + 3.120 +.search input[type=submit] { 3.121 + padding: 4px; 3.122 + margin-left: -4px; 3.123 + background-color: #f1f1f1; 3.124 + border: 1px solid #ddd; 3.125 + cursor: pointer; 3.126 + color: #000; 3.127 + font-weight: bold; 3.128 + border-radius: 0px; 3.129 +} 3.130 + 3.131 +.search input[type=submit].radius { 3.132 + border-top-right-radius: 4px; 3.133 + border-bottom-right-radius: 4px; 3.134 + border-top-left-radius: 0px; 3.135 + border-bottom-left-radius: 0px; 3.136 +} 3.137 + 3.138 +.search input[type=text] { 3.139 + border: 1px solid #ddd; 3.140 + padding: 4px; 3.141 + height: 17px; 3.142 + margin: 0; 3.143 + width: 200px; 3.144 + border-top-left-radius: 4px; 3.145 + border-bottom-left-radius: 4px; 3.146 +} 3.147 + 3.148 +.box { 3.149 + margin: 10px 0; 3.150 + padding: 12px; 3.151 + background: #f8f8f8; 3.152 + border: 1px solid #ddd; 3.153 +} 3.154 + 3.155 +.box ul { list-style-type: none; padding: 0; } 3.156 + 3.157 +.debug { 3.158 + position: fixed; 3.159 + bottom: 0px; 3.160 + right: 10px; 3.161 + left: 10px; 3.162 + margin: 5px; 3.163 + padding: 4px 10px; 3.164 + background-color: #111; 3.165 + color: #fff; 3.166 + border: 0; 3.167 + font-size: 12px; 3.168 + opacity: 0.9; 3.169 +} 3.170 + 3.171 +.float-left { float: left; } 3.172 +.float-right { float: right; } 3.173 + 3.174 +/* Table */ 3.175 + 3.176 +table { 3.177 + background-color: #f8f8f8; 3.178 + border: 1px solid #ddd; 3.179 + padding: 10px; 3.180 + width: 100%; 3.181 + margin: 0 0 6px 0; 3.182 +} 3.183 + 3.184 +table a { color: #000; } 3.185 +table a:hover { color: #666; } 3.186 +td.small { min-width: 60px; } 3.187 +td.pkg { max-width: 160px; } 3.188 +td.desc { max-width: 300px; } 3.189 +td.pct { min-width: 200px; background: #eee; } 3.190 +div.pct { background: #ccc; display: inline; } 3.191 +td.pct, div.pct { border-radius: 2px; } 3.192 + 3.193 +#thead, .thead, thead { 3.194 + height: 10px; 3.195 + font-weight: bold; 3.196 +} 3.197 + 3.198 +/* syntax_highlighter */ 3.199 + 3.200 +span.conf-comment { color: #666; } 3.201 +span.conf-var { color: #392600; } 3.202 +span.conf-val, span.sh-val { color: #f35a00; } 3.203 +span.sh-comment { color: #b20000; } 3.204 +span.activity-log { color: #888; font-size: 95%; } 3.205 +span.diff-rm { color: red; } 3.206 +span.diff-add { color: green; } 3.207 +span.diff-at { color: blue; } 3.208 +span.top { color: #00c800; font-weight: bold; font-size: 95%; } 3.209 + 3.210 +/* Misc */ 3.211 + 3.212 +pre, .pre-main { 3.213 + background-color: #f8f8f8; 3.214 + border: 1px solid #ddd; 3.215 + padding: 10px; 3.216 + margin: 10px 0; 3.217 + overflow: auto; 3.218 +} 3.219 + 3.220 +.pre-main { margin: 16px 0; } 3.221 + 3.222 +input[type=submit], select, .button { 3.223 + padding: 4px; 3.224 + margin: 0; 3.225 + background-color: #f1f1f1; 3.226 + border: 1px solid #ddd; 3.227 + cursor: pointer; 3.228 + color: #000; 3.229 +} 3.230 + 3.231 +input[type=submit]:hover, select:hover, .button:hover { 3.232 + background-color: #ddd; 3.233 + border: 1px solid #999; 3.234 +} 3.235 + 3.236 +input[type=text], input[type=password] { height: 18px; } 3.237 + 3.238 +div.scroll { height: 200px; overflow: auto; 3.239 + border: 1px solid #ddd; } 3.240 +div.scroll table { border: 0px solid #fff; } 3.241 + 3.242 +#terminal { 3.243 + background: #000; 3.244 + color: #fff; 3.245 + border: 1px solid #444; 3.246 + min-height: 180px; 3.247 + opacity: 0.8; 3.248 +} 3.249 + 3.250 +/* Round corner */ 3.251 + 3.252 +#loading, table, pre, input[type=submit], .debug, .box, 3.253 +.button, div.scroll { 3.254 + /*-moz-border-radius: 4px; 3.255 + -webkit-border-radius: 4px; */ 3.256 + border-radius: 4px; 3.257 +} 3.258 + 3.259 +/* Help page */ 3.260 + 3.261 +#help { text-align: justify; } 3.262 +#help a { color: #215090; text-decoration: underline; } 3.263 +#help a:hover { text-decoration: none; color: blue; } 3.264 + 3.265 +/* Footer */ 3.266 + 3.267 +#footer { 3.268 + /* border-bottom: 1px solid #c1baad; */ 3.269 + height: 25px; 3.270 + text-align: center; 3.271 + padding: 40px 10px; 3.272 + font-size: 11px; 3.273 + color: #bbb; 3.274 +} 3.275 + 3.276 +#footer a { color: #bbb; } 3.277 +#footer a:hover { color: #555; }
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 4.2 +++ b/installer/installer.sh Thu Aug 18 17:04:16 2011 +0200 4.3 @@ -0,0 +1,38 @@ 4.4 +#!/bin/sh 4.5 +# 4.6 +# Launcher for installer.cgi 4.7 +# 4.8 +# Copyright (C) 2011 SliTaz GNU/Linux - GNU General Public License v3. 4.9 +# 4.10 +# Authors : Dominique Corbex <domcox@slitaz.org> 4.11 +# 4.12 + 4.13 +HTTPD_PORT=83 4.14 +PIDFILE=/run/installer.pid 4.15 + 4.16 +if (ps | grep httpd | grep -q "\-p $HTTPD_PORT"); then 4.17 + export ALERT_DIALOG=' 4.18 + <vbox> 4.19 + <pixmap icon_size="4"> 4.20 + <input file stock="gtk-dialog-warning"></input> 4.21 + </pixmap> 4.22 + <text> 4.23 + <label>SliTaz Installer is already running!</label> 4.24 + </text> 4.25 + <hbox homogeneous="true"> 4.26 + <button cancel></button> 4.27 + </hbox> 4.28 + </vbox> ' 4.29 + gtkdialog --program=ALERT_DIALOG 4.30 +else 4.31 + # Start httpd 4.32 + httpd -p $HTTPD_PORT -u root -f \ 4.33 + -r Installer Authentication - Default: root:root & \ 4.34 + ps | grep "httpd" | grep "\-p $HTTPD_PORT" | \ 4.35 + awk '{ print $1 }' > $PIDFILE 4.36 + # Run Tazweb 4.37 + tazweb localhost:83/installer/installer.cgi 4.38 + # Stop httpd 4.39 + kill $(cat $PIDFILE) 4.40 +fi 4.41 +
5.1 --- a/rootfs/usr/share/applications/slitaz-installer.desktop Wed Aug 17 22:03:26 2011 +0200 5.2 +++ b/rootfs/usr/share/applications/slitaz-installer.desktop Thu Aug 18 17:04:16 2011 +0200 5.3 @@ -3,7 +3,7 @@ 5.4 Name=SliTaz Installer 5.5 Name[fr]=SliTaz Installateur 5.6 Name[pt]=Instalador do SliTaz 5.7 -Exec=subox 'xterm -e slitaz-installer' 5.8 +Exec=subox installer.sh 5.9 Icon=/usr/share/icons/SliTaz/16x16/apps/system-installer.png 5.10 Type=Application 5.11 Categories=System;