--- alx-src/trunk/alxinstall-ng/bin/alxinstall-ng.sh.in 2011/06/15 08:58:22 2390 +++ alx-src/trunk/alxinstall-ng/bin/alxinstall-ng.sh.in 2011/08/11 14:58:15 2736 @@ -21,7 +21,7 @@ ######################################## ### System/Config Version -VERSION="0.3.7" +VERSION="%VERSIONTAG%" TITLE="alxinstall-ng - ${VERSION}" CDPATH="/mnt/cdrom" @@ -31,8 +31,12 @@ CURRENTLINE=0 #TOTALLINES=11072 # -> now in images.conf -# standart kernel opts -KERNELOPTS="quiet" +# standard kernel opts +KERNELOPTS="quiet video=1024x768" + +# grub options +GRUBLEGACYOPTS="" +GRUB2OPTS="" # default specialdevices SPECIALDEVICE="" @@ -444,7 +448,8 @@ fi done - export KERNELOPTS="${KERNELOPTS} rootdelay=8" + # only add this for grub legacy, grub2 detect these settings on its own + export GRUBLEGACYOPTS="rootdelay=8" export SPECIALDEVICE="zotac" fi } @@ -531,71 +536,95 @@ install_bootsector_chroot() { local my_roothdd + local grubconf=${INSTALLPATH}/boot/grub/grub.conf + local grub2conf=/boot/grub/grub.cfg - ### grubconf schreiben - source ${INSTALLPATH}/boot/kernelversion - - #for alx only - if [ -e ${INSTALLPATH}/etc/alx_version ] + # check for grub2 + if [[ -f ${INSTALLPATH}/sbin/grub-mkconfig ]] then - OLD_ALXVER="${ALXVER}" - source ${INSTALLPATH}/etc/alx_version - KRNVER="ALX-${ALXVER}" - ALXVER="${OLD_ALXVER}" - fi + # needed by grub-mkconfig on the first run + if [[ ! -f ${INSTALLPATH}/boot/grub/video.lst ]] + then + install -m0644 ${INSTALLPATH}/lib/grub/*/video.lst ${INSTALLPATH}/boot/grub/video.lst || die + fi - [[ -z ${KRNVER} ]] && KRNVER="AutoSta_LX" - [[ -z ${KRNINITRD} ]] && KRNINITRD="initrd" - [[ -z ${KRNIMG} ]] && KRNIMG="vmlinuz" + # set kernelopts + if [[ -f ${INSTALLPATH}/etc/conf.d/grub ]] + then + sed -i "s:^\(export GRUB_CMDLINE_LINUX_DEFAULT=\).*:\1\"${KERNELOPTS}\":" ${INSTALLPATH}/etc/conf.d/grub || die + else + echo "export GRUB_CMDLINE_LINUX_DEFAULT=\"${KERNELOPTS}\"" > ${INSTALLPATH}/etc/conf.d/grub || die + fi + echo 'grub-mkdevicemap' > ${INSTALLPATH}/root/.installrc || die + echo "LC_ALL=C grub-mkconfig -o ${grub2conf} &> /dev/null" >> ${INSTALLPATH}/root/.installrc || die + echo "grub-install --no-floppy ${HDD} &> /dev/null" >> ${INSTALLPATH}/root/.installrc || die + echo "exit 0" >> ${INSTALLPATH}/root/.installrc || die - # uuid support - if is_uuid_supported - then - my_roothdd="UUID=$(get_uuid ${ROOTHDD})" + # grub-legacy else - my_roothdd="${ROOTHDD}" - fi + ### grubconf schreiben + source ${INSTALLPATH}/boot/kernelversion - local grubconf=${INSTALLPATH}/boot/grub/grub.conf - : > ${grubconf} || die - echo "default 0" >> ${grubconf} || die - echo "timeout 3" >> ${grubconf} || die - # using current root password - echo "password --md5 $(cat ${INSTALLPATH}/etc/shadow | grep root | cut -d: -f2)" >> ${grubconf} || die + #for alx only + if [ -e ${INSTALLPATH}/etc/alx_version ] + then + OLD_ALXVER="${ALXVER}" + source ${INSTALLPATH}/etc/alx_version + KRNVER="ALX-${ALXVER}" + ALXVER="${OLD_ALXVER}" + fi - echo >> ${grubconf} || die - echo "# normal boot" >> ${grubconf} || die - echo "title ${KRNVER}" >> ${grubconf} || die - 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 + [[ -z ${KRNVER} ]] && KRNVER="AutoSta_LX" + [[ -z ${KRNINITRD} ]] && KRNINITRD="initrd" + [[ -z ${KRNIMG} ]] && KRNIMG="vmlinuz" - echo >> ${grubconf} || die - echo "# admin boot" >> ${grubconf} || die - echo "title ${KRNVER} - Re-run hardware-detection" >> ${grubconf} || die - echo "lock" >> ${grubconf} || die - echo "root (hd0,0)" >> ${grubconf} || die - echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} hardware-auto-detection" >> ${grubconf} || die - if is_initrd_supported - then - echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die - fi + # uuid support + if is_uuid_supported + then + my_roothdd="UUID=$(get_uuid ${ROOTHDD})" + else + my_roothdd="${ROOTHDD}" + fi - echo >> ${grubconf} || die - echo "title ${KRNVER} - Reset *all* local settings" >> ${grubconf} || die - echo "lock" >> ${grubconf} || die - echo "root (hd0,0)" >> ${grubconf} || die - echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} alx-reset-settings" >> ${grubconf} || die - if is_initrd_supported - then - echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die - fi + : > ${grubconf} || die + echo "default 0" >> ${grubconf} || die + echo "timeout 3" >> ${grubconf} || die + # using current root password + echo "password --md5 $(cat ${INSTALLPATH}/etc/shadow | grep root | cut -d: -f2)" >> ${grubconf} || die + + echo >> ${grubconf} || die + echo "# normal boot" >> ${grubconf} || die + echo "title ${KRNVER}" >> ${grubconf} || die + echo "root (hd0,0)" >> ${grubconf} || die + echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS}" >> ${grubconf} || die + if is_initrd_supported + then + echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die + fi + + echo >> ${grubconf} || die + echo "# admin boot" >> ${grubconf} || die + echo "title ${KRNVER} - Re-run hardware-detection" >> ${grubconf} || die + echo "lock" >> ${grubconf} || die + echo "root (hd0,0)" >> ${grubconf} || die + echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS} hardware-auto-detection" >> ${grubconf} || die + if is_initrd_supported + then + echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die + fi - # bootsector schreiben chrooted schreiben (lfs/magellan) - cat > ${INSTALLPATH}/root/.bashrc << CHROOTEOF + echo >> ${grubconf} || die + echo "title ${KRNVER} - Reset *all* local settings" >> ${grubconf} || die + echo "lock" >> ${grubconf} || die + echo "root (hd0,0)" >> ${grubconf} || die + echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS} alx-reset-settings" >> ${grubconf} || die + if is_initrd_supported + then + echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die + fi + + # bootsector schreiben chrooted schreiben (lfs/magellan) + cat > ${INSTALLPATH}/root/.installrc << CHROOTEOF /usr/sbin/grub --no-floppy --batch << "EOF" 1> /dev/null 2> /dev/null root (hd0,0) setup (hd0) @@ -603,16 +632,17 @@ EOF exit 0 CHROOTEOF + fi ## enters chroot mount -t proc proc ${INSTALLPATH}/proc mount -t sysfs sysfs ${INSTALLPATH}/sys mount -o bind /dev ${INSTALLPATH}/dev - chroot ${INSTALLPATH} /bin/bash --rcfile /root/.bashrc -i + chroot ${INSTALLPATH} /bin/bash --rcfile /root/.installrc -i umount ${INSTALLPATH}/proc umount ${INSTALLPATH}/sys umount ${INSTALLPATH}/dev - rm ${INSTALLPATH}/root/.bashrc + rm ${INSTALLPATH}/root/.installrc } is_initrd_supported() @@ -627,8 +657,19 @@ # only generate initrds if the cmd exists is_initrd_supported || return 0 - cat > ${INSTALLPATH}/root/.bashrc << CHROOTEOF -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 + DISKMODS="sd_mod" + OLDPATAMODS="amd74xx piix sis5513 via82cxxx" + PATAMODS="ata_piix pata_amd pata_mpiix pata_oldpiix pata_sis pata_via" + SATAMODS="sata_via sata_sis sata_nv" + DRMMODS="i915 mga nouveau r128 radeon savage sis tdfx ttm via" + FBMODS="uvesafb" + + # install an appropriate uvesafb.conf + install -d ${INSTALLPATH}/etc/modprobe.d || die + echo "options uvesafb mode_option=1024x768-32@60 scroll=ywrap" > ${INSTALLPATH}/etc/modprobe.d/uvesafb.conf || die + + cat > ${INSTALLPATH}/root/.installrc << CHROOTEOF +echo "MODULES=\"${FORMAT_FILESYSTEM} ${DISKMODS} ${OLDATAMODS} ${PATAMODS} ${SATAMODS} ${DRMMODS} ${FBMODS}\"" > /etc/conf.d/mkinitrd mkinitrd -f /boot/$(readlink /boot/initrd) $(readlink /boot/vmlinuz | sed "s:kernel-::g") > /dev/null exit 0 CHROOTEOF @@ -637,11 +678,11 @@ mount -t proc proc ${INSTALLPATH}/proc mount -t sysfs sysfs ${INSTALLPATH}/sys mount -o bind /dev ${INSTALLPATH}/dev - chroot ${INSTALLPATH} /bin/bash --rcfile /root/.bashrc -i + chroot ${INSTALLPATH} /bin/bash --rcfile /root/.installrc -i umount ${INSTALLPATH}/proc umount ${INSTALLPATH}/sys umount ${INSTALLPATH}/dev - rm ${INSTALLPATH}/root/.bashrc + rm ${INSTALLPATH}/root/.installrc } is_uuid_supported() @@ -743,13 +784,14 @@ install_mount_rootfs (install_system_image > /tmp/install.log) 2> /tmp/install_errors.log | dialog_install_meter | dialog_install_system_image - dialog_install_bootsector - install_bootsector_chroot - dialog_install_settings sleep 1 install_system_settings install_initrd_chroot + + dialog_install_bootsector + install_bootsector_chroot + install_umount_rootfs dialog_install_successful } @@ -764,13 +806,14 @@ install_mount_rootfs_flash (install_system_image > /tmp/install.log) 2> /tmp/install_errors.log | dialog_install_meter | dialog_install_system_image - dialog_install_bootsector - install_bootsector_chroot - dialog_install_settings sleep 1 install_system_settings_flash install_initrd_chroot + + dialog_install_bootsector + install_bootsector_chroot + install_umount_rootfs_flash dialog_install_successful } @@ -785,13 +828,14 @@ install_mount_rootfs_flash (install_system_image > /tmp/install.log) 2> /tmp/install_errors.log | dialog_install_meter | dialog_install_system_image - dialog_install_bootsector - install_bootsector_chroot - dialog_install_settings sleep 1 install_system_settings_flash install_initrd_chroot + + dialog_install_bootsector + install_bootsector_chroot + install_umount_rootfs_flash dialog_install_successful }