59 |
ERROR=$1 |
ERROR=$1 |
60 |
RETVAL=$? |
RETVAL=$? |
61 |
dialog_install_failure |
dialog_install_failure |
62 |
|
trap_exit |
63 |
exit 1 |
exit 1 |
64 |
} |
} |
65 |
|
|
600 |
local my_roothdd |
local my_roothdd |
601 |
local grubconf=${INSTALLPATH}/boot/grub/grub.conf |
local grubconf=${INSTALLPATH}/boot/grub/grub.conf |
602 |
local grub2conf=/boot/grub/grub.cfg |
local grub2conf=/boot/grub/grub.cfg |
603 |
|
local CONFIG |
604 |
|
|
605 |
# check for grub2 |
# check for grub2 |
606 |
if [[ -f ${INSTALLPATH}/sbin/grub-mkconfig ]] |
if [[ -f ${INSTALLPATH}/sbin/grub-mkconfig ]] |
620 |
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 |
621 |
echo "export GRUB_GFXPAYLOAD_LINUX=\"${GRUB2GFXPAYLOAD}\"" >> ${INSTALLPATH}/etc/conf.d/grub || die |
echo "export GRUB_GFXPAYLOAD_LINUX=\"${GRUB2GFXPAYLOAD}\"" >> ${INSTALLPATH}/etc/conf.d/grub || die |
622 |
fi |
fi |
623 |
echo 'grub-mkdevicemap' > ${INSTALLPATH}/root/.installrc || die |
CONFIG=${INSTALLPATH}/.installrc |
624 |
echo "LC_ALL=C grub-mkconfig -o ${grub2conf} &> /dev/null" >> ${INSTALLPATH}/root/.installrc || die |
clearconfig |
625 |
echo "grub-install --no-floppy ${HDD} &> /dev/null" >> ${INSTALLPATH}/root/.installrc || die |
addconfig 'grub-mkdevicemap' |
626 |
echo "exit 0" >> ${INSTALLPATH}/root/.installrc || die |
addconfig "LC_ALL=C grub-mkconfig -o ${grub2conf} &> /dev/null" |
627 |
|
addconfig "grub-install --no-floppy ${HDD} &> /dev/null" |
628 |
|
addconfig "exit 0" |
629 |
|
|
630 |
# grub-legacy |
# grub-legacy |
631 |
else |
else |
653 |
my_roothdd="${ROOTHDD}" |
my_roothdd="${ROOTHDD}" |
654 |
fi |
fi |
655 |
|
|
656 |
: > ${grubconf} || die |
CONFIG="${grubconf}" |
657 |
echo "default 0" >> ${grubconf} || die |
clearconfig |
658 |
echo "timeout 3" >> ${grubconf} || die |
addconfig "default 0" |
659 |
|
addconfig "timeout 3" |
660 |
# using current root password |
# using current root password |
661 |
echo "password --md5 $(cat ${INSTALLPATH}/etc/shadow | grep root | cut -d: -f2)" >> ${grubconf} || die |
addconfig "password --md5 $(cat ${INSTALLPATH}/etc/shadow | grep root | cut -d: -f2)" |
662 |
|
addconfig |
663 |
echo >> ${grubconf} || die |
addconfig "# normal boot" |
664 |
echo "# normal boot" >> ${grubconf} || die |
addconfig "title ${KRNVER}" |
665 |
echo "title ${KRNVER}" >> ${grubconf} || die |
addconfig "root (hd0,0)" |
666 |
echo "root (hd0,0)" >> ${grubconf} || die |
addconfig "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS}" |
|
echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS}" >> ${grubconf} || die |
|
667 |
if is_initrd_supported |
if is_initrd_supported |
668 |
then |
then |
669 |
echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die |
addconfig "initrd /boot/${KRNINITRD}" |
670 |
fi |
fi |
671 |
|
addconfig |
672 |
echo >> ${grubconf} || die |
addconfig "# admin boot" |
673 |
echo "# admin boot" >> ${grubconf} || die |
addconfig "title ${KRNVER} - Re-run hardware-detection" |
674 |
echo "title ${KRNVER} - Re-run hardware-detection" >> ${grubconf} || die |
addconfig "lock" |
675 |
echo "lock" >> ${grubconf} || die |
addconfig "root (hd0,0)" |
676 |
echo "root (hd0,0)" >> ${grubconf} || die |
addconfig "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS} hardware-auto-detection" |
|
echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS} hardware-auto-detection" >> ${grubconf} || die |
|
677 |
if is_initrd_supported |
if is_initrd_supported |
678 |
then |
then |
679 |
echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die |
addconfig "initrd /boot/${KRNINITRD}" |
680 |
fi |
fi |
681 |
|
addconfig |
682 |
echo >> ${grubconf} || die |
addconfig "title ${KRNVER} - Reset *all* local settings" |
683 |
echo "title ${KRNVER} - Reset *all* local settings" >> ${grubconf} || die |
addconfig "lock" |
684 |
echo "lock" >> ${grubconf} || die |
addconfig "root (hd0,0)" |
685 |
echo "root (hd0,0)" >> ${grubconf} || die |
addconfig "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS} alx-reset-settings" |
|
echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS} alx-reset-settings" >> ${grubconf} || die |
|
686 |
if is_initrd_supported |
if is_initrd_supported |
687 |
then |
then |
688 |
echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die |
addconfig "initrd /boot/${KRNINITRD}" |
689 |
fi |
fi |
690 |
|
|
691 |
# write bootsector chrooted (lfs/magellan) |
# write bootsector chrooted (lfs/magellan) |
692 |
cat > ${INSTALLPATH}/root/.installrc << CHROOTEOF |
CONFIG=${INSTALLPATH}/.installrc |
693 |
/usr/sbin/grub --no-floppy --batch << "EOF" 1> /dev/null 2> /dev/null |
clearconfig |
694 |
root (hd0,0) |
addconfig '/usr/sbin/grub --no-floppy --batch << "EOF" 1> /dev/null 2> /dev/null' |
695 |
setup (hd0) |
addconfig 'root (hd0,0)' |
696 |
quit |
addconfig 'setup (hd0)' |
697 |
EOF |
addconfig 'quit' |
698 |
exit 0 |
addconfig 'EOF' |
699 |
CHROOTEOF |
addconfig 'exit 0' |
700 |
fi |
fi |
701 |
|
|
702 |
## enters chroot |
## enter chroot |
703 |
mount -t proc proc ${INSTALLPATH}/proc |
enter_chroot_installrc |
|
mount -t sysfs sysfs ${INSTALLPATH}/sys |
|
|
mount -o bind /dev ${INSTALLPATH}/dev |
|
|
chroot ${INSTALLPATH} /bin/bash --rcfile /root/.installrc -i |
|
|
umount ${INSTALLPATH}/proc |
|
|
umount ${INSTALLPATH}/sys |
|
|
umount ${INSTALLPATH}/dev |
|
|
rm ${INSTALLPATH}/root/.installrc |
|
704 |
} |
} |
705 |
|
|
706 |
is_initrd_supported() |
is_initrd_supported() |
753 |
clearconfig |
clearconfig |
754 |
addconfig "options i810fb xres=1024 yres=768 bpp=16 mtrr=1 hsync1=30 hsync2=62 vsync1=30 vsync2=60" |
addconfig "options i810fb xres=1024 yres=768 bpp=16 mtrr=1 hsync1=30 hsync2=62 vsync1=30 vsync2=60" |
755 |
|
|
756 |
cat > ${INSTALLPATH}/root/.installrc << CHROOTEOF |
CONFIG=${INSTALLPATH}/.installrc |
757 |
echo "MODULES=\"${FORMAT_FILESYSTEM} ${DISKMODS} ${OLDATAMODS} ${PATAMODS} ${SATAMODS} ${DRMMODS} ${FBMODS} ${OTHERMODS}\"" > /etc/conf.d/mkinitrd |
clearconfig |
758 |
mkinitrd -f /boot/$(readlink /boot/initrd) $(readlink /boot/vmlinuz | sed "s:kernel-::g") > /dev/null |
addconfig 'echo "MODULES=\"${FORMAT_FILESYSTEM} ${DISKMODS} ${OLDATAMODS} ${PATAMODS} ${SATAMODS} ${DRMMODS} ${FBMODS} ${OTHERMODS}\"" > /etc/conf.d/mkinitrd' |
759 |
exit 0 |
addconfig 'mkinitrd -f /boot/$(readlink /boot/initrd) $(readlink /boot/vmlinuz | sed "s:kernel-::g") > /dev/null' |
760 |
CHROOTEOF |
addconfig 'exit 0' |
761 |
|
## enter chroot |
762 |
## enters chroot |
enter_chroot_installrc |
|
mount -t proc proc ${INSTALLPATH}/proc |
|
|
mount -t sysfs sysfs ${INSTALLPATH}/sys |
|
|
mount -o bind /dev ${INSTALLPATH}/dev |
|
|
chroot ${INSTALLPATH} /bin/bash --rcfile /root/.installrc -i |
|
|
umount ${INSTALLPATH}/proc |
|
|
umount ${INSTALLPATH}/sys |
|
|
umount ${INSTALLPATH}/dev |
|
|
rm ${INSTALLPATH}/root/.installrc |
|
763 |
} |
} |
764 |
|
|
765 |
is_uuid_supported() |
is_uuid_supported() |
914 |
dialog_install_successful |
dialog_install_successful |
915 |
} |
} |
916 |
|
|
917 |
|
# set some proper traps |
918 |
|
trap "trap_exit" SIGINT SIGQUIT |
919 |
|
|
920 |
dialog_main |
dialog_main |
921 |
|
|
922 |
exit 0 |
exit 0 |