slitaz-modular rev 159
initramfs: Add a custom version of slitaz-installer.
author | Christopher Rogers <slaxemulator@gmail.com> |
---|---|
date | Thu Jan 12 19:07:11 2012 +0000 (2012-01-12) |
parents | dc3284c77140 |
children | d1ce26b3493b |
files | initramfs/usr/bin/slitaz-installer |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/initramfs/usr/bin/slitaz-installer Thu Jan 12 19:07:11 2012 +0000 1.3 @@ -0,0 +1,1158 @@ 1.4 +#!/bin/sh 1.5 +# slitaz-installer - SliTaz GNU/Linux installer. 1.6 +# 1.7 +# So this is the SliTaz installer using dialog boxes. All the comments are in 1.8 +# English but displayed messages are in French. The script starts with a 1.9 +# few main variables, then all the functions and then a sequence of functions. 1.10 +# 1.11 +# (C) 2007-2009 SliTaz - GNU General Public License v3. 1.12 +# 1.13 +# Author : Christophe Lincoln <pankso@slitaz.org> 1.14 +# 1.15 +VERSION=2.0 1.16 + 1.17 +: ${DIALOG=dialog} 1.18 +[ "$1" = "gui" ] && DIALOG=tazdialog 1.19 + 1.20 +# We need to know cdrom device and kernel version string to copy files. 1.21 +DRIVE_NAME=`cat /proc/sys/dev/cdrom/info | grep "drive name" | cut -f 3` 1.22 +[ -n "$DRIVE_NAME" ] || DRIVE_NAME=cdrom 1.23 +CDROM=/dev/$DRIVE_NAME 1.24 +KERNEL=vmlinuz-`uname -r` 1.25 +TARGET_ROOT=/mnt/target 1.26 +LOG=/var/log/slitaz-installer.log 1.27 +BACKLIST="SliTaz GNU/Linux installer" 1.28 +ACTION=$1 1.29 +[ -f /etc/slitaz/slitaz.conf ] && . /etc/slitaz/slitaz.conf 1.30 + 1.31 +####################### 1.32 +# Installer functions # 1.33 +####################### 1.34 + 1.35 +# Messages language setting. 1.36 +set_messages() 1.37 +{ 1.38 + if [ -s /usr/share/slitaz/messages/${LANG:0:2}/installer.msg ]; then 1.39 + . /usr/share/slitaz/messages/${LANG:0:2}/installer.msg 1.40 + else 1.41 + . /usr/share/slitaz/messages/en/installer.msg 1.42 + fi 1.43 +} 1.44 + 1.45 +# Display error message. 1.46 +error_message() 1.47 +{ 1.48 + $DIALOG --title " Error " \ 1.49 + --colors --backtitle "$BACKLIST" \ 1.50 + --clear --msgbox "\n$ERROR_MSG" 18 70 1.51 +} 1.52 + 1.53 +# Exit install if user is not root. 1.54 +check_root() 1.55 +{ 1.56 + if test $(id -u) != 0 ; then 1.57 + ERROR_MSG="\ 1.58 +[\Z6en\Zn] You must be root administrator to start SliTaz installer, please \ 1.59 +use 'su' to get a root SHell and restart installation.\n\n 1.60 +[\Z6fr\Zn] Vous devez ĂȘtre root pour installer SLiTaz GNU/Linux. Vous pouvez \ 1.61 +utiliser 'su' suivi du mot de passe administrateur pour devenir root \ 1.62 +et relancer l'installation." 1.63 + error_message 1.64 + exit 0 1.65 + fi 1.66 +} 1.67 + 1.68 +# This function is used after each screen to contine or abort install. 1.69 +check_retval() 1.70 +{ 1.71 + case $retval in 1.72 + 0) 1.73 + continue ;; 1.74 + 1) 1.75 + echo -e "\nVoluntary exit.\n" && exit 0 ;; 1.76 + 3) 1.77 + continue ;; 1.78 + 255) 1.79 + echo -e "ESC pressed.\n" && exit 0 ;; 1.80 + esac 1.81 +} 1.82 + 1.83 +# Start install with basic information. 1.84 +start_installer() 1.85 +{ 1.86 + $DIALOG --title " Install or Upgrade " \ 1.87 + --backtitle "$BACKLIST" \ 1.88 + --extra-button --extra-label "Upgrade" \ 1.89 + --ok-label "Install" \ 1.90 + --clear --colors --yesno "$START_INSTALL_MSG" 18 70 1.91 + retval=$? 1.92 + case $retval in 1.93 + 0) 1.94 + ACTION=install ;; 1.95 + 1) 1.96 + echo -e "\nVoluntary exit.\n" && exit 0 ;; 1.97 + 3) 1.98 + ACTION=upgrade ;; 1.99 + 255) 1.100 + echo -e "ESC pressed.\n" && exit 0 ;; 1.101 + esac 1.102 + echo "start_installer: `date`" > $LOG 1.103 +} 1.104 + 1.105 +# Mount cdrom and verify if it's really SliTaz CD. 1.106 +mount_cdrom() 1.107 +{ 1.108 + ERROR_MSG="" 1.109 + ( 1.110 + echo "XXX" && echo 30 1.111 + echo -e "\nCreating mount point (/media/cdrom)..." 1.112 + echo "XXX" 1.113 + mkdir -p /media/cdrom 1.114 + sleep 1 1.115 + # First try to mount a cdrom 1.116 + if mount -t udf $CDROM /media/cdrom 2>>$LOG; then 1.117 + echo "XXX" && echo 60 1.118 + echo -e "\nUsing files from cdrom ($CDROM)..." 1.119 + echo "XXX" 1.120 + sleep 2 1.121 + # We may be in LiveUSB mode 1.122 + elif [ -d /home/boot ]; then 1.123 + echo "XXX" && echo 60 1.124 + echo -e "\nUsing files from USB device..." 1.125 + echo "XXX" 1.126 + rm /media/cdrom/boot 2>/dev/null 1.127 + ln -s /home/boot /media/cdrom/boot 1.128 + sleep 2 1.129 + # We may be in Tiny Web boot mode 1.130 + elif [ -d /cdrom/boot ]; then 1.131 + echo "XXX" && echo 60 1.132 + echo -e "\nUsing files from HTTP device..." 1.133 + echo "XXX" 1.134 + rm /media/cdrom/boot 2>/dev/null 1.135 + ln -s /cdrom/boot /media/cdrom/boot 1.136 + sleep 2 1.137 + fi 1.138 + 1.139 + echo "XXX" && echo 90 1.140 + echo -e "\nChecking installation media..." 1.141 + echo "XXX" 1.142 + sleep 2 1.143 + ) | 1.144 + $DIALOG --title " Mounting cdrom " \ 1.145 + --backtitle "$BACKLIST" \ 1.146 + --gauge "Preparing the installation media..." 18 70 0 1.147 + # Exit with error msg if no rootfs.gz found. 1.148 + if [ ! -f /media/cdrom/boot/rootfs.gz -a \ 1.149 + ! -f /media/cdrom/boot/rootfs1.gz ]; then 1.150 + ERROR_MSG="$MOUNT_CDROM_ERROR_MSG" 1.151 + error_message 1.152 + echo "missing: /media/cdrom/boot/rootfs.gz" >>$LOG 1.153 + exit 1 1.154 + fi 1.155 +} 1.156 + 1.157 +# Display a list of available partitions. 1.158 +fdisk_list() 1.159 +{ 1.160 + LIST_PARTITIONS=`fdisk -l | grep ^/dev | sed s/'e Win95'/'e'/g` 1.161 + $DIALOG --title " Partition tables " \ 1.162 + --backtitle "$BACKLIST" \ 1.163 + --clear --msgbox "\n 1.164 +Available partitions :\n\n 1.165 +$LIST_PARTITIONS" 18 70 1.166 +} 1.167 + 1.168 +# We need a partition to install to (inputbox). 1.169 +ask_for_target_dev() 1.170 +{ 1.171 + exec 3>&1 1.172 + TARGET_DEV=`$DIALOG --title " Root Partition " \ 1.173 + --backtitle "$BACKLIST" --clear \ 1.174 + --extra-label "List" --extra-button \ 1.175 + --colors --inputbox "$ASK_FOR_TARGET_DEV_MSG" 18 70 2>&1 1>&3` 1.176 + retval=$? 1.177 + exec 3>&- 1.178 + check_retval 1.179 + # Display list and come back. 1.180 + if [ "$retval" = "3" ]; then 1.181 + fdisk_list 1.182 + ask_for_target_dev 1.183 + fi 1.184 + # Empty value. 1.185 + if [ -z $TARGET_DEV ]; then 1.186 + ask_for_target_dev 1.187 + fi 1.188 + set_messages 1.189 + # Check if specified device exists in /proc/partitions. 1.190 + DEV_NAME=${TARGET_DEV#/dev/} 1.191 + if cat /proc/partitions | grep -q $DEV_NAME; then 1.192 + if [ "$DEV_NAME" = "$TARGET_DEV" ]; then 1.193 + TARGET_DEV="/dev/$DEV_NAME" 1.194 + fi 1.195 + echo "ask_for_target_dev: $TARGET_DEV" >>$LOG 1.196 + else 1.197 + ERROR_MSG="Partition \Z2$TARGET_DEV\Zn doesn't exist." 1.198 + error_message 1.199 + ask_for_target_dev 1.200 + fi 1.201 +} 1.202 + 1.203 +# Mkfs if needed/wanted on /. 1.204 +ask_for_mkfs_target_dev() 1.205 +{ 1.206 + $DIALOG --title " Format " \ 1.207 + --backtitle "$BACKLIST" \ 1.208 + --clear --colors --yesno "$ASK_FOR_MKFS_TARGET_DEV_MSG" 18 70 1.209 + retval=$? 1.210 + case $retval in 1.211 + 0) 1.212 + MKFS_TARGET_DEV="ext3" 1.213 + echo "mkfs_target_dev: ext3" >>$LOG ;; 1.214 + 1) 1.215 + CLEAN="clean" 1.216 + echo "mkfs_target_dev: clean" >>$LOG ;; 1.217 + 255) 1.218 + echo -e "ESC pressed.\n" && exit 0 ;; 1.219 + esac 1.220 + 1.221 +} 1.222 + 1.223 +# We can have a separate partition for /home. 1.224 +ask_for_home() 1.225 +{ 1.226 + exec 3>&1 1.227 + HOME_DEV=`$DIALOG --title " Home Partition " \ 1.228 + --backtitle "$BACKLIST" --clear \ 1.229 + --extra-label "List" --extra-button \ 1.230 + --colors --inputbox " 1.231 +On most GNU/Linux systems users personal files are stored in the directory \ 1.232 +/home. Home can be on a separate partition or another hard disk. 1.233 + 1.234 +\Z2Home partition to use (Optional):\Zn" 18 70 2>&1 1>&3` 1.235 + retval=$? 1.236 + exec 3>&- 1.237 + check_retval 1.238 + # Display list and come back. 1.239 + if [ "$retval" = "3" ]; then 1.240 + fdisk_list 1.241 + ask_for_home 1.242 + fi 1.243 + if [ -n "$HOME_DEV" ]; then 1.244 + # Check if specified device exists in /proc/partitions. 1.245 + DEV_NAME=${HOME_DEV#/dev/} 1.246 + if cat /proc/partitions | grep -q $DEV_NAME; then 1.247 + if [ "$DEV_NAME" = "$HOME_DEV" ]; then 1.248 + HOME_DEV="/dev/$DEV_NAME" 1.249 + fi 1.250 + echo "ask_for_home: $HOME_DEV" >>$LOG 1.251 + else 1.252 + ERROR_MSG="Partition \Z2$HOME_DEV\Zn doesn't exist." 1.253 + error_message 1.254 + ask_for_home 1.255 + fi 1.256 + fi 1.257 +} 1.258 + 1.259 +# Mkfs if needed/wanted on /. 1.260 +ask_for_mkfs_home() 1.261 +{ 1.262 + $DIALOG --title " Format " \ 1.263 + --backtitle "$BACKLIST" \ 1.264 + --clear --colors --yesno " 1.265 +Here you can format the /home partition: $HOME_DEV 1.266 + 1.267 +SliTaz uses ext3 by default but another filesystem can be used if wanted, \ 1.268 +for this please adjust your /etc/fstab after installation. 1.269 + 1.270 +\Z2Do you want to format (Option): $HOME_DEV\Zn" 18 70 1.271 + retval=$? 1.272 + case $retval in 1.273 + 0) 1.274 + MKFS_HOME="ext3" 1.275 + echo "mkfs_home: ext3" >>$LOG ;; 1.276 + 1) 1.277 + MKFS_HOME="" 1.278 + echo "mkfs_home: no" >>$LOG ;; 1.279 + 255) 1.280 + echo -e "ESC pressed.\n" && exit 0 ;; 1.281 + esac 1.282 + 1.283 +} 1.284 + 1.285 +# Ask for hostname before installing files. 1.286 +ask_for_hostname() 1.287 +{ 1.288 + exec 3>&1 1.289 + HOSTNAME=`$DIALOG --title " Hostname " \ 1.290 + --backtitle "$BACKLIST" --clear \ 1.291 + --colors --inputbox "$ASK_FOR_HOSTNAME_MSG" 18 70 "slitaz" 2>&1 1>&3` 1.292 + retval=$? 1.293 + exec 3>&- 1.294 + check_retval 1.295 + # Empty value. 1.296 + if [ -z $HOSTNAME ]; then 1.297 + HOSTNAME="slitaz" 1.298 + fi 1.299 +} 1.300 + 1.301 +# Ask for root password and default user settings. 1.302 +ask_for_users_settings() 1.303 +{ 1.304 + # Root passwd 1.305 + exec 3>&1 1.306 + ROOT_PASSWD=`$DIALOG --title " Root password " \ 1.307 + --backtitle "$BACKLIST" --clear \ 1.308 + --colors --nocancel --inputbox " 1.309 +The root administrator privilege lets you manage and configure the full \ 1.310 +system. A root user can damage your system so you should always setup a \ 1.311 +strong password with special characters and/or numbers. 1.312 + 1.313 +\Z2Please specify the Root password for your new system:\Zn" 18 70 "root" 2>&1 1>&3` 1.314 + retval=$? 1.315 + exec 3>&- 1.316 + check_retval 1.317 + # Prevent empty value. 1.318 + if [ -z $ROOT_PASSWD ]; then 1.319 + ROOT_PASSWD="root" 1.320 + fi 1.321 + # Default user 1.322 + exec 3>&1 1.323 + USER=`$DIALOG --title " User name " \ 1.324 + --backtitle "$BACKLIST" --clear \ 1.325 + --colors --nocancel --inputbox " 1.326 +The default user for the system will have their personal files stored \ 1.327 +in /home/*user* (and will be automatically added to the audio group). 1.328 + 1.329 +\Z2Default user name login:\Zn" 18 70 "tux" 2>&1 1>&3` 1.330 + retval=$? 1.331 + exec 3>&- 1.332 + check_retval 1.333 + # Prevent empty value. 1.334 + if [ -z $USER ]; then 1.335 + USER="tux" 1.336 + fi 1.337 + # User passwd 1.338 + exec 3>&1 1.339 + USER_PASSWD=`$DIALOG --title " User password " \ 1.340 + --backtitle "$BACKLIST" --clear \ 1.341 + --colors --nocancel --inputbox " 1.342 +The password for default user $USER. It may be a security risk if too \ 1.343 +weak and should always be strong if you use a SSH connection through the web. 1.344 + 1.345 +\Z2Please specify $USER password:\Zn" 18 70 "tux" 2>&1 1>&3` 1.346 + retval=$? 1.347 + exec 3>&- 1.348 + check_retval 1.349 + # Prevent empty value. 1.350 + if [ -z $USER_PASSWD ]; then 1.351 + USER_PASSWD="tux" 1.352 + fi 1.353 +} 1.354 + 1.355 +# Tiny summary and last chance to cancel or restart for user. 1.356 +summary() 1.357 +{ 1.358 + $DIALOG --title " Summary " \ 1.359 + --backtitle "$BACKLIST" \ 1.360 + --clear --colors --yesno " 1.361 +Installation settings summary and last chance to cancel or restart all \ 1.362 +installation steps. 1.363 + 1.364 +Root partition: $TARGET_DEV 1.365 +Home partition: $HOME_DEV 1.366 +Hostname: $HOSTNAME 1.367 +Default user: $USER 1.368 + 1.369 +\Z2Go and install SliTaz or cancel?\Zn" 18 70 1.370 + retval=$? 1.371 + check_retval 1.372 +} 1.373 + 1.374 +# Mount and mkfs with progress. 1.375 +prepare_partitions() 1.376 +{ 1.377 + ( 1.378 + echo "XXX" && echo 30 1.379 + echo -e "\nPreparing target partition..." 1.380 + echo "XXX" 1.381 + # Mount point can be already used. 1.382 + if mount | grep -q $TARGET_ROOT; then 1.383 + umount $TARGET_ROOT 2>$LOG 1.384 + fi 1.385 + sleep 2 1.386 + 1.387 + if [ "$MKFS_TARGET_DEV" == "ext3" ]; then 1.388 + echo "XXX" && echo 50 1.389 + echo -e "\nExecuting mkfs.ext3 on $TARGET_DEV" 1.390 + echo "XXX" 1.391 + mkfs.ext3 $TARGET_DEV >>$LOG 2>>$LOG 1.392 + else 1.393 + echo "XXX" && echo 50 1.394 + echo -e "\nThe partition ($TARGET_DEV) will be cleaned..." 1.395 + echo "XXX" 1.396 + sleep 2 1.397 + fi 1.398 + 1.399 + if [ "$MKFS_HOME" == "ext3" ]; then 1.400 + echo "XXX" && echo 70 1.401 + echo -e "\nExecuting mkfs.ext3 on $HOME_DEV" 1.402 + echo "XXX" 1.403 + mkfs.ext3 -L "Home" $HOME_DEV >>$LOG 2>>$LOG 1.404 + else 1.405 + echo "XXX" && echo 70 1.406 + echo -e "\nThe partition ($HOME_DEV) will be kept..." 1.407 + echo "XXX" 1.408 + sleep 2 1.409 + fi 1.410 + 1.411 + echo "XXX" && echo 90 1.412 + echo -e "\nCreating mount point: $TARGET_ROOT" 1.413 + echo "XXX" 1.414 + mkdir -p $TARGET_ROOT 1.415 + sleep 2 1.416 + 1.417 + ) | 1.418 + $DIALOG --title " Prepare the target " \ 1.419 + --backtitle "$BACKLIST" \ 1.420 + --gauge "Target in preparation..." 18 70 0 1.421 + # Mount target. 1.422 + mount $TARGET_DEV $TARGET_ROOT >>$LOG 2>>$LOG 1.423 +} 1.424 + 1.425 +# Get a clean target device (15%). 1.426 +clean_target() 1.427 +{ 1.428 + if [ "$CLEAN" == "clean" ]; then 1.429 + echo "XXX" && echo 15 1.430 + echo -e "\nCleaning the root partition ($TARGET_DEV)..." 1.431 + echo "XXX" 1.432 + # Keep /home in case of reinstall. 1.433 + cd $TARGET_ROOT 1.434 + for dir in * 1.435 + do 1.436 + case "$dir" in 1.437 + home) 1.438 + mv $TARGET_ROOT/home $TARGET_ROOT/home.bak 1.439 + echo "keeping /home found on: $TARGET_DEV" >>$LOG ;; 1.440 + lost+found) 1.441 + continue ;; 1.442 + *) 1.443 + echo "removing target: $dir" >>$LOG 1.444 + rm -rf $dir 2>>$LOG ;; 1.445 + esac 1.446 + done 1.447 + if [ -d $TARGET_ROOT/mklost+found ]; then 1.448 + mklost+found 2>>$LOG 1.449 + fi 1.450 + fi 1.451 + sleep 2 1.452 +} 1.453 + 1.454 +# Kernel is renamed to standard vmlinuz-$VERSION. 1.455 +install_kernel() 1.456 +{ 1.457 + mkdir -p $TARGET_ROOT/boot 1.458 + cp /media/cdrom/boot/bzImage $TARGET_ROOT/boot/$KERNEL 1.459 + echo "install_kernel: $KERNEL" >> $LOG 1.460 + sleep 2 1.461 +} 1.462 + 1.463 +# Copy isolinux r/w files (not syslinux, some files are read only). 1.464 +copy_bootloaders() 1.465 +{ 1.466 + if [ -d "/media/cdrom/boot/isolinux" ]; then 1.467 + mkdir -p $TARGET_ROOT/boot/isolinux 1.468 + cp -a /media/cdrom/boot/isolinux/*.cfg $TARGET_ROOT/boot/isolinux 1.469 + cp -a /media/cdrom/boot/isolinux/*.kbd $TARGET_ROOT/boot/isolinux 1.470 + cp -a /media/cdrom/boot/isolinux/*.txt $TARGET_ROOT/boot/isolinux 1.471 + cp -a /media/cdrom/boot/isolinux/*.bin $TARGET_ROOT/boot/isolinux 1.472 + cp -a /media/cdrom/boot/isolinux/*.msg $TARGET_ROOT/boot/isolinux 1.473 + cp -a /media/cdrom/boot/isolinux/*.lss $TARGET_ROOT/boot/isolinux 1.474 + cp -a /media/cdrom/boot/isolinux/*.c32 $TARGET_ROOT/boot/isolinux 1.475 + fi 1.476 +} 1.477 + 1.478 +need_package() 1.479 +{ 1.480 + [ -d $INSTALLED/$1 ] || tazpkg get-install $1 1.481 +} 1.482 + 1.483 +# extract packed rootfs: squashfs or cromfs 1.484 +extract_loramfs() 1.485 +{ 1.486 + local i 1.487 + for i in $(cpio -idvum 2> /dev/null); do 1.488 + case "$i" in 1.489 + rootfs*) 1.490 + need_package squashfs 1.491 + if ! unsquashfs $i ; then 1.492 + need_package cromfs 1.493 + unmkcromfs $i squashfs-root 1.494 + fi 1.495 + mv -f squashfs-root/* . 1.496 + rmdir squashfs-root 1.497 + rm -f $i 1.498 + esac 1.499 + done 1.500 +} 1.501 + 1.502 +# This is a loram rootfs.gz, skip loram bootstrap and extract 1.503 +extract_first_loramfs() 1.504 +{ 1.505 + (zcat $1 || unlzma -c $1) | cpio -i extractfs.cpio 2> /dev/null && 1.506 + ( cd / ; cpio -id ) < extractfs.cpio && rm -f extractfs.cpio 1.507 + ofs=$(awk '/07070100/ { o+=index($0,"07070100"); printf "%d\n",o/4 ; exit } { o+=1+length() }' < $1) 1.508 + dd if=$1 skip=$(($ofs / 1024)) bs=4k count=1 2> /dev/null | \ 1.509 + ( dd skip=$(($ofs % 1024)) bs=4 2> /dev/null ; \ 1.510 + dd if=$1 skip=$((1 + ($ofs / 1024) )) bs=4k ) | extract_loramfs 1.511 +} 1.512 + 1.513 +# Extract lzma'ed or gziped rootfs. 1.514 +extract_rootfs() 1.515 +{ 1.516 + local isloramfs 1.517 + isloramfs= 1.518 + cd $TARGET_ROOT 1.519 + if [ -d $1/../fs/etc ]; then 1.520 + # This is a tazlitobox loram (cdrom) 1.521 + cp -a $1/../fs/. . 1.522 + else 1.523 + for i in $(ls $1/rootfs* | sort -r); do 1.524 + if [ ! -d etc ]; then 1.525 + if [ $( (zcat $i 2>/dev/null || lzma d $i -so) | wc -c) \ 1.526 + -lt $(stat -c %s $i) ]; then 1.527 + # This is a tazlitobox loram (ram) 1.528 + isloramfs=$i 1.529 + extract_first_loramfs $i 1.530 + continue 1.531 + fi 1.532 + fi 1.533 + if [ -n "$isloramfs" ]; then 1.534 + extract_loramfs < $i 1.535 + continue 1.536 + fi 1.537 + ( zcat $i 2>/dev/null || lzma d $i -so || \ 1.538 + cat $i ) 2>>$LOG | cpio -idu 1.539 + done 2>>$LOG > /dev/null 1.540 + fi 1.541 + cp /etc/keymap.conf etc 1.542 + # unpack /usr (double check...) 1.543 + if ls etc/tazlito | grep -q ".extract"; then 1.544 + for i in etc/tazlito/*.extract; do 1.545 + [ -f "$i" ] && . $i /media/cdrom 1.546 + done 1.547 + fi 1.548 +} 1.549 + 1.550 +# Pre configure freshly installed system (60 - 80%). 1.551 +pre_config_system() 1.552 +{ 1.553 + cd $TARGET_ROOT 1.554 + # Restore backup of existing /home if exists. 1.555 + # (created by prepare_target_dev) 1.556 + if [ -d home.bak ]; then 1.557 + echo "XXX" && echo 65 1.558 + echo -e "\nRestoring directory: /home..." 1.559 + echo "XXX" 1.560 + rm -rf home 1.561 + mv home.bak home 1.562 + sleep 1 1.563 + fi 1.564 + # Add root device to CHECK_FS in rcS.conf to check filesystem 1.565 + # on each boot. 1.566 + echo "XXX" && echo 70 1.567 + echo -e "\nAdding $TARGET_DEV and CHECK_FS to file /etc/rcS.conf..." 1.568 + echo "XXX" 1.569 + sed -i s#'CHECK_FS=\"\"'#"CHECK_FS=\"$TARGET_DEV\""# etc/rcS.conf 1.570 + sleep 2 1.571 + # Set hostname. 1.572 + echo "XXX" && echo 80 1.573 + echo -e "\nConfiguring host name: $HOSTNAME" 1.574 + echo "XXX" 1.575 + echo $HOSTNAME > etc/hostname 1.576 +} 1.577 + 1.578 +# Set root passwd and create user after rootfs extraction. 1.579 +users_settings() 1.580 +{ 1.581 + cat > $TARGET_ROOT/users.sh << _EOF_ 1.582 +#!/bin/sh 1.583 +echo "root:$ROOT_PASSWD" | chpasswd 1.584 +adduser -D -H $USER 1.585 + 1.586 +for grp in audio cdrom floppy dialout disk kmem tape tty video; do 1.587 + if ! grep \$grp /etc/group | grep -q $USER ; then 1.588 + addgroup $USER \$grp 1.589 + fi 1.590 +done 1.591 + 1.592 +echo "$USER:$USER_PASSWD" | chpasswd 1.593 +if [ ! -d /home/$USER ]; then 1.594 + cp -a /etc/skel /home/$USER 1.595 + cp /root/.xinitrc /home/$USER 1.596 + mkdir -p /home/$USER/.config/slitaz 1.597 + cp -a /etc/slitaz/applications.conf /home/$USER/.config/slitaz 1.598 + chown -R $USER.users /home/$USER 1.599 + # Path for user desktop files. 1.600 + for i in /home/$USER/.local/share/applications/*.desktop 1.601 + do 1.602 + sed -i s/"user_name"/"$USER"/g \$i 1.603 + done 1.604 +fi 1.605 +# Slim default user. 1.606 +if [ -f /etc/slim.conf ]; then 1.607 + sed -i s/"default_user .*"/"default_user $USER"/ \ 1.608 + /etc/slim.conf 1.609 +fi 1.610 +_EOF_ 1.611 + chmod +x $TARGET_ROOT/users.sh 1.612 + chroot $TARGET_ROOT ./users.sh 1.613 + rm $TARGET_ROOT/users.sh 1.614 +} 1.615 + 1.616 +# /home can be on a separate partition. If default user exist in /home 1.617 +# we remove default file crated by users_settings(). 1.618 +home_config() 1.619 +{ 1.620 + echo "home_config: $HOME_DEV" >> $LOG 1.621 + cd $TARGET_ROOT 1.622 + mv home/$USER tmp 1.623 + mount $HOME_DEV home 1.624 + if [ -d $TARGET_ROOT/home/$USER ]; then 1.625 + rm -rf tmp/$USER 1.626 + else 1.627 + mv tmp/$USER home 1.628 + fi 1.629 + echo "$HOME_DEV /home ext3 defaults 0 2" \ 1.630 + >> etc/fstab 1.631 + umount home 1.632 +} 1.633 + 1.634 +# Determine GRUB partition number and GRUB disk number. 1.635 +grub_config() 1.636 +{ 1.637 + DISK_LETTER=${TARGET_DEV#/dev/[h-s]d} 1.638 + DISK_LETTER=${DISK_LETTER%[0-9]} 1.639 + GRUB_PARTITION=$((${TARGET_DEV#/dev/[h-s]d[a-z]}-1)) 1.640 + for disk in a b c d e f g h 1.641 + do 1.642 + nb=$(($nb+1)) 1.643 + if [ "$disk" = "$DISK_LETTER" ]; then 1.644 + GRUB_DISK=$(($nb-1)) 1.645 + break 1.646 + fi 1.647 + done 1.648 + [ -f $INSTALLED/grub2/receipt ] && GRUB_PARTITION=$((${TARGET_DEV#/dev/[h-s]d[a-z]})) 1.649 + GRUB_ROOT="(hd${GRUB_DISK},${GRUB_PARTITION})" 1.650 + # Create the target GRUB configuration. 1.651 + mkdir -p $TARGET_ROOT/boot/grub 1.652 + . /etc/locale.conf 1.653 + if [ -f $INSTALLED/grub/receipt ]; then 1.654 + cat > $TARGET_ROOT/boot/grub/menu.lst << _EOF_ 1.655 +# /boot/grub/menu.lst: GRUB boot loader configuration. 1.656 +# 1.657 + 1.658 +# By default, boot the first entry. 1.659 +default 0 1.660 + 1.661 +# Boot automatically after 8 secs. 1.662 +timeout 8 1.663 + 1.664 +# Graphical splash image. 1.665 +splashimage=/boot/grub/splash.xpm.gz 1.666 + 1.667 +# Change the colors. 1.668 +#color yellow/brown light-green/black 1.669 + 1.670 +# For booting SliTaz from : $TARGET_DEV 1.671 +# 1.672 +title SliTaz GNU/Linux (cooking) (Kernel $KERNEL) 1.673 +root $GRUB_ROOT 1.674 +kernel /boot/$KERNEL root=$TARGET_DEV lang=$LANG 1.675 + 1.676 +_EOF_ 1.677 + # log 1.678 + echo "grub_config: $TARGET_ROOT/boot/grub/menu.lst" >>$LOG 1.679 + sleep 2 1.680 + elif [ -f $INSTALLED/grub2/receipt ]; then 1.681 + cat > $TARGET_ROOT/boot/grub/grub.cfg << _EOF_ 1.682 +# /boot/grub/menu.lst: GRUB boot loader configuration. 1.683 +# 1.684 + 1.685 +# By default, boot the first entry. 1.686 +set default=0 1.687 + 1.688 +# Boot automatically after 8 secs. 1.689 +set timeout=8 1.690 + 1.691 +# Graphical splash image. 1.692 +#splashimage=/boot/grub/splash.xpm.gz 1.693 + 1.694 +# Change the colors. 1.695 +#color yellow/brown light-green/black 1.696 + 1.697 +# For booting SliTaz from : $TARGET_DEV 1.698 +# 1.699 +menuentry "SliTaz GNU/Linux (cooking) (Kernel $KERNEL)" { 1.700 + set root=$GRUB_ROOT 1.701 + linux /boot/$KERNEL root=$TARGET_DEV lang=$LANG 1.702 +} 1.703 + 1.704 +_EOF_ 1.705 + # log 1.706 + echo "grub_config: $TARGET_ROOT/boot/grub/grub.cfg" >>$LOG 1.707 + sleep 2 1.708 + fi 1.709 +} 1.710 + 1.711 +# Files install with gauge, calling for functions or with cmds. 1.712 +install_files() 1.713 +{ 1.714 + ( 1.715 + 1.716 + echo "XXX" && echo 10 1.717 + echo -e "\nCleaning the root partition if necessary..." 1.718 + echo "XXX" 1.719 + clean_target 1.720 + 1.721 + echo "XXX" && echo 20 1.722 + echo -e "\nInstalling the kernel ($KERNEL)..." 1.723 + echo "XXX" 1.724 + install_kernel 1.725 + 1.726 + echo "XXX" && echo 30 1.727 + echo -e "\nCopying the bootloader syslinux/isolinux..." 1.728 + echo "XXX" 1.729 + copy_bootloaders 1.730 + 1.731 + if [ -d /mnt/live/initramfs ]; then 1.732 + echo "XXX" && echo 50 1.733 + echo -e "\nExtracting slitaz-tank root system..." 1.734 + cp -a /mnt/live/initramfs/* $TARGET_ROOT 1.735 + images=/mnt/live/memory/images 1.736 + for i in $(ls $images); do 1.737 + for a in $(ls $images/$i); do 1.738 + cp -a $images/$i/$a $TARGET_ROOT 1.739 + done 1.740 + done 1.741 + else 1.742 + echo "XXX" && echo 50 1.743 + echo -e "\nExtracting the root system..." 1.744 + echo "XXX" 1.745 + extract_rootfs /media/cdrom/boot 1.746 + fi 1.747 + 1.748 + 1.749 + echo "XXX" && echo 60 1.750 + echo -e "\nPreconfiguring the system..." 1.751 + echo "XXX" 1.752 + pre_config_system 1.753 + 1.754 + echo "XXX" && echo 70 1.755 + echo -e "\nConfiguring root and default $USER account..." 1.756 + echo "XXX" 1.757 + users_settings 1.758 + sleep 2 1.759 + 1.760 + if [ "$HOME_DEV" != "" ]; then 1.761 + echo "XXX" && echo 80 1.762 + echo -e "\nConfiguring $HOME_DEV to be used as /home..." 1.763 + echo "XXX" 1.764 + home_config 1.765 + sleep 2 1.766 + fi 1.767 + 1.768 + echo "XXX" && echo 90 1.769 + echo -e "\nCreating the configuration file for GRUB (menu.lst)..." 1.770 + echo "XXX" 1.771 + grub_config 1.772 + 1.773 + echo "XXX" && echo 100 1.774 + echo -e "\nFinishing the files installation..." 1.775 + echo "XXX" 1.776 + echo "install_files: OK" >>$LOG 1.777 + sleep 2 1.778 + 1.779 + ) | 1.780 + $DIALOG --title " Install files " \ 1.781 + --backtitle "$BACKLIST" \ 1.782 + --gauge "Starting to install files..." 18 70 0 1.783 +} 1.784 + 1.785 +# GRUB info with disk name used for grub-install. 1.786 +grub_install() 1.787 +{ 1.788 + TARGET_DISK=`echo $TARGET_DEV | sed s/"[0-9]"/''/` 1.789 + set_messages 1.790 + $DIALOG --title " GRUB install " \ 1.791 + --backtitle "$BACKLIST" \ 1.792 + --clear --colors --yesno "$GRUB_INSTALL_MSG" 18 70 1.793 + retval=$? 1.794 + case $retval in 1.795 + 0) 1.796 + ( 1.797 + echo "XXX" && echo 50 1.798 + echo -e "\nRunning grub-install on : $TARGET_DISK" 1.799 + echo "XXX" 1.800 + grub-install --no-floppy \ 1.801 + --root-directory=$TARGET_ROOT $TARGET_DISK 2>>$LOG 1.802 + echo "XXX" && echo 100 1.803 + echo -e "\nFinished installation..." 1.804 + echo "XXX" 1.805 + sleep 2 1.806 + ) | 1.807 + $DIALOG --title " GRUB install " \ 1.808 + --backtitle "$BACKLIST" \ 1.809 + --gauge "Installing GRUB..." 18 70 0 ;; 1.810 + 1) 1.811 + echo "grub_install: NO" >>$LOG ;; 1.812 + 255) 1.813 + echo -e "ESC pressed.\n" && exit 0 ;; 1.814 + esac 1.815 +} 1.816 + 1.817 +# Copy log file, umount target and eject cdrom. 1.818 +umount_devices() 1.819 +{ 1.820 + ( 1.821 + echo "XXX" && echo 25 1.822 + echo -e "\nCopying the log files ($LOG)..." 1.823 + echo "XXX" 1.824 + cp -a $LOG $TARGET_ROOT/var/log 1.825 + sleep 2 1.826 + echo "XXX" && echo 50 1.827 + echo -e "\nUnmounting the target ($TARGET_DEV)..." 1.828 + echo "XXX" 1.829 + if mount | grep -q $TARGET_ROOT; then 1.830 + umount $TARGET_ROOT 2>/dev/null 1.831 + fi 1.832 + echo "XXX" && echo 75 1.833 + echo -e "\nUnmounting and ejecting the cdrom..." 1.834 + echo "XXX" 1.835 + if mount | grep -q /media/cdrom; then 1.836 + umount /media/cdrom 1.837 + if [ ! -d /mnt/live/initramfs ]; then 1.838 + grep -q slitaz-loram-cdrom /etc/init.d/rcS || eject 1.839 + fi 1.840 + fi 1.841 + sleep 2 1.842 + echo "XXX" && echo 100 1.843 + echo -e "\n$TITLE..." 1.844 + echo "XXX" 1.845 + sleep 2 1.846 + ) | 1.847 + $DIALOG --title " $TITLE " \ 1.848 + --backtitle "$BACKLIST" \ 1.849 + --gauge "$TITLE starting..." 18 70 0 1.850 +} 1.851 + 1.852 +# End of installation. 1.853 +end_of_install() 1.854 +{ 1.855 + echo "end_of_install: `date`" >>$LOG 1.856 + $DIALOG --title " Installation complete " \ 1.857 + --backtitle "$BACKLIST" \ 1.858 + --yes-label "Exit" \ 1.859 + --no-label "Reboot" \ 1.860 + --clear --colors --yesno "$END_OF_INSTALL_MSG" 18 70 1.861 + retval=$? 1.862 + case $retval in 1.863 + 0) 1.864 + TITLE="Exiting" 1.865 + umount_devices ;; 1.866 + 1) 1.867 + TITLE="Rebooting" 1.868 + umount_devices 1.869 + reboot || reboot -f ;; 1.870 + 255) 1.871 + echo -e "ESC pressed.\n" && exit 0 ;; 1.872 +esac 1.873 +} 1.874 + 1.875 +##################### 1.876 +# Upgrade functions # 1.877 +##################### 1.878 + 1.879 +# We need a partition to upgrade SliTaz. 1.880 +ask_for_upgrade_dev() 1.881 +{ 1.882 + exec 3>&1 1.883 + UPGRADE_DEV=`$DIALOG --title " Target to upgrade " \ 1.884 + --backtitle "$BACKLIST" --clear \ 1.885 + --extra-label "List" --extra-button \ 1.886 + --colors --inputbox "\n 1.887 +The installer will upgrade the target by saving all configuration files and \ 1.888 +the list of installed packages. Then, it will clean the partition and install the \ 1.889 +version of SliTaz contained on the cdrom, restore the configuration files and \ 1.890 +reinstall any packages which are not present on the cdrom. You will need an active \ 1.891 +internet connection before upgrading.\n\n 1.892 +\Z2Partition containing the system upgrade:\Zn" 18 70 2>&1 1>&3` 1.893 + retval=$? 1.894 + exec 3>&- 1.895 + check_retval 1.896 + # Display list and come back. 1.897 + if [ "$retval" = "3" ]; then 1.898 + fdisk_list 1.899 + ask_for_upgrade_dev 1.900 + fi 1.901 + # Empty value. 1.902 + if [ -z $UPGRADE_DEV ]; then 1.903 + ask_for_upgrade_dev 1.904 + fi 1.905 + # Check if specified device exists in /proc/partitions. 1.906 + DEV_NAME=${UPGRADE_DEV#/dev/} 1.907 + if cat /proc/partitions | grep -q $DEV_NAME; then 1.908 + echo "ask_for_target_dev: $TARGET_DEV" >>$LOG 1.909 + else 1.910 + ERROR_MSG="The partition \Z2$UPGRADE_DEV\Zn doesn't seem to exist." 1.911 + error_message 1.912 + ask_for_upgrade_dev 1.913 + fi 1.914 + echo "partition to upgrade: $UPGRADE_DEV" >>$LOG 1.915 +} 1.916 + 1.917 +# Prepare the partition to upgrade, backup, install, restore configs 1.918 +# and reinstall pkgs. 1.919 +upgrade_process() 1.920 +{ 1.921 + ( 1.922 + echo "XXX" && echo 5 1.923 + echo -e "\nPreparing the target partition..." 1.924 + echo "XXX" 1.925 + # Mount point can be already used. 1.926 + if mount | grep -q $TARGET_ROOT; then 1.927 + umount $TARGET_ROOT 2>$LOG 1.928 + fi 1.929 + mkdir -p $TARGET_ROOT && sleep 2 1.930 + # Mount target. 1.931 + mount $UPGRADE_DEV $TARGET_ROOT >>$LOG 2>>$LOG 1.932 + cd $TARGET_ROOT 1.933 + TARGET_DEV=$UPGRADE_DEV 1.934 + set_messages 1.935 + 1.936 + echo "XXX" && echo 10 1.937 + echo -e "\nSearching for /etc/slitaz-release" 1.938 + echo "XXX" 1.939 + if [ -f etc/slitaz-release ]; then 1.940 + release=`cat etc/slitaz-release` 1.941 + echo "XXX" && echo 15 1.942 + echo -e "\nSliTaz release: $release" 1.943 + echo "XXX" 1.944 + else 1.945 + ERROR_MSG="The partition \Z2$UPGRADE_DEV\Zn doesn't appear to contain \ 1.946 +a SliTaz system, the file: /etc/slitaz-release doesn't exist." 1.947 + error_message 1.948 + exit 0 1.949 + fi && sleep 2 1.950 + 1.951 + echo "XXX" && echo 20 1.952 + echo -e "\nBackup /etc, /home and the packages list..." 1.953 + echo "XXX" 1.954 + # Backup target packages list. 1.955 + ls -1 var/lib/tazpkg/installed > home/packages-selection.list 1.956 + for dir in * 1.957 + do 1.958 + case "$dir" in 1.959 + boot) 1.960 + # Upgrade doesn't prompt for grub install, so backup and 1.961 + # create a new grub menu.lst. 1.962 + rm -rf $TARGET_ROOT/boot/vmlinuz-* 1.963 + mv $TARGET_ROOT/boot/grub/menu.lst \ 1.964 + $TARGET_ROOT/boot/grub/menu.lst.bak 2>/dev/null 1.965 + grub_config ;; 1.966 + home) 1.967 + mv $TARGET_ROOT/home $TARGET_ROOT/home.bak 1.968 + echo "keeping /home found on: $UPGRADE_DEV" >>$LOG ;; 1.969 + etc) 1.970 + tar czf $TARGET_ROOT/etc.tar.gz etc 1.971 + mv $TARGET_ROOT/etc $TARGET_ROOT/etc.bak 1.972 + echo "keeping /etc found on: $UPGRADE_DEV" >>$LOG ;; 1.973 + var) 1.974 + if [ -d $TARGET_ROOT/var/www ]; then 1.975 + mv $TARGET_ROOT/var/www $TARGET_ROOT/www.bak 1.976 + fi 1.977 + rm -rf $TARGET_ROOT/var ;; 1.978 + lost+found) 1.979 + continue ;; 1.980 + *) 1.981 + echo "removing target: $dir" >>$LOG 1.982 + rm -rf $TARGET_ROOT/$dir 2>>$LOG ;; 1.983 + esac 1.984 + done 1.985 + if [ -d $TARGET_ROOT/mklost+found ]; then 1.986 + mklost+found 2>>$LOG 1.987 + fi 1.988 + sleep 2 1.989 + 1.990 + echo "XXX" && echo 25 1.991 + echo -e "\nInstalling the kernel ($KERNEL)..." 1.992 + echo "XXX" 1.993 + install_kernel 1.994 + 1.995 + echo "XXX" && echo 30 1.996 + echo -e "\nCopying the bootloader syslinux/isolinux..." 1.997 + echo "XXX" 1.998 + copy_bootloaders 1.999 + 1.1000 + echo "XXX" && echo 40 1.1001 + echo -e "\nExtracting the root system..." 1.1002 + echo "XXX" 1.1003 + extract_rootfs /media/cdrom/boot 1.1004 + 1.1005 + # Restore backups. 1.1006 + echo "XXX" && echo 42 1.1007 + echo -e "\nRestoring configuration files..." 1.1008 + echo "XXX" 1.1009 + rm -rf $TARGET_ROOT/home 1.1010 + mv $TARGET_ROOT/home.bak $TARGET_ROOT/home 1.1011 + rm -rf $TARGET_ROOT/etc 1.1012 + mv $TARGET_ROOT/etc.bak $TARGET_ROOT/etc 1.1013 + if [ -d $TARGET_ROOT/www.bak ]; then 1.1014 + rm -rf $TARGET_ROOT/var/www 1.1015 + mv $TARGET_ROOT/www.bak $TARGET_ROOT/var/www 1.1016 + fi 1.1017 + echo "backups restored: `date`" >> $LOG 1.1018 + 1.1019 + # /var/lib/slitaz-installer 1.1020 + mkdir $TARGET_ROOT/var/lib/slitaz-installer 1.1021 + mv $TARGET_ROOT/etc.tar.gz $TARGET_ROOT/var/lib/slitaz-installer 1.1022 + mv $TARGET_ROOT/home/packages-selection.list $TARGET_ROOT/var/lib/slitaz-installer 1.1023 + cd $TARGET_ROOT/var/lib/slitaz-installer 1.1024 + 1.1025 + # LiveCD packages list. 1.1026 + echo "XXX" && echo 46 1.1027 + echo -e "\nCreating package lists..." 1.1028 + echo "XXX" 1.1029 + ls -1 $TARGET_ROOT/var/lib/tazpkg/installed > packages-cdrom.list || exit 1 1.1030 + echo "packages-cdrom.list: done" >> $LOG 1.1031 + # Diff 1.1032 + diff packages-cdrom.list packages-selection.list | \ 1.1033 + grep ^+[a-z] | sed s/^+// > packages-selection.diff 1.1034 + echo "packages-selection.diff: done" >> $LOG 1.1035 + # Get mirror list. 1.1036 + tazpkg recharge >>$LOG 2>>$LOG 1.1037 + if [ ! -f /var/lib/tazpkg/packages.list ]; then 1.1038 + ERROR_MSG="The list of available packages on the mirror could not be \ 1.1039 +downloaded. No missing packages will be reinstalled now, but \ 1.1040 +you can do so later by looking at the following list: \n\n 1.1041 + 1.1042 +/var/lib/slitaz-installer/packages-selection.diff" 1.1043 + error_message 1.1044 + fi 1.1045 + sleep 2 1.1046 + 1.1047 + # Check if the pkg is on the mirror. 1.1048 + echo "XXX" && echo 48 1.1049 + echo -e "\nChecking the availability of packages..." 1.1050 + echo "XXX" 1.1051 + touch packages-to-install.list 1.1052 + packages=0 1.1053 + diff=`cat packages-selection.diff | sort` 1.1054 + for pkg in $diff 1.1055 + do 1.1056 + if grep -q ^$pkg-[0-9] /var/lib/tazpkg/packages.list; then 1.1057 + packages=$(($packages+1)) 1.1058 + echo "$pkg" >> packages-to-install.list 1.1059 + fi 1.1060 + done 1.1061 + 1.1062 + # Calculate the percent for one package and install. 1.1063 + echo "XXX" && echo 50 1.1064 + echo -e "\nInstalling any packages..." 1.1065 + echo "XXX" 1.1066 + sleep 2 1.1067 + if [ "$packages" == "0" ]; then 1.1068 + echo "packages to install: 0" >> $LOG 1.1069 + else 1.1070 + onepkg=$((48/$packages)) 1.1071 + pct=50 1.1072 + # Get-install all missing pkgs. 1.1073 + for pkg in `cat packages-to-install.list` 1.1074 + do 1.1075 + pct=$(($pct+$onepkg)) 1.1076 + echo "XXX" && echo $pct 1.1077 + echo -e "\nInstalling: $pkg..." 1.1078 + echo "XXX" 1.1079 + # Log please. 1.1080 + echo "get-install: $pkg" >>$LOG 1.1081 + # Get install package and answer yes in case of dependencies. 1.1082 + pkgname=`grep ^$pkg /var/lib/tazpkg/packages.list` 1.1083 + tazpkg get $pkg >/dev/null 2>/dev/null 1.1084 + yes "" | tazpkg install $pkgname.tazpkg --root=$TARGET_ROOT >/dev/null 2>/dev/null 1.1085 + rm -f $pkgname.tazpkg 1.1086 + done 1.1087 + fi 1.1088 + echo "XXX" && echo 100 1.1089 + echo -e "\nInstallation of packages complete..." 1.1090 + echo "XXX" 1.1091 + sleep 2 1.1092 + ) | 1.1093 + $DIALOG --title " Processing system upgrade " \ 1.1094 + --backtitle "$BACKLIST" \ 1.1095 + --gauge "Target in preparation..." 18 70 0 1.1096 +} 1.1097 + 1.1098 +# End of system upgrade. 1.1099 +end_of_upgrade() 1.1100 +{ 1.1101 + TARGET_DEV=$UPGRADE_DEV 1.1102 + set_messages 1.1103 + pkgscd=`cat $TARGET_ROOT/var/lib/slitaz-installer/packages-cdrom.list | wc -l` 1.1104 + pkginst=`cat $TARGET_ROOT/var/lib/slitaz-installer/packages-to-install.list | wc -l` 1.1105 + echo "end_of_upgrade: `date`" >>$LOG 1.1106 + $DIALOG --title " Upgrade completed " \ 1.1107 + --backtitle "$BACKLIST" \ 1.1108 + --yes-label "Exit" \ 1.1109 + --no-label "Reboot" \ 1.1110 + --clear --colors --yesno "\n 1.1111 +Upgrade finished. You can now restart (reboot) \ 1.1112 +from your SliTaz GNU/Linux system.\n\n 1.1113 +Packages on the cdrom : $pkgscd\n 1.1114 +Packages installed from the mirror : $pkginst\n" 18 70 1.1115 + retval=$? 1.1116 + case $retval in 1.1117 + 0) 1.1118 + TITLE="Exiting" 1.1119 + umount_devices ;; 1.1120 + 1) 1.1121 + TITLE="Rebooting" 1.1122 + umount_devices 1.1123 + reboot || reboot -f ;; 1.1124 + 255) 1.1125 + echo -e "ESC pressed.\n" && exit 0 ;; 1.1126 +esac 1.1127 +} 1.1128 + 1.1129 +###################### 1.1130 +# Installer sequence # 1.1131 +###################### 1.1132 + 1.1133 +set_messages 1.1134 +check_root 1.1135 +start_installer 1.1136 + 1.1137 +case $ACTION in 1.1138 + upgrade) 1.1139 + BACKLIST="$BACKLIST (Upgrade)" 1.1140 + mount_cdrom 1.1141 + ask_for_upgrade_dev 1.1142 + upgrade_process 1.1143 + end_of_upgrade ;; 1.1144 + install|*) 1.1145 + mount_cdrom 1.1146 + ask_for_target_dev 1.1147 + ask_for_mkfs_target_dev 1.1148 + ask_for_home 1.1149 + if [ -n "$HOME_DEV" ]; then 1.1150 + ask_for_mkfs_home 1.1151 + fi 1.1152 + ask_for_hostname 1.1153 + ask_for_users_settings 1.1154 + summary 1.1155 + prepare_partitions 1.1156 + install_files 1.1157 + grub_install 1.1158 + end_of_install ;; 1.1159 +esac 1.1160 + 1.1161 +exit 0