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