Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


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