Contents of /tags/installer-simple-0_4_90_20140108_3/bin/installer.sh.in
Parent Directory | Revision Log
Revision 2472 -
(show annotations)
(download)
Wed Jan 8 08:52:28 2014 UTC (10 years, 8 months ago) by niro
Original Path: trunk/installer-simple/bin/installer.sh.in
File size: 17609 byte(s)
Wed Jan 8 08:52:28 2014 UTC (10 years, 8 months ago) by niro
Original Path: trunk/installer-simple/bin/installer.sh.in
File size: 17609 byte(s)
-honor locales
1 | #!/bin/bash |
2 | # $Id$ |
3 | # |
4 | # Simple Installation Script |
5 | # merged from alxinstall-ng and mcore-installer |
6 | # |
7 | # Niels Rogalla <niro@magellan-linux.de> |
8 | # |
9 | |
10 | # setup locales |
11 | TEXTDOMAIN=installer |
12 | LC_MESSAGES=C |
13 | |
14 | # include dir |
15 | INSTALLER_LIBDIR="%LIBDIR%" |
16 | |
17 | # TOTALLINES=linecount of ${CDIMAGENAME}-tarball -1 ! |
18 | # -> now in images.conf |
19 | CURRENTLINE=0 |
20 | |
21 | die() |
22 | { |
23 | echo "Error: $@" |
24 | exit 1 |
25 | } |
26 | |
27 | # load common includes |
28 | for inc in %SYSCONFDIR%/installer.conf \ |
29 | ${INSTALLER_LIBDIR}/functions/common.sh \ |
30 | ${INSTALLER_LIBDIR}/functions/common-dialogs.sh \ |
31 | ${INSTALLER_LIBDIR}/functions/hwdetection.sh \ |
32 | ${INSTALLER_LIBDIR}/functions/bootloader.sh \ |
33 | ${INSTALLER_LIBDIR}/functions/initrd-tools.sh \ |
34 | ${INSTALLER_LIBDIR}/functions/installer-dialogs.sh |
35 | do |
36 | if [ -e ${inc} ] |
37 | then |
38 | source "${inc}" |
39 | else |
40 | die "'${inc}' not found" |
41 | fi |
42 | done |
43 | |
44 | # TOTALLINES=linecount of ${CDIMAGENAME}-tarball -1 ! |
45 | # -> now in images.conf |
46 | CDIMAGENAME="" |
47 | TOTALLINES="" |
48 | CURRENTLINE=0 |
49 | if [ -e /mnt/cdrom/system/images.conf ] |
50 | then |
51 | source /mnt/cdrom/system/images.conf |
52 | # check if all required variables are set |
53 | [[ -z ${CDIMAGENAME} ]] && die "CDIMAGENAME is empty in /mnt/cdrom/system/images.conf" |
54 | [[ -z ${TOTALLINES} ]] && die "TOTALLINES is empty in /mnt/cdrom/system/images.conf" |
55 | else |
56 | die "/mnt/cdrom/system/images.conf not found" |
57 | fi |
58 | |
59 | ### System/Config Version |
60 | VERSION="%VERSIONTAG%" |
61 | TITLE="${DEFAULT_TITLE} - ${VERSION}" |
62 | |
63 | # some sane defaults |
64 | CDROOT="${DEFAULT_CDROOT}" |
65 | INSTALLROOT="${DEFAULT_INSTALLROOT}" |
66 | KERNELPKG="${DEFAULT_KERNELPKG}" |
67 | KERNELOPTS="${DEFAULT_KERNELOPTS}" |
68 | GRUBLEGACYOPTS="" |
69 | GRUB2OPTS="" |
70 | FDISKPARTIONBELOW256MB=0 |
71 | SPECIALDEVICE="" |
72 | FORMFACTOR="${DEFAULT_FORMFACTOR}" |
73 | FORMAT_FILESYSTEM="${DEFAULT_FILESYSTEM}" |
74 | |
75 | ################################################# |
76 | # DIALOG BOXEN # |
77 | ################################################# |
78 | |
79 | trap_exit() |
80 | { |
81 | is_mounted --location "${INSTALLROOT}/dev" && umount ${INSTALLROOT}/dev |
82 | is_mounted --location "${INSTALLROOT}/proc" && umount ${INSTALLROOT}/proc |
83 | is_mounted --location "${INSTALLROOT}/sys" && umount ${INSTALLROOT}/sys |
84 | is_mounted --location "${INSTALLROOT}/boot" && umount ${INSTALLROOT}/boot |
85 | is_mounted --location "${INSTALLROOT}" && umount ${INSTALLROOT} |
86 | |
87 | echo $"Installation aborted." |
88 | exit 1 |
89 | } |
90 | |
91 | dialog_die() |
92 | { |
93 | ERROR="$1" |
94 | RETVAL="$?" |
95 | dialog_install_failure |
96 | exit 1 |
97 | } |
98 | |
99 | dialog_warning() |
100 | { |
101 | local retval |
102 | |
103 | yesnobox $"\Z1 !!! Warning !!! \Zn\n\n\This harddrive will be irreversibly erased.\n\n\Do you want to continue ?" |
104 | retval=$? |
105 | if [[ ${retval} -eq 1 ]] |
106 | then |
107 | clear |
108 | echo $"The process was aborted." |
109 | exit 1 |
110 | fi |
111 | } |
112 | |
113 | dialog_setup_hdd_info() |
114 | { |
115 | local SHDD="${HDD//\/dev\/}" |
116 | |
117 | messagebox -h $"[ Harddrive partitioning ]" \ |
118 | $"Please create 1 partition.\n\n[ \Z3${SHDD}1\Zn ] type: \Z3linux\Zn with the whole diskspace.\nPlease mark ${SHDD}1 \Z3bootable\Zn." |
119 | } |
120 | |
121 | dialog_setup_hdd_info_auto() |
122 | { |
123 | local SHDD="${HDD//\/dev\/}" |
124 | |
125 | messagebox -h $"[ Harddrive partitioning ]" \ |
126 | $"\Z1Warning!\Zn\n\nAll data on disk [ \Z3${HDD}\Zn ] will be erased!" |
127 | } |
128 | |
129 | dialog_setup_system_menu() |
130 | { |
131 | local mode |
132 | local retval |
133 | |
134 | mode=$(menubox -h $"[ Harddrive partitioning ]" $"\nSelect an installation mode" \ |
135 | $"1:Automatic setup (recommended)" \ |
136 | ":" \ |
137 | $":\Z1Expert modes:\Zn" \ |
138 | $"2:Common IDE-disk (manual setup)") |
139 | retval=$? |
140 | [[ ${retval} -eq 1 ]] && return 1 |
141 | if [[ ${retval} -eq 0 ]] |
142 | then |
143 | case "${mode}" in |
144 | "1") run_install_auto ;; |
145 | "2") run_install_normal ;; |
146 | "") dialog_setup_system_menu;; |
147 | esac |
148 | fi |
149 | } |
150 | |
151 | dialog_hardware_detection() |
152 | { |
153 | local message |
154 | |
155 | run_hardware_detection_disks |
156 | |
157 | message+=$"Harddrives:\n" |
158 | |
159 | if [[ ! -z ${ALL_DISKS} ]] |
160 | then |
161 | for i in ${ALL_DISKS} |
162 | do |
163 | message+="\Z3${i}\Zn " |
164 | done |
165 | message+="\n" |
166 | fi |
167 | |
168 | if [[ ! -z ${ALL_CDROMS} ]] |
169 | then |
170 | message+="\n" |
171 | message+=$"Optical disk drives:\n" |
172 | for i in ${ALL_CDROMS} |
173 | do |
174 | message+="\Z3${i}\Zn" |
175 | done |
176 | message+="\n" |
177 | fi |
178 | |
179 | # other devices |
180 | run_hardware_detection |
181 | case "${SPECIALDEVICE}" in |
182 | zotac*) message+=$"\n\Z2Zotac device detected.\Zn" ;; |
183 | rangee) message+=$"\n\Z2Rangee device detected.\Zn" ;; |
184 | maxdata) message+=$"\n\Z2Maxdata device detected.\Zn" ;; |
185 | *) message+=$"\n\ZnCommon device detected.\Zn" ;; |
186 | esac |
187 | if [[ ${FORMFACTOR} = laptop ]] |
188 | then |
189 | message+=$"\n\ZnFormfactor Laptop, activating 'ondemand' powersaving mode.\Zn" |
190 | fi |
191 | |
192 | messagebox -y 12 -h $"Detected hardware:" "${message}" |
193 | } |
194 | |
195 | dialog_setup_hdd_partitions_manual() |
196 | { |
197 | local i |
198 | local retval |
199 | |
200 | if [[ -z ${ALL_DISKS} ]] |
201 | then |
202 | dialog_no_harddrive_found |
203 | exit 1 |
204 | else |
205 | HDD=$(dialog_select_target_harddrive) |
206 | retval=$? |
207 | [[ ${retval} -eq 1 ]] && return 1 |
208 | if [[ ${retval} -eq 0 ]] |
209 | then |
210 | dialog_setup_hdd_info |
211 | setup_hdd_partitions_manual |
212 | fi |
213 | fi |
214 | } |
215 | |
216 | dialog_setup_hdd_partitions_auto() |
217 | { |
218 | local i |
219 | local retval |
220 | |
221 | if [[ -z ${ALL_DISKS} ]] |
222 | then |
223 | dialog_no_harddrive_found |
224 | exit 1 |
225 | else |
226 | HDD=$(dialog_select_target_harddrive) |
227 | retval=$? |
228 | [[ ${retval} -eq 1 ]] && return 1 |
229 | if [[ ${retval} -eq 0 ]] |
230 | then |
231 | dialog_setup_hdd_info_auto |
232 | dialog_setup_hdd_create_partitions |
233 | setup_hdd_partitions_auto |
234 | fi |
235 | fi |
236 | } |
237 | |
238 | install_meter() |
239 | { |
240 | while [[ ${CURRENTLINE} != ${TOTALLINES} ]] |
241 | do |
242 | CURRENTLINE=$(grep -c . /tmp/install.log) |
243 | PERCENT=$(( ${CURRENTLINE} * 100 / ${TOTALLINES})) |
244 | echo ${PERCENT} |
245 | sleep 1 |
246 | done |
247 | rm -f /tmp/install.log |
248 | return 0 |
249 | } |
250 | |
251 | dialog_main() |
252 | { |
253 | local method=0 |
254 | local retval |
255 | |
256 | while [[ ${method} -le 2 ]] |
257 | do |
258 | method=$(CANCEL_LABEL=$"Exit" menubox $"Configuration:" \ |
259 | $"1:Install system" \ |
260 | $"2:Show detected harddrives" \ |
261 | $"3:Exit and reboot" \ |
262 | $"4:Exit and drop into a shell") |
263 | retval=$? |
264 | [[ ${retval} -eq 1 ]] && exit 1 |
265 | if [[ ${retval} -eq 0 ]] |
266 | then |
267 | case ${method} in |
268 | "1") dialog_setup_system_menu ;; |
269 | "2") dialog_hardware_detection ;; |
270 | "3") install_do_reboot ;; |
271 | "4") /bin/bash --login -i ;; |
272 | esac |
273 | fi |
274 | done |
275 | } |
276 | |
277 | ################################################# |
278 | # Install Komandos # |
279 | ################################################# |
280 | run_hardware_detection() |
281 | { |
282 | local hwinfo |
283 | |
284 | hwinfo="$(hwinfo --bios --storage --pci --gfxcard --sys)" |
285 | |
286 | ## check for special devices/clients: |
287 | ## if zotac a zotac and the disk is a removeable device, then add rootdelay to kernelcmd |
288 | #local removable=0 |
289 | #if [[ ! -z $(echo "${hwinfo}" | grep -i zotac) ]] |
290 | #then |
291 | #for i in /sys/block/[hs]d*/removable |
292 | #do |
293 | #if [[ $(< ${i}) = 1 ]] |
294 | #then |
295 | #removable=1 |
296 | #fi |
297 | #done |
298 | ## smartcard = udevadm info -n /dev/sda -a | grep -i 'configuration.*card' |
299 | |
300 | ## only add this for grub legacy, grub2 detect these settings on its own |
301 | #export GRUBLEGACYOPTS="rootdelay=8" |
302 | ## there are to zotac types in the wild, nvidia based gfx and intel |
303 | #if [[ ! -z $(echo "${hwinfo}" | grep -i nouveau) ]] |
304 | #then |
305 | #export SPECIALDEVICE="zotac_nvidia" |
306 | #else |
307 | #export SPECIALDEVICE="zotac_intel" |
308 | #fi |
309 | #fi |
310 | |
311 | # check for special devices/clients: |
312 | # if a rangee and disk ist smaller then 256mb move partion one block further ahead |
313 | if [[ ! -z $(echo "${hwinfo}" | grep -i CLE266) ]] |
314 | then |
315 | # for a rangee always define partion startblock +1 |
316 | export FDISKPARTIONBELOW256MB="1" |
317 | export SPECIALDEVICE="rangee" |
318 | export GRUBLEGACYOPTS="" |
319 | fi |
320 | |
321 | # check for special devices/clients: |
322 | # check for maxdata / i810/ i815 Chipsets and disable KMS and use i810fb frambuffer |
323 | if [[ ! -z $(echo "${hwinfo}" | grep -i i810) ]] || [[ ! -z $(echo "${hwinfo}" | grep -i i815) ]] |
324 | then |
325 | export SPECIALDEVICE="maxdata" |
326 | export GRUBLEGACYOPTS="" |
327 | fi |
328 | |
329 | # check for special devices/clients: |
330 | # check for laptops and activate cpufreq scaling |
331 | if [[ $(echo "${hwinfo}" | grep 'Formfactor:' | sed 's:.*Formfactor\:\ \"\(.*\)\":\1:') = laptop ]] |
332 | then |
333 | export FORMFACTOR="laptop" |
334 | export KERNELOPTS="${KERNELOPTS} cpufreq.governor=ondemand" |
335 | fi |
336 | } |
337 | |
338 | run_hardware_detection_disks() |
339 | { |
340 | local bootdev |
341 | |
342 | # all disks but exclude ramdisks |
343 | export ALL_DISKS=$(get_hwinfo disk | sed '/\/dev\/ram[0-9].*/d') |
344 | # remove the boot device from ALL_DISKS if it was an usbstick |
345 | if [[ $(grep '[[:space:]]/mnt/cdrom[[:space:]]' /proc/mounts | cut -d' ' -f3) != iso9660 ]] |
346 | then |
347 | bootdev="$(grep '[[:space:]]/mnt/cdrom[[:space:]]' /proc/mounts | cut -d' ' -f1 | sed 's:[0-9]::g')" |
348 | export ALL_DISKS=$(echo "${ALL_DISKS}" | grep -v "${bootdev}") |
349 | fi |
350 | export ALL_CDROMS="$(get_hwinfo cdrom)" |
351 | } |
352 | |
353 | hdd_size_below_256mb() |
354 | { |
355 | local hdd="$1" |
356 | local size |
357 | local retval |
358 | [[ -z ${hdd} ]] && dialog_die "Error: get_hdd_size() no \$hdd given!" |
359 | |
360 | size=$(fdisk -l ${hdd} | grep "Disk.*${hdd}" | sed 's:.*,\ \(.*\)\ byte.*:\1:') |
361 | if [[ ${size} -le 257000000 ]] |
362 | then |
363 | retval="0" |
364 | else |
365 | retval="1" |
366 | fi |
367 | |
368 | return "${retval}" |
369 | } |
370 | |
371 | setup_hdd_partitions_auto() |
372 | { |
373 | ROOTHDD="${HDD}1" |
374 | |
375 | # sanity check - should not happen |
376 | if is_mounted --device "${ROOTHDD}" |
377 | then |
378 | echo "partition: device ${ROOTHDD} is already mounted, umount it" >&2 |
379 | umount "${ROOTHDD}" |
380 | fi |
381 | |
382 | # run this only if FDISKPARTITIONBELOW256MB is not already 1 |
383 | if [[ ${FDISKPARTIONBELOW256MB} != 1 ]] |
384 | then |
385 | if hdd_size_below_256mb ${HDD} |
386 | then |
387 | FDISKPARTIONBELOW256MB=1 |
388 | else |
389 | FDISKPARTIONBELOW256MB=0 |
390 | fi |
391 | fi |
392 | |
393 | ## delete disk |
394 | dd if=/dev/zero of=${HDD} count=1 &> /dev/null || dialog_die |
395 | |
396 | if [[ ${FDISKPARTIONBELOW256MB} = 1 ]] |
397 | then |
398 | ## setup one bootable partition |
399 | #1. n= new disk |
400 | #2. p= primary disk |
401 | #3. 1= first partition |
402 | #4. 2= default sector start // small disk needs more space for grub2 mbr sector |
403 | #5. ''= defaul sector end |
404 | #6. a= bootable flag |
405 | #7. 1= boot flag for partition 1 |
406 | #8. w= write/quit |
407 | fdisk ${HDD} &> /dev/null << EOF |
408 | n |
409 | p |
410 | 1 |
411 | 2 |
412 | |
413 | a |
414 | 1 |
415 | w |
416 | EOF |
417 | else |
418 | ## setup one bootable partition |
419 | #1. n= new disk |
420 | #2. p= primary disk |
421 | #3. 1= first partition |
422 | #4. ''= default sector start |
423 | #5. ''= defaul sector end |
424 | #6. a= bootable flag |
425 | #7. 1= boot flag for partition 1 |
426 | #8. w= write/quit |
427 | fdisk ${HDD} &> /dev/null << EOF |
428 | n |
429 | p |
430 | 1 |
431 | |
432 | |
433 | a |
434 | 1 |
435 | w |
436 | EOF |
437 | fi |
438 | } |
439 | |
440 | setup_hdd_partitions_manual() |
441 | { |
442 | ROOTHDD="${HDD}1" |
443 | SWAPHDD="" |
444 | BOOTHDD="" |
445 | cfdisk ${HDD} || dialog_die |
446 | } |
447 | |
448 | setup_hdd_format() |
449 | { |
450 | # sanity check - should not happen |
451 | if is_mounted --device "${ROOTHDD}" |
452 | then |
453 | echo "format: device ${ROOTHDD} is already mounted, umount it" >&2 |
454 | umount "${ROOTHDD}" |
455 | fi |
456 | |
457 | mkfs."${FORMAT_FILESYSTEM}" -q "${ROOTHDD}" || dialog_die |
458 | } |
459 | |
460 | install_mount_rootfs() |
461 | { |
462 | is_mounted --location "${INSTALLROOT}" || mount "${ROOTHDD}" "${INSTALLROOT}" |
463 | install -d ${INSTALLROOT}/boot || dialog_die |
464 | } |
465 | |
466 | install_system_image() |
467 | { |
468 | pushd ${INSTALLROOT} > /dev/null |
469 | tar xvjpf ${CDROOT}/system/${CDIMAGENAME} -C ${INSTALLROOT} |
470 | popd > /dev/null |
471 | } |
472 | |
473 | disabled_install_bootsector_chroot() |
474 | { |
475 | local my_roothdd |
476 | local grubconf="${INSTALLROOT}/boot/grub/grub.conf" |
477 | local grub2conf="/boot/grub/grub.cfg" |
478 | |
479 | # check for grub2 |
480 | if [[ -f ${INSTALLROOT}/sbin/grub-mkconfig ]] |
481 | then |
482 | # needed by grub-mkconfig on the first run |
483 | if [[ ! -f ${INSTALLROOT}/boot/grub/video.lst ]] |
484 | then |
485 | install -m0644 ${INSTALLROOT}/lib/grub/*/video.lst ${INSTALLROOT}/boot/grub/video.lst || dialog_die |
486 | fi |
487 | |
488 | # set kernelopts |
489 | if [[ -f ${INSTALLROOT}/etc/conf.d/grub ]] |
490 | then |
491 | sed -i "s:^\(export GRUB_CMDLINE_LINUX_DEFAULT=\).*:\1\"${KERNELOPTS}\":" ${INSTALLROOT}/etc/conf.d/grub || dialog_die |
492 | else |
493 | CONFIG="${INSTALLROOT}/etc/conf.d/grub" |
494 | clearconfig |
495 | addconfig "export GRUB_CMDLINE_LINUX_DEFAULT=\"${KERNELOPTS}\"" |
496 | fi |
497 | CONFIG="${INSTALLROOT}/root/.installrc" |
498 | clearconfig |
499 | # only grub 1.99 |
500 | addconfig 'type -P grub-mkdevicemap && grub-mkdevicemap' |
501 | addconfig "grub-install --no-floppy ${HDD} &> /dev/null" |
502 | addconfig "LC_ALL=C grub-mkconfig -o ${grub2conf} &> /dev/null" |
503 | addconfig "exit 0" |
504 | |
505 | # grub-legacy |
506 | else |
507 | source ${INSTALLROOT}/boot/kernelversion |
508 | |
509 | if [ -e ${INSTALLROOT}/etc/alx_version ] |
510 | then |
511 | OLD_ALXVER="${ALXVER}" |
512 | source ${INSTALLROOT}/etc/alx_version |
513 | KRNVER="ALX-${ALXVER}" |
514 | ALXVER="${OLD_ALXVER}" |
515 | fi |
516 | |
517 | [[ -z ${KRNVER} ]] && KRNVER="AutoSta_LX" |
518 | [[ -z ${KRNINITRD} ]] && KRNINITRD="initrd" |
519 | [[ -z ${KRNIMG} ]] && KRNIMG="vmlinuz" |
520 | |
521 | # uuid support |
522 | my_roothdd="UUID=$(get_uuid ${ROOTHDD})" |
523 | |
524 | CONFIG="${grubconf}" |
525 | clearconfig |
526 | addconfig "default 0" |
527 | addconfig "timeout 3" |
528 | # using current root password |
529 | addconfig "password --md5 $(cat ${INSTALLROOT}/etc/shadow | grep root | cut -d: -f2)" |
530 | |
531 | addconfig |
532 | addconfig "# normal boot" |
533 | addconfig "title ${KRNVER}" |
534 | addconfig "root (hd0,0)" |
535 | addconfig "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS}" |
536 | if is_initrd_supported |
537 | then |
538 | addconfig "initrd /boot/${KRNINITRD}" |
539 | fi |
540 | |
541 | addconfig |
542 | addconfig "# admin boot" |
543 | addconfig "title ${KRNVER} - Re-run hardware-detection" |
544 | addconfig "lock" |
545 | addconfig "root (hd0,0)" |
546 | addconfig "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS} hardware-auto-detection" |
547 | if is_initrd_supported |
548 | then |
549 | addconfig "initrd /boot/${KRNINITRD}" |
550 | fi |
551 | |
552 | addconfig |
553 | addconfig "title ${KRNVER} - Reset *all* local settings" |
554 | addconfig "lock" |
555 | addconfig "root (hd0,0)" |
556 | addconfig "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS} alx-reset-settings" |
557 | if is_initrd_supported |
558 | then |
559 | addconfig "initrd /boot/${KRNINITRD}" |
560 | fi |
561 | |
562 | # bootsector schreiben chrooted schreiben (lfs/magellan) |
563 | cat > ${INSTALLROOT}/root/.installrc << CHROOTEOF |
564 | /usr/sbin/grub --no-floppy --batch << "EOF" 1> /dev/null 2> /dev/null |
565 | root (hd0,0) |
566 | setup (hd0) |
567 | quit |
568 | EOF |
569 | exit 0 |
570 | CHROOTEOF |
571 | fi |
572 | |
573 | # run installrc |
574 | chrooted /bin/bash --rcfile /root/.installrc -i |
575 | rm ${INSTALLROOT}/root/.installrc |
576 | } |
577 | |
578 | disabled_install_initrd_chroot() |
579 | { |
580 | # only generate initrds if the cmd exists |
581 | is_initrd_supported || return 0 |
582 | |
583 | DISKMODS="sd_mod" |
584 | OLDPATAMODS="amd74xx piix sis5513 via82cxxx" |
585 | PATAMODS="ata_piix pata_amd pata_mpiix pata_oldpiix pata_sis pata_via" |
586 | SATAMODS="sata_via sata_sis sata_nv" |
587 | DRMMODS="i915 mga nouveau r128 radeon savage sis tdfx ttm via" |
588 | OTHERMODS="" |
589 | case ${SPECIALDEVICE} in |
590 | zotac_intel) FBMODS=""; DRMMODS="i915" ;; |
591 | zotac_nvidia) FBMODS=""; DRMMODS="nouveau" ;; |
592 | rangee) FBMODS="" ;; ## fallback to vesafb, viafb does not run on all CLE266 boards |
593 | # not working with kms enabled drivers -> segfaults |
594 | #maxdata) FBMODS="i810fb" ;; ## check for maxdata / i810/ i815 Chipsets and disable KMS and use i810fb frambuffer |
595 | maxdata) FBMODS="" ;; |
596 | *) FBMODS="uvesafb" ;; |
597 | esac |
598 | |
599 | if [[ ${FORMFACTOR} = laptop ]] |
600 | then |
601 | OTHERMODS="acpi-cpufreq cpufreq_ondemand cpufreq_conservative cpufreq_powersave" |
602 | fi |
603 | |
604 | # install an appropriate uvesafb.conf |
605 | install -d ${INSTALLROOT}/etc/modprobe.d || dialog_die |
606 | CONFIG="${INSTALLROOT}/etc/modprobe.d/uvesafb.conf" |
607 | clearconfig |
608 | addconfig "options uvesafb mode_option=1024x768-32@60 scroll=ywrap" |
609 | |
610 | # install an appropriate viafb.conf |
611 | CONFIG="${INSTALLROOT}/etc/modprobe.d/viafb.conf" |
612 | clearconfig |
613 | addconfig "options viafb viafb_mode=1024x768 viafb_refresh=60" |
614 | |
615 | # install an appropriate i810fb.conf |
616 | CONFIG="${INSTALLROOT}/etc/modprobe.d/i810fb.conf" |
617 | clearconfig |
618 | addconfig "options i810fb xres=1024 yres=768 bpp=16 mtrr=1 hsync1=30 hsync2=62 vsync1=30 vsync2=60" |
619 | |
620 | cat > ${INSTALLROOT}/root/.installrc << CHROOTEOF |
621 | echo "MODULES=\"${FORMAT_FILESYSTEM} ${DISKMODS} ${OLDATAMODS} ${PATAMODS} ${SATAMODS} ${DRMMODS} ${FBMODS} ${OTHERMODS}\"" > /etc/conf.d/mkinitrd |
622 | mkinitrd -f /boot/$(readlink /boot/initrd) $(readlink /boot/vmlinuz | sed "s:kernel-::g") > /dev/null |
623 | exit 0 |
624 | CHROOTEOF |
625 | |
626 | # run installrc |
627 | chrooted /bin/bash --rcfile /root/.installrc -i |
628 | rm ${INSTALLROOT}/root/.installrc |
629 | } |
630 | |
631 | install_system_settings() |
632 | { |
633 | local CONFIG |
634 | |
635 | # write fstab |
636 | CONFIG="${INSTALLROOT}/etc/fstab" |
637 | clearconfig |
638 | addconfig -e "UUID=$(get_uuid ${ROOTHDD})\t/\t${FORMAT_FILESYSTEM}\tnoatime,noauto\t1 1" |
639 | addconfig -e "proc\t/proc\tproc\tdefaults\t0 0" |
640 | addconfig -e "shm\t/dev/shm\ttmpfs\tdefaults\t0 0" |
641 | |
642 | # install network config skeleton |
643 | CONFIG="${INSTALLROOT}/etc/conf.d/net.eth0" |
644 | clearconfig |
645 | addconfig 'ONBOOT="yes"' |
646 | addconfig 'NETWORKING="dhcp"' |
647 | |
648 | # intel framebuffer quirk |
649 | if [ -e ${INSTALLROOT}/etc/splash/splash.conf ] |
650 | then |
651 | if [ -e /proc/fb ] |
652 | then |
653 | if [[ ! -z $(grep 'inteldrmfb' /proc/fb) ]] |
654 | then |
655 | fbdev=$(grep 'inteldrmfb' /proc/fb | sed 's:\([0-9]\).*:\1:') |
656 | if [[ ${fbdev} != 0 ]] |
657 | then |
658 | sed -i "s:^\(SPLASH_DEV=\).*:\1\"/dev/fb${fbdev}\":" ${INSTALLROOT}/etc/splash/splash.conf || dialog_die |
659 | fi |
660 | fi |
661 | fi |
662 | fi |
663 | } |
664 | |
665 | install_umount_rootfs() |
666 | { |
667 | is_mounted --location ${INSTALLROOT}/boot && umount ${INSTALLROOT}/boot |
668 | is_mounted --location ${INSTALLROOT} && umount ${INSTALLROOT} |
669 | } |
670 | |
671 | install_do_reboot() |
672 | { |
673 | reboot |
674 | } |
675 | |
676 | ################################################# |
677 | # Install Ablauf Scripte # |
678 | ################################################# |
679 | |
680 | run_install_normal() |
681 | { |
682 | dialog_hardware_detection |
683 | |
684 | dialog_setup_hdd_partitions_manual |
685 | dialog_setup_hdd_format |
686 | setup_hdd_format > /dev/null |
687 | install_mount_rootfs |
688 | (install_system_image > /tmp/install.log) 2> /tmp/install_errors.log | install_meter | dialog_install_system_image |
689 | |
690 | dialog_install_settings |
691 | sleep 1 |
692 | install_system_settings |
693 | if is_initrd_supported |
694 | then |
695 | dialog_install_initrd |
696 | initrd_config |
697 | initrd_install |
698 | fi |
699 | |
700 | dialog_install_bootsector |
701 | bootloader_config |
702 | bootloader_install |
703 | |
704 | install_umount_rootfs |
705 | dialog_install_successful |
706 | } |
707 | |
708 | run_install_auto() |
709 | { |
710 | dialog_hardware_detection |
711 | |
712 | dialog_setup_hdd_partitions_auto |
713 | dialog_setup_hdd_format |
714 | setup_hdd_format > /dev/null |
715 | install_mount_rootfs |
716 | (install_system_image > /tmp/install.log) 2> /tmp/install_errors.log | install_meter | dialog_install_system_image |
717 | |
718 | dialog_install_settings |
719 | sleep 1 |
720 | install_system_settings |
721 | if is_initrd_supported |
722 | then |
723 | dialog_install_initrd |
724 | initrd_config |
725 | initrd_install |
726 | fi |
727 | |
728 | dialog_install_bootsector |
729 | bootloader_config |
730 | bootloader_install |
731 | |
732 | install_umount_rootfs |
733 | dialog_install_successful |
734 | } |
735 | |
736 | # set some proper traps |
737 | trap "trap_exit" SIGINT SIGQUIT |
738 | |
739 | dialog_main |
740 | |
741 | exit 0 |