Annotation of /trunk/installer-simple/bin/installer.sh.in
Parent Directory | Revision Log
Revision 2892 -
(hide annotations)
(download)
Fri Jul 31 11:40:56 2015 UTC (9 years, 1 month ago) by niro
File size: 16016 byte(s)
Fri Jul 31 11:40:56 2015 UTC (9 years, 1 month ago) by niro
File size: 16016 byte(s)
-added more hardware quirks
1 | niro | 2323 | #!/bin/bash |
2 | niro | 2322 | # $Id$ |
3 | niro | 2320 | # |
4 | niro | 2322 | # Simple Installation Script |
5 | # merged from alxinstall-ng and mcore-installer | ||
6 | niro | 2320 | # |
7 | # Niels Rogalla <niro@magellan-linux.de> | ||
8 | # | ||
9 | |||
10 | niro | 2472 | # setup locales |
11 | TEXTDOMAIN=installer | ||
12 | |||
13 | niro | 2340 | # include dir |
14 | niro | 2333 | INSTALLER_LIBDIR="%LIBDIR%" |
15 | |||
16 | niro | 2340 | # TOTALLINES=linecount of ${CDIMAGENAME}-tarball -1 ! |
17 | # -> now in images.conf | ||
18 | CURRENTLINE=0 | ||
19 | |||
20 | niro | 2397 | die() |
21 | { | ||
22 | echo "Error: $@" | ||
23 | exit 1 | ||
24 | } | ||
25 | |||
26 | niro | 2401 | # load common includes |
27 | niro | 2402 | for inc in %SYSCONFDIR%/installer.conf \ |
28 | ${INSTALLER_LIBDIR}/functions/common.sh \ | ||
29 | ${INSTALLER_LIBDIR}/functions/common-dialogs.sh \ | ||
30 | ${INSTALLER_LIBDIR}/functions/hwdetection.sh \ | ||
31 | niro | 2428 | ${INSTALLER_LIBDIR}/functions/bootloader.sh \ |
32 | ${INSTALLER_LIBDIR}/functions/initrd-tools.sh \ | ||
33 | niro | 2402 | ${INSTALLER_LIBDIR}/functions/installer-dialogs.sh |
34 | niro | 2401 | do |
35 | if [ -e ${inc} ] | ||
36 | then | ||
37 | source "${inc}" | ||
38 | else | ||
39 | die "'${inc}' not found" | ||
40 | fi | ||
41 | done | ||
42 | niro | 2332 | |
43 | niro | 2320 | ### System/Config Version |
44 | VERSION="%VERSIONTAG%" | ||
45 | niro | 2332 | TITLE="${DEFAULT_TITLE} - ${VERSION}" |
46 | niro | 2320 | |
47 | niro | 2890 | # initialize global variables so they are exportable |
48 | niro | 2404 | # some sane defaults |
49 | niro | 2891 | INSTALL_METHOD="" |
50 | niro | 2653 | LIVEROOT="${DEFAULT_LIVEROOT}" |
51 | niro | 2642 | IMAGEROOT="${DEFAULT_IMAGEROOT}" |
52 | niro | 2342 | INSTALLROOT="${DEFAULT_INSTALLROOT}" |
53 | niro | 2404 | KERNELPKG="${DEFAULT_KERNELPKG}" |
54 | KERNELOPTS="${DEFAULT_KERNELOPTS}" | ||
55 | niro | 2320 | GRUBLEGACYOPTS="" |
56 | GRUB2OPTS="" | ||
57 | FDISKPARTIONBELOW256MB=0 | ||
58 | SPECIALDEVICE="" | ||
59 | niro | 2404 | FORMFACTOR="${DEFAULT_FORMFACTOR}" |
60 | niro | 2332 | FORMAT_FILESYSTEM="${DEFAULT_FILESYSTEM}" |
61 | niro | 2890 | FLASHDISK=0 |
62 | niro | 2320 | |
63 | niro | 2642 | # TOTALLINES=linecount of ${CDIMAGENAME}-tarball -1 ! |
64 | # -> now in images.conf | ||
65 | CDIMAGENAME="" | ||
66 | TOTALLINES="" | ||
67 | CURRENTLINE=0 | ||
68 | if [ -e ${IMAGEROOT}/images.conf ] | ||
69 | then | ||
70 | source ${IMAGEROOT}/images.conf | ||
71 | # check if all required variables are set | ||
72 | [[ -z ${CDIMAGENAME} ]] && die "CDIMAGENAME is empty in ${IMAGEROOT}/images.conf" | ||
73 | [[ -z ${TOTALLINES} ]] && die "TOTALLINES is empty in ${IMAGEROOT}/images.conf" | ||
74 | else | ||
75 | die "${IMAGEROOT}/images.conf not found" | ||
76 | fi | ||
77 | niro | 2320 | |
78 | niro | 2482 | ### helper scripts ### |
79 | |||
80 | niro | 2409 | trap_exit() |
81 | { | ||
82 | is_mounted --location "${INSTALLROOT}/dev" && umount ${INSTALLROOT}/dev | ||
83 | is_mounted --location "${INSTALLROOT}/proc" && umount ${INSTALLROOT}/proc | ||
84 | is_mounted --location "${INSTALLROOT}/sys" && umount ${INSTALLROOT}/sys | ||
85 | is_mounted --location "${INSTALLROOT}/boot" && umount ${INSTALLROOT}/boot | ||
86 | is_mounted --location "${INSTALLROOT}" && umount ${INSTALLROOT} | ||
87 | niro | 2889 | [[ -n ${SWAPHDD} ]] && swapoff ${SWAPHDD} |
88 | niro | 2409 | |
89 | echo $"Installation aborted." | ||
90 | exit 1 | ||
91 | } | ||
92 | |||
93 | niro | 2423 | install_meter() |
94 | niro | 2320 | { |
95 | while [[ ${CURRENTLINE} != ${TOTALLINES} ]] | ||
96 | do | ||
97 | CURRENTLINE=$(grep -c . /tmp/install.log) | ||
98 | PERCENT=$(( ${CURRENTLINE} * 100 / ${TOTALLINES})) | ||
99 | echo ${PERCENT} | ||
100 | sleep 1 | ||
101 | done | ||
102 | rm -f /tmp/install.log | ||
103 | return 0 | ||
104 | } | ||
105 | |||
106 | niro | 2485 | mount_rootfs() |
107 | niro | 2484 | { |
108 | niro | 2489 | local retval |
109 | |||
110 | niro | 2882 | if [[ -n ${SWAPHDD} ]] |
111 | niro | 2489 | then |
112 | niro | 2882 | swapon ${SWAPHDD} || dialog_die $"Could not enable swap space '${SWAPHDD}'" |
113 | niro | 2489 | fi |
114 | niro | 2882 | |
115 | if [[ -n ${ROOTHDD} ]] | ||
116 | then | ||
117 | if is_mounted --location "${INSTALLROOT}" | ||
118 | then | ||
119 | echo $"${INSTALLROOT} already mounted" >&2 | ||
120 | else | ||
121 | niro | 2888 | mount -t "${FORMAT_FILESYSTEM_ROOTHDD}" "${ROOTHDD}" "${INSTALLROOT}" || dialog_die $"Could not mount rootfs - drive '${ROOTHDD}' -> '${INSTALLROOT}'" |
122 | niro | 2882 | fi |
123 | fi | ||
124 | |||
125 | niro | 2486 | [[ -d ${INSTALLROOT}/boot ]] || install -d ${INSTALLROOT}/boot |
126 | niro | 2882 | |
127 | if [[ -n ${BOOTHDD} ]] | ||
128 | then | ||
129 | if is_mounted --location "${INSTALLROOT}"/boot | ||
130 | then | ||
131 | echo $"${INSTALLROOT}/boot already mounted" >&2 | ||
132 | else | ||
133 | niro | 2888 | mount -t "${FORMAT_FILESYSTEM_BOOTHDD}" "${BOOTHDD}" "${INSTALLROOT}"/boot || dialog_die $"Could not mount bootfs - drive '${BOOTHDD}' -> '${INSTALLROOT}/boot'" |
134 | niro | 2882 | fi |
135 | fi | ||
136 | niro | 2484 | } |
137 | |||
138 | niro | 2485 | umount_rootfs() |
139 | niro | 2484 | { |
140 | is_mounted --location ${INSTALLROOT}/boot && umount ${INSTALLROOT}/boot | ||
141 | is_mounted --location ${INSTALLROOT} && umount ${INSTALLROOT} | ||
142 | niro | 2882 | |
143 | if [[ -n ${SWAPHDD} ]] | ||
144 | then | ||
145 | swapoff ${SWAPHDD} || die | ||
146 | fi | ||
147 | niro | 2484 | } |
148 | |||
149 | install_do_reboot() | ||
150 | { | ||
151 | reboot | ||
152 | } | ||
153 | |||
154 | niro | 2320 | run_hardware_detection() |
155 | { | ||
156 | local hwinfo | ||
157 | |||
158 | hwinfo="$(hwinfo --bios --storage --pci --gfxcard --sys)" | ||
159 | |||
160 | niro | 2654 | # check for special devices/clients: |
161 | # if zotac a zotac and the disk is a removeable device, then add rootdelay to kernelcmd | ||
162 | local removable=0 | ||
163 | if [[ ! -z $(echo "${hwinfo}" | grep -i zotac) ]] | ||
164 | then | ||
165 | niro | 2890 | for i in /sys/block/[hs]d*/removable |
166 | do | ||
167 | if [[ $(< ${i}) = 1 ]] | ||
168 | then | ||
169 | removable=1 | ||
170 | # we assume that all removable disks are flash disks on a zotac | ||
171 | export FLASHDISK=1 | ||
172 | fi | ||
173 | done | ||
174 | niro | 2654 | # smartcard = udevadm info -n /dev/sda -a | grep -i 'configuration.*card' |
175 | niro | 2320 | |
176 | niro | 2654 | # only add this for grub legacy, grub2 detect these settings on its own |
177 | export GRUBLEGACYOPTS="rootdelay=8" | ||
178 | # there are to zotac types in the wild, nvidia based gfx and intel | ||
179 | if [[ ! -z $(echo "${hwinfo}" | grep -i nouveau) ]] | ||
180 | then | ||
181 | export SPECIALDEVICE="zotac_nvidia" | ||
182 | else | ||
183 | export SPECIALDEVICE="zotac_intel" | ||
184 | fi | ||
185 | fi | ||
186 | niro | 2320 | |
187 | # check for special devices/clients: | ||
188 | # if a rangee and disk ist smaller then 256mb move partion one block further ahead | ||
189 | if [[ ! -z $(echo "${hwinfo}" | grep -i CLE266) ]] | ||
190 | then | ||
191 | # for a rangee always define partion startblock +1 | ||
192 | export FDISKPARTIONBELOW256MB="1" | ||
193 | export SPECIALDEVICE="rangee" | ||
194 | export GRUBLEGACYOPTS="" | ||
195 | fi | ||
196 | |||
197 | # check for special devices/clients: | ||
198 | # check for maxdata / i810/ i815 Chipsets and disable KMS and use i810fb frambuffer | ||
199 | if [[ ! -z $(echo "${hwinfo}" | grep -i i810) ]] || [[ ! -z $(echo "${hwinfo}" | grep -i i815) ]] | ||
200 | then | ||
201 | export SPECIALDEVICE="maxdata" | ||
202 | export GRUBLEGACYOPTS="" | ||
203 | fi | ||
204 | |||
205 | niro | 2892 | # check for i845 Chipsets and enable KMS and use 915 drm driver later in initrd |
206 | if [[ ! -z $(echo "${hwinfo}" | grep -i i845) ]] | ||
207 | then | ||
208 | export SPECIALDEVICE="i845" | ||
209 | # unset default video=1024x768 opt or the drm driver breaks | ||
210 | export KERNELOPTS="quiet" | ||
211 | export GRUBLEGACYOPTS="" | ||
212 | # enable full kms support | ||
213 | export GRUB2GFXPAYLOAD="keep" | ||
214 | fi | ||
215 | |||
216 | # check for radeon gfxcards | ||
217 | if [[ ! -z $(echo "${hwinfo}" | grep -i radeon) ]] | ||
218 | then | ||
219 | # enable full kms support | ||
220 | export GRUB2GFXPAYLOAD="keep" | ||
221 | fi | ||
222 | |||
223 | # requires nomsi to prevent massive IRQ error spam | ||
224 | # see: http://ubuntuforums.org/showthread.php?t=1234983 | ||
225 | if [[ ! -z $(echo "${hwinfo}" | grep -i 'P5VD2-X') ]] || [[ ! -z $(echo "${hwinfo}" | grep -i 'VT8237') ]] || [[ ! -z $(echo "${hwinfo}" | grep -i 'VX700') ]] | ||
226 | then | ||
227 | export SPECIALDEVICE="nomsi" | ||
228 | export KERNELOPTS="${KERNELOPTS} pci=nomsi,noaer" | ||
229 | fi | ||
230 | |||
231 | niro | 2320 | # check for special devices/clients: |
232 | # check for laptops and activate cpufreq scaling | ||
233 | if [[ $(echo "${hwinfo}" | grep 'Formfactor:' | sed 's:.*Formfactor\:\ \"\(.*\)\":\1:') = laptop ]] | ||
234 | then | ||
235 | export FORMFACTOR="laptop" | ||
236 | export KERNELOPTS="${KERNELOPTS} cpufreq.governor=ondemand" | ||
237 | fi | ||
238 | } | ||
239 | |||
240 | niro | 2429 | run_hardware_detection_disks() |
241 | { | ||
242 | local bootdev | ||
243 | |||
244 | # all disks but exclude ramdisks | ||
245 | export ALL_DISKS=$(get_hwinfo disk | sed '/\/dev\/ram[0-9].*/d') | ||
246 | # remove the boot device from ALL_DISKS if it was an usbstick | ||
247 | niro | 2653 | if [[ $(grep '[[:space:]]${LIVEROOT}[[:space:]]' /proc/mounts | cut -d' ' -f3) != iso9660 ]] |
248 | niro | 2429 | then |
249 | niro | 2653 | bootdev=$(grep "[[:space:]]${LIVEROOT}[[:space:]]" /proc/mounts | cut -d' ' -f1 | sed 's:[0-9]::g') |
250 | niro | 2429 | export ALL_DISKS=$(echo "${ALL_DISKS}" | grep -v "${bootdev}") |
251 | fi | ||
252 | export ALL_CDROMS="$(get_hwinfo cdrom)" | ||
253 | } | ||
254 | |||
255 | niro | 2882 | setup_hdd_partitions() |
256 | niro | 2320 | { |
257 | niro | 2435 | # sanity check - should not happen |
258 | if is_mounted --device "${ROOTHDD}" | ||
259 | then | ||
260 | echo "partition: device ${ROOTHDD} is already mounted, umount it" >&2 | ||
261 | umount "${ROOTHDD}" | ||
262 | fi | ||
263 | niro | 2882 | if [[ -n ${BOOTHDD} ]] |
264 | niro | 2320 | then |
265 | niro | 2882 | if is_mounted --device "${BOOTHDD}" |
266 | niro | 2320 | then |
267 | niro | 2882 | echo "partition: device ${BOOTHDD} is already mounted, umount it" >&2 |
268 | umount "${BOOTHDD}" | ||
269 | niro | 2320 | fi |
270 | fi | ||
271 | |||
272 | niro | 2882 | if [[ ${INSTALL_METHOD} = auto ]] |
273 | then | ||
274 | # run this only if FDISKPARTITIONBELOW256MB is not already 1 | ||
275 | if [[ ${FDISKPARTIONBELOW256MB} != 1 ]] | ||
276 | then | ||
277 | if device_minimum_size "${HDD}" 256 | ||
278 | then | ||
279 | FDISKPARTIONBELOW256MB=1 | ||
280 | else | ||
281 | FDISKPARTIONBELOW256MB=0 | ||
282 | fi | ||
283 | fi | ||
284 | niro | 2320 | |
285 | niro | 2882 | ## delete disk |
286 | dd if=/dev/zero of=${HDD} count=1 &> /dev/null || dialog_die | ||
287 | |||
288 | niro | 2890 | if [[ ${FLASHDISK} = 1 ]] |
289 | niro | 2882 | then |
290 | niro | 2890 | if [[ ${FDISKPARTIONBELOW256MB} = 1 ]] |
291 | then | ||
292 | ## setup one bootable partition | ||
293 | # 1. n= new disk | ||
294 | # 2. p= primary disk | ||
295 | # 3. 1= first partition | ||
296 | # 4. 2= default sector start // small disk needs more space for grub2 mbr sector | ||
297 | # 5. ''= defaul sector end | ||
298 | # 6. a= bootable flag | ||
299 | # 7. 1= boot flag for partition 1 | ||
300 | # 8. n= new disk | ||
301 | #10. p= primary disk | ||
302 | #11. 2= second partition | ||
303 | #12. ''= default sector start | ||
304 | #13. ''= defaul sector end | ||
305 | #14. w= write/quit | ||
306 | fdisk ${HDD} &> /dev/null << EOF | ||
307 | niro | 2320 | n |
308 | p | ||
309 | 1 | ||
310 | 2 | ||
311 | niro | 2890 | +50M |
312 | a | ||
313 | 1 | ||
314 | n | ||
315 | p | ||
316 | 2 | ||
317 | niro | 2320 | |
318 | niro | 2890 | |
319 | w | ||
320 | EOF | ||
321 | else | ||
322 | ## setup one bootable partition | ||
323 | # 1. n= new disk | ||
324 | # 2. p= primary disk | ||
325 | # 3. 1= first partition | ||
326 | # 4. ''= default sector start | ||
327 | # 5. ''= defaul sector end | ||
328 | # 6. a= bootable flag | ||
329 | # 7. 1= boot flag for partition 1 | ||
330 | # 8. n= new disk | ||
331 | #10. p= primary disk | ||
332 | #11. 2= second partition | ||
333 | #12. ''= default sector start | ||
334 | #13. ''= defaul sector end | ||
335 | #14. w= write/quit | ||
336 | fdisk ${HDD} &> /dev/null << EOF | ||
337 | n | ||
338 | p | ||
339 | 1 | ||
340 | |||
341 | +50M | ||
342 | niro | 2320 | a |
343 | 1 | ||
344 | niro | 2890 | n |
345 | p | ||
346 | 2 | ||
347 | |||
348 | |||
349 | niro | 2320 | w |
350 | EOF | ||
351 | niro | 2890 | fi |
352 | niro | 2882 | else |
353 | niro | 2890 | if [[ ${FDISKPARTIONBELOW256MB} = 1 ]] |
354 | then | ||
355 | ## setup one bootable partition | ||
356 | #1. n= new disk | ||
357 | #2. p= primary disk | ||
358 | #3. 1= first partition | ||
359 | #4. 2= default sector start // small disk needs more space for grub2 mbr sector | ||
360 | #5. ''= defaul sector end | ||
361 | #6. a= bootable flag | ||
362 | #7. 1= boot flag for partition 1 | ||
363 | #8. w= write/quit | ||
364 | fdisk ${HDD} &> /dev/null << EOF | ||
365 | niro | 2320 | n |
366 | p | ||
367 | 1 | ||
368 | niro | 2890 | 2 |
369 | niro | 2320 | |
370 | niro | 2890 | a |
371 | 1 | ||
372 | w | ||
373 | EOF | ||
374 | else | ||
375 | ## setup one bootable partition | ||
376 | #1. n= new disk | ||
377 | #2. p= primary disk | ||
378 | #3. 1= first partition | ||
379 | #4. ''= default sector start | ||
380 | #5. ''= defaul sector end | ||
381 | #6. a= bootable flag | ||
382 | #7. 1= boot flag for partition 1 | ||
383 | #8. w= write/quit | ||
384 | fdisk ${HDD} &> /dev/null << EOF | ||
385 | n | ||
386 | p | ||
387 | 1 | ||
388 | niro | 2320 | |
389 | niro | 2890 | |
390 | niro | 2320 | a |
391 | 1 | ||
392 | w | ||
393 | EOF | ||
394 | niro | 2890 | fi |
395 | niro | 2882 | fi |
396 | else | ||
397 | cfdisk ${HDD} || dialog_die | ||
398 | niro | 2320 | fi |
399 | } | ||
400 | |||
401 | setup_hdd_format() | ||
402 | { | ||
403 | niro | 2883 | install -d /tmp |
404 | :> /tmp/format.log | ||
405 | |||
406 | niro | 2882 | if [[ -n ${SWAPHDD} ]] |
407 | niro | 2435 | then |
408 | niro | 2882 | # sanity check - should not happen |
409 | if is_mounted --device "${SWAPHDD}" | ||
410 | then | ||
411 | echo "format: device ${SWAPHDD} is already mounted, umount it" >&2 | ||
412 | umount "${SWAPHDD}" | ||
413 | fi | ||
414 | mkswap ${SWAPHDD} || die | ||
415 | niro | 2435 | fi |
416 | |||
417 | niro | 2882 | if [[ -n ${BOOTHDD} ]] |
418 | then | ||
419 | # sanity check - should not happen | ||
420 | if is_mounted --device "${BOOTHDD}" | ||
421 | then | ||
422 | echo "format: device ${BOOTHDD} is already mounted, umount it" >&2 | ||
423 | umount "${BOOTHDD}" | ||
424 | fi | ||
425 | |||
426 | niro | 2885 | mkfs."${FORMAT_FILESYSTEM_BOOTHDD}" "${BOOTHDD}" &>> /tmp/format.log || dialog_die |
427 | niro | 2882 | fi |
428 | |||
429 | if [[ -n ${ROOTHDD} ]] | ||
430 | then | ||
431 | # sanity check - should not happen | ||
432 | if is_mounted --device "${ROOTHDD}" | ||
433 | then | ||
434 | echo "format: device ${ROOTHDD} is already mounted, umount it" >&2 | ||
435 | umount "${ROOTHDD}" | ||
436 | fi | ||
437 | |||
438 | niro | 2885 | mkfs."${FORMAT_FILESYSTEM_ROOTHDD}" "${ROOTHDD}" &>> /tmp/format.log || dialog_die |
439 | niro | 2882 | fi |
440 | niro | 2320 | } |
441 | |||
442 | install_system_image() | ||
443 | { | ||
444 | niro | 2433 | pushd ${INSTALLROOT} > /dev/null |
445 | niro | 2655 | tar xvjpf ${IMAGEROOT}/${CDIMAGENAME} -C ${INSTALLROOT} |
446 | niro | 2433 | popd > /dev/null |
447 | niro | 2320 | } |
448 | |||
449 | install_system_settings() | ||
450 | { | ||
451 | niro | 2443 | local CONFIG |
452 | niro | 2320 | |
453 | niro | 2443 | # write fstab |
454 | CONFIG="${INSTALLROOT}/etc/fstab" | ||
455 | clearconfig | ||
456 | niro | 2882 | if [[ -n ${BOOTHDD} ]] |
457 | then | ||
458 | niro | 2885 | addconfig -e "UUID=$(get_uuid ${BOOTHDD})\t/\t${FORMAT_FILESYSTEM_BOOTHDD}\tnoatime\t1 1" |
459 | niro | 2882 | fi |
460 | if [[ -n ${ROOTHDD} ]] | ||
461 | then | ||
462 | niro | 2885 | addconfig -e "UUID=$(get_uuid ${ROOTHDD})\t/\t${FORMAT_FILESYSTEM_ROOTHDD}\tnoatime\t0 0" |
463 | niro | 2882 | fi |
464 | if [[ -n ${SWAPHDD} ]] | ||
465 | then | ||
466 | addconfig -e "UUID='$(get_uuid ${SWAPHDD})'\tswap\tswap\tpri=1\t0 0" | ||
467 | fi | ||
468 | niro | 2443 | addconfig -e "proc\t/proc\tproc\tdefaults\t0 0" |
469 | addconfig -e "shm\t/dev/shm\ttmpfs\tdefaults\t0 0" | ||
470 | |||
471 | niro | 2320 | # install network config skeleton |
472 | niro | 2443 | CONFIG="${INSTALLROOT}/etc/conf.d/net.eth0" |
473 | clearconfig | ||
474 | addconfig 'ONBOOT="yes"' | ||
475 | addconfig 'NETWORKING="dhcp"' | ||
476 | niro | 2320 | |
477 | niro | 2442 | # intel framebuffer quirk |
478 | niro | 2500 | CONFIG="${INSTALLROOT}/etc/splash/splash.conf" |
479 | if [ -e ${CONFIG} ] && [ -e /proc/fb ] | ||
480 | niro | 2320 | then |
481 | niro | 2500 | if [[ ! -z $(grep 'inteldrmfb' /proc/fb) ]] |
482 | niro | 2320 | then |
483 | niro | 2500 | fbdev=$(grep 'inteldrmfb' /proc/fb | sed 's:\([0-9]\).*:\1:') |
484 | [[ ${fbdev} != 0 ]] && sed -i "s:^\(SPLASH_DEV=\).*:\1\"/dev/fb${fbdev}\":" ${CONFIG} || dialog_die | ||
485 | niro | 2320 | fi |
486 | fi | ||
487 | } | ||
488 | |||
489 | |||
490 | niro | 2482 | ### installer dialogs ### |
491 | |||
492 | dialog_die() | ||
493 | { | ||
494 | ERROR="$1" | ||
495 | RETVAL="$?" | ||
496 | dialog_install_failure | ||
497 | exit 1 | ||
498 | } | ||
499 | |||
500 | dialog_warning() | ||
501 | { | ||
502 | local retval | ||
503 | |||
504 | yesnobox $"\Z1 !!! Warning !!! \Zn\n\n\This harddrive will be irreversibly erased.\n\n\Do you want to continue ?" | ||
505 | retval=$? | ||
506 | if [[ ${retval} -eq 1 ]] | ||
507 | then | ||
508 | clear | ||
509 | echo $"The process was aborted." | ||
510 | exit 1 | ||
511 | fi | ||
512 | } | ||
513 | |||
514 | |||
515 | ### installer tasks ### | ||
516 | |||
517 | task_setup_system_menu() | ||
518 | { | ||
519 | local mode | ||
520 | local retval | ||
521 | |||
522 | mode="$(dialog_setup_system_menu)" | ||
523 | retval=$? | ||
524 | [[ ${retval} -eq 1 ]] && return 1 | ||
525 | if [[ ${retval} -eq 0 ]] | ||
526 | then | ||
527 | case "${mode}" in | ||
528 | niro | 2882 | "1") run_install auto ;; |
529 | "2") run_install normal ;; | ||
530 | niro | 2482 | "") task_setup_system_menu;; |
531 | esac | ||
532 | fi | ||
533 | } | ||
534 | |||
535 | task_hardware_detection() | ||
536 | { | ||
537 | local message | ||
538 | |||
539 | run_hardware_detection_disks | ||
540 | |||
541 | message+=$"Harddrives:\n" | ||
542 | |||
543 | if [[ ! -z ${ALL_DISKS} ]] | ||
544 | then | ||
545 | for i in ${ALL_DISKS} | ||
546 | do | ||
547 | message+="\Z3${i}\Zn " | ||
548 | done | ||
549 | message+="\n" | ||
550 | fi | ||
551 | |||
552 | if [[ ! -z ${ALL_CDROMS} ]] | ||
553 | then | ||
554 | message+="\n" | ||
555 | message+=$"Optical disk drives:\n" | ||
556 | for i in ${ALL_CDROMS} | ||
557 | do | ||
558 | message+="\Z3${i}\Zn" | ||
559 | done | ||
560 | message+="\n" | ||
561 | fi | ||
562 | |||
563 | # other devices | ||
564 | run_hardware_detection | ||
565 | case "${SPECIALDEVICE}" in | ||
566 | zotac*) message+=$"\n\Z2Zotac device detected.\Zn" ;; | ||
567 | rangee) message+=$"\n\Z2Rangee device detected.\Zn" ;; | ||
568 | maxdata) message+=$"\n\Z2Maxdata device detected.\Zn" ;; | ||
569 | niro | 2892 | i845) message+=$"\n\Z2Intel i845 VGA device detected.\Zn" ;; |
570 | nomsi) message+=$"\n\Z2Mainboard with P5VD2-X/VT8237/VX700 chipset detected.\Zn" | ||
571 | message+=$"\n\Z2Disabling Message Signaled Interrupts (MSI) capability of the kernel.\Zn" ;; | ||
572 | niro | 2482 | *) message+=$"\n\ZnCommon device detected.\Zn" ;; |
573 | esac | ||
574 | if [[ ${FORMFACTOR} = laptop ]] | ||
575 | then | ||
576 | message+=$"\n\ZnFormfactor Laptop, activating 'ondemand' powersaving mode.\Zn" | ||
577 | fi | ||
578 | niro | 2890 | if [[ ${FLASHDISK} = 1 ]] |
579 | then | ||
580 | message+=$"\n\ZnFlash memory detected.\Zn" | ||
581 | message+=$"\n\ZnF2FS will be used as default filesystem withn the auto installation mode.\Zn" | ||
582 | fi | ||
583 | niro | 2482 | |
584 | messagebox -y 12 -h $"Detected hardware:" "${message}" | ||
585 | } | ||
586 | |||
587 | niro | 2882 | task_setup_hdd_partitions() |
588 | niro | 2482 | { |
589 | local i | ||
590 | local retval | ||
591 | |||
592 | if [[ -z ${ALL_DISKS} ]] | ||
593 | then | ||
594 | dialog_no_harddrive_found | ||
595 | exit 1 | ||
596 | else | ||
597 | HDD=$(dialog_select_target_harddrive) | ||
598 | retval=$? | ||
599 | [[ ${retval} -eq 1 ]] && return 1 | ||
600 | if [[ ${retval} -eq 0 ]] | ||
601 | then | ||
602 | dialog_setup_hdd_info | ||
603 | niro | 2882 | setup_hdd_partitions |
604 | niro | 2482 | fi |
605 | fi | ||
606 | } | ||
607 | |||
608 | task_main() | ||
609 | { | ||
610 | local method=0 | ||
611 | local retval | ||
612 | |||
613 | while [[ ${method} -le 2 ]] | ||
614 | do | ||
615 | method=$(dialog_main) | ||
616 | retval=$? | ||
617 | [[ ${retval} -eq 1 ]] && exit 1 | ||
618 | if [[ ${retval} -eq 0 ]] | ||
619 | then | ||
620 | case ${method} in | ||
621 | "1") task_setup_system_menu ;; | ||
622 | "2") task_hardware_detection ;; | ||
623 | "3") install_do_reboot ;; | ||
624 | "4") /bin/bash --login -i ;; | ||
625 | esac | ||
626 | fi | ||
627 | done | ||
628 | } | ||
629 | |||
630 | niro | 2882 | run_install() |
631 | niro | 2320 | { |
632 | niro | 2882 | local method="$1" |
633 | |||
634 | niro | 2481 | task_hardware_detection |
635 | niro | 2320 | |
636 | niro | 2882 | case "${method}" in |
637 | auto) | ||
638 | niro | 2890 | if [[ ${FLASHDISK} = 1 ]] |
639 | then | ||
640 | export BOOTHDD="${HDD}1" | ||
641 | export SWAPHDD="" | ||
642 | export ROOTHDD="${HDD}2" | ||
643 | export FORMAT_FILESYSTEM_BOOTHDD="f2fs" | ||
644 | export FORMAT_FILESYSTEM_ROOTHDD="ext2" | ||
645 | else | ||
646 | export BOOTHDD="" | ||
647 | export SWAPHDD="" | ||
648 | export ROOTHDD="${HDD}1" | ||
649 | export FORMAT_FILESYSTEM_BOOTHDD="" | ||
650 | export FORMAT_FILESYSTEM_ROOTHDD="${FORMAT_FILESYSTEM}" | ||
651 | fi | ||
652 | niro | 2882 | export INSTALL_METHOD="${method}" |
653 | ;; | ||
654 | normal) | ||
655 | niro | 2886 | export BOOTHDD="${HDD}1" |
656 | export SWAPHDD="${HDD}2" | ||
657 | export ROOTHDD="${HDD}3" | ||
658 | niro | 2885 | export FORMAT_FILESYSTEM_BOOTHDD="${FORMAT_FILESYSTEM}" |
659 | export FORMAT_FILESYSTEM_ROOTHDD="${FORMAT_FILESYSTEM}" | ||
660 | niro | 2882 | export INSTALL_METHOD="${method}" |
661 | ;; | ||
662 | niro | 2885 | single) |
663 | niro | 2886 | export BOOTHDD="" |
664 | export SWAPHDD="" | ||
665 | export ROOTHDD="${HDD}1" | ||
666 | niro | 2885 | export FORMAT_FILESYSTEM_BOOTHDD="" |
667 | export FORMAT_FILESYSTEM_ROOTHDD="${FORMAT_FILESYSTEM}" | ||
668 | export INSTALL_METHOD="${method}" | ||
669 | ;; | ||
670 | niro | 2887 | flash) |
671 | export BOOTHDD="${HDD}1" | ||
672 | export SWAPHDD="" | ||
673 | export ROOTHDD="${HDD}2" | ||
674 | export FORMAT_FILESYSTEM_BOOTHDD="${FORMAT_FILESYSTEM}" | ||
675 | export FORMAT_FILESYSTEM_ROOTHDD="f2fs" | ||
676 | export INSTALL_METHOD="${method}" | ||
677 | ;; | ||
678 | niro | 2882 | *) |
679 | die "Unknown install method '${method}', aborting." | ||
680 | ;; | ||
681 | esac | ||
682 | niro | 2320 | |
683 | niro | 2882 | task_setup_hdd_partitions |
684 | niro | 2320 | dialog_setup_hdd_format |
685 | niro | 2399 | setup_hdd_format > /dev/null |
686 | niro | 2485 | mount_rootfs |
687 | niro | 2423 | (install_system_image > /tmp/install.log) 2> /tmp/install_errors.log | install_meter | dialog_install_system_image |
688 | niro | 2320 | |
689 | dialog_install_settings | ||
690 | sleep 1 | ||
691 | niro | 2399 | install_system_settings |
692 | niro | 2440 | if is_initrd_supported |
693 | then | ||
694 | dialog_install_initrd | ||
695 | initrd_config | ||
696 | initrd_install | ||
697 | fi | ||
698 | niro | 2320 | |
699 | dialog_install_bootsector | ||
700 | niro | 2440 | bootloader_config |
701 | bootloader_install | ||
702 | niro | 2320 | |
703 | niro | 2485 | umount_rootfs |
704 | niro | 2320 | dialog_install_successful |
705 | } | ||
706 | |||
707 | niro | 2409 | # set some proper traps |
708 | trap "trap_exit" SIGINT SIGQUIT | ||
709 | |||
710 | niro | 2477 | task_main |
711 | niro | 2320 | |
712 | exit 0 |