21 |
######################################## |
######################################## |
22 |
|
|
23 |
### System/Config Version |
### System/Config Version |
24 |
VERSION="0.3.7" |
VERSION="%VERSIONTAG%" |
25 |
TITLE="alxinstall-ng - ${VERSION}" |
TITLE="alxinstall-ng - ${VERSION}" |
26 |
|
|
27 |
CDPATH="/mnt/cdrom" |
CDPATH="/mnt/cdrom" |
31 |
CURRENTLINE=0 |
CURRENTLINE=0 |
32 |
#TOTALLINES=11072 # -> now in images.conf |
#TOTALLINES=11072 # -> now in images.conf |
33 |
|
|
34 |
# standart kernel opts |
# standard kernel opts |
35 |
KERNELOPTS="quiet" |
KERNELOPTS="quiet video=1024x768" |
36 |
|
|
37 |
|
# grub options |
38 |
|
GRUBLEGACYOPTS="" |
39 |
|
GRUB2OPTS="" |
40 |
|
|
41 |
# default specialdevices |
# default specialdevices |
42 |
SPECIALDEVICE="" |
SPECIALDEVICE="" |
448 |
fi |
fi |
449 |
done |
done |
450 |
|
|
451 |
export KERNELOPTS="${KERNELOPTS} rootdelay=8" |
# only add this for grub legacy, grub2 detect these settings on its own |
452 |
|
export GRUBLEGACYOPTS="rootdelay=8" |
453 |
export SPECIALDEVICE="zotac" |
export SPECIALDEVICE="zotac" |
454 |
fi |
fi |
455 |
} |
} |
536 |
install_bootsector_chroot() |
install_bootsector_chroot() |
537 |
{ |
{ |
538 |
local my_roothdd |
local my_roothdd |
539 |
|
local grubconf=${INSTALLPATH}/boot/grub/grub.conf |
540 |
|
local grub2conf=/boot/grub/grub.cfg |
541 |
|
|
542 |
### grubconf schreiben |
# check for grub2 |
543 |
source ${INSTALLPATH}/boot/kernelversion |
if [[ -f ${INSTALLPATH}/sbin/grub-mkconfig ]] |
|
|
|
|
#for alx only |
|
|
if [ -e ${INSTALLPATH}/etc/alx_version ] |
|
544 |
then |
then |
545 |
OLD_ALXVER="${ALXVER}" |
# needed by grub-mkconfig on the first run |
546 |
source ${INSTALLPATH}/etc/alx_version |
if [[ ! -f ${INSTALLPATH}/boot/grub/video.lst ]] |
547 |
KRNVER="ALX-${ALXVER}" |
then |
548 |
ALXVER="${OLD_ALXVER}" |
install -m0644 ${INSTALLPATH}/lib/grub/*/video.lst ${INSTALLPATH}/boot/grub/video.lst || die |
549 |
fi |
fi |
550 |
|
|
551 |
[[ -z ${KRNVER} ]] && KRNVER="AutoSta_LX" |
# set kernelopts |
552 |
[[ -z ${KRNINITRD} ]] && KRNINITRD="initrd" |
if [[ -f ${INSTALLPATH}/etc/conf.d/grub ]] |
553 |
[[ -z ${KRNIMG} ]] && KRNIMG="vmlinuz" |
then |
554 |
|
sed -i "s:^\(export GRUB_CMDLINE_LINUX_DEFAULT=\).*:\1\"${KERNELOPTS}\":" ${INSTALLPATH}/etc/conf.d/grub || die |
555 |
|
else |
556 |
|
echo "export GRUB_CMDLINE_LINUX_DEFAULT=\"${KERNELOPTS}\"" > ${INSTALLPATH}/etc/conf.d/grub || die |
557 |
|
fi |
558 |
|
echo 'grub-mkdevicemap' > ${INSTALLPATH}/root/.installrc || die |
559 |
|
echo "LC_ALL=C grub-mkconfig -o ${grub2conf} &> /dev/null" >> ${INSTALLPATH}/root/.installrc || die |
560 |
|
echo "grub-install --no-floppy ${HDD} &> /dev/null" >> ${INSTALLPATH}/root/.installrc || die |
561 |
|
echo "exit 0" >> ${INSTALLPATH}/root/.installrc || die |
562 |
|
|
563 |
# uuid support |
# grub-legacy |
|
if is_uuid_supported |
|
|
then |
|
|
my_roothdd="UUID=$(get_uuid ${ROOTHDD})" |
|
564 |
else |
else |
565 |
my_roothdd="${ROOTHDD}" |
### grubconf schreiben |
566 |
fi |
source ${INSTALLPATH}/boot/kernelversion |
567 |
|
|
568 |
local grubconf=${INSTALLPATH}/boot/grub/grub.conf |
#for alx only |
569 |
: > ${grubconf} || die |
if [ -e ${INSTALLPATH}/etc/alx_version ] |
570 |
echo "default 0" >> ${grubconf} || die |
then |
571 |
echo "timeout 3" >> ${grubconf} || die |
OLD_ALXVER="${ALXVER}" |
572 |
# using current root password |
source ${INSTALLPATH}/etc/alx_version |
573 |
echo "password --md5 $(cat ${INSTALLPATH}/etc/shadow | grep root | cut -d: -f2)" >> ${grubconf} || die |
KRNVER="ALX-${ALXVER}" |
574 |
|
ALXVER="${OLD_ALXVER}" |
575 |
|
fi |
576 |
|
|
577 |
echo >> ${grubconf} || die |
[[ -z ${KRNVER} ]] && KRNVER="AutoSta_LX" |
578 |
echo "# normal boot" >> ${grubconf} || die |
[[ -z ${KRNINITRD} ]] && KRNINITRD="initrd" |
579 |
echo "title ${KRNVER}" >> ${grubconf} || die |
[[ -z ${KRNIMG} ]] && KRNIMG="vmlinuz" |
|
echo "root (hd0,0)" >> ${grubconf} || die |
|
|
echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS}" >> ${grubconf} || die |
|
|
if is_initrd_supported |
|
|
then |
|
|
echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die |
|
|
fi |
|
580 |
|
|
581 |
echo >> ${grubconf} || die |
# uuid support |
582 |
echo "# admin boot" >> ${grubconf} || die |
if is_uuid_supported |
583 |
echo "title ${KRNVER} - Re-run hardware-detection" >> ${grubconf} || die |
then |
584 |
echo "lock" >> ${grubconf} || die |
my_roothdd="UUID=$(get_uuid ${ROOTHDD})" |
585 |
echo "root (hd0,0)" >> ${grubconf} || die |
else |
586 |
echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} hardware-auto-detection" >> ${grubconf} || die |
my_roothdd="${ROOTHDD}" |
587 |
if is_initrd_supported |
fi |
|
then |
|
|
echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die |
|
|
fi |
|
588 |
|
|
589 |
echo >> ${grubconf} || die |
: > ${grubconf} || die |
590 |
echo "title ${KRNVER} - Reset *all* local settings" >> ${grubconf} || die |
echo "default 0" >> ${grubconf} || die |
591 |
echo "lock" >> ${grubconf} || die |
echo "timeout 3" >> ${grubconf} || die |
592 |
echo "root (hd0,0)" >> ${grubconf} || die |
# using current root password |
593 |
echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} alx-reset-settings" >> ${grubconf} || die |
echo "password --md5 $(cat ${INSTALLPATH}/etc/shadow | grep root | cut -d: -f2)" >> ${grubconf} || die |
594 |
if is_initrd_supported |
|
595 |
then |
echo >> ${grubconf} || die |
596 |
echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die |
echo "# normal boot" >> ${grubconf} || die |
597 |
fi |
echo "title ${KRNVER}" >> ${grubconf} || die |
598 |
|
echo "root (hd0,0)" >> ${grubconf} || die |
599 |
|
echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS}" >> ${grubconf} || die |
600 |
|
if is_initrd_supported |
601 |
|
then |
602 |
|
echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die |
603 |
|
fi |
604 |
|
|
605 |
|
echo >> ${grubconf} || die |
606 |
|
echo "# admin boot" >> ${grubconf} || die |
607 |
|
echo "title ${KRNVER} - Re-run hardware-detection" >> ${grubconf} || die |
608 |
|
echo "lock" >> ${grubconf} || die |
609 |
|
echo "root (hd0,0)" >> ${grubconf} || die |
610 |
|
echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS} hardware-auto-detection" >> ${grubconf} || die |
611 |
|
if is_initrd_supported |
612 |
|
then |
613 |
|
echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die |
614 |
|
fi |
615 |
|
|
616 |
# bootsector schreiben chrooted schreiben (lfs/magellan) |
echo >> ${grubconf} || die |
617 |
cat > ${INSTALLPATH}/root/.bashrc << CHROOTEOF |
echo "title ${KRNVER} - Reset *all* local settings" >> ${grubconf} || die |
618 |
|
echo "lock" >> ${grubconf} || die |
619 |
|
echo "root (hd0,0)" >> ${grubconf} || die |
620 |
|
echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS} alx-reset-settings" >> ${grubconf} || die |
621 |
|
if is_initrd_supported |
622 |
|
then |
623 |
|
echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die |
624 |
|
fi |
625 |
|
|
626 |
|
# bootsector schreiben chrooted schreiben (lfs/magellan) |
627 |
|
cat > ${INSTALLPATH}/root/.installrc << CHROOTEOF |
628 |
/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 |
629 |
root (hd0,0) |
root (hd0,0) |
630 |
setup (hd0) |
setup (hd0) |
632 |
EOF |
EOF |
633 |
exit 0 |
exit 0 |
634 |
CHROOTEOF |
CHROOTEOF |
635 |
|
fi |
636 |
|
|
637 |
## enters chroot |
## enters chroot |
638 |
mount -t proc proc ${INSTALLPATH}/proc |
mount -t proc proc ${INSTALLPATH}/proc |
639 |
mount -t sysfs sysfs ${INSTALLPATH}/sys |
mount -t sysfs sysfs ${INSTALLPATH}/sys |
640 |
mount -o bind /dev ${INSTALLPATH}/dev |
mount -o bind /dev ${INSTALLPATH}/dev |
641 |
chroot ${INSTALLPATH} /bin/bash --rcfile /root/.bashrc -i |
chroot ${INSTALLPATH} /bin/bash --rcfile /root/.installrc -i |
642 |
umount ${INSTALLPATH}/proc |
umount ${INSTALLPATH}/proc |
643 |
umount ${INSTALLPATH}/sys |
umount ${INSTALLPATH}/sys |
644 |
umount ${INSTALLPATH}/dev |
umount ${INSTALLPATH}/dev |
645 |
rm ${INSTALLPATH}/root/.bashrc |
rm ${INSTALLPATH}/root/.installrc |
646 |
} |
} |
647 |
|
|
648 |
is_initrd_supported() |
is_initrd_supported() |
657 |
# only generate initrds if the cmd exists |
# only generate initrds if the cmd exists |
658 |
is_initrd_supported || return 0 |
is_initrd_supported || return 0 |
659 |
|
|
660 |
cat > ${INSTALLPATH}/root/.bashrc << CHROOTEOF |
DISKMODS="sd_mod" |
661 |
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" |
662 |
|
PATAMODS="ata_piix pata_amd pata_mpiix pata_oldpiix pata_sis pata_via" |
663 |
|
SATAMODS="sata_via sata_sis sata_nv" |
664 |
|
DRMMODS="i915 mga nouveau r128 radeon savage sis tdfx ttm via" |
665 |
|
FBMODS="uvesafb" |
666 |
|
|
667 |
|
# install an appropriate uvesafb.conf |
668 |
|
install -d ${INSTALLPATH}/etc/modprobe.d || die |
669 |
|
echo "options uvesafb mode_option=1024x768-32@60 scroll=ywrap" > ${INSTALLPATH}/etc/modprobe.d/uvesafb.conf || die |
670 |
|
|
671 |
|
cat > ${INSTALLPATH}/root/.installrc << CHROOTEOF |
672 |
|
echo "MODULES=\"${FORMAT_FILESYSTEM} ${DISKMODS} ${OLDATAMODS} ${PATAMODS} ${SATAMODS} ${DRMMODS} ${FBMODS}\"" > /etc/conf.d/mkinitrd |
673 |
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 |
674 |
exit 0 |
exit 0 |
675 |
CHROOTEOF |
CHROOTEOF |
678 |
mount -t proc proc ${INSTALLPATH}/proc |
mount -t proc proc ${INSTALLPATH}/proc |
679 |
mount -t sysfs sysfs ${INSTALLPATH}/sys |
mount -t sysfs sysfs ${INSTALLPATH}/sys |
680 |
mount -o bind /dev ${INSTALLPATH}/dev |
mount -o bind /dev ${INSTALLPATH}/dev |
681 |
chroot ${INSTALLPATH} /bin/bash --rcfile /root/.bashrc -i |
chroot ${INSTALLPATH} /bin/bash --rcfile /root/.installrc -i |
682 |
umount ${INSTALLPATH}/proc |
umount ${INSTALLPATH}/proc |
683 |
umount ${INSTALLPATH}/sys |
umount ${INSTALLPATH}/sys |
684 |
umount ${INSTALLPATH}/dev |
umount ${INSTALLPATH}/dev |
685 |
rm ${INSTALLPATH}/root/.bashrc |
rm ${INSTALLPATH}/root/.installrc |
686 |
} |
} |
687 |
|
|
688 |
is_uuid_supported() |
is_uuid_supported() |
784 |
install_mount_rootfs |
install_mount_rootfs |
785 |
(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 |
786 |
|
|
|
dialog_install_bootsector |
|
|
install_bootsector_chroot |
|
|
|
|
787 |
dialog_install_settings |
dialog_install_settings |
788 |
sleep 1 |
sleep 1 |
789 |
install_system_settings |
install_system_settings |
790 |
install_initrd_chroot |
install_initrd_chroot |
791 |
|
|
792 |
|
dialog_install_bootsector |
793 |
|
install_bootsector_chroot |
794 |
|
|
795 |
install_umount_rootfs |
install_umount_rootfs |
796 |
dialog_install_successful |
dialog_install_successful |
797 |
} |
} |
806 |
install_mount_rootfs_flash |
install_mount_rootfs_flash |
807 |
(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 |
808 |
|
|
|
dialog_install_bootsector |
|
|
install_bootsector_chroot |
|
|
|
|
809 |
dialog_install_settings |
dialog_install_settings |
810 |
sleep 1 |
sleep 1 |
811 |
install_system_settings_flash |
install_system_settings_flash |
812 |
install_initrd_chroot |
install_initrd_chroot |
813 |
|
|
814 |
|
dialog_install_bootsector |
815 |
|
install_bootsector_chroot |
816 |
|
|
817 |
install_umount_rootfs_flash |
install_umount_rootfs_flash |
818 |
dialog_install_successful |
dialog_install_successful |
819 |
} |
} |
828 |
install_mount_rootfs_flash |
install_mount_rootfs_flash |
829 |
(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 |
830 |
|
|
|
dialog_install_bootsector |
|
|
install_bootsector_chroot |
|
|
|
|
831 |
dialog_install_settings |
dialog_install_settings |
832 |
sleep 1 |
sleep 1 |
833 |
install_system_settings_flash |
install_system_settings_flash |
834 |
install_initrd_chroot |
install_initrd_chroot |
835 |
|
|
836 |
|
dialog_install_bootsector |
837 |
|
install_bootsector_chroot |
838 |
|
|
839 |
install_umount_rootfs_flash |
install_umount_rootfs_flash |
840 |
dialog_install_successful |
dialog_install_successful |
841 |
} |
} |