slitaz-tools view tinyutils/slitaz-installer.sh @ rev 17

Fixe 'soundconf' screen output
author Christophe Lincoln <pankso@slitaz.org>
date Tue Dec 04 13:08:52 2007 +0100 (2007-12-04)
parents 824e6610b8da
children b04ce844fbf2
line source
1 #!/bin/sh
2 # SliTaz GNU/Linux text mode installer.
3 #
4 VERSION=beta
6 DRIVE_NAME=`cat /proc/sys/dev/cdrom/info | grep "drive name" | cut -f 3`
7 CDROM=/dev/$DRIVE_NAME
8 KERNEL=vmlinuz-`uname -r`
10 # Check if user is root.
11 check_root()
12 {
13 if test $(id -u) != 0 ; then
14 echo -e "
15 Vous devez être root pour continuer l'installation du système. Arrêt.
16 Vous pouvez utiliser 'su' suivi du mot de passe root pour devenir
17 administarteur.\n"
18 exit 0
19 fi
20 }
22 # Status function.
23 status()
24 {
25 local CHECK=$?
26 echo -en "\\033[70G[ "
27 if [ $CHECK = 0 ]; then
28 echo -en "\\033[1;33mOK"
29 else
30 echo -en "\\033[1;31mFailed"
31 fi
32 echo -e "\\033[0;39m ]"
33 }
35 # Basic informations.
36 echo ""
37 echo -e "\033[1mSliTaz GNU/Linux - Installateur mode texte\033[0m"
38 echo "================================================================================"
39 echo "
40 Bienvenue dans l'installateur en mode texte de SliTaz GNU/Linux. Il vous
41 suffirat de répondre à quelques questions lors des différentes étapes
42 d'installation. Avant de commencer, assurer vous de connaître le nom de la
43 partitions sur laquelle vous désirez installer SliTaz. L'installateur va
44 commencer par vous proposer de formater la partition cible et la monter.
45 Ensuite il va monter le cdrom, décompresser les fichiers et les installer
46 sur la cible. Pour finir, vous aurez aussi la possibilité d'installer le
47 gestionnaire de démarrage GRUB, si besoin est. A noter que pour continuer
48 cette installation, vous devez avoir les droits d'administrateur root, qui
49 peuvent s'obtenir via la commande 'su' et le mot de passe 'root'."
50 echo ""
51 echo "================================================================================"
52 echo ""
54 echo -n "Commencer l'installation (oui/Non) ? "; read anser
55 if [ ! "$anser" = "oui" ]; then
56 echo -e "\nArrêt volontaire.\n"
57 exit 0
58 fi
60 # Exit install if user is not root.
61 #check_root
63 # Ask for partitions.
64 echo "
65 Veuilliez indiquer la partition à utiliser pour installer SliTaz,
66 exemple : /dev/hda1."
67 echo ""
68 echo -n "Partition à utiliser ? "; read anser
69 if [ "$anser" == "" ]; then
70 echo -e "\nPas de partition spécifiée. Arrêt.\n"
71 exit 0
72 else
73 TARGET_DEV=$anser
74 fi
76 # Mkfs if needed/wanted.
77 echo "
78 SliTaz va être installé sur la partition : $TARGET_DEV"
79 echo ""
80 echo -n "Faut t'il formater la partition en ext3 (oui/Non) ? "; read anser
81 if [ "$anser" == "oui" ]; then
82 mkfs.ext3 $TARGET_DEV
83 else
84 echo "Le système de fichiers déjà présent sera utilisé..."
85 fi
87 # Mount.
88 echo "Montage de la partitions et du cdrom..."
89 mkdir -p /mnt/target /media/cdrom
90 mount $TARGET_DEV /mnt/target
91 mount -t iso9660 $CDROM /media/cdrom
93 # Copy and install.
94 echo -n "Création du répertoire /boot..."
95 mkdir -p /mnt/target/boot
96 status
97 echo -n "Copie du noyau Linux..."
98 cp /media/cdrom/boot/bzImage /mnt/target/boot/$KERNEL
99 status
101 if [ -f /media/cdrom/boot/rootfs.lz ]; then
102 echo -n "Copie du système de fichier racine..."
103 cp /media/cdrom/boot/rootfs.lz /mnt/target
104 status
105 # Extract lzma rootfs
106 echo "Extraction du système de fichiers racine (rootfs.lz)..."
107 cd /mnt/target
108 lzma d rootfs.lz rootfs.cpio
109 cpio -id < rootfs.cpio
110 echo -n "Suppression des fichiers copiés..."
111 rm rootfs.cpio rootfs.lz init
112 status
113 else
114 echo -n "Copie du système de fichier racine..."
115 cp /media/cdrom/boot/rootfs.gz /mnt/target
116 status
117 # Extract gziped rootfs
118 echo "Extraction du système de fichiers racine (rootfs.gz)..."
119 cd /mnt/target
120 gzip -d rootfs.gz && cpio -id < rootfs
121 echo -n "Suppression des fichiers inutiles..."
122 rm rootfs init
123 status
124 fi
126 # Creat the target GRUB configuration.
127 #
128 if [ ! -f /mnt/target/boot/grub/menu.lst ]; then
129 echo "Creating default GRUB menu.lst..."
130 mkdir -p /mnt/target/boot/grub
131 cat > /mnt/target/boot/grub/menu.lst << EOF
132 # /boot/grub/menu.lst: GRUB boot loader configuration.
133 #
135 # By default, boot the first entry.
136 default 0
138 # Boot automatically after 20 secs.
139 timeout 20
141 # Change the colors.
142 color yellow/brown light-green/black
144 # For booting SliTaz from : $TARGET_DEV
145 #
146 title SliTaz GNU/Linux (cooking) (Kernel $KERNEL)
147 root(hd0,0)
148 kernel /boot/$KERNEL root=$TARGET_DEV
150 EOF
151 fi
153 # End info
154 echo ""
155 echo -e "\033[1mInstallation terminée\033[0m
156 ================================================================================
158 Avant de redémarrer sur votre nouveau système SliTaz GNU/Linux, veuillez vous
159 assurer qu'un gestionnaire de démarrage est bien installé. Si ce n'est pas le
160 cas vous pouvez lancer la commande (en modifiant 'hda' en fonction de votre
161 système) :
163 # grub-install --root-directory=/mnt/target /dev/hda
165 Les lignes suivantes on été ajoutées au fichier de configuration de GRUB
166 /boot/grub/menu.lst de la cible. Elles feront démarrer SliTaz en modifiant
167 la valeure root(hd0,0) en fonction de votre système. Si vous n'installé pas
168 GRUB, vous pouvez utiliser ces même lignes dans un autre fichier menu.lst,
169 situé sur une autre partitions :
171 title SliTaz GNU/Linux (cooking) (Kernel $KERNEL)
172 root(hd0,0)
173 kernel /boot/$KERNEL root=$TARGET_DEV
175 ================================================================================"
176 echo ""