10 |
source /mnt/cdrom/system/images.conf |
source /mnt/cdrom/system/images.conf |
11 |
|
|
12 |
# includes |
# includes |
13 |
|
source ${MLIBDIR}/functions/generic.sh |
14 |
source ${MLIBDIR}/functions/hwdetection.sh |
source ${MLIBDIR}/functions/hwdetection.sh |
15 |
|
|
16 |
### System/Config Version |
### System/Config Version |
19 |
|
|
20 |
# locations |
# locations |
21 |
CDPATH="/mnt/cdrom" |
CDPATH="/mnt/cdrom" |
22 |
INSTALLPATH="/mnt/magellan" |
INSTALL_ROOT="/mnt/magellan" |
23 |
|
|
24 |
# default system settings |
# default system settings |
25 |
# standard kernel opts |
# standard kernel opts |
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 |
|
|
485 |
;; |
;; |
486 |
|
|
487 |
single|auto) |
single|auto) |
488 |
|
BOOTHDD="" |
489 |
|
SWAPHDD="" |
490 |
ROOTHDD="${HDD}1" |
ROOTHDD="${HDD}1" |
491 |
;; |
;; |
492 |
esac |
esac |
563 |
fi |
fi |
564 |
if [[ -n ${BOOTHDD} ]] |
if [[ -n ${BOOTHDD} ]] |
565 |
then |
then |
566 |
mke2fs -j -q ${BOOTHDD} || die |
mkfs.${FORMAT_FILESYSTEM} -q ${BOOTHDD} || die |
567 |
fi |
fi |
568 |
if [[ -n ${ROOTHDD} ]] |
if [[ -n ${ROOTHDD} ]] |
569 |
then |
then |
570 |
mke2fs -j -q ${ROOTHDD} || die |
mkfs.${FORMAT_FILESYSTEM} -q ${ROOTHDD} || die |
571 |
fi |
fi |
572 |
} |
} |
573 |
|
|
579 |
fi |
fi |
580 |
if [[ -n ${ROOTHDD} ]] |
if [[ -n ${ROOTHDD} ]] |
581 |
then |
then |
582 |
mount ${ROOTHDD} ${INSTALLPATH} || die |
mount ${ROOTHDD} ${INSTALL_ROOT} || die |
583 |
fi |
fi |
584 |
if [[ -n ${BOOTHDD} ]] |
if [[ -n ${BOOTHDD} ]] |
585 |
then |
then |
586 |
install -d ${INSTALLPATH}/boot || die |
install -d ${INSTALL_ROOT}/boot || die |
587 |
mount ${BOOTHDD} ${INSTALLPATH}/boot || die |
mount ${BOOTHDD} ${INSTALL_ROOT}/boot || die |
588 |
fi |
fi |
589 |
|
|
590 |
cd ${INSTALLPATH} || die |
cd ${INSTALL_ROOT} || die |
591 |
} |
} |
592 |
|
|
593 |
install_system_image() |
install_system_image() |
594 |
{ |
{ |
595 |
tar xvjpf ${CDPATH}/system/${CDIMAGENAME} -C ${INSTALLPATH} |
tar xvjpf ${CDPATH}/system/${CDIMAGENAME} -C ${INSTALL_ROOT} |
596 |
} |
} |
597 |
|
|
598 |
install_bootsector_chroot() |
install_bootsector_chroot() |
599 |
{ |
{ |
600 |
local my_roothdd |
local my_roothdd |
601 |
local grubconf=${INSTALLPATH}/boot/grub/grub.conf |
local grubconf=${INSTALL_ROOT}/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 ${INSTALL_ROOT}/sbin/grub-mkconfig ]] |
607 |
then |
then |
608 |
# needed by grub-mkconfig on the first run |
# needed by grub-mkconfig on the first run |
609 |
if [[ ! -f ${INSTALLPATH}/boot/grub/video.lst ]] |
if [[ ! -f ${INSTALL_ROOT}/boot/grub/video.lst ]] |
610 |
then |
then |
611 |
install -m0644 ${INSTALLPATH}/lib/grub/*/video.lst ${INSTALLPATH}/boot/grub/video.lst || die |
install -m0644 ${INSTALL_ROOT}/lib/grub/*/video.lst ${INSTALL_ROOT}/boot/grub/video.lst || die |
612 |
fi |
fi |
613 |
|
|
614 |
# set kernelopts |
# set kernelopts |
615 |
if [[ -f ${INSTALLPATH}/etc/conf.d/grub ]] |
if [[ -f ${INSTALL_ROOT}/etc/conf.d/grub ]] |
616 |
then |
then |
617 |
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}\":" ${INSTALL_ROOT}/etc/conf.d/grub || die |
618 |
sed -i "s:^\(export GRUB_GFXPAYLOAD_LINUX=\).*:\1\"${GRUB2GFXPAYLOAD}\":" ${INSTALLPATH}/etc/conf.d/grub || die |
sed -i "s:^\(export GRUB_GFXPAYLOAD_LINUX=\).*:\1\"${GRUB2GFXPAYLOAD}\":" ${INSTALL_ROOT}/etc/conf.d/grub || die |
619 |
else |
else |
620 |
echo "export GRUB_CMDLINE_LINUX_DEFAULT=\"${KERNELOPTS}\"" > ${INSTALLPATH}/etc/conf.d/grub || die |
echo "export GRUB_CMDLINE_LINUX_DEFAULT=\"${KERNELOPTS}\"" > ${INSTALL_ROOT}/etc/conf.d/grub || die |
621 |
echo "export GRUB_GFXPAYLOAD_LINUX=\"${GRUB2GFXPAYLOAD}\"" >> ${INSTALLPATH}/etc/conf.d/grub || die |
echo "export GRUB_GFXPAYLOAD_LINUX=\"${GRUB2GFXPAYLOAD}\"" >> ${INSTALL_ROOT}/etc/conf.d/grub || die |
622 |
fi |
fi |
623 |
echo 'grub-mkdevicemap' > ${INSTALLPATH}/root/.installrc || die |
CONFIG=${INSTALL_ROOT}/.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 |
632 |
### grubconf schreiben |
### grubconf schreiben |
633 |
source ${INSTALLPATH}/boot/kernelversion |
source ${INSTALL_ROOT}/boot/kernelversion |
634 |
|
|
635 |
#for alx only |
#for alx only |
636 |
if [ -e ${INSTALLPATH}/etc/alx_version ] |
if [ -e ${INSTALL_ROOT}/etc/alx_version ] |
637 |
then |
then |
638 |
OLD_ALXVER="${ALXVER}" |
OLD_ALXVER="${ALXVER}" |
639 |
source ${INSTALLPATH}/etc/alx_version |
source ${INSTALL_ROOT}/etc/alx_version |
640 |
KRNVER="ALX-${ALXVER}" |
KRNVER="ALX-${ALXVER}" |
641 |
ALXVER="${OLD_ALXVER}" |
ALXVER="${OLD_ALXVER}" |
642 |
fi |
fi |
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 ${INSTALL_ROOT}/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=${INSTALL_ROOT}/.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() |
707 |
{ |
{ |
708 |
# only generate initrds if the cmd exists |
# only generate initrds if the cmd exists |
709 |
[[ -x ${INSTALLPATH}/sbin/mkinitrd ]] && return 0 |
[[ -x ${INSTALL_ROOT}/sbin/mkinitrd ]] && return 0 |
710 |
return 1 |
return 1 |
711 |
} |
} |
712 |
|
|
713 |
install_initrd_chroot() |
install_initrd_chroot() |
714 |
{ |
{ |
715 |
|
local CONFIG |
716 |
|
|
717 |
# only generate initrds if the cmd exists |
# only generate initrds if the cmd exists |
718 |
is_initrd_supported || return 0 |
is_initrd_supported || return 0 |
719 |
|
|
739 |
fi |
fi |
740 |
|
|
741 |
# install an appropriate uvesafb.conf |
# install an appropriate uvesafb.conf |
742 |
install -d ${INSTALLPATH}/etc/modprobe.d || die |
CONFIG=${INSTALL_ROOT}/etc/modprobe.d/uvesafb.conf |
743 |
echo "options uvesafb mode_option=1024x768-32@60 scroll=ywrap" > ${INSTALLPATH}/etc/modprobe.d/uvesafb.conf || die |
clearconfig |
744 |
|
addconfig "options uvesafb mode_option=1024x768-32@60 scroll=ywrap" |
745 |
|
|
746 |
# install an appropriate viafb.conf |
# install an appropriate viafb.conf |
747 |
echo "options viafb viafb_mode=1024x768 viafb_refresh=60" > ${INSTALLPATH}/etc/modprobe.d/viafb.conf || die |
CONFIG=${INSTALL_ROOT}/etc/modprobe.d/viafb.conf |
748 |
|
clearconfig |
749 |
|
addconfig "options viafb viafb_mode=1024x768 viafb_refresh=60" |
750 |
|
|
751 |
# install an appropriate i810fb.conf |
# install an appropriate i810fb.conf |
752 |
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 |
CONFIG=${INSTALL_ROOT}/etc/modprobe.d/i810fb.conf |
753 |
|
clearconfig |
754 |
cat > ${INSTALLPATH}/root/.installrc << CHROOTEOF |
addconfig "options i810fb xres=1024 yres=768 bpp=16 mtrr=1 hsync1=30 hsync2=62 vsync1=30 vsync2=60" |
755 |
echo "MODULES=\"${FORMAT_FILESYSTEM} ${DISKMODS} ${OLDATAMODS} ${PATAMODS} ${SATAMODS} ${DRMMODS} ${FBMODS} ${OTHERMODS}\"" > /etc/conf.d/mkinitrd |
|
756 |
mkinitrd -f /boot/$(readlink /boot/initrd) $(readlink /boot/vmlinuz | sed "s:kernel-::g") > /dev/null |
CONFIG=${INSTALL_ROOT}/.installrc |
757 |
exit 0 |
clearconfig |
758 |
CHROOTEOF |
addconfig 'echo "MODULES=\"${FORMAT_FILESYSTEM} ${DISKMODS} ${OLDATAMODS} ${PATAMODS} ${SATAMODS} ${DRMMODS} ${FBMODS} ${OTHERMODS}\"" > /etc/conf.d/mkinitrd' |
759 |
|
addconfig 'mkinitrd -f /boot/$(readlink /boot/initrd) $(readlink /boot/vmlinuz | sed "s:kernel-::g") > /dev/null' |
760 |
## enters chroot |
addconfig 'exit 0' |
761 |
mount -t proc proc ${INSTALLPATH}/proc |
## enter chroot |
762 |
mount -t sysfs sysfs ${INSTALLPATH}/sys |
enter_chroot_installrc |
|
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() |
802 |
then |
then |
803 |
if [[ -n ${BOOTHDD} ]] |
if [[ -n ${BOOTHDD} ]] |
804 |
then |
then |
805 |
echo -e "UUID=$(get_uuid ${BOOTHDD})\t/boot\t${FORMAT_FILESYSTEM}\tnoatime,noauto\t1 1" > ${INSTALLPATH}/etc/fstab || die |
echo -e "UUID=$(get_uuid ${BOOTHDD})\t/boot\t${FORMAT_FILESYSTEM}\tnoatime,noauto\t1 1" > ${INSTALL_ROOT}/etc/fstab || die |
806 |
fi |
fi |
807 |
if [[ -n ${ROOTHDD} ]] |
if [[ -n ${ROOTHDD} ]] |
808 |
then |
then |
809 |
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" >> ${INSTALL_ROOT}/etc/fstab || die |
810 |
fi |
fi |
811 |
else |
else |
812 |
if [[ -n ${BOOTHDD} ]] |
if [[ -n ${BOOTHDD} ]] |
813 |
then |
then |
814 |
echo -e "${BOOTHDD}\t/boot\t${FORMAT_FILESYSTEM}\tnoatime,noauto\t1 1" > ${INSTALLPATH}/etc/fstab || die |
echo -e "${BOOTHDD}\t/boot\t${FORMAT_FILESYSTEM}\tnoatime,noauto\t1 1" > ${INSTALL_ROOT}/etc/fstab || die |
815 |
fi |
fi |
816 |
if [[ -n ${ROOTHDD} ]] |
if [[ -n ${ROOTHDD} ]] |
817 |
then |
then |
818 |
echo -e "${ROOTHDD}\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" >> ${INSTALLPATH}/etc/fstab || die |
echo -e "${ROOTHDD}\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" >> ${INSTALL_ROOT}/etc/fstab || die |
819 |
fi |
fi |
820 |
fi |
fi |
821 |
# not needed busybox loads all with swapon -a, even if not mentioned in fstab |
# not needed busybox loads all with swapon -a, even if not mentioned in fstab |
822 |
#echo -e "UUID='$(get_uuid ${SWAPHDD})'\tswap\tswap\tpri=1\t0 0" >> ${INSTALLPATH}/etc/fstab || die |
#echo -e "UUID='$(get_uuid ${SWAPHDD})'\tswap\tswap\tpri=1\t0 0" >> ${INSTALL_ROOT}/etc/fstab || die |
823 |
echo -e "proc\t/proc\tproc\tdefaults\t0 0" >> ${INSTALLPATH}/etc/fstab || die |
echo -e "proc\t/proc\tproc\tdefaults\t0 0" >> ${INSTALL_ROOT}/etc/fstab || die |
824 |
echo -e "shm\t/dev/shm\ttmpfs\tdefaults\t0 0" >> ${INSTALLPATH}/etc/fstab || die |
echo -e "shm\t/dev/shm\ttmpfs\tdefaults\t0 0" >> ${INSTALL_ROOT}/etc/fstab || die |
825 |
|
|
826 |
# install network config skeleton |
# install network config skeleton |
827 |
install -m0644 ${INSTALLPATH}/etc/alxconfig-ng/skel/net/net.eth0 ${INSTALLPATH}/etc/conf.d/ || die |
install -m0644 ${INSTALL_ROOT}/etc/alxconfig-ng/skel/net/net.eth0 ${INSTALL_ROOT}/etc/conf.d/ || die |
828 |
|
|
829 |
# intel framebufer quirk |
# intel framebufer quirk |
830 |
if [[ -e /proc/fb ]] |
if [[ -e /proc/fb ]] |
834 |
fbdev=$(grep 'inteldrmfb' /proc/fb | sed 's:\([0-9]\).*:\1:') |
fbdev=$(grep 'inteldrmfb' /proc/fb | sed 's:\([0-9]\).*:\1:') |
835 |
if [[ ${fbdev} != 0 ]] |
if [[ ${fbdev} != 0 ]] |
836 |
then |
then |
837 |
sed -i "s:^\(SPLASH_DEV=\).*:\1\"/dev/fb${fbdev}\":" ${INSTALLPATH}/etc/splash/splash.conf || die |
sed -i "s:^\(SPLASH_DEV=\).*:\1\"/dev/fb${fbdev}\":" ${INSTALL_ROOT}/etc/splash/splash.conf || die |
838 |
fi |
fi |
839 |
fi |
fi |
840 |
fi |
fi |
845 |
cd / |
cd / |
846 |
if [[ -n ${BOOTHDD} ]] |
if [[ -n ${BOOTHDD} ]] |
847 |
then |
then |
848 |
umount ${INSTALLPATH}/boot || die |
umount ${INSTALL_ROOT}/boot || die |
849 |
fi |
fi |
850 |
if [[ -n ${ROOTHDD} ]] |
if [[ -n ${ROOTHDD} ]] |
851 |
then |
then |
852 |
umount ${INSTALLPATH} || die |
umount ${INSTALL_ROOT} || die |
853 |
fi |
fi |
854 |
if [[ -n ${SWAPHDD} ]] |
if [[ -n ${SWAPHDD} ]] |
855 |
then |
then |
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 |