Magellan Linux

Annotation of /trunk/installer-simple/bin/installer.sh.in

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2473 - (hide annotations) (download)
Wed Jan 8 08:53:38 2014 UTC (10 years, 4 months ago) by niro
File size: 17630 byte(s)
-choose better variable names
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     LC_MESSAGES=C
13    
14 niro 2340 # include dir
15 niro 2333 INSTALLER_LIBDIR="%LIBDIR%"
16    
17 niro 2340 # TOTALLINES=linecount of ${CDIMAGENAME}-tarball -1 !
18     # -> now in images.conf
19     CURRENTLINE=0
20    
21 niro 2397 die()
22     {
23     echo "Error: $@"
24     exit 1
25     }
26    
27 niro 2401 # load common includes
28 niro 2402 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 niro 2428 ${INSTALLER_LIBDIR}/functions/bootloader.sh \
33     ${INSTALLER_LIBDIR}/functions/initrd-tools.sh \
34 niro 2402 ${INSTALLER_LIBDIR}/functions/installer-dialogs.sh
35 niro 2401 do
36     if [ -e ${inc} ]
37     then
38     source "${inc}"
39     else
40     die "'${inc}' not found"
41     fi
42     done
43 niro 2332
44 niro 2340 # TOTALLINES=linecount of ${CDIMAGENAME}-tarball -1 !
45     # -> now in images.conf
46     CDIMAGENAME=""
47     TOTALLINES=""
48     CURRENTLINE=0
49 niro 2334 if [ -e /mnt/cdrom/system/images.conf ]
50     then
51     source /mnt/cdrom/system/images.conf
52 niro 2340 # 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 niro 2334 else
56     die "/mnt/cdrom/system/images.conf not found"
57     fi
58 niro 2320
59     ### System/Config Version
60     VERSION="%VERSIONTAG%"
61 niro 2332 TITLE="${DEFAULT_TITLE} - ${VERSION}"
62 niro 2320
63 niro 2404 # some sane defaults
64 niro 2343 CDROOT="${DEFAULT_CDROOT}"
65 niro 2342 INSTALLROOT="${DEFAULT_INSTALLROOT}"
66 niro 2404 KERNELPKG="${DEFAULT_KERNELPKG}"
67     KERNELOPTS="${DEFAULT_KERNELOPTS}"
68 niro 2320 GRUBLEGACYOPTS=""
69     GRUB2OPTS=""
70     FDISKPARTIONBELOW256MB=0
71     SPECIALDEVICE=""
72 niro 2404 FORMFACTOR="${DEFAULT_FORMFACTOR}"
73 niro 2332 FORMAT_FILESYSTEM="${DEFAULT_FILESYSTEM}"
74 niro 2320
75     #################################################
76     # DIALOG BOXEN #
77     #################################################
78    
79 niro 2409 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 niro 2336 dialog_die()
92     {
93 niro 2341 ERROR="$1"
94     RETVAL="$?"
95 niro 2320 dialog_install_failure
96     exit 1
97     }
98    
99     dialog_warning()
100     {
101 niro 2398 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 niro 2320 then
107     clear
108 niro 2398 echo $"The process was aborted."
109 niro 2320 exit 1
110     fi
111     }
112    
113     dialog_setup_hdd_info()
114     {
115 niro 2473 local drivenode="${HDD//\/dev\/}"
116 niro 2320
117 niro 2411 messagebox -h $"[ Harddrive partitioning ]" \
118 niro 2473 $"Please create 1 partition.\n\n[ \Z3${drivenode}1\Zn ] type: \Z3linux\Zn with the whole diskspace.\nPlease mark ${SHDD}1 \Z3bootable\Zn."
119 niro 2320 }
120    
121     dialog_setup_hdd_info_auto()
122     {
123 niro 2473 local drivenode="${HDD//\/dev\/}"
124 niro 2320
125 niro 2411 messagebox -h $"[ Harddrive partitioning ]" \
126 niro 2473 $"\Z1Warning!\Zn\n\nAll data on disk [ \Z3${drivenode}\Zn ] will be erased!"
127 niro 2320 }
128    
129     dialog_setup_system_menu()
130     {
131 niro 2412 local mode
132     local retval
133 niro 2320
134 niro 2416 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 niro 2412 retval=$?
140     [[ ${retval} -eq 1 ]] && return 1
141     if [[ ${retval} -eq 0 ]]
142 niro 2320 then
143 niro 2415 case "${mode}" in
144 niro 2320 "1") run_install_auto ;;
145 niro 2341 "2") run_install_normal ;;
146 niro 2320 "") dialog_setup_system_menu;;
147     esac
148     fi
149     }
150    
151     dialog_hardware_detection()
152     {
153 niro 2417 local message
154 niro 2320
155 niro 2344 run_hardware_detection_disks
156 niro 2320
157 niro 2417 message+=$"Harddrives:\n"
158 niro 2320
159 niro 2344 if [[ ! -z ${ALL_DISKS} ]]
160 niro 2320 then
161 niro 2344 for i in ${ALL_DISKS}
162 niro 2320 do
163 niro 2417 message+="\Z3${i}\Zn "
164 niro 2320 done
165 niro 2417 message+="\n"
166 niro 2320 fi
167    
168 niro 2344 if [[ ! -z ${ALL_CDROMS} ]]
169 niro 2320 then
170 niro 2417 message+="\n"
171     message+=$"Optical disk drives:\n"
172 niro 2344 for i in ${ALL_CDROMS}
173 niro 2320 do
174 niro 2417 message+="\Z3${i}\Zn"
175 niro 2320 done
176 niro 2417 message+="\n"
177 niro 2320 fi
178    
179     # other devices
180     run_hardware_detection
181     case "${SPECIALDEVICE}" in
182 niro 2417 zotac*) message+=$"\n\Z2Zotac device detected.\Zn" ;;
183     rangee) message+=$"\n\Z2Rangee device detected.\Zn" ;;
184     maxdata) message+=$"\n\Z2Maxdata device detected.\Zn" ;;
185 niro 2470 *) message+=$"\n\ZnCommon device detected.\Zn" ;;
186 niro 2320 esac
187     if [[ ${FORMFACTOR} = laptop ]]
188     then
189 niro 2460 message+=$"\n\ZnFormfactor Laptop, activating 'ondemand' powersaving mode.\Zn"
190 niro 2320 fi
191    
192 niro 2467 messagebox -y 12 -h $"Detected hardware:" "${message}"
193 niro 2320 }
194    
195 niro 2413 dialog_setup_hdd_partitions_manual()
196 niro 2320 {
197     local i
198 niro 2422 local retval
199 niro 2320
200 niro 2418 if [[ -z ${ALL_DISKS} ]]
201 niro 2320 then
202 niro 2421 dialog_no_harddrive_found
203 niro 2320 exit 1
204     else
205 niro 2422 HDD=$(dialog_select_target_harddrive)
206     retval=$?
207     [[ ${retval} -eq 1 ]] && return 1
208     if [[ ${retval} -eq 0 ]]
209 niro 2320 then
210     dialog_setup_hdd_info
211 niro 2413 setup_hdd_partitions_manual
212 niro 2320 fi
213     fi
214     }
215    
216     dialog_setup_hdd_partitions_auto()
217     {
218     local i
219 niro 2422 local retval
220 niro 2320
221 niro 2419 if [[ -z ${ALL_DISKS} ]]
222 niro 2320 then
223 niro 2421 dialog_no_harddrive_found
224 niro 2320 exit 1
225     else
226 niro 2422 HDD=$(dialog_select_target_harddrive)
227     retval=$?
228     [[ ${retval} -eq 1 ]] && return 1
229     if [[ ${retval} -eq 0 ]]
230 niro 2320 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 niro 2423 install_meter()
239 niro 2320 {
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 niro 2424 local method=0
254     local retval
255 niro 2320
256 niro 2424 while [[ ${method} -le 2 ]]
257 niro 2320 do
258 niro 2471 method=$(CANCEL_LABEL=$"Exit" menubox $"Configuration:" \
259 niro 2425 $"1:Install system" \
260     $"2:Show detected harddrives" \
261     $"3:Exit and reboot" \
262     $"4:Exit and drop into a shell")
263 niro 2424 retval=$?
264     [[ ${retval} -eq 1 ]] && exit 1
265     if [[ ${retval} -eq 0 ]]
266 niro 2320 then
267 niro 2424 case ${method} in
268 niro 2341 "1") dialog_setup_system_menu ;;
269 niro 2320 "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 niro 2430 ## 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 niro 2431 ## smartcard = udevadm info -n /dev/sda -a | grep -i 'configuration.*card'
299 niro 2320
300 niro 2430 ## 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 niro 2320
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 niro 2429 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 niro 2320 hdd_size_below_256mb()
354     {
355     local hdd="$1"
356     local size
357     local retval
358 niro 2336 [[ -z ${hdd} ]] && dialog_die "Error: get_hdd_size() no \$hdd given!"
359 niro 2320
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 niro 2435 # 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 niro 2320 # 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 niro 2336 dd if=/dev/zero of=${HDD} count=1 &> /dev/null || dialog_die
395 niro 2320
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 niro 2413 setup_hdd_partitions_manual()
441 niro 2320 {
442     ROOTHDD="${HDD}1"
443 niro 2437 SWAPHDD=""
444     BOOTHDD=""
445 niro 2336 cfdisk ${HDD} || dialog_die
446 niro 2320 }
447    
448     setup_hdd_format()
449     {
450 niro 2435 # 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 niro 2432 mkfs."${FORMAT_FILESYSTEM}" -q "${ROOTHDD}" || dialog_die
458 niro 2320 }
459    
460     install_mount_rootfs()
461     {
462 niro 2435 is_mounted --location "${INSTALLROOT}" || mount "${ROOTHDD}" "${INSTALLROOT}"
463 niro 2342 install -d ${INSTALLROOT}/boot || dialog_die
464 niro 2320 }
465    
466     install_system_image()
467     {
468 niro 2433 pushd ${INSTALLROOT} > /dev/null
469 niro 2343 tar xvjpf ${CDROOT}/system/${CDIMAGENAME} -C ${INSTALLROOT}
470 niro 2433 popd > /dev/null
471 niro 2320 }
472    
473 niro 2446 disabled_install_bootsector_chroot()
474 niro 2320 {
475     local my_roothdd
476 niro 2444 local grubconf="${INSTALLROOT}/boot/grub/grub.conf"
477     local grub2conf="/boot/grub/grub.cfg"
478 niro 2320
479     # check for grub2
480 niro 2342 if [[ -f ${INSTALLROOT}/sbin/grub-mkconfig ]]
481 niro 2320 then
482     # needed by grub-mkconfig on the first run
483 niro 2342 if [[ ! -f ${INSTALLROOT}/boot/grub/video.lst ]]
484 niro 2320 then
485 niro 2342 install -m0644 ${INSTALLROOT}/lib/grub/*/video.lst ${INSTALLROOT}/boot/grub/video.lst || dialog_die
486 niro 2320 fi
487    
488     # set kernelopts
489 niro 2342 if [[ -f ${INSTALLROOT}/etc/conf.d/grub ]]
490 niro 2320 then
491 niro 2342 sed -i "s:^\(export GRUB_CMDLINE_LINUX_DEFAULT=\).*:\1\"${KERNELOPTS}\":" ${INSTALLROOT}/etc/conf.d/grub || dialog_die
492 niro 2320 else
493 niro 2444 CONFIG="${INSTALLROOT}/etc/conf.d/grub"
494     clearconfig
495     addconfig "export GRUB_CMDLINE_LINUX_DEFAULT=\"${KERNELOPTS}\""
496 niro 2320 fi
497 niro 2444 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 niro 2320
505     # grub-legacy
506     else
507 niro 2342 source ${INSTALLROOT}/boot/kernelversion
508 niro 2320
509 niro 2342 if [ -e ${INSTALLROOT}/etc/alx_version ]
510 niro 2320 then
511     OLD_ALXVER="${ALXVER}"
512 niro 2342 source ${INSTALLROOT}/etc/alx_version
513 niro 2320 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 niro 2441 my_roothdd="UUID=$(get_uuid ${ROOTHDD})"
523 niro 2320
524 niro 2444 CONFIG="${grubconf}"
525     clearconfig
526     addconfig "default 0"
527     addconfig "timeout 3"
528 niro 2320 # using current root password
529 niro 2444 addconfig "password --md5 $(cat ${INSTALLROOT}/etc/shadow | grep root | cut -d: -f2)"
530 niro 2320
531 niro 2444 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 niro 2320 if is_initrd_supported
537     then
538 niro 2444 addconfig "initrd /boot/${KRNINITRD}"
539 niro 2320 fi
540    
541 niro 2444 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 niro 2320 if is_initrd_supported
548     then
549 niro 2444 addconfig "initrd /boot/${KRNINITRD}"
550 niro 2320 fi
551    
552 niro 2444 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 niro 2320 if is_initrd_supported
558     then
559 niro 2444 addconfig "initrd /boot/${KRNINITRD}"
560 niro 2320 fi
561    
562     # bootsector schreiben chrooted schreiben (lfs/magellan)
563 niro 2342 cat > ${INSTALLROOT}/root/.installrc << CHROOTEOF
564 niro 2320 /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 niro 2436 # run installrc
574     chrooted /bin/bash --rcfile /root/.installrc -i
575 niro 2342 rm ${INSTALLROOT}/root/.installrc
576 niro 2320 }
577    
578 niro 2446 disabled_install_initrd_chroot()
579 niro 2320 {
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 niro 2342 install -d ${INSTALLROOT}/etc/modprobe.d || dialog_die
606 niro 2444 CONFIG="${INSTALLROOT}/etc/modprobe.d/uvesafb.conf"
607     clearconfig
608     addconfig "options uvesafb mode_option=1024x768-32@60 scroll=ywrap"
609 niro 2320
610     # install an appropriate viafb.conf
611 niro 2444 CONFIG="${INSTALLROOT}/etc/modprobe.d/viafb.conf"
612     clearconfig
613     addconfig "options viafb viafb_mode=1024x768 viafb_refresh=60"
614 niro 2320
615     # install an appropriate i810fb.conf
616 niro 2444 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 niro 2320
620 niro 2342 cat > ${INSTALLROOT}/root/.installrc << CHROOTEOF
621 niro 2320 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 niro 2436 # run installrc
627     chrooted /bin/bash --rcfile /root/.installrc -i
628 niro 2342 rm ${INSTALLROOT}/root/.installrc
629 niro 2320 }
630    
631     install_system_settings()
632     {
633 niro 2443 local CONFIG
634 niro 2320
635 niro 2443 # 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 niro 2320 # install network config skeleton
643 niro 2443 CONFIG="${INSTALLROOT}/etc/conf.d/net.eth0"
644     clearconfig
645     addconfig 'ONBOOT="yes"'
646     addconfig 'NETWORKING="dhcp"'
647 niro 2320
648 niro 2442 # intel framebuffer quirk
649     if [ -e ${INSTALLROOT}/etc/splash/splash.conf ]
650 niro 2320 then
651 niro 2442 if [ -e /proc/fb ]
652 niro 2320 then
653 niro 2442 if [[ ! -z $(grep 'inteldrmfb' /proc/fb) ]]
654 niro 2320 then
655 niro 2442 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 niro 2320 fi
661     fi
662     fi
663     }
664    
665     install_umount_rootfs()
666     {
667 niro 2435 is_mounted --location ${INSTALLROOT}/boot && umount ${INSTALLROOT}/boot
668     is_mounted --location ${INSTALLROOT} && umount ${INSTALLROOT}
669 niro 2320 }
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 niro 2413 dialog_setup_hdd_partitions_manual
685 niro 2320 dialog_setup_hdd_format
686     setup_hdd_format > /dev/null
687     install_mount_rootfs
688 niro 2423 (install_system_image > /tmp/install.log) 2> /tmp/install_errors.log | install_meter | dialog_install_system_image
689 niro 2320
690     dialog_install_settings
691     sleep 1
692     install_system_settings
693 niro 2440 if is_initrd_supported
694     then
695     dialog_install_initrd
696     initrd_config
697     initrd_install
698     fi
699 niro 2320
700     dialog_install_bootsector
701 niro 2440 bootloader_config
702     bootloader_install
703 niro 2320
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 niro 2399 setup_hdd_format > /dev/null
715     install_mount_rootfs
716 niro 2423 (install_system_image > /tmp/install.log) 2> /tmp/install_errors.log | install_meter | dialog_install_system_image
717 niro 2320
718     dialog_install_settings
719     sleep 1
720 niro 2399 install_system_settings
721 niro 2440 if is_initrd_supported
722     then
723     dialog_install_initrd
724     initrd_config
725     initrd_install
726     fi
727 niro 2320
728     dialog_install_bootsector
729 niro 2440 bootloader_config
730     bootloader_install
731 niro 2320
732 niro 2399 install_umount_rootfs
733 niro 2320 dialog_install_successful
734     }
735    
736 niro 2409 # set some proper traps
737     trap "trap_exit" SIGINT SIGQUIT
738    
739 niro 2320 dialog_main
740    
741     exit 0