1 |
#!/bin/sh |
#!/bin/sh |
2 |
# |
# $Id$ |
|
# $Header: /home/cvsd/alx-cvs/alx-src/alxinstall-ng/bin/alxinstall-ng.sh,v 1.15 2008-06-28 00:37:45 niro Exp $ |
|
|
# |
|
|
# AutoSta_LX Installation Script |
|
|
# |
|
|
# Niels Rogalla <niro@magellan-linux.de> |
|
|
# <rogalla@augusta-bochum.de> |
|
|
# |
|
|
# |
|
|
# Install Navigation Gui |
|
|
# |
|
3 |
|
|
4 |
#images: (get ${CDIMAGENAME}) |
# ignore environment! |
5 |
|
LC_ALL=C |
6 |
|
|
7 |
|
MLIBDIR="/usr/lib/alxinstall-ng" |
8 |
|
|
9 |
|
# images: (get ${CDIMAGENAME}) |
10 |
source /mnt/cdrom/system/images.conf |
source /mnt/cdrom/system/images.conf |
11 |
|
|
12 |
#Includes |
# includes |
13 |
source /usr/lib/alxinstall-ng/functions/findhdd.sh > /dev/null |
source ${MLIBDIR}/functions/hwdetection.sh |
|
### bugfix ############################### |
|
|
cdromdev="$(echo ${cdromdev} | sed 's/ //')" |
|
|
######################################## |
|
14 |
|
|
15 |
### System/Config Version |
### System/Config Version |
16 |
VERSION="%VERSIONTAG%" |
VERSION="@@VERSION@@" |
17 |
TITLE="alxinstall-ng - ${VERSION}" |
TITLE="alxinstall-ng - ${VERSION}" |
18 |
|
|
19 |
CDPATH="/mnt/cdrom" |
CDPATH="/mnt/cdrom" |
20 |
INSTALLPATH="/mnt/magellan" |
INSTALLPATH="/mnt/magellan" |
21 |
|
|
22 |
### WICHTIG: anzahl lines in der autosta_lx.tar.gz -1 |
### linecount of system.tar.gz -1 ! |
23 |
CURRENTLINE=0 |
CURRENTLINE=0 |
24 |
#TOTALLINES=11072 # -> now in images.conf |
#TOTALLINES=11072 # -> now in images.conf |
25 |
|
|
26 |
# standard kernel opts |
# standard kernel opts |
27 |
KERNELOPTS="quiet video=1024x768" |
KERNELOPTS="quiet video=1024x768" |
28 |
|
|
29 |
|
# grub options |
30 |
|
GRUBLEGACYOPTS="" |
31 |
|
GRUB2OPTS="" |
32 |
|
GRUB2GFXPAYLOAD="1024x768x16,1024x768" |
33 |
|
|
34 |
|
# fdisk options |
35 |
|
FDISKPARTIONBELOW256MB=0 |
36 |
|
|
37 |
# default specialdevices |
# default specialdevices |
38 |
SPECIALDEVICE="" |
SPECIALDEVICE="" |
39 |
|
FORMFACTOR="desktop" |
40 |
|
|
41 |
# target filesystem |
# target filesystem |
42 |
FORMAT_FILESYSTEM="ext4" |
FORMAT_FILESYSTEM="ext4" |
43 |
|
|
44 |
################################################# |
################################################# |
45 |
# DIALOG BOXEN # |
# DIALOG BOXES # |
46 |
################################################# |
################################################# |
47 |
|
|
48 |
die() |
die() |
87 |
Bitte ${SHDD}1 als \Z3bootable\Zn markieren." 12 81 |
Bitte ${SHDD}1 als \Z3bootable\Zn markieren." 12 81 |
88 |
} |
} |
89 |
|
|
90 |
dialog_setup_hdd_info_flash() |
dialog_setup_hdd_info_simple() |
91 |
{ |
{ |
92 |
local SHDD="$(echo $HDD | sed 's/\/dev\///')" |
local SHDD="$(echo $HDD | sed 's/\/dev\///')" |
93 |
|
|
137 |
then |
then |
138 |
case "${i}" in |
case "${i}" in |
139 |
"1") run_install_auto ;; |
"1") run_install_auto ;; |
140 |
"2") run_install_normal ;; |
"2") run_install_normal ;; |
141 |
"3") run_install_flash ;; |
"3") run_install_simple ;; |
142 |
"") dialog_setup_system_menu;; |
"") dialog_setup_system_menu;; |
143 |
esac |
esac |
144 |
fi |
fi |
156 |
hwtmp="/tmp/hwtmp.sh" |
hwtmp="/tmp/hwtmp.sh" |
157 |
fi |
fi |
158 |
|
|
159 |
[[ ! -z ${installdevs} ]] && installdevs="" |
run_hardware_detection_disks |
160 |
|
|
161 |
echo "dialog \\" > ${hwtmp} |
echo "dialog \\" > ${hwtmp} |
162 |
echo "--backtitle \"${TITLE}\" \\" >> ${hwtmp} |
echo "--backtitle \"${TITLE}\" \\" >> ${hwtmp} |
166 |
echo "--msgbox \"Gefundene Hardware:\n\n \\" >> ${hwtmp} |
echo "--msgbox \"Gefundene Hardware:\n\n \\" >> ${hwtmp} |
167 |
echo " Festplatten:\n \\" >> ${hwtmp} |
echo " Festplatten:\n \\" >> ${hwtmp} |
168 |
|
|
169 |
if [[ ! -z ${scsidisks} ]] |
if [[ ! -z ${ALL_DISKS} ]] |
170 |
then |
then |
171 |
for i in ${scsidisks} |
for i in ${ALL_DISKS} |
172 |
do |
do |
173 |
if [[ ${i} != ${cdromdev} ]] |
echo " \\Z3${i}\\Zn\n \\" >> ${hwtmp} |
|
then |
|
|
echo " \\Z7SCSI: \\Z3${i}\\Zn\n \\" >> ${hwtmp} |
|
|
installdevs="${installdevs} ${i}" |
|
|
fi |
|
174 |
done |
done |
175 |
fi |
fi |
176 |
|
|
177 |
if [[ ! -z ${idedisks} ]] |
if [[ ! -z ${ALL_CDROMS} ]] |
178 |
then |
then |
179 |
for i in ${idedisks} |
echo " \n \\" >> ${hwtmp} |
180 |
|
echo " CDROM Laufwerke:\n \\" >> ${hwtmp} |
181 |
|
for i in ${ALL_CDROMS} |
182 |
do |
do |
183 |
if [[ ${i} != ${cdromdev} ]] |
echo " \\Z3${i}\\Zn\n \\" >> ${hwtmp} |
|
then |
|
|
echo " \\Z7IDE: \\Z3${i}\\Zn\n \\" >> ${hwtmp} |
|
|
installdevs="${installdevs} ${i}" |
|
|
fi |
|
184 |
done |
done |
185 |
fi |
fi |
186 |
|
|
|
if [[ ! -z ${cdromdev} ]] |
|
|
then |
|
|
echo " \n \\" >> ${hwtmp} |
|
|
echo " \\Z7andere Laufwerke:\n \\" >> ${hwtmp} |
|
|
echo " CDROM: \\Z3${cdromdev}\\Zn\n \\" >> ${hwtmp} |
|
|
fi |
|
|
|
|
187 |
# other devices |
# other devices |
188 |
run_hardware_detection |
run_hardware_detection |
189 |
case "${SPECIALDEVICE}" in |
case "${SPECIALDEVICE}" in |
190 |
zotac) echo " \n\n\n \\Z2Zotac Device erkannt!\\Zn \\" >> ${hwtmp} ;; |
zotac*) echo " \n \\Z2Zotac Device erkannt.\\Zn \\" >> ${hwtmp} ;; |
191 |
*) echo " \n\n\n \\ZnStandard Device erkannt!\\Zn \\" >> ${hwtmp} ;; |
rangee) echo " \n \\Z2Rangee Device erkannt.\\Zn \\" >> ${hwtmp} ;; |
192 |
|
maxdata) echo " \n \\Z2Maxdata Device erkannt.\\Zn \\" >> ${hwtmp} ;; |
193 |
|
i845) echo " \n \\Z2Intel i845 Device erkannt.\\Zn \\" >> ${hwtmp} ;; |
194 |
|
*) echo " \n \\ZnStandard Device erkannt.\\Zn \\" >> ${hwtmp} ;; |
195 |
esac |
esac |
196 |
|
if [[ ${FORMFACTOR} = laptop ]] |
197 |
|
then |
198 |
|
echo " \n \\ZnFormfactor Laptop, Powersave Modus 'ondemand' wird aktiviert.\\Zn \\" >> ${hwtmp} |
199 |
|
fi |
200 |
|
|
201 |
echo " \" 13 70" >> ${hwtmp} |
echo " \" 14 70" >> ${hwtmp} |
202 |
chmod a+x ${hwtmp} |
chmod a+x ${hwtmp} |
203 |
${hwtmp} |
${hwtmp} |
204 |
|
|
213 |
{ |
{ |
214 |
local i |
local i |
215 |
|
|
216 |
if [[ -z ${installdevs} ]] |
if [[ -z ${ALL_DISKS} ]] |
217 |
then |
then |
218 |
dialog \ |
dialog \ |
219 |
--backtitle "${TITLE}" \ |
--backtitle "${TITLE}" \ |
229 |
echo "--stdout \\" >> /tmp/hddtmp.sh |
echo "--stdout \\" >> /tmp/hddtmp.sh |
230 |
echo "--menu \"Installations Laufwerk auswaehlen:\" 10 70 3 \\" >> /tmp/hddtmp.sh |
echo "--menu \"Installations Laufwerk auswaehlen:\" 10 70 3 \\" >> /tmp/hddtmp.sh |
231 |
|
|
232 |
for i in ${installdevs} |
for i in ${ALL_DISKS} |
233 |
do |
do |
234 |
echo "\"${i}\" \"\" \\" >> /tmp/hddtmp.sh |
echo "\"${i}\" \"\" \\" >> /tmp/hddtmp.sh |
235 |
done |
done |
247 |
fi |
fi |
248 |
} |
} |
249 |
|
|
250 |
dialog_setup_hdd_partitions_manuell_flash() |
dialog_setup_hdd_partitions_manuell_simple() |
251 |
{ |
{ |
252 |
local i |
local i |
253 |
|
|
254 |
if [[ -z ${installdevs} ]] |
if [[ -z ${ALL_DISKS} ]] |
255 |
then |
then |
256 |
dialog \ |
dialog \ |
257 |
--backtitle "${TITLE}" \ |
--backtitle "${TITLE}" \ |
267 |
echo "--stdout \\" >> /tmp/hddtmp.sh |
echo "--stdout \\" >> /tmp/hddtmp.sh |
268 |
echo "--menu \"Installations Laufwerk auswaehlen:\" 10 70 3 \\" >> /tmp/hddtmp.sh |
echo "--menu \"Installations Laufwerk auswaehlen:\" 10 70 3 \\" >> /tmp/hddtmp.sh |
269 |
|
|
270 |
for i in ${installdevs} |
for i in ${ALL_DISKS} |
271 |
do |
do |
272 |
echo "\"${i}\" \"\" \\" >> /tmp/hddtmp.sh |
echo "\"${i}\" \"\" \\" >> /tmp/hddtmp.sh |
273 |
done |
done |
279 |
[[ ${RES} -eq 1 ]] && return 1 |
[[ ${RES} -eq 1 ]] && return 1 |
280 |
if [[ ${RES} -eq 0 ]] |
if [[ ${RES} -eq 0 ]] |
281 |
then |
then |
282 |
dialog_setup_hdd_info_flash |
dialog_setup_hdd_info_simple |
283 |
setup_hdd_partitions_manuell_flash |
setup_hdd_partitions_manuell_simple |
284 |
fi |
fi |
285 |
fi |
fi |
286 |
} |
} |
289 |
{ |
{ |
290 |
local i |
local i |
291 |
|
|
292 |
if [[ -z ${installdevs} ]] |
if [[ -z ${ALL_DISKS} ]] |
293 |
then |
then |
294 |
dialog \ |
dialog \ |
295 |
--backtitle "${TITLE}" \ |
--backtitle "${TITLE}" \ |
305 |
echo "--stdout \\" >> /tmp/hddtmp.sh |
echo "--stdout \\" >> /tmp/hddtmp.sh |
306 |
echo "--menu \"Installations Laufwerk auswaehlen:\" 10 70 3 \\" >> /tmp/hddtmp.sh |
echo "--menu \"Installations Laufwerk auswaehlen:\" 10 70 3 \\" >> /tmp/hddtmp.sh |
307 |
|
|
308 |
for i in ${installdevs} |
for i in ${ALL_DISKS} |
309 |
do |
do |
310 |
echo "\"${i}\" \"\" \\" >> /tmp/hddtmp.sh |
echo "\"${i}\" \"\" \\" >> /tmp/hddtmp.sh |
311 |
done |
done |
365 |
return 0 |
return 0 |
366 |
} |
} |
367 |
|
|
|
|
|
368 |
dialog_install_bootsector() |
dialog_install_bootsector() |
369 |
{ |
{ |
370 |
dialog \ |
dialog \ |
411 |
if [[ ${RES} -eq 0 ]] |
if [[ ${RES} -eq 0 ]] |
412 |
then |
then |
413 |
case ${METHOD} in |
case ${METHOD} in |
414 |
"1") dialog_setup_system_menu ;; |
"1") dialog_setup_system_menu ;; |
415 |
"2") dialog_hardware_detection ;; |
"2") dialog_hardware_detection ;; |
416 |
"3") install_do_reboot ;; |
"3") install_do_reboot ;; |
417 |
"4") /bin/bash --login -i ;; |
"4") /bin/bash --login -i ;; |
421 |
} |
} |
422 |
|
|
423 |
################################################# |
################################################# |
424 |
# Install Komandos # |
# Install Commands # |
425 |
################################################# |
################################################# |
426 |
run_hardware_detection() |
run_hardware_detection() |
427 |
{ |
{ |
428 |
|
local hwinfo |
429 |
|
hwinfo="$(hwinfo --bios --storage --pci --gfxcard --sys)" |
430 |
|
|
431 |
# check for special devices/clients: |
# check for special devices/clients: |
432 |
# if zotac a zotac and the disk is a removeable device, then add rootdelay to kernelcmd |
# if zotac a zotac and the disk is a removeable device, then add rootdelay to kernelcmd |
433 |
local removable=0 |
local removable=0 |
434 |
if [[ ! -z $(hwinfo --bios --storage | grep -i zotac) ]] |
if [[ ! -z $(echo "${hwinfo}" | grep -i zotac) ]] |
435 |
then |
then |
436 |
for i in /sys/block/[hs]d*/removable |
for i in /sys/block/[hs]d*/removable |
437 |
do |
do |
441 |
fi |
fi |
442 |
done |
done |
443 |
|
|
444 |
export KERNELOPTS="${KERNELOPTS} rootdelay=8" |
# only add this for grub legacy, grub2 detect these settings on its own |
445 |
export SPECIALDEVICE="zotac" |
export GRUBLEGACYOPTS="rootdelay=8" |
446 |
|
# there are two zotac types in the wild, nvidia based gfx and intel |
447 |
|
if [[ ! -z $(echo "${hwinfo}" | grep -i nouveau) ]] |
448 |
|
then |
449 |
|
export SPECIALDEVICE="zotac_nvidia" |
450 |
|
else |
451 |
|
export SPECIALDEVICE="zotac_intel" |
452 |
|
fi |
453 |
|
fi |
454 |
|
|
455 |
|
# check for special devices/clients: |
456 |
|
# if a rangee and disk ist smaller then 256mb move partion one block further ahead |
457 |
|
if [[ ! -z $(echo "${hwinfo}" | grep -i CLE266) ]] |
458 |
|
then |
459 |
|
# for a rangee always define partion startblock +1 |
460 |
|
export FDISKPARTIONBELOW256MB="1" |
461 |
|
export SPECIALDEVICE="rangee" |
462 |
|
export GRUBLEGACYOPTS="" |
463 |
|
fi |
464 |
|
|
465 |
|
# check for special devices/clients: |
466 |
|
# check for maxdata / i810/ i815 Chipsets and disable KMS and use i810fb frambuffer |
467 |
|
if [[ ! -z $(echo "${hwinfo}" | grep -i i810) ]] || [[ ! -z $(echo "${hwinfo}" | grep -i i815) ]] |
468 |
|
then |
469 |
|
export SPECIALDEVICE="maxdata" |
470 |
|
export GRUBLEGACYOPTS="" |
471 |
|
fi |
472 |
|
|
473 |
|
# check for i845 Chipsets and disable KMS and use 915 drm driver |
474 |
|
if [[ ! -z $(echo "${hwinfo}" | grep -i i845) ]] |
475 |
|
then |
476 |
|
export SPECIALDEVICE="i845" |
477 |
|
# unset default video=1024x768 opt or the drm driver breaks |
478 |
|
export KERNELOPTS="quiet" |
479 |
|
export GRUBLEGACYOPTS="" |
480 |
|
# enable full kms support |
481 |
|
export GRUB2GFXPAYLOAD="keep" |
482 |
|
fi |
483 |
|
|
484 |
|
# check for radeon gfxcards |
485 |
|
if [[ ! -z $(echo "${hwinfo}" | grep -i radeon) ]] |
486 |
|
then |
487 |
|
# enable full kms support |
488 |
|
export GRUB2GFXPAYLOAD="keep" |
489 |
|
fi |
490 |
|
|
491 |
|
# check for special devices/clients: |
492 |
|
# check for laptops and activate cpufreq scaling |
493 |
|
if [[ $(echo "${hwinfo}" | grep 'Formfactor:' | sed 's:.*Formfactor\:\ \"\(.*\)\":\1:') = laptop ]] |
494 |
|
then |
495 |
|
export FORMFACTOR="laptop" |
496 |
|
export KERNELOPTS="${KERNELOPTS} cpufreq.governor=ondemand" |
497 |
fi |
fi |
498 |
} |
} |
499 |
|
|
500 |
|
run_hardware_detection_disks() |
501 |
|
{ |
502 |
|
local bootdev |
503 |
|
|
504 |
|
# all disks but exclude ramdisks |
505 |
|
export ALL_DISKS=$(get_hwinfo disk | sed '/\/dev\/ram[0-9].*/d') |
506 |
|
# remove the boot device from ALL_DISKS if it was an usbstick |
507 |
|
if [[ $(grep '[[:space:]]/mnt/cdrom[[:space:]]' /proc/mounts | cut -d' ' -f3) != iso9660 ]] |
508 |
|
then |
509 |
|
bootdev="$(grep '[[:space:]]/mnt/cdrom[[:space:]]' /proc/mounts | cut -d' ' -f1 | sed 's:[0-9]::g')" |
510 |
|
export ALL_DISKS=$(echo "${ALL_DISKS}" | grep -v "${bootdev}") |
511 |
|
fi |
512 |
|
export ALL_CDROMS="$(get_hwinfo cdrom)" |
513 |
|
} |
514 |
|
|
515 |
|
hdd_size_below_256mb() |
516 |
|
{ |
517 |
|
local hdd="$1" |
518 |
|
local size |
519 |
|
local retval |
520 |
|
[[ -z ${hdd} ]] && die "Error: get_hdd_size() no \$hdd given!" |
521 |
|
|
522 |
|
size=$(fdisk -l ${hdd} | grep "Disk.*${hdd}" | sed 's:.*,\ \(.*\)\ byte.*:\1:') |
523 |
|
if [[ ${size} -le 257000000 ]] |
524 |
|
then |
525 |
|
retval="0" |
526 |
|
else |
527 |
|
retval="1" |
528 |
|
fi |
529 |
|
|
530 |
|
return "${retval}" |
531 |
|
} |
532 |
|
|
533 |
setup_hdd_partitions_auto() |
setup_hdd_partitions_auto() |
534 |
{ |
{ |
535 |
ROOTHDD="${HDD}1" |
ROOTHDD="${HDD}1" |
536 |
|
|
537 |
|
# run this only if FDISKPARTITIONBELOW256MB is not already 1 |
538 |
|
if [[ ${FDISKPARTIONBELOW256MB} != 1 ]] |
539 |
|
then |
540 |
|
if hdd_size_below_256mb ${HDD} |
541 |
|
then |
542 |
|
FDISKPARTIONBELOW256MB=1 |
543 |
|
else |
544 |
|
FDISKPARTIONBELOW256MB=0 |
545 |
|
fi |
546 |
|
fi |
547 |
|
|
548 |
## delete disk |
## delete disk |
549 |
dd if=/dev/zero of=${HDD} count=1 &> /dev/null || die |
dd if=/dev/zero of=${HDD} count=1 &> /dev/null || die |
550 |
|
|
551 |
## setup one bootable partition |
if [[ ${FDISKPARTIONBELOW256MB} = 1 ]] |
552 |
#1. n= new disk |
then |
553 |
#2. p= primary disk |
## setup one bootable partition |
554 |
#3. 1= first partition |
#1. n= new disk |
555 |
#4. ''= default sector start |
#2. p= primary disk |
556 |
#5. ''= defaul sector end |
#3. 1= first partition |
557 |
#6. a= bootable flag |
#4. 2= default sector start // small disk needs more space for grub2 mbr sector |
558 |
#7. 1= boot flag for partition 1 |
#5. ''= defaul sector end |
559 |
#8. w= write/quit |
#6. a= bootable flag |
560 |
fdisk ${HDD} &> /dev/null << EOF |
#7. 1= boot flag for partition 1 |
561 |
|
#8. w= write/quit |
562 |
|
fdisk ${HDD} &> /dev/null << EOF |
563 |
|
n |
564 |
|
p |
565 |
|
1 |
566 |
|
2 |
567 |
|
|
568 |
|
a |
569 |
|
1 |
570 |
|
w |
571 |
|
EOF |
572 |
|
else |
573 |
|
## setup one bootable partition |
574 |
|
#1. n= new disk |
575 |
|
#2. p= primary disk |
576 |
|
#3. 1= first partition |
577 |
|
#4. ''= default sector start |
578 |
|
#5. ''= defaul sector end |
579 |
|
#6. a= bootable flag |
580 |
|
#7. 1= boot flag for partition 1 |
581 |
|
#8. w= write/quit |
582 |
|
fdisk ${HDD} &> /dev/null << EOF |
583 |
n |
n |
584 |
p |
p |
585 |
1 |
1 |
589 |
1 |
1 |
590 |
w |
w |
591 |
EOF |
EOF |
592 |
|
fi |
593 |
} |
} |
594 |
|
|
595 |
setup_hdd_partitions_manuell() |
setup_hdd_partitions_manuell() |
602 |
cfdisk ${HDD} || die |
cfdisk ${HDD} || die |
603 |
} |
} |
604 |
|
|
605 |
setup_hdd_partitions_manuell_flash() |
setup_hdd_partitions_manuell_simple() |
606 |
{ |
{ |
607 |
ROOTHDD="${HDD}1" |
ROOTHDD="${HDD}1" |
608 |
|
|
617 |
mke2fs -j -q ${ROOTHDD} || die |
mke2fs -j -q ${ROOTHDD} || die |
618 |
} |
} |
619 |
|
|
620 |
setup_hdd_format_flash() |
setup_hdd_format_simple() |
621 |
{ |
{ |
622 |
mke2fs -j -q ${ROOTHDD} || die |
mke2fs -j -q ${ROOTHDD} || die |
623 |
} |
} |
631 |
cd ${INSTALLPATH} || die |
cd ${INSTALLPATH} || die |
632 |
} |
} |
633 |
|
|
634 |
install_mount_rootfs_flash() |
install_mount_rootfs_simple() |
635 |
{ |
{ |
636 |
mount ${ROOTHDD} ${INSTALLPATH} || die |
mount ${ROOTHDD} ${INSTALLPATH} || die |
637 |
install -d ${INSTALLPATH}/boot || die |
install -d ${INSTALLPATH}/boot || die |
647 |
{ |
{ |
648 |
local my_roothdd |
local my_roothdd |
649 |
local grubconf=${INSTALLPATH}/boot/grub/grub.conf |
local grubconf=${INSTALLPATH}/boot/grub/grub.conf |
650 |
local grub2conf=${INSTALLPATH}/boot/grub/grub.cfg |
local grub2conf=/boot/grub/grub.cfg |
651 |
|
|
652 |
# check for grub2 |
# check for grub2 |
653 |
if [[ -f ${INSTALLPATH}/sbin/grub-mkconfig ]] |
if [[ -f ${INSTALLPATH}/sbin/grub-mkconfig ]] |
655 |
# needed by grub-mkconfig on the first run |
# needed by grub-mkconfig on the first run |
656 |
if [[ ! -f ${INSTALLPATH}/boot/grub/video.lst ]] |
if [[ ! -f ${INSTALLPATH}/boot/grub/video.lst ]] |
657 |
then |
then |
658 |
install -m0644 ${INSTALLPATH}/lib/grub/*/video.lst /boot/grub/video.lst || die |
install -m0644 ${INSTALLPATH}/lib/grub/*/video.lst ${INSTALLPATH}/boot/grub/video.lst || die |
659 |
fi |
fi |
660 |
|
|
661 |
# set kernelopts |
# set kernelopts |
662 |
if [[ -f ${INSTALLPATH}/etc/conf.d/grub ]] |
if [[ -f ${INSTALLPATH}/etc/conf.d/grub ]] |
663 |
then |
then |
664 |
sed -i "s:^\(export GRUB_CMDLINE_LINUX_DEFAULT\)=.*:\1\"${KERNELOPTS}\":" ${INSTALLPATH}/etc/conf.d/grub || die |
sed -i "s:^\(export GRUB_CMDLINE_LINUX_DEFAULT=\).*:\1\"${KERNELOPTS}\":" ${INSTALLPATH}/etc/conf.d/grub || die |
665 |
|
sed -i "s:^\(export GRUB_GFXPAYLOAD_LINUX=\).*:\1\"${GRUB2GFXPAYLOAD}\":" ${INSTALLPATH}/etc/conf.d/grub || die |
666 |
else |
else |
667 |
echo "export GRUB_CMDLINE_LINUX_DEFAULT=\"${KERNELOPTS}\"" > ${INSTALLPATH}/etc/conf.d/grub || die |
echo "export GRUB_CMDLINE_LINUX_DEFAULT=\"${KERNELOPTS}\"" > ${INSTALLPATH}/etc/conf.d/grub || die |
668 |
|
echo "export GRUB_GFXPAYLOAD_LINUX=\"${GRUB2GFXPAYLOAD}\"" >> ${INSTALLPATH}/etc/conf.d/grub || die |
669 |
fi |
fi |
670 |
echo 'grub-mkdevicemap' > ${INSTALLPATH}/root/.bashrc || die |
echo 'grub-mkdevicemap' > ${INSTALLPATH}/root/.installrc || die |
671 |
echo "LC_ALL=C grub-mkconfig -o ${grub2conf}" >> ${INSTALLPATH}/root/.bashrc || die |
echo "LC_ALL=C grub-mkconfig -o ${grub2conf} &> /dev/null" >> ${INSTALLPATH}/root/.installrc || die |
672 |
echo "grub-install --no-floppy ${HDD}" >> ${INSTALLPATH}/root/.bashrc || die |
echo "grub-install --no-floppy ${HDD} &> /dev/null" >> ${INSTALLPATH}/root/.installrc || die |
673 |
|
echo "exit 0" >> ${INSTALLPATH}/root/.installrc || die |
674 |
|
|
675 |
# grub-legacy |
# grub-legacy |
676 |
else |
else |
708 |
echo "# normal boot" >> ${grubconf} || die |
echo "# normal boot" >> ${grubconf} || die |
709 |
echo "title ${KRNVER}" >> ${grubconf} || die |
echo "title ${KRNVER}" >> ${grubconf} || die |
710 |
echo "root (hd0,0)" >> ${grubconf} || die |
echo "root (hd0,0)" >> ${grubconf} || die |
711 |
echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS}" >> ${grubconf} || die |
echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS}" >> ${grubconf} || die |
712 |
if is_initrd_supported |
if is_initrd_supported |
713 |
then |
then |
714 |
echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die |
echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die |
719 |
echo "title ${KRNVER} - Re-run hardware-detection" >> ${grubconf} || die |
echo "title ${KRNVER} - Re-run hardware-detection" >> ${grubconf} || die |
720 |
echo "lock" >> ${grubconf} || die |
echo "lock" >> ${grubconf} || die |
721 |
echo "root (hd0,0)" >> ${grubconf} || die |
echo "root (hd0,0)" >> ${grubconf} || die |
722 |
echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} hardware-auto-detection" >> ${grubconf} || die |
echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS} hardware-auto-detection" >> ${grubconf} || die |
723 |
if is_initrd_supported |
if is_initrd_supported |
724 |
then |
then |
725 |
echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die |
echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die |
729 |
echo "title ${KRNVER} - Reset *all* local settings" >> ${grubconf} || die |
echo "title ${KRNVER} - Reset *all* local settings" >> ${grubconf} || die |
730 |
echo "lock" >> ${grubconf} || die |
echo "lock" >> ${grubconf} || die |
731 |
echo "root (hd0,0)" >> ${grubconf} || die |
echo "root (hd0,0)" >> ${grubconf} || die |
732 |
echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} alx-reset-settings" >> ${grubconf} || die |
echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS} alx-reset-settings" >> ${grubconf} || die |
733 |
if is_initrd_supported |
if is_initrd_supported |
734 |
then |
then |
735 |
echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die |
echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die |
736 |
fi |
fi |
737 |
|
|
738 |
# bootsector schreiben chrooted schreiben (lfs/magellan) |
# write bootsector chrooted (lfs/magellan) |
739 |
cat > ${INSTALLPATH}/root/.bashrc << CHROOTEOF |
cat > ${INSTALLPATH}/root/.installrc << CHROOTEOF |
740 |
/usr/sbin/grub --no-floppy --batch << "EOF" 1> /dev/null 2> /dev/null |
/usr/sbin/grub --no-floppy --batch << "EOF" 1> /dev/null 2> /dev/null |
741 |
root (hd0,0) |
root (hd0,0) |
742 |
setup (hd0) |
setup (hd0) |
750 |
mount -t proc proc ${INSTALLPATH}/proc |
mount -t proc proc ${INSTALLPATH}/proc |
751 |
mount -t sysfs sysfs ${INSTALLPATH}/sys |
mount -t sysfs sysfs ${INSTALLPATH}/sys |
752 |
mount -o bind /dev ${INSTALLPATH}/dev |
mount -o bind /dev ${INSTALLPATH}/dev |
753 |
chroot ${INSTALLPATH} /bin/bash --rcfile /root/.bashrc -i |
chroot ${INSTALLPATH} /bin/bash --rcfile /root/.installrc -i |
754 |
umount ${INSTALLPATH}/proc |
umount ${INSTALLPATH}/proc |
755 |
umount ${INSTALLPATH}/sys |
umount ${INSTALLPATH}/sys |
756 |
umount ${INSTALLPATH}/dev |
umount ${INSTALLPATH}/dev |
757 |
rm ${INSTALLPATH}/root/.bashrc |
rm ${INSTALLPATH}/root/.installrc |
758 |
} |
} |
759 |
|
|
760 |
is_initrd_supported() |
is_initrd_supported() |
769 |
# only generate initrds if the cmd exists |
# only generate initrds if the cmd exists |
770 |
is_initrd_supported || return 0 |
is_initrd_supported || return 0 |
771 |
|
|
772 |
cat > ${INSTALLPATH}/root/.bashrc << CHROOTEOF |
DISKMODS="sd_mod" |
773 |
echo "MODULES=\"${FORMAT_FILESYSTEM} amd74xx piix sis5513 via82cxxx sd_mod ata_piix pata_amd pata_mpiix pata_oldpiix pata_sis pata_via sata_via sata_sis sata_nv\"" > /etc/conf.d/mkinitrd |
OLDPATAMODS="amd74xx piix sis5513 via82cxxx" |
774 |
|
PATAMODS="ata_piix pata_amd pata_mpiix pata_oldpiix pata_sis pata_via" |
775 |
|
SATAMODS="sata_via sata_sis sata_nv" |
776 |
|
DRMMODS="i915 mga nouveau r128 radeon savage sis tdfx ttm via" |
777 |
|
OTHERMODS="" |
778 |
|
case ${SPECIALDEVICE} in |
779 |
|
zotac_intel|i845) FBMODS=""; DRMMODS="i915" ;; |
780 |
|
zotac_nvidia) FBMODS=""; DRMMODS="nouveau" ;; |
781 |
|
rangee) FBMODS="" ;; ## fallback to vesafb, viafb does not run on all CLE266 boards |
782 |
|
# not working with kms enabled drivers -> segfaults |
783 |
|
#maxdata) FBMODS="i810fb" ;; ## check for maxdata / i810/ i815 Chipsets and disable KMS and use i810fb frambuffer |
784 |
|
maxdata) FBMODS="" ;; |
785 |
|
*) FBMODS="uvesafb" ;; |
786 |
|
esac |
787 |
|
|
788 |
|
if [[ ${FORMFACTOR} = laptop ]] |
789 |
|
then |
790 |
|
OTHERMODS="acpi-cpufreq cpufreq_ondemand cpufreq_conservative cpufreq_powersave" |
791 |
|
fi |
792 |
|
|
793 |
|
# install an appropriate uvesafb.conf |
794 |
|
install -d ${INSTALLPATH}/etc/modprobe.d || die |
795 |
|
echo "options uvesafb mode_option=1024x768-32@60 scroll=ywrap" > ${INSTALLPATH}/etc/modprobe.d/uvesafb.conf || die |
796 |
|
|
797 |
|
# install an appropriate viafb.conf |
798 |
|
echo "options viafb viafb_mode=1024x768 viafb_refresh=60" > ${INSTALLPATH}/etc/modprobe.d/viafb.conf || die |
799 |
|
|
800 |
|
# install an appropriate i810fb.conf |
801 |
|
echo "options i810fb xres=1024 yres=768 bpp=16 mtrr=1 hsync1=30 hsync2=62 vsync1=30 vsync2=60" > ${INSTALLPATH}/etc/modprobe.d/i810fb.conf || die |
802 |
|
|
803 |
|
cat > ${INSTALLPATH}/root/.installrc << CHROOTEOF |
804 |
|
echo "MODULES=\"${FORMAT_FILESYSTEM} ${DISKMODS} ${OLDATAMODS} ${PATAMODS} ${SATAMODS} ${DRMMODS} ${FBMODS} ${OTHERMODS}\"" > /etc/conf.d/mkinitrd |
805 |
mkinitrd -f /boot/$(readlink /boot/initrd) $(readlink /boot/vmlinuz | sed "s:kernel-::g") > /dev/null |
mkinitrd -f /boot/$(readlink /boot/initrd) $(readlink /boot/vmlinuz | sed "s:kernel-::g") > /dev/null |
806 |
exit 0 |
exit 0 |
807 |
CHROOTEOF |
CHROOTEOF |
810 |
mount -t proc proc ${INSTALLPATH}/proc |
mount -t proc proc ${INSTALLPATH}/proc |
811 |
mount -t sysfs sysfs ${INSTALLPATH}/sys |
mount -t sysfs sysfs ${INSTALLPATH}/sys |
812 |
mount -o bind /dev ${INSTALLPATH}/dev |
mount -o bind /dev ${INSTALLPATH}/dev |
813 |
chroot ${INSTALLPATH} /bin/bash --rcfile /root/.bashrc -i |
chroot ${INSTALLPATH} /bin/bash --rcfile /root/.installrc -i |
814 |
umount ${INSTALLPATH}/proc |
umount ${INSTALLPATH}/proc |
815 |
umount ${INSTALLPATH}/sys |
umount ${INSTALLPATH}/sys |
816 |
umount ${INSTALLPATH}/dev |
umount ${INSTALLPATH}/dev |
817 |
rm ${INSTALLPATH}/root/.bashrc |
rm ${INSTALLPATH}/root/.installrc |
818 |
} |
} |
819 |
|
|
820 |
is_uuid_supported() |
is_uuid_supported() |
868 |
|
|
869 |
# install network config skeleton |
# install network config skeleton |
870 |
install -m0644 ${INSTALLPATH}/etc/alxconfig-ng/skel/net/net.eth0 ${INSTALLPATH}/etc/conf.d/ || die |
install -m0644 ${INSTALLPATH}/etc/alxconfig-ng/skel/net/net.eth0 ${INSTALLPATH}/etc/conf.d/ || die |
871 |
|
|
872 |
|
# intel framebufer quirk |
873 |
|
if [[ -e /proc/fb ]] |
874 |
|
then |
875 |
|
if [[ ! -z $(grep 'inteldrmfb' /proc/fb) ]] |
876 |
|
then |
877 |
|
fbdev=$(grep 'inteldrmfb' /proc/fb | sed 's:\([0-9]\).*:\1:') |
878 |
|
if [[ ${fbdev} != 0 ]] |
879 |
|
then |
880 |
|
sed -i "s:^\(SPLASH_DEV=\).*:\1\"/dev/fb${fbdev}\":" ${INSTALLPATH}/etc/splash/splash.conf || die |
881 |
|
fi |
882 |
|
fi |
883 |
|
fi |
884 |
} |
} |
885 |
|
|
886 |
install_system_settings_flash() |
install_system_settings_simple() |
887 |
{ |
{ |
888 |
# schreibe fstab |
# write fstab |
889 |
if is_uuid_supported |
if is_uuid_supported |
890 |
then |
then |
891 |
echo -e "UUID=$(get_uuid ${ROOTHDD})\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" > ${INSTALLPATH}/etc/fstab || die |
echo -e "UUID=$(get_uuid ${ROOTHDD})\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" > ${INSTALLPATH}/etc/fstab || die |
904 |
swapoff ${SWAPHDD} || die |
swapoff ${SWAPHDD} || die |
905 |
} |
} |
906 |
|
|
907 |
install_umount_rootfs_flash() |
install_umount_rootfs_simple() |
908 |
{ |
{ |
909 |
cd / |
cd / |
910 |
umount ${INSTALLPATH} || die |
umount ${INSTALLPATH} || die |
916 |
} |
} |
917 |
|
|
918 |
################################################# |
################################################# |
919 |
# Install Ablauf Scripte # |
# Install Main Scripts # |
920 |
################################################# |
################################################# |
921 |
|
|
922 |
run_install_normal() |
run_install_normal() |
941 |
dialog_install_successful |
dialog_install_successful |
942 |
} |
} |
943 |
|
|
944 |
run_install_flash() |
run_install_simple() |
945 |
{ |
{ |
946 |
dialog_hardware_detection |
dialog_hardware_detection |
947 |
|
|
948 |
dialog_setup_hdd_partitions_manuell_flash |
dialog_setup_hdd_partitions_manuell_simple |
949 |
dialog_setup_hdd_format |
dialog_setup_hdd_format |
950 |
setup_hdd_format_flash > /dev/null |
setup_hdd_format_simple > /dev/null |
951 |
install_mount_rootfs_flash |
install_mount_rootfs_simple |
952 |
(install_system_image > /tmp/install.log) 2> /tmp/install_errors.log | dialog_install_meter | dialog_install_system_image |
(install_system_image > /tmp/install.log) 2> /tmp/install_errors.log | dialog_install_meter | dialog_install_system_image |
953 |
|
|
954 |
dialog_install_settings |
dialog_install_settings |
955 |
sleep 1 |
sleep 1 |
956 |
install_system_settings_flash |
install_system_settings_simple |
957 |
install_initrd_chroot |
install_initrd_chroot |
958 |
|
|
959 |
dialog_install_bootsector |
dialog_install_bootsector |
960 |
install_bootsector_chroot |
install_bootsector_chroot |
961 |
|
|
962 |
install_umount_rootfs_flash |
install_umount_rootfs_simple |
963 |
dialog_install_successful |
dialog_install_successful |
964 |
} |
} |
965 |
|
|
969 |
|
|
970 |
dialog_setup_hdd_partitions_auto |
dialog_setup_hdd_partitions_auto |
971 |
dialog_setup_hdd_format |
dialog_setup_hdd_format |
972 |
setup_hdd_format_flash > /dev/null |
setup_hdd_format_simple > /dev/null |
973 |
install_mount_rootfs_flash |
install_mount_rootfs_simple |
974 |
(install_system_image > /tmp/install.log) 2> /tmp/install_errors.log | dialog_install_meter | dialog_install_system_image |
(install_system_image > /tmp/install.log) 2> /tmp/install_errors.log | dialog_install_meter | dialog_install_system_image |
975 |
|
|
976 |
dialog_install_settings |
dialog_install_settings |
977 |
sleep 1 |
sleep 1 |
978 |
install_system_settings_flash |
install_system_settings_simple |
979 |
install_initrd_chroot |
install_initrd_chroot |
980 |
|
|
981 |
dialog_install_bootsector |
dialog_install_bootsector |
982 |
install_bootsector_chroot |
install_bootsector_chroot |
983 |
|
|
984 |
install_umount_rootfs_flash |
install_umount_rootfs_simple |
985 |
dialog_install_successful |
dialog_install_successful |
986 |
} |
} |
987 |
|
|