Magellan Linux

Diff of /alx-src/trunk/alxinstall-ng/bin/alxinstall-ng.sh.in

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 6828 by niro, Thu Jul 23 11:39:57 2015 UTC revision 6834 by niro, Thu Jul 23 12:25:33 2015 UTC
# Line 10  MLIBDIR="/usr/lib/alxinstall-ng" Line 10  MLIBDIR="/usr/lib/alxinstall-ng"
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
# Line 58  die() Line 59  die()
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    
# Line 598  install_bootsector_chroot() Line 600  install_bootsector_chroot()
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 ]]
# Line 617  install_bootsector_chroot() Line 620  install_bootsector_chroot()
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
# Line 648  install_bootsector_chroot() Line 653  install_bootsector_chroot()
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()
# Line 716  is_initrd_supported() Line 712  is_initrd_supported()
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    
# Line 741  install_initrd_chroot() Line 739  install_initrd_chroot()
739   fi   fi
740    
741   # install an appropriate uvesafb.conf   # install an appropriate uvesafb.conf
742   install -d ${INSTALLPATH}/etc/modprobe.d || die   CONFIG=${INSTALLPATH}/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=${INSTALLPATH}/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=${INSTALLPATH}/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=${INSTALLPATH}/.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()
# Line 919  run_install() Line 914  run_install()
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

Legend:
Removed from v.6828  
changed lines
  Added in v.6834