slitaz-tools rev 70
New SliTaz installer (using ncurse/dialog boxes ~630 lines)
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Sat Feb 23 19:16:31 2008 +0100 (2008-02-23) |
parents | 0fd5a7bdf689 |
children | 8d24e280df36 |
files | installer/slitaz-installer |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/installer/slitaz-installer Sat Feb 23 19:16:31 2008 +0100 1.3 @@ -0,0 +1,635 @@ 1.4 +#!/bin/sh 1.5 +# slitaz-installer - SliTaz GNU/Linux installer. 1.6 +# 1.7 +# So this is SliTaz installer using dialog boxes. All the comments are in 1.8 +# English but displayed messages are in French. The scrip starts with a 1.9 +# few main variables, then all the functions and then a sequece of functions. 1.10 +# 1.11 +# (C) 2007-2008 SliTaz - GNU General Public License v3. 1.12 +# 1.13 +# Author : Christophe Lincoln <pankso@slitaz.org> 1.14 +# 1.15 +VERSION=1.0 1.16 +: ${DIALOG=dialog} 1.17 + 1.18 +# Installer actions can be specified on cmdline (install or upgrade). 1.19 +if [ -n "$1" ]; then 1.20 + ACTION=$1 1.21 +else 1.22 + ACTION=install 1.23 +fi 1.24 + 1.25 +# We need to know cdrom device and kernel version string to copy files. 1.26 +DRIVE_NAME=`cat /proc/sys/dev/cdrom/info | grep "drive name" | cut -f 3` 1.27 +CDROM=/dev/$DRIVE_NAME 1.28 +KERNEL=vmlinuz-`uname -r` 1.29 +TARGET_ROOT=/mnt/target 1.30 +LOG=/var/log/slitaz-installer.log 1.31 +BACKLIST="SliTaz GNU/Linux installer" 1.32 + 1.33 +# start_install messages (to translate) 1.34 +START_INSTALL_MSG="\n 1.35 +Bienvenue dans l'installateur de SliTaz GNU/Linux. Vous pouvez utiliser \ 1.36 +les flèches du clavier et la touche ENTER ou la souris pour valider. Il vous \ 1.37 +suffirat de répondre à quelques questions lors des différentes étapes \ 1.38 +d'installation. L'installateur va commencer par monter le cdrom, vous \ 1.39 +demander la partition utiliser comme racine du système et vous proposer \ 1.40 +de la formater. Ensuite il va copier les fichiers depuis le cdrom, les \ 1.41 +décompresser, les installer et va préconfigurer le système. Pour finir, 1.42 +vous aurez aussi la possibilité d'installer le gestionnaire de démarrage 1.43 +GRUB, si besoin est.\n\n 1.44 +\Z2Commencer l'installation ?\Zn" 1.45 + 1.46 +####################### 1.47 +# Installer functions # 1.48 +####################### 1.49 + 1.50 +# Display error message. 1.51 +error_message() 1.52 +{ 1.53 + $DIALOG --title " Erreur " \ 1.54 + --colors --backtitle "$BACKLIST" \ 1.55 + --clear --msgbox "\n$ERROR_MSG" 18 70 1.56 +} 1.57 + 1.58 +# Exit install if user is not root. 1.59 +check_root() 1.60 +{ 1.61 + if test $(id -u) != 0 ; then 1.62 + ERROR_MSG="\ 1.63 +[\Z6fr\Zn] Vous devez être root pour installer SLiTaz GNU/Linux. Vous pouvez \ 1.64 +utiliser 'su' suivi du mot de passe administrateur pour devenir root \ 1.65 +et relancer l'installation.\n\n 1.66 +[\Z6en\Zn] You must be root administrator to start SliTaz installer, please \ 1.67 +use 'su' to get a root SHell and restart installation." 1.68 + error_message 1.69 + exit 0 1.70 + fi 1.71 +} 1.72 + 1.73 +# This function is used after each screen to contine or abort install. 1.74 +check_retval() 1.75 +{ 1.76 +case $retval in 1.77 + 0) 1.78 + continue ;; 1.79 + 1) 1.80 + echo -e "\nArrêt volontaire.\n" && exit 0 ;; 1.81 + 3) 1.82 + continue ;; 1.83 + 255) 1.84 + echo -e "ESC pressed.\n" && exit 0 ;; 1.85 +esac 1.86 +} 1.87 + 1.88 +# Start install with basic informations. 1.89 +start_install() 1.90 +{ 1.91 + $DIALOG --title " Débuter l'installation " \ 1.92 + --backtitle "$BACKLIST" \ 1.93 + --clear --colors --yesno "$START_INSTALL_MSG" 18 70 1.94 + retval=$? 1.95 + check_retval 1.96 + echo "start_infos: `date`" > $LOG 1.97 +} 1.98 + 1.99 +# Mount cdrom and verify if it's realy SliTaz CD. 1.100 +mount_cdrom() 1.101 +{ 1.102 + ERROR_MSG="" 1.103 + umount /media/cdrom 2>/dev/null 1.104 + ( 1.105 + echo "XXX" && echo 30 1.106 + echo -e "\nCréation du point de montage (/media/cdrom)..." 1.107 + echo "XXX" 1.108 + mkdir -p /media/cdrom 1.109 + sleep 1 1.110 + echo "XXX" && echo 60 1.111 + echo -e "\nMontage du cdrom ($CDROM)..." 1.112 + echo "XXX" 1.113 + mount -t iso9660 $CDROM /media/cdrom 2>>$LOG 1.114 + echo "XXX" && echo 90 1.115 + echo -e "\nVérification du media d'installation..." 1.116 + echo "XXX" 1.117 + sleep 2 1.118 + ) | 1.119 + $DIALOG --title " Montage du cdrom " \ 1.120 + --backtitle "$BACKLIST" \ 1.121 + --gauge "Préparation du media d'installation..." 18 70 0 1.122 + # Exit with error msg if no rootfs.gz found 1.123 + if [ ! -f /media/cdrom/boot/rootfs.gz ]; then 1.124 + ERROR_MSG="\ 1.125 +Impossible de trouver : rootfs.gz\n\n 1.126 +L'archive du système de fichiers racine n'est pas présente sur le cdrom. \ 1.127 +Il se peut que cette erreur soit due au fait que le LiveCD de SliTaz ne soit \ 1.128 +pas inséré dans le premier lecteur CD/DVD et que le media n'as pas pu être \ 1.129 +correctement monté. Arrêt." 1.130 + error_message 1.131 + echo "missing: /media/cdrom/boot/rootfs.gz" >>$LOG 1.132 + exit 1 1.133 + fi 1.134 +} 1.135 + 1.136 +# Display a list of available partition. 1.137 +fdisk_list() 1.138 +{ 1.139 + LIST_PARTITIONS=`fdisk -l | grep ^/dev | sed s/'e Win95'/'e'/g` 1.140 + $DIALOG --title " Partitions tables " \ 1.141 + --backtitle "$BACKLIST" \ 1.142 + --clear --msgbox "\n 1.143 +Liste des partitions disponibles :\n\n 1.144 +$LIST_PARTITIONS" 18 70 1.145 +} 1.146 + 1.147 +# We need a partition to install (inputbox). 1.148 +ask_for_target_dev() 1.149 +{ 1.150 + exec 3>&1 1.151 + TARGET_DEV=`$DIALOG --title " Partition racine " \ 1.152 + --backtitle "$BACKLIST" --clear \ 1.153 + --extra-label "List" --extra-button \ 1.154 + --colors --inputbox "\n 1.155 +Veuilliez indiquer la partition à utiliser pour installer SliTaz GNU/Linux, \ 1.156 +exemple: '/dev/hda1'. Vous pouvez utiliser le bouton 'List' pour afficher \ 1.157 +une liste des partitions disponibles sur le ou les disques durs et revenir \ 1.158 +ensuite à cet écran. A noter qu'il faut au minimum 100 Mb pour le coeur du \ 1.159 +système et que si vous prévoyez d'installer de nouveaux paquets, vous serez \ 1.160 +plus à l'aise avec environ 400 Mb.\n\n 1.161 +\Z2Partition à utiliser:\Zn" 18 70 2>&1 1>&3` 1.162 + retval=$? 1.163 + exec 3>&- 1.164 + check_retval 1.165 + # Display list and comme back. 1.166 + if [ "$retval" = "3" ]; then 1.167 + fdisk_list 1.168 + ask_for_target_dev 1.169 + fi 1.170 + # Empty value. 1.171 + if [ -z $TARGET_DEV ]; then 1.172 + ask_for_target_dev 1.173 + fi 1.174 + # Check if specified device exist in /proc/partitions. 1.175 + DEV_NAME=${TARGET_DEV#/dev/} 1.176 + if cat /proc/partitions | grep -q $DEV_NAME; then 1.177 + echo "ask_for_target_dev: $TARGET_DEV" >>$LOG 1.178 + else 1.179 + ERROR_MSG="La partition \Z2$TARGET_DEV\Zn ne semble pas exister." 1.180 + error_message 1.181 + ask_for_target_dev 1.182 + fi 1.183 +} 1.184 + 1.185 +# Mkfs if needed/wanted. 1.186 +ask_for_mkfs_target_dev() 1.187 +{ 1.188 + $DIALOG --title " Formater " \ 1.189 + --backtitle "$BACKLIST" \ 1.190 + --clear --colors --yesno "\n 1.191 +SliTaz va être installé sur la partition : $TARGET_DEV\n\n 1.192 +Vous avez la possibilité de formater la partition en ext3 ou d'utiliser \ 1.193 +le système de fichiers déjà présent sur la partition. Le format ext3 est \ 1.194 +un système de fichier propre à Linux, robuste, stable et jounalisé, c'est \ 1.195 +le format conseillé. Faites attention, si vous formatez toutes les données \ 1.196 +de cette partition seront définitivement détruites. Si vous conserver le \ 1.197 +système de fichiers actuel, la partition sera nettoyée et les donnés 1.198 +utilisateurs conservées (/home).\n\n 1.199 +\Z2Faut t'il formater la partition en ext3 ?\Zn" 18 70 1.200 + retval=$? 1.201 + case $retval in 1.202 + 0) 1.203 + MKFS_TARGET_DEV="ext3" 1.204 + echo "mkfs_target_dev: ext3" >>$LOG ;; 1.205 + 1) 1.206 + CLEAN="clean" 1.207 + echo "mkfs_target_dev: clean" >>$LOG ;; 1.208 + 255) 1.209 + echo -e "ESC pressed.\n" && exit 0 ;; 1.210 + esac 1.211 + 1.212 +} 1.213 + 1.214 +# Mount and mkfs with progress. 1.215 +prepare_target_dev() 1.216 +{ 1.217 + ( 1.218 + echo "XXX" && echo 30 1.219 + echo -e "\nPréparation de la partition cible..." 1.220 + echo "XXX" 1.221 + # Mount point can be already used. 1.222 + if mount | grep -q $TARGET_ROOT; then 1.223 + umount $TARGET_ROOT 2>$LOG 1.224 + fi 1.225 + sleep 2 1.226 + 1.227 + if [ "$MKFS_TARGET_DEV" == "ext3" ]; then 1.228 + echo "XXX" && echo 60 1.229 + echo -e "\nExécution de mkfs.ext3 sur $TARGET_DEV" 1.230 + echo "XXX" 1.231 + mkfs.ext3 $TARGET_DEV >>$LOG 2>>$LOG 1.232 + else 1.233 + echo "XXX" && echo 60 1.234 + echo -e "\nLa partition ($TARGET_DEV) sera nettoyée..." 1.235 + echo "XXX" 1.236 + sleep 2 1.237 + fi 1.238 + 1.239 + echo "XXX" && echo 90 1.240 + echo -e "\nCréation du point de montage: $TARGET_ROOT" 1.241 + echo "XXX" 1.242 + mkdir -p $TARGET_ROOT 1.243 + sleep 2 1.244 + 1.245 + ) | 1.246 + $DIALOG --title " Préparation de la cible " \ 1.247 + --backtitle "$BACKLIST" \ 1.248 + --gauge "Target in preparation..." 18 70 0 1.249 + # Mount target 1.250 + mount $TARGET_DEV $TARGET_ROOT >>$LOG 2>>$LOG 1.251 +} 1.252 + 1.253 +# Ask for hostanme before installing files. 1.254 +ask_for_hostname() 1.255 +{ 1.256 + exec 3>&1 1.257 + HOSTNAME=`$DIALOG --title " Hostname " \ 1.258 + --backtitle "$BACKLIST" --clear \ 1.259 + --colors --inputbox "\n 1.260 +Veuilliez indiquer le nom de machine à utiliser pour votre système SliTaz.\ 1.261 +Le nom de machine ou 'hostname' est utilisé pour identifier votre machine sur 1.262 +le réseaux et en local par le système (defaut: slitaz). A noter que cette\ 1.263 +valeur peut aussi être modifiée une fois le système installé en utilisant 1.264 +'netbox' graphiquement ou la ligne de commande.\n\n 1.265 +\Z2Nom de machine:\Zn" 18 70 2>&1 1>&3` 1.266 + retval=$? 1.267 + exec 3>&- 1.268 + check_retval 1.269 + # Empty value. 1.270 + if [ -z $HOSTNAME ]; then 1.271 + HOSTNAME="slitaz" 1.272 + fi 1.273 +} 1.274 + 1.275 +# Get a clean target device (15%). 1.276 +clean_target() 1.277 +{ 1.278 + if [ "$CLEAN" == "clean" ]; then 1.279 + echo "XXX" && echo 15 1.280 + echo -e "\nNettoyage de la partition racine ($TARGET_DEV)..." 1.281 + echo "XXX" 1.282 + cd $TARGET_ROOT 1.283 + # Keep /home in case of reinstall. 1.284 + for dir in * 1.285 + do 1.286 + case "$dir" in 1.287 + home) 1.288 + mv home home.bak 1.289 + echo "keeping /home found on: $TARGET_DEV" >>$LOG ;; 1.290 + lost+found) 1.291 + break ;; 1.292 + *) 1.293 + rm -rf $dir 2>$LOG ;; 1.294 + esac 1.295 + done 1.296 + if [ -d $TARGET_ROOT/mklost+found ]; then 1.297 + mklost+found 2>>$LOG 1.298 + fi 1.299 + fi 1.300 + sleep 2 1.301 +} 1.302 + 1.303 +# Kernel is rename to standard vmlinuz-$VERSION. 1.304 +install_kernel() 1.305 +{ 1.306 + mkdir -p $TARGET_ROOT/boot 1.307 + cp /media/cdrom/boot/bzImage $TARGET_ROOT/boot/$KERNEL 1.308 + echo "install_kernel: $KERNEL" >>$LOG 1.309 + sleep 2 1.310 +} 1.311 + 1.312 +# Copy isolinux r/w files (not syslinux, some files are read only). 1.313 +copy_bootloaders() 1.314 +{ 1.315 + if [ -d "/media/cdrom/boot/isolinux" ]; then 1.316 + mkdir -p $TARGET_ROOT/boot/isolinux 1.317 + cp -a /media/cdrom/boot/isolinux/*.cfg $TARGET_ROOT/boot/isolinux 1.318 + cp -a /media/cdrom/boot/isolinux/*.kbd $TARGET_ROOT/boot/isolinux 1.319 + cp -a /media/cdrom/boot/isolinux/*.txt $TARGET_ROOT/boot/isolinux 1.320 + cp -a /media/cdrom/boot/isolinux/*.bin $TARGET_ROOT/boot/isolinux 1.321 + cp -a /media/cdrom/boot/isolinux/*.msg $TARGET_ROOT/boot/isolinux 1.322 + cp -a /media/cdrom/boot/isolinux/*.lss $TARGET_ROOT/boot/isolinux 1.323 + cp -a /media/cdrom/boot/isolinux/*.c32 $TARGET_ROOT/boot/isolinux 1.324 + fi 1.325 +} 1.326 + 1.327 +# Extract lzma'ed or gziped rootfs. 1.328 +extract_rootfs() 1.329 +{ 1.330 + cd $TARGET_ROOT 1.331 + (zcat rootfs.gz 2>/dev/null || lzma d rootfs.gz -so) 2>>$LOG | cpio -id 2>>$LOG 1.332 + rm -f rootfs rootfs.cpio rootfs.gz 1.333 +} 1.334 + 1.335 +# /etc/skel (60%) 1.336 +gen_etc_skel() 1.337 +{ 1.338 + #Maybe we don't have /home/hacker directory 1.339 + if [ -d $TARGET_ROOT/home/hacker ]; then 1.340 + echo "XXX" && echo 60 1.341 + echo -e "\nCopie des fichiers utilisateurs par défaut (/etc/skel)..." 1.342 + echo "XXX" 1.343 + cp -a $TARGET_ROOT/home/hacker $TARGET_ROOT/etc/skel 1.344 + else 1.345 + echo "XXX" && echo 60 1.346 + echo -e "\nCréation du répertoire (/etc/skel)..." 1.347 + echo "XXX" 1.348 + mkdir -p $TARGET_ROOT/etc/skel \ 1.349 + $TARGET_ROOT/etc/Documents \ 1.350 + $TARGET_ROOT/etc/skel/Images \ 1.351 + $TARGET_ROOT/etc/skel/.local/bin \ 1.352 + $TARGET_ROOT/etc/skel/.local/share 1.353 + fi 1.354 + sleep 2 1.355 +} 1.356 + 1.357 +# Pre configure freshly installed system (70 - 90%). 1.358 +pre_config_system() 1.359 +{ 1.360 + cd $TARGET_ROOT 1.361 + # Restore backup of existing /home if exist. 1.362 + # (created by prepare_target_dev) 1.363 + if [ -d home.bak ]; then 1.364 + echo "XXX" && echo 75 1.365 + echo -e "\nRestoration du répertoire /home..." 1.366 + echo "XXX" 1.367 + rm -rf home 1.368 + mv home.bak home 1.369 + sleep 2 1.370 + fi 1.371 + # Add root device to CHECK_FS in rcS.conf to check filesystem 1.372 + # on each boot. 1.373 + echo "XXX" && echo 80 1.374 + echo -e "\nAjout de $TARGET_DEV à CHECK_FS du fichier /etc/rcS.conf..." 1.375 + echo "XXX" 1.376 + sed -i s#'CHECK_FS=\"\"'#"CHECK_FS=\"$TARGET_DEV\""# etc/rcS.conf 1.377 + sleep 2 1.378 + # Set hostname. 1.379 + echo "XXX" && echo 85 1.380 + echo -e "\nConfiguration du nom de machine: $HOSTNAME" 1.381 + echo "XXX" 1.382 + echo $HOSTNAME > etc/hostname 1.383 + sleep 2 1.384 +} 1.385 + 1.386 +# Determin GRUB partition number and GRUB disk number. 1.387 +grub_config() 1.388 +{ 1.389 + DISK_LETTER=${TARGET_DEV#/dev/[h-s]d} 1.390 + DISK_LETTER=${DISK_LETTER%[0-9]} 1.391 + GRUB_PARTITION=$((${TARGET_DEV#/dev/[h-s]d[a-z]}-1)) 1.392 + for disk in a b c d e f g h 1.393 + do 1.394 + nb=$(($nb+1)) 1.395 + if [ "$disk" = "$DISK_LETTER" ]; then 1.396 + GRUB_DISK=$(($nb-1)) 1.397 + break 1.398 + fi 1.399 + done 1.400 + GRUB_ROOT="(hd${GRUB_DISK},${GRUB_PARTITION})" 1.401 + # Creat the target GRUB configuration. 1.402 + mkdir -p $TARGET_ROOT/boot/grub 1.403 + cat > $TARGET_ROOT/boot/grub/menu.lst << _EOF_ 1.404 +# /boot/grub/menu.lst: GRUB boot loader configuration. 1.405 +# 1.406 + 1.407 +# By default, boot the first entry. 1.408 +default 0 1.409 + 1.410 +# Boot automatically after 8 secs. 1.411 +timeout 8 1.412 + 1.413 +# Change the colors. 1.414 +color yellow/brown light-green/black 1.415 + 1.416 +# For booting SliTaz from : $TARGET_DEV 1.417 +# 1.418 +title SliTaz GNU/Linux (cooking) (Kernel $KERNEL) 1.419 + root $GRUB_ROOT 1.420 + kernel /boot/$KERNEL root=$TARGET_DEV 1.421 + 1.422 +_EOF_ 1.423 + # log 1.424 + echo "grub_config: $TARGET_ROOT/boot/grub/menu.lst" >>$LOG 1.425 + sleep 2 1.426 +} 1.427 + 1.428 +# Files install with gauge, calling for functions or with cmds. 1.429 +install_files() 1.430 +{ 1.431 + ( 1.432 + 1.433 + echo "XXX" && echo 10 1.434 + echo -e "\nNettoyage de la partition racine si nécessaire..." 1.435 + echo "XXX" 1.436 + clean_target 1.437 + 1.438 + echo "XXX" && echo 20 1.439 + echo -e "\nInstallations du noyau ($KERNEL)..." 1.440 + echo "XXX" 1.441 + install_kernel 1.442 + 1.443 + echo "XXX" && echo 30 1.444 + echo -e "\nCopie des bootloaders syslinux/isolinux..." 1.445 + echo "XXX" 1.446 + copy_bootloaders 1.447 + 1.448 + echo "XXX" && echo 40 1.449 + echo -e "\nCopie du système compressé (rootfs.gz)..." 1.450 + echo "XXX" 1.451 + cp /media/cdrom/boot/rootfs.gz $TARGET_ROOT 1.452 + sleep 2 1.453 + 1.454 + echo "XXX" && echo 50 1.455 + echo -e "\nExtraction du système racine..." 1.456 + echo "XXX" 1.457 + extract_rootfs 1.458 + 1.459 + echo "XXX" && echo 60 1.460 + echo -e "\nCopie des fichiers utilisateurs par défaut (/etc/skel)..." 1.461 + echo "XXX" 1.462 + gen_etc_skel 1.463 + sleep 2 1.464 + 1.465 + echo "XXX" && echo 70 1.466 + echo -e "\nPreconfiguration du système..." 1.467 + echo "XXX" 1.468 + pre_config_system 1.469 + 1.470 + echo "XXX" && echo 90 1.471 + echo -e "\nCréation du fichier de configuration de GRUB (menu.lst)..." 1.472 + echo "XXX" 1.473 + grub_config 1.474 + 1.475 + echo "XXX" && echo 100 1.476 + echo -e "\nFin de l'installation des fichiers..." 1.477 + echo "XXX" 1.478 + echo "install_files: OK" >>$LOG 1.479 + sleep 4 1.480 + 1.481 + ) | 1.482 + $DIALOG --title " Installation des fichiers " \ 1.483 + --backtitle "$BACKLIST" \ 1.484 + --gauge "Starting to install files..." 18 70 0 1.485 +} 1.486 + 1.487 +# GRUB info with disk name used for grub-install 1.488 +grub_install() 1.489 +{ 1.490 + TARGET_DISK=`echo $TARGET_DEV | sed s/"[0-9]"/''/` 1.491 + $DIALOG --title " GRUB install " \ 1.492 + --backtitle "$BACKLIST" \ 1.493 + --clear --colors --yesno "\n 1.494 +Avant de redémarrer sur votre nouveau système SliTaz GNU/Linux, veuillez \ 1.495 +vous assurer qu'un gestionnaire de démarrage est bien installé. Si ce n'est \ 1.496 +pas le cas vous pouvez répondre oui et installer GRUB. Si vous n'installez \ 1.497 +pas GRUB, un fichier de configuration (menu.lst) à été généré pendant \ 1.498 +l'installation, il contient les lignes qui permettent de démarrer SliTaz.\n\n 1.499 +Une fois installé, GRUB peut facilement être reconfiguré et propose un SHell \ 1.500 +interactif au boot.\n\n 1.501 +\Z2Faut t'il installer GRUB sur: $TARGET_DISK ?\Zn" 18 70 1.502 + retval=$? 1.503 + case $retval in 1.504 + 0) 1.505 + ( 1.506 + echo "XXX" && echo 50 1.507 + echo -e "\nExécution de grub-install sur : $TARGET_DISK..." 1.508 + echo "XXX" 1.509 + grub-install --no-floppy \ 1.510 + --root-directory=$TARGET_ROOT $TARGET_DISK 2>>$LOG 1.511 + echo "XXX" && echo 100 1.512 + echo -e "\nFin de l'installation..." 1.513 + echo "XXX" 1.514 + sleep 2 1.515 + ) | 1.516 + $DIALOG --title " GRUB install " \ 1.517 + --backtitle "$BACKLIST" \ 1.518 + --gauge "Installation de GRUB..." 18 70 0 ;; 1.519 + 1) 1.520 + echo "grub_install: NO" >>$LOG ;; 1.521 + 255) 1.522 + echo -e "ESC pressed.\n" && exit 0 ;; 1.523 + esac 1.524 +} 1.525 + 1.526 +# Copy log file, umount target and eject cdrom 1.527 +umount_devices() 1.528 +{ 1.529 + ( 1.530 + echo "XXX" && echo 25 1.531 + echo -e "\nCopie du fichier de log ($LOG)..." 1.532 + echo "XXX" 1.533 + cp -a $LOG $TARGET_ROOT/var/log 1.534 + sleep 2 1.535 + echo "XXX" && echo 50 1.536 + echo -e "\nDémontage de la cible ($TARGET_DEV)..." 1.537 + echo "XXX" 1.538 + if mount | grep -q $TARGET_ROOT; then 1.539 + umount $TARGET_ROOT 2>/dev/null 1.540 + fi 1.541 + echo "XXX" && echo 75 1.542 + echo -e "\nDémontage et éjection du cdrom..." 1.543 + echo "XXX" 1.544 + if mount | grep -q /media/cdrom; then 1.545 + umount /media/cdrom 1.546 + eject 1.547 + fi 1.548 + sleep 2 1.549 + echo "XXX" && echo 100 1.550 + echo -e "\n$TITLE..." 1.551 + echo "XXX" 1.552 + sleep 2 1.553 + ) | 1.554 + $DIALOG --title " $TITLE " \ 1.555 + --backtitle "$BACKLIST" \ 1.556 + --gauge "$TITLE starting..." 18 70 0 1.557 +} 1.558 + 1.559 +# End of installation 1.560 +end_of_install() 1.561 +{ 1.562 + echo "end_of_install: `date`" >>$LOG 1.563 + $DIALOG --title " Installation terminée " \ 1.564 + --backtitle "$BACKLIST" \ 1.565 + --yes-label "Exit" \ 1.566 + --no-label "Reboot" \ 1.567 + --clear --colors --yesno "\n 1.568 +L'installation est terminée. Vous pouvez dès maintenant redémarrer (reboot) \ 1.569 +sur votre nouveau système SliTaz GNU/Linux et commencer à finement le \ 1.570 +configurer en fonction de vos besoins et préférences. Vous trouverez de l'aide \ 1.571 +ou un support technique gratuit via la liste de discussion et/ou le forum \ 1.572 +officiel du projet. Pour bien commencer à utiliser le système, vous pouvez \ 1.573 +vous référer aux documents du Handbook de SliTaz et utiliser le gestionnaire \ 1.574 +de paquets Tazpkg pour installer de nouveaux logiciels prêts à savourer." 18 70 1.575 + retval=$? 1.576 + case $retval in 1.577 + 0) 1.578 + TITLE="Exiting" 1.579 + umount_devices ;; 1.580 + 1) 1.581 + TITLE="Rebooting" 1.582 + umount_devices 1.583 + reboot || reboot -f ;; 1.584 + 255) 1.585 + echo -e "ESC pressed.\n" && exit 0 ;; 1.586 +esac 1.587 +} 1.588 + 1.589 +##################### 1.590 +# Upgrade functions # 1.591 +##################### 1.592 + 1.593 +# Start upgrade with basic informations (TODO). 1.594 +start_upgrade() 1.595 +{ 1.596 + $DIALOG --title " Mise à jour du système " \ 1.597 + --backtitle "$BACKLIST" \ 1.598 + --clear --colors --yesno "\n 1.599 +La fonction de mise à jour complète du système n'est pas encore implémentée. 1.600 +\n\n 1.601 +* Montage de la partition.\n 1.602 +* Sauvegarde des fichiers de configuration.\n 1.603 +* Créer un diff entre les paquets du cdrom et ceux installés.\n 1.604 +* Nettoyer la partition.\n 1.605 +* Installer la version du cdrom.\n 1.606 +* Restauration des fichiers de config.\n 1.607 +* Réinstaller les paquets manquants depuis le miroir." 18 70 1.608 + retval=$? 1.609 + #check_retval 1.610 + #echo "start_upgarde: `date`" > $LOG 1.611 + exit 0 1.612 +} 1.613 + 1.614 +###################### 1.615 +# Installer sequence # 1.616 +###################### 1.617 + 1.618 +case $ACTION in 1.619 + upgrade) 1.620 + check_root 1.621 + start_upgrade 1.622 + #mount_cdrom 1.623 + ;; 1.624 + install|*) 1.625 + check_root 1.626 + start_install 1.627 + mount_cdrom 1.628 + ask_for_target_dev 1.629 + ask_for_mkfs_target_dev 1.630 + prepare_target_dev 1.631 + ask_for_hostname 1.632 + install_files 1.633 + grub_install 1.634 + end_of_install 1.635 + ;; 1.636 +esac 1.637 + 1.638 +exit 0