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 2573 by niro, Mon Jul 4 21:24:46 2011 UTC revision 5575 by niro, Tue Apr 22 10:55:06 2014 UTC
# Line 34  CURRENTLINE=0 Line 34  CURRENTLINE=0
34  # standard kernel opts  # standard kernel opts
35  KERNELOPTS="quiet video=1024x768"  KERNELOPTS="quiet video=1024x768"
36    
37    # grub options
38    GRUBLEGACYOPTS=""
39    GRUB2OPTS=""
40    GRUB2GFXPAYLOAD="1024x768x16,1024x768"
41    
42    # fdisk options
43    FDISKPARTIONBELOW256MB=0
44    
45  # default specialdevices  # default specialdevices
46  SPECIALDEVICE=""  SPECIALDEVICE=""
47    FORMFACTOR="desktop"
48    
49  # target filesystem  # target filesystem
50  FORMAT_FILESYSTEM="ext4"  FORMAT_FILESYSTEM="ext4"
# Line 199  dialog_hardware_detection() Line 208  dialog_hardware_detection()
208   # other devices   # other devices
209   run_hardware_detection   run_hardware_detection
210   case "${SPECIALDEVICE}" in   case "${SPECIALDEVICE}" in
211   zotac) echo " \n\n\n \\Z2Zotac Device erkannt!\\Zn \\" >> ${hwtmp} ;;   zotac*) echo " \n\n\n \\Z2Zotac Device erkannt.\\Zn \\" >> ${hwtmp} ;;
212   *) echo " \n\n\n \\ZnStandard Device erkannt!\\Zn \\" >> ${hwtmp} ;;   rangee) echo " \n\n\n \\Z2Rangee Device erkannt.\\Zn \\" >> ${hwtmp} ;;
213     maxdata) echo " \n\n\n \\Z2Maxdata Device erkannt.\\Zn \\" >> ${hwtmp} ;;
214     i845) echo " \n\n\n \\Z2Intel i845 Device erkannt.\\Zn \\" >> ${hwtmp} ;;
215     *) echo " \n\n\n \\ZnStandard Device erkannt.\\Zn \\" >> ${hwtmp} ;;
216   esac   esac
217     if [[ ${FORMFACTOR} = laptop ]]
218     then
219     echo " \n \\ZnFormfactor Laptop, Powersave Modus 'ondemand' wird aktiviert.\\Zn \\" >> ${hwtmp}
220     fi
221    
222   echo " \" 13 70" >> ${hwtmp}   echo " \" 14 70" >> ${hwtmp}
223   chmod a+x ${hwtmp}   chmod a+x ${hwtmp}
224   ${hwtmp}   ${hwtmp}
225    
# Line 431  dialog_main() Line 447  dialog_main()
447  #################################################  #################################################
448  run_hardware_detection()  run_hardware_detection()
449  {  {
450     local hwinfo
451    
452     hwinfo="$(hwinfo --bios --storage --pci --gfxcard --sys)"
453    
454   # check for special devices/clients:   # check for special devices/clients:
455   # if zotac a zotac and the disk is a removeable device, then add rootdelay to kernelcmd   # if zotac a zotac and the disk is a removeable device, then add rootdelay to kernelcmd
456   local removable=0   local removable=0
457   if [[ ! -z $(hwinfo --bios --storage | grep -i zotac) ]]   if [[ ! -z $(echo "${hwinfo}" | grep -i zotac) ]]
458   then   then
459   for i in /sys/block/[hs]d*/removable   for i in /sys/block/[hs]d*/removable
460   do   do
# Line 444  run_hardware_detection() Line 464  run_hardware_detection()
464   fi   fi
465   done   done
466    
467   export KERNELOPTS="${KERNELOPTS} rootdelay=8"   # only add this for grub legacy, grub2 detect these settings on its own
468   export SPECIALDEVICE="zotac"   export GRUBLEGACYOPTS="rootdelay=8"
469     # there are two zotac types in the wild, nvidia based gfx and intel
470     if [[ ! -z $(echo "${hwinfo}" | grep -i nouveau) ]]
471     then
472     export SPECIALDEVICE="zotac_nvidia"
473     else
474     export SPECIALDEVICE="zotac_intel"
475     fi
476     fi
477    
478     # check for special devices/clients:
479     # if a rangee and disk ist smaller then 256mb move partion one block further ahead
480     if [[ ! -z $(echo "${hwinfo}" | grep -i CLE266) ]]
481     then
482     # for a rangee always define partion startblock +1
483     export FDISKPARTIONBELOW256MB="1"
484     export SPECIALDEVICE="rangee"
485     export GRUBLEGACYOPTS=""
486     fi
487    
488     # check for special devices/clients:
489     # check for maxdata / i810/ i815 Chipsets and disable KMS and use i810fb frambuffer
490     if [[ ! -z $(echo "${hwinfo}" | grep -i i810) ]] || [[ ! -z $(echo "${hwinfo}" | grep -i i815) ]]
491     then
492     export SPECIALDEVICE="maxdata"
493     export GRUBLEGACYOPTS=""
494     fi
495    
496     # check for i845 Chipsets and disable KMS and use 915 drm driver
497     if [[ ! -z $(echo "${hwinfo}" | grep -i i845) ]]
498     then
499     export SPECIALDEVICE="i845"
500     # unset default video=1024x768 opt or the drm driver breaks
501     export KERNELOPTS="quiet"
502     export GRUBLEGACYOPTS=""
503     # enable full kms support
504     export GRUB2GFXPAYLOAD="keep"
505     fi
506    
507     # check for special devices/clients:
508     # check for laptops and activate cpufreq scaling
509     if [[ $(echo "${hwinfo}" | grep 'Formfactor:' | sed 's:.*Formfactor\:\ \"\(.*\)\":\1:') = laptop ]]
510     then
511     export FORMFACTOR="laptop"
512     export KERNELOPTS="${KERNELOPTS} cpufreq.governor=ondemand"
513   fi   fi
514  }  }
515    
516    hdd_size_below_256mb()
517    {
518     local hdd="$1"
519     local size
520     local retval
521     [[ -z ${hdd} ]] && die "Error: get_hdd_size() no \$hdd given!"
522    
523     size=$(fdisk -l ${hdd} | grep "Disk.*${hdd}" | sed 's:.*,\ \(.*\)\ byte.*:\1:')
524     if [[ ${size} -le 257000000 ]]
525     then
526     retval="0"
527     else
528     retval="1"
529     fi
530    
531     return "${retval}"
532    }
533    
534  setup_hdd_partitions_auto()  setup_hdd_partitions_auto()
535  {  {
536   ROOTHDD="${HDD}1"   ROOTHDD="${HDD}1"
537    
538     # run this only if FDISKPARTITIONBELOW256MB is not already 1
539     if [[ ${FDISKPARTIONBELOW256MB} != 1 ]]
540     then
541     if hdd_size_below_256mb ${HDD}
542     then
543     FDISKPARTIONBELOW256MB=1
544     else
545     FDISKPARTIONBELOW256MB=0
546     fi
547     fi
548    
549   ## delete disk   ## delete disk
550   dd if=/dev/zero of=${HDD} count=1 &> /dev/null || die   dd if=/dev/zero of=${HDD} count=1 &> /dev/null || die
551    
552   ## setup one bootable partition   if [[ ${FDISKPARTIONBELOW256MB} = 1 ]]
553   #1. n= new disk   then
554   #2. p= primary disk   ## setup one bootable partition
555   #3. 1= first partition   #1. n= new disk
556   #4. ''= default sector start   #2. p= primary disk
557   #5. ''= defaul sector end   #3. 1= first partition
558   #6. a= bootable flag   #4. 2= default sector start // small disk needs more space for grub2 mbr sector
559   #7. 1= boot flag for partition 1   #5. ''= defaul sector end
560   #8. w= write/quit   #6. a= bootable flag
561   fdisk ${HDD} &> /dev/null << EOF   #7. 1= boot flag for partition 1
562     #8. w= write/quit
563     fdisk ${HDD} &> /dev/null << EOF
564    n
565    p
566    1
567    2
568    
569    a
570    1
571    w
572    EOF
573     else
574     ## setup one bootable partition
575     #1. n= new disk
576     #2. p= primary disk
577     #3. 1= first partition
578     #4. ''= default sector start
579     #5. ''= defaul sector end
580     #6. a= bootable flag
581     #7. 1= boot flag for partition 1
582     #8. w= write/quit
583     fdisk ${HDD} &> /dev/null << EOF
584  n  n
585  p  p
586  1  1
# Line 475  a Line 590  a
590  1  1
591  w  w
592  EOF  EOF
593     fi
594  }  }
595    
596  setup_hdd_partitions_manuell()  setup_hdd_partitions_manuell()
# Line 547  install_bootsector_chroot() Line 663  install_bootsector_chroot()
663   if [[ -f ${INSTALLPATH}/etc/conf.d/grub ]]   if [[ -f ${INSTALLPATH}/etc/conf.d/grub ]]
664   then   then
665   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}\":" ${INSTALLPATH}/etc/conf.d/grub || die
666     sed -i "s:^\(export GRUB_GFXPAYLOAD_LINUX=\).*:\1\"${GRUB2GFXPAYLOAD}\":" ${INSTALLPATH}/etc/conf.d/grub || die
667   else   else
668   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
669     echo "export GRUB_GFXPAYLOAD_LINUX=\"${GRUB2GFXPAYLOAD}\"" >>  ${INSTALLPATH}/etc/conf.d/grub || die
670   fi   fi
671   echo 'grub-mkdevicemap' > ${INSTALLPATH}/root/.installrc || die   echo 'grub-mkdevicemap' > ${INSTALLPATH}/root/.installrc || die
672   echo "LC_ALL=C grub-mkconfig -o ${grub2conf}  &> /dev/null" >> ${INSTALLPATH}/root/.installrc || die   echo "LC_ALL=C grub-mkconfig -o ${grub2conf}  &> /dev/null" >> ${INSTALLPATH}/root/.installrc || die
# Line 591  install_bootsector_chroot() Line 709  install_bootsector_chroot()
709   echo "# normal boot" >> ${grubconf} || die   echo "# normal boot" >> ${grubconf} || die
710   echo "title ${KRNVER}" >> ${grubconf} || die   echo "title ${KRNVER}" >> ${grubconf} || die
711   echo "root (hd0,0)" >> ${grubconf} || die   echo "root (hd0,0)" >> ${grubconf} || die
712   echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS}" >> ${grubconf} || die   echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS}" >> ${grubconf} || die
713   if is_initrd_supported   if is_initrd_supported
714   then   then
715   echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die   echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die
# Line 602  install_bootsector_chroot() Line 720  install_bootsector_chroot()
720   echo "title ${KRNVER} - Re-run hardware-detection" >> ${grubconf} || die   echo "title ${KRNVER} - Re-run hardware-detection" >> ${grubconf} || die
721   echo "lock"  >> ${grubconf} || die   echo "lock"  >> ${grubconf} || die
722   echo "root (hd0,0)" >> ${grubconf} || die   echo "root (hd0,0)" >> ${grubconf} || die
723   echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} hardware-auto-detection" >> ${grubconf} || die   echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS} hardware-auto-detection" >> ${grubconf} || die
724   if is_initrd_supported   if is_initrd_supported
725   then   then
726   echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die   echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die
# Line 612  install_bootsector_chroot() Line 730  install_bootsector_chroot()
730   echo "title ${KRNVER} - Reset *all* local settings" >> ${grubconf} || die   echo "title ${KRNVER} - Reset *all* local settings" >> ${grubconf} || die
731   echo "lock"  >> ${grubconf} || die   echo "lock"  >> ${grubconf} || die
732   echo "root (hd0,0)" >> ${grubconf} || die   echo "root (hd0,0)" >> ${grubconf} || die
733   echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} alx-reset-settings" >> ${grubconf} || die   echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS} alx-reset-settings" >> ${grubconf} || die
734   if is_initrd_supported   if is_initrd_supported
735   then   then
736   echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die   echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die
# Line 657  install_initrd_chroot() Line 775  install_initrd_chroot()
775   PATAMODS="ata_piix pata_amd pata_mpiix pata_oldpiix pata_sis pata_via"   PATAMODS="ata_piix pata_amd pata_mpiix pata_oldpiix pata_sis pata_via"
776   SATAMODS="sata_via sata_sis sata_nv"   SATAMODS="sata_via sata_sis sata_nv"
777   DRMMODS="i915 mga nouveau r128 radeon savage sis tdfx ttm via"   DRMMODS="i915 mga nouveau r128 radeon savage sis tdfx ttm via"
778   FBMODS="uvesafb"   OTHERMODS=""
779     case ${SPECIALDEVICE} in
780     zotac_intel|i845) FBMODS=""; DRMMODS="i915" ;;
781     zotac_nvidia) FBMODS=""; DRMMODS="nouveau" ;;
782     rangee) FBMODS="" ;; ## fallback to vesafb, viafb does not run on all CLE266 boards
783     # not working with kms enabled drivers -> segfaults
784     #maxdata) FBMODS="i810fb" ;; ## check for maxdata / i810/ i815 Chipsets and disable KMS and use i810fb frambuffer
785     maxdata) FBMODS="" ;;
786     *) FBMODS="uvesafb" ;;
787     esac
788    
789     if [[ ${FORMFACTOR} = laptop ]]
790     then
791     OTHERMODS="acpi-cpufreq cpufreq_ondemand cpufreq_conservative cpufreq_powersave"
792     fi
793    
794   # install an appropriate uvesafb.conf   # install an appropriate uvesafb.conf
795   install -d ${INSTALLPATH}/etc/modprobe.d || die   install -d ${INSTALLPATH}/etc/modprobe.d || die
796   echo "options uvesafb mode_option=1024x768-32@60 scroll=ywrap" > ${INSTALLPATH}/etc/modprobe.d/uvesafb.conf || die   echo "options uvesafb mode_option=1024x768-32@60 scroll=ywrap" > ${INSTALLPATH}/etc/modprobe.d/uvesafb.conf || die
797    
798     # install an appropriate viafb.conf
799     echo "options viafb viafb_mode=1024x768 viafb_refresh=60" > ${INSTALLPATH}/etc/modprobe.d/viafb.conf || die
800    
801     # install an appropriate i810fb.conf
802     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
803    
804   cat > ${INSTALLPATH}/root/.installrc << CHROOTEOF   cat > ${INSTALLPATH}/root/.installrc << CHROOTEOF
805  echo "MODULES=\"${FORMAT_FILESYSTEM} ${DISKMODS} ${OLDATAMODS} ${PATAMODS} ${SATAMODS} ${DRMMODS} ${FBMODS}\"" > /etc/conf.d/mkinitrd  echo "MODULES=\"${FORMAT_FILESYSTEM} ${DISKMODS} ${OLDATAMODS} ${PATAMODS} ${SATAMODS} ${DRMMODS} ${FBMODS} ${OTHERMODS}\"" > /etc/conf.d/mkinitrd
806  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
807  exit 0  exit 0
808  CHROOTEOF  CHROOTEOF
# Line 731  install_system_settings() Line 869  install_system_settings()
869    
870   # install network config skeleton   # install network config skeleton
871   install -m0644 ${INSTALLPATH}/etc/alxconfig-ng/skel/net/net.eth0 ${INSTALLPATH}/etc/conf.d/ || die   install -m0644 ${INSTALLPATH}/etc/alxconfig-ng/skel/net/net.eth0 ${INSTALLPATH}/etc/conf.d/ || die
872    
873     # intel framebufer quirk
874     if [[ -e /proc/fb ]]
875     then
876     if [[ ! -z $(grep 'inteldrmfb' /proc/fb) ]]
877     then
878     fbdev=$(grep 'inteldrmfb' /proc/fb | sed 's:\([0-9]\).*:\1:')
879     if [[ ${fbdev} != 0 ]]
880     then
881     sed -i "s:^\(SPLASH_DEV=\).*:\1\"/dev/fb${fbdev}\":" ${INSTALLPATH}/etc/splash/splash.conf || die
882     fi
883     fi
884     fi
885  }  }
886    
887  install_system_settings_flash()  install_system_settings_flash()

Legend:
Removed from v.2573  
changed lines
  Added in v.5575