Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


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