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 3199 by niro, Wed Sep 14 11:11:55 2011 UTC revision 6832 by niro, Thu Jul 23 12:07:16 2015 UTC
# Line 1  Line 1 
1  #!/bin/sh  #!/bin/sh
2  #  # $Id$
 # $Header: /home/cvsd/alx-cvs/alx-src/alxinstall-ng/bin/alxinstall-ng.sh,v 1.15 2008-06-28 00:37:45 niro Exp $  
 #  
 # AutoSta_LX Installation Script  
 #  
 # Niels Rogalla <niro@magellan-linux.de>  
 # <rogalla@augusta-bochum.de>  
 #  
 #  
 # Install Navigation Gui  
 #  
3    
4  #images: (get ${CDIMAGENAME})  # ignore environment!
5    LC_ALL=C
6    
7    MLIBDIR="/usr/lib/alxinstall-ng"
8    
9    # images: (get ${CDIMAGENAME})
10  source /mnt/cdrom/system/images.conf  source /mnt/cdrom/system/images.conf
11    
12  #Includes  # includes
13  source /usr/lib/alxinstall-ng/functions/findhdd.sh > /dev/null  source ${MLIBDIR}/functions/generic.sh
14  ### bugfix ###############################  source ${MLIBDIR}/functions/hwdetection.sh
 cdromdev="$(echo ${cdromdev} | sed 's/ //')"  
 ########################################  
15    
16  ### System/Config Version  ### System/Config Version
17  VERSION="%VERSIONTAG%"  VERSION="@@VERSION@@"
18  TITLE="alxinstall-ng - ${VERSION}"  TITLE="alxinstall-ng - ${VERSION}"
19    
20    # locations
21  CDPATH="/mnt/cdrom"  CDPATH="/mnt/cdrom"
22  INSTALLPATH="/mnt/magellan"  INSTALLPATH="/mnt/magellan"
23    
24  ### WICHTIG: anzahl lines in der autosta_lx.tar.gz -1  # default system settings
 CURRENTLINE=0  
 #TOTALLINES=11072 # -> now in images.conf  
   
25  # standard kernel opts  # standard kernel opts
26  KERNELOPTS="quiet video=1024x768"  DEFAULT_KERNELOPTS="quiet video=1024x768"
27    
28  # grub options  # grub options
29  GRUBLEGACYOPTS=""  DEFAULT_GRUBLEGACYOPTS=""
30  GRUB2OPTS=""  DEFAULT_GRUB2OPTS=""
31    DEFAULT_GRUB2GFXPAYLOAD="1024x768x16,1024x768"
 # fdisk options  
 FDISKPARTIONBELOW256MB=0  
32    
33  # default specialdevices  # default specialdevices
34  SPECIALDEVICE=""  DEFAULT_FORMFACTOR="desktop"
35    
36  # target filesystem  # target filesystem
37  FORMAT_FILESYSTEM="ext4"  DEFAULT_FORMAT_FILESYSTEM="ext4"
38    
39    # initialize global variables so they are exportable
40    INSTALL_METHOD=""
41    KERNELOPTS=""
42    GRUBLEGACYOPTS=""
43    GRUB2OPTS=""
44    GRUB2GFXPAYLOAD=""
45    FORMFACTOR=""
46    FORMAT_FILESYSTEM=""
47    FDISKPARTIONBELOW256MB=0
48    SPECIALDEVICE=""
49    ### linecount of system.tar.gz -1 !
50    CURRENTLINE=0
51    #TOTALLINES=11072 # -> now in images.conf
52    
53  #################################################  #################################################
54  #  DIALOG BOXEN #  #  DIALOG BOXES #
55  #################################################  #################################################
56    
57  die()  die()
# Line 56  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 79  dialog_warning() Line 83  dialog_warning()
83    
84  dialog_setup_hdd_info()  dialog_setup_hdd_info()
85  {  {
86     case "${INSTALL_METHOD}" in
87     auto)
88     dialog_setup_hdd_info_auto
89     dialog_setup_hdd_create_partitions
90     ;;
91     normal) dialog_setup_hdd_info_normal ;;
92     single) dialog_setup_hdd_info_single ;;
93     esac
94    }
95    
96    dialog_setup_hdd_info_normal()
97    {
98   local SHDD="$(echo ${HDD} | sed 's/\/dev\///')"   local SHDD="$(echo ${HDD} | sed 's/\/dev\///')"
99    
100   dialog \   dialog \
# Line 93  dialog_setup_hdd_info() Line 109  dialog_setup_hdd_info()
109   Bitte ${SHDD}1 als \Z3bootable\Zn markieren." 12 81   Bitte ${SHDD}1 als \Z3bootable\Zn markieren." 12 81
110  }  }
111    
112  dialog_setup_hdd_info_flash()  dialog_setup_hdd_info_single()
113  {  {
114   local SHDD="$(echo $HDD | sed 's/\/dev\///')"   local SHDD="$(echo $HDD | sed 's/\/dev\///')"
115    
# Line 136  dialog_setup_system_menu() Line 152  dialog_setup_system_menu()
152   "" "" \   "" "" \
153   "" "\Z1Experten Modi:\Zn" \   "" "\Z1Experten Modi:\Zn" \
154   "2" "Normale IDE-Disk (Manuell)" \   "2" "Normale IDE-Disk (Manuell)" \
155   "3" "Flash-Speicher (Manuell)")   "3" "Normale IDE Disk (Single)")
156   RES=$?   RES=$?
157   [[ ${RES} -eq 1 ]] && return 1   [[ ${RES} -eq 1 ]] && return 1
158   if [[ ${RES} -eq 0 ]]   if [[ ${RES} -eq 0 ]]
159   then   then
160   case "${i}" in   case "${i}" in
161   "1") run_install_auto ;;   "1") run_install auto ;;
162           "2") run_install_normal ;;   "2") run_install normal ;;
163   "3") run_install_flash ;;   "3") run_install single ;;
164   "") dialog_setup_system_menu;;   "") dialog_setup_system_menu;;
165   esac   esac
166   fi   fi
# Line 162  dialog_hardware_detection() Line 178  dialog_hardware_detection()
178   hwtmp="/tmp/hwtmp.sh"   hwtmp="/tmp/hwtmp.sh"
179   fi   fi
180    
181   [[ ! -z ${installdevs} ]] && installdevs=""   run_hardware_detection_disks
182    
183   echo "dialog \\"  > ${hwtmp}   echo "dialog \\"  > ${hwtmp}
184   echo "--backtitle \"${TITLE}\" \\" >> ${hwtmp}   echo "--backtitle \"${TITLE}\" \\" >> ${hwtmp}
# Line 172  dialog_hardware_detection() Line 188  dialog_hardware_detection()
188   echo "--msgbox \"Gefundene Hardware:\n\n \\" >> ${hwtmp}   echo "--msgbox \"Gefundene Hardware:\n\n \\" >> ${hwtmp}
189   echo " Festplatten:\n \\" >> ${hwtmp}   echo " Festplatten:\n \\" >> ${hwtmp}
190    
191   if [[ ! -z ${scsidisks} ]]   if [[ ! -z ${ALL_DISKS} ]]
192   then   then
193   for i in ${scsidisks}   for i in ${ALL_DISKS}
194   do   do
195   if [[ ${i} != ${cdromdev} ]]   echo " \\Z3${i}\\Zn\n \\" >> ${hwtmp}
  then  
  echo " \\Z7SCSI: \\Z3${i}\\Zn\n \\" >> ${hwtmp}  
  installdevs="${installdevs} ${i}"  
  fi  
196   done   done
197   fi   fi
198    
199   if [[ ! -z ${idedisks} ]]   if [[ ! -z ${ALL_CDROMS} ]]
200   then   then
201   for i in ${idedisks}   echo " \n \\" >> ${hwtmp}
202     echo " CDROM Laufwerke:\n \\" >> ${hwtmp}
203     for i in ${ALL_CDROMS}
204   do   do
205   if [[ ${i} != ${cdromdev} ]]   echo " \\Z3${i}\\Zn\n \\" >> ${hwtmp}
  then  
  echo " \\Z7IDE:  \\Z3${i}\\Zn\n \\" >> ${hwtmp}  
  installdevs="${installdevs} ${i}"  
  fi  
206   done   done
207   fi   fi
208    
  if [[ ! -z ${cdromdev} ]]  
  then  
  echo " \n \\" >> ${hwtmp}  
  echo " \\Z7andere Laufwerke:\n \\" >> ${hwtmp}  
  echo " CDROM: \\Z3${cdromdev}\\Zn\n \\" >> ${hwtmp}  
  fi  
   
209   # other devices   # other devices
210   run_hardware_detection   run_hardware_detection
211   case "${SPECIALDEVICE}" in   case "${SPECIALDEVICE}" in
212   zotac) echo " \n\n\n \\Z2Zotac Device erkannt!\\Zn \\" >> ${hwtmp} ;;   zotac*) echo " \n \\Z2Zotac Device erkannt.\\Zn \\" >> ${hwtmp} ;;
213   "rangee+256mb")  echo " \n\n\n \\Z2Rangee Device mit Flashdisk (=< 256MB) erkannt!\\Zn \\" >> ${hwtmp} ;;   rangee) echo " \n \\Z2Rangee Device erkannt.\\Zn \\" >> ${hwtmp} ;;
214   rangee) echo " \n\n\n \\Z2Rangee Device erkannt!\\Zn \\" >> ${hwtmp} ;;   maxdata) echo " \n \\Z2Maxdata Device erkannt.\\Zn \\" >> ${hwtmp} ;;
215   *) echo " \n\n\n \\ZnStandard Device erkannt!\\Zn \\" >> ${hwtmp} ;;   i845) echo " \n \\Z2Intel i845 Device erkannt.\\Zn \\" >> ${hwtmp} ;;
216     *) echo " \n \\ZnStandard Device erkannt.\\Zn \\" >> ${hwtmp} ;;
217   esac   esac
218     if [[ ${FORMFACTOR} = laptop ]]
219     then
220     echo " \n \\ZnFormfactor Laptop, Powersave Modus 'ondemand' wird aktiviert.\\Zn \\" >> ${hwtmp}
221     fi
222    
223   echo " \" 13 70" >> ${hwtmp}   echo " \" 14 70" >> ${hwtmp}
224   chmod a+x ${hwtmp}   chmod a+x ${hwtmp}
225   ${hwtmp}   ${hwtmp}
226    
# Line 223  dialog_hardware_detection() Line 231  dialog_hardware_detection()
231   fi   fi
232  }  }
233    
234  dialog_setup_hdd_partitions_manuell()  dialog_setup_hdd_partitions()
235  {  {
236   local i   local i
237    
238   if [[ -z ${installdevs} ]]   if [[ -z ${ALL_DISKS} ]]
239   then   then
240   dialog \   dialog \
241   --backtitle "${TITLE}" \   --backtitle "${TITLE}" \
# Line 243  dialog_setup_hdd_partitions_manuell() Line 251  dialog_setup_hdd_partitions_manuell()
251   echo "--stdout \\" >> /tmp/hddtmp.sh   echo "--stdout \\" >> /tmp/hddtmp.sh
252   echo "--menu \"Installations Laufwerk auswaehlen:\" 10 70 3 \\" >> /tmp/hddtmp.sh   echo "--menu \"Installations Laufwerk auswaehlen:\" 10 70 3 \\" >> /tmp/hddtmp.sh
253    
254   for i in ${installdevs}   for i in ${ALL_DISKS}
255   do   do
256   echo "\"${i}\" \"\" \\" >> /tmp/hddtmp.sh   echo "\"${i}\" \"\" \\" >> /tmp/hddtmp.sh
257   done   done
# Line 256  dialog_setup_hdd_partitions_manuell() Line 264  dialog_setup_hdd_partitions_manuell()
264   if [[ ${RES} -eq 0 ]]   if [[ ${RES} -eq 0 ]]
265   then   then
266   dialog_setup_hdd_info   dialog_setup_hdd_info
267   setup_hdd_partitions_manuell   setup_hdd_partitions
  fi  
  fi  
 }  
   
 dialog_setup_hdd_partitions_manuell_flash()  
 {  
  local i  
   
  if [[ -z ${installdevs} ]]  
  then  
  dialog \  
  --backtitle "${TITLE}" \  
  --ok-label "Beenden" \  
  --msgbox "Kein geeignetes Laufwerk gefunden.\nDie Installation ist fehlgeschlagen." 6 70  
  exit 1  
  else  
   
  echo "dialog \\" > /tmp/hddtmp.sh  
  echo "--backtitle \"${TITLE}\" \\" >> /tmp/hddtmp.sh  
  echo "--ok-label \"Weiter\" \\" >> /tmp/hddtmp.sh  
  echo "--cancel-label \"Beenden\" \\" >> /tmp/hddtmp.sh  
  echo "--stdout \\" >> /tmp/hddtmp.sh  
  echo "--menu \"Installations Laufwerk auswaehlen:\" 10 70 3 \\" >> /tmp/hddtmp.sh  
   
  for i in ${installdevs}  
  do  
  echo "\"${i}\" \"\" \\" >> /tmp/hddtmp.sh  
  done  
  echo -e "\n" >> /tmp/hddtmp.sh  
   
  chmod a+x /tmp/hddtmp.sh  
  HDD="$(/tmp/hddtmp.sh)"  
  RES=$?  
  [[ ${RES} -eq 1 ]] && return 1  
  if [[ ${RES} -eq 0 ]]  
  then  
  dialog_setup_hdd_info_flash  
  setup_hdd_partitions_manuell_flash  
  fi  
  fi  
 }  
   
 dialog_setup_hdd_partitions_auto()  
 {  
  local i  
   
  if [[ -z ${installdevs} ]]  
  then  
  dialog \  
  --backtitle "${TITLE}" \  
  --ok-label "Beenden" \  
  --msgbox "Kein geeignetes Laufwerk gefunden.\nDie Installation ist fehlgeschlagen." 6 70  
  exit 1  
  else  
   
  echo "dialog \\" > /tmp/hddtmp.sh  
  echo "--backtitle \"${TITLE}\" \\" >> /tmp/hddtmp.sh  
  echo "--ok-label \"Weiter\" \\" >> /tmp/hddtmp.sh  
  echo "--cancel-label \"Beenden\" \\" >> /tmp/hddtmp.sh  
  echo "--stdout \\" >> /tmp/hddtmp.sh  
  echo "--menu \"Installations Laufwerk auswaehlen:\" 10 70 3 \\" >> /tmp/hddtmp.sh  
   
  for i in ${installdevs}  
  do  
  echo "\"${i}\" \"\" \\" >> /tmp/hddtmp.sh  
  done  
  echo -e "\n" >> /tmp/hddtmp.sh  
   
  chmod a+x /tmp/hddtmp.sh  
  HDD="$(/tmp/hddtmp.sh)"  
  RES=$?  
  [[ ${RES} -eq 1 ]] && return 1  
  if [[ ${RES} -eq 0 ]]  
  then  
  dialog_setup_hdd_info_auto  
  dialog_setup_hdd_create_partitions  
  setup_hdd_partitions_auto  
268   fi   fi
269   fi   fi
270  }  }
# Line 379  dialog_install_meter() Line 310  dialog_install_meter()
310   return 0   return 0
311  }  }
312    
   
313  dialog_install_bootsector()  dialog_install_bootsector()
314  {  {
315   dialog \   dialog \
# Line 426  dialog_main() Line 356  dialog_main()
356   if [[ ${RES} -eq 0 ]]   if [[ ${RES} -eq 0 ]]
357   then   then
358   case ${METHOD} in   case ${METHOD} in
359           "1") dialog_setup_system_menu ;;   "1") dialog_setup_system_menu ;;
360   "2") dialog_hardware_detection ;;   "2") dialog_hardware_detection ;;
361   "3") install_do_reboot ;;   "3") install_do_reboot ;;
362   "4") /bin/bash --login -i ;;   "4") /bin/bash --login -i ;;
# Line 436  dialog_main() Line 366  dialog_main()
366  }  }
367    
368  #################################################  #################################################
369  # Install Komandos #  # Install Commands #
370  #################################################  #################################################
371  run_hardware_detection()  run_hardware_detection()
372  {  {
373   local hwinfo   local hwinfo
374     hwinfo="$(hwinfo --bios --storage --pci --gfxcard --sys)"
  hwinfo="$(hwinfo --bios --storage)"  
375    
376   # check for special devices/clients:   # check for special devices/clients:
377   # 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
# Line 459  run_hardware_detection() Line 388  run_hardware_detection()
388    
389   # only add this for grub legacy, grub2 detect these settings on its own   # only add this for grub legacy, grub2 detect these settings on its own
390   export GRUBLEGACYOPTS="rootdelay=8"   export GRUBLEGACYOPTS="rootdelay=8"
391   export SPECIALDEVICE="zotac"   # there are two zotac types in the wild, nvidia based gfx and intel
392     if [[ ! -z $(echo "${hwinfo}" | grep -i nouveau) ]]
393     then
394     export SPECIALDEVICE="zotac_nvidia"
395     else
396     export SPECIALDEVICE="zotac_intel"
397     fi
398   fi   fi
399    
400   # check for special devices/clients:   # check for special devices/clients:
# Line 471  run_hardware_detection() Line 406  run_hardware_detection()
406   export SPECIALDEVICE="rangee"   export SPECIALDEVICE="rangee"
407   export GRUBLEGACYOPTS=""   export GRUBLEGACYOPTS=""
408   fi   fi
409    
410     # check for special devices/clients:
411     # check for maxdata / i810/ i815 Chipsets and disable KMS and use i810fb frambuffer
412     if [[ ! -z $(echo "${hwinfo}" | grep -i i810) ]] || [[ ! -z $(echo "${hwinfo}" | grep -i i815) ]]
413     then
414     export SPECIALDEVICE="maxdata"
415     export GRUBLEGACYOPTS=""
416     fi
417    
418     # check for i845 Chipsets and disable KMS and use 915 drm driver
419     if [[ ! -z $(echo "${hwinfo}" | grep -i i845) ]]
420     then
421     export SPECIALDEVICE="i845"
422     # unset default video=1024x768 opt or the drm driver breaks
423     export KERNELOPTS="quiet"
424     export GRUBLEGACYOPTS=""
425     # enable full kms support
426     export GRUB2GFXPAYLOAD="keep"
427     fi
428    
429     # check for radeon gfxcards
430     if [[ ! -z $(echo "${hwinfo}" | grep -i radeon) ]]
431     then
432     # enable full kms support
433     export GRUB2GFXPAYLOAD="keep"
434     fi
435    
436     # check for special devices/clients:
437     # check for laptops and activate cpufreq scaling
438     if [[ $(echo "${hwinfo}" | grep 'Formfactor:' | sed 's:.*Formfactor\:\ \"\(.*\)\":\1:') = laptop ]]
439     then
440     export FORMFACTOR="laptop"
441     export KERNELOPTS="${KERNELOPTS} cpufreq.governor=ondemand"
442     fi
443    }
444    
445    run_hardware_detection_disks()
446    {
447     local bootdev
448    
449     # all disks but exclude ramdisks
450     export ALL_DISKS=$(get_hwinfo disk | sed '/\/dev\/ram[0-9].*/d')
451     # remove the boot device from ALL_DISKS if it was an usbstick
452     if [[ $(grep '[[:space:]]/mnt/cdrom[[:space:]]' /proc/mounts | cut -d' ' -f3) != iso9660 ]]
453     then
454     bootdev="$(grep '[[:space:]]/mnt/cdrom[[:space:]]' /proc/mounts | cut -d' ' -f1 | sed 's:[0-9]::g')"
455     export ALL_DISKS=$(echo "${ALL_DISKS}" | grep -v "${bootdev}")
456     fi
457     export ALL_CDROMS="$(get_hwinfo cdrom)"
458  }  }
459    
460  hdd_size_below_256mb()  hdd_size_below_256mb()
# Line 491  hdd_size_below_256mb() Line 475  hdd_size_below_256mb()
475   return "${retval}"   return "${retval}"
476  }  }
477    
478  setup_hdd_partitions_auto()  setup_hdd_partitions()
479  {  {
480   ROOTHDD="${HDD}1"   case "${INSTALL_METHOD}" in
481     normal)
482     BOOTHDD="${HDD}1"
483     SWAPHDD="${HDD}2"
484     ROOTHDD="${HDD}3"
485     ;;
486    
487     single|auto)
488     BOOTHDD=""
489     SWAPHDD=""
490     ROOTHDD="${HDD}1"
491     ;;
492     esac
493    
494   # run this only if FDISKPARTITIONBELOW256MB is not already 1   if [[ ${INSTALL_METHOD} = auto ]]
  if [[ ${FDISKPARTIONBELOW256MB} != 1 ]]  
495   then   then
496   if hdd_size_below_256mb ${HDD}   # run this only if FDISKPARTITIONBELOW256MB is not already 1
497     if [[ ${FDISKPARTIONBELOW256MB} != 1 ]]
498   then   then
499   FDISKPARTIONBELOW256MB=1   if hdd_size_below_256mb ${HDD}
500   else   then
501   FDISKPARTIONBELOW256MB=0   FDISKPARTIONBELOW256MB=1
502     else
503     FDISKPARTIONBELOW256MB=0
504     fi
505   fi   fi
  fi  
506    
507   ## delete disk   ## delete disk
508   dd if=/dev/zero of=${HDD} count=1 &> /dev/null || die   dd if=/dev/zero of=${HDD} count=1 &> /dev/null || die
509    
510   if [[ ${FDISKPARTIONBELOW256MB} = 1 ]]   if [[ ${FDISKPARTIONBELOW256MB} = 1 ]]
511   then   then
512   ## setup one bootable partition   ## setup one bootable partition
513   #1. n= new disk   #1. n= new disk
514   #2. p= primary disk   #2. p= primary disk
515   #3. 1= first partition   #3. 1= first partition
516   #4. 2= default sector start // small disk needs more space for grub2 mbr sector   #4. 2= default sector start // small disk needs more space for grub2 mbr sector
517   #5. ''= defaul sector end   #5. ''= defaul sector end
518   #6. a= bootable flag   #6. a= bootable flag
519   #7. 1= boot flag for partition 1   #7. 1= boot flag for partition 1
520   #8. w= write/quit   #8. w= write/quit
521   fdisk ${HDD} &> /dev/null << EOF   fdisk ${HDD} &> /dev/null << EOF
522  n  n
523  p  p
524  1  1
# Line 530  a Line 528  a
528  1  1
529  w  w
530  EOF  EOF
531   else   else
532   ## setup one bootable partition   ## setup one bootable partition
533   #1. n= new disk   #1. n= new disk
534   #2. p= primary disk   #2. p= primary disk
535   #3. 1= first partition   #3. 1= first partition
536   #4. ''= default sector start   #4. ''= default sector start
537   #5. ''= defaul sector end   #5. ''= defaul sector end
538   #6. a= bootable flag   #6. a= bootable flag
539   #7. 1= boot flag for partition 1   #7. 1= boot flag for partition 1
540   #8. w= write/quit   #8. w= write/quit
541   fdisk ${HDD} &> /dev/null << EOF   fdisk ${HDD} &> /dev/null << EOF
542  n  n
543  p  p
544  1  1
# Line 550  a Line 548  a
548  1  1
549  w  w
550  EOF  EOF
551     fi
552     else
553     ## hdds partitionieren manuell
554     cfdisk ${HDD} || die
555   fi   fi
556  }  }
557    
 setup_hdd_partitions_manuell()  
 {  
  BOOTHDD="${HDD}1"  
  SWAPHDD="${HDD}2"  
  ROOTHDD="${HDD}3"  
   
  ## hdds partitionieren manuell  
  cfdisk ${HDD} || die  
 }  
   
 setup_hdd_partitions_manuell_flash()  
 {  
  ROOTHDD="${HDD}1"  
   
  ## hdds partitionieren manuell  
  cfdisk ${HDD} || die  
 }  
   
558  setup_hdd_format()  setup_hdd_format()
559  {  {
560   mkswap ${SWAPHDD} || die   if [[ -n ${SWAPHDD} ]]
561   mke2fs -j -q ${BOOTHDD} || die   then
562   mke2fs -j -q ${ROOTHDD} || die   mkswap ${SWAPHDD} || die
563  }   fi
564     if [[ -n ${BOOTHDD} ]]
565  setup_hdd_format_flash()   then
566  {   mkfs.${FORMAT_FILESYSTEM} -q ${BOOTHDD} || die
567   mke2fs -j -q ${ROOTHDD} || die   fi
568     if [[ -n ${ROOTHDD} ]]
569     then
570     mkfs.${FORMAT_FILESYSTEM} -q ${ROOTHDD} || die
571     fi
572  }  }
573    
574  install_mount_rootfs()  install_mount_rootfs()
575  {  {
576   swapon ${SWAPHDD} || die   if [[ -n ${SWAPHDD} ]]
577   mount ${ROOTHDD} ${INSTALLPATH} || die   then
578   install -d ${INSTALLPATH}/boot || die   swapon ${SWAPHDD} || die
579   mount ${BOOTHDD} ${INSTALLPATH}/boot || die   fi
580   cd ${INSTALLPATH} || die   if [[ -n ${ROOTHDD} ]]
581  }   then
582     mount ${ROOTHDD} ${INSTALLPATH} || die
583     fi
584     if [[ -n ${BOOTHDD} ]]
585     then
586     install -d ${INSTALLPATH}/boot || die
587     mount ${BOOTHDD} ${INSTALLPATH}/boot || die
588     fi
589    
 install_mount_rootfs_flash()  
 {  
  mount ${ROOTHDD} ${INSTALLPATH} || die  
  install -d ${INSTALLPATH}/boot || die  
590   cd ${INSTALLPATH} || die   cd ${INSTALLPATH} || die
591  }  }
592    
# Line 623  install_bootsector_chroot() Line 614  install_bootsector_chroot()
614   if [[ -f ${INSTALLPATH}/etc/conf.d/grub ]]   if [[ -f ${INSTALLPATH}/etc/conf.d/grub ]]
615   then   then
616   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
617     sed -i "s:^\(export GRUB_GFXPAYLOAD_LINUX=\).*:\1\"${GRUB2GFXPAYLOAD}\":" ${INSTALLPATH}/etc/conf.d/grub || die
618   else   else
619   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
620     echo "export GRUB_GFXPAYLOAD_LINUX=\"${GRUB2GFXPAYLOAD}\"" >>  ${INSTALLPATH}/etc/conf.d/grub || die
621   fi   fi
622   echo 'grub-mkdevicemap' > ${INSTALLPATH}/root/.installrc || die   echo 'grub-mkdevicemap' > ${INSTALLPATH}/root/.installrc || die
623   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 694  install_bootsector_chroot() Line 687  install_bootsector_chroot()
687   echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die   echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die
688   fi   fi
689    
690   # bootsector schreiben chrooted schreiben (lfs/magellan)   # write bootsector chrooted (lfs/magellan)
691   cat > ${INSTALLPATH}/root/.installrc << CHROOTEOF   cat > ${INSTALLPATH}/root/.installrc << CHROOTEOF
692  /usr/sbin/grub --no-floppy --batch << "EOF" 1> /dev/null 2> /dev/null  /usr/sbin/grub --no-floppy --batch << "EOF" 1> /dev/null 2> /dev/null
693  root (hd0,0)  root (hd0,0)
# Line 725  is_initrd_supported() Line 718  is_initrd_supported()
718    
719  install_initrd_chroot()  install_initrd_chroot()
720  {  {
721     local CONFIG
722    
723   # only generate initrds if the cmd exists   # only generate initrds if the cmd exists
724   is_initrd_supported || return 0   is_initrd_supported || return 0
725    
# Line 733  install_initrd_chroot() Line 728  install_initrd_chroot()
728   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"
729   SATAMODS="sata_via sata_sis sata_nv"   SATAMODS="sata_via sata_sis sata_nv"
730   DRMMODS="i915 mga nouveau r128 radeon savage sis tdfx ttm via"   DRMMODS="i915 mga nouveau r128 radeon savage sis tdfx ttm via"
731   FBMODS="uvesafb"   OTHERMODS=""
732     case ${SPECIALDEVICE} in
733     zotac_intel|i845) FBMODS=""; DRMMODS="i915" ;;
734     zotac_nvidia) FBMODS=""; DRMMODS="nouveau" ;;
735     rangee) FBMODS="" ;; ## fallback to vesafb, viafb does not run on all CLE266 boards
736     # not working with kms enabled drivers -> segfaults
737     #maxdata) FBMODS="i810fb" ;; ## check for maxdata / i810/ i815 Chipsets and disable KMS and use i810fb frambuffer
738     maxdata) FBMODS="" ;;
739     *) FBMODS="uvesafb" ;;
740     esac
741    
742     if [[ ${FORMFACTOR} = laptop ]]
743     then
744     OTHERMODS="acpi-cpufreq cpufreq_ondemand cpufreq_conservative cpufreq_powersave"
745     fi
746    
747   # install an appropriate uvesafb.conf   # install an appropriate uvesafb.conf
748   install -d ${INSTALLPATH}/etc/modprobe.d || die   CONFIG=${INSTALLPATH}/etc/modprobe.d/uvesafb.conf
749   echo "options uvesafb mode_option=1024x768-32@60 scroll=ywrap" > ${INSTALLPATH}/etc/modprobe.d/uvesafb.conf || die   clearconfig
750     addconfig "options uvesafb mode_option=1024x768-32@60 scroll=ywrap"
751    
752     # install an appropriate viafb.conf
753     CONFIG=${INSTALLPATH}/etc/modprobe.d/viafb.conf
754     clearconfig
755     addconfig "options viafb viafb_mode=1024x768 viafb_refresh=60"
756    
757     # install an appropriate i810fb.conf
758     CONFIG=${INSTALLPATH}/etc/modprobe.d/i810fb.conf
759     clearconfig
760     addconfig "options i810fb xres=1024 yres=768 bpp=16 mtrr=1 hsync1=30 hsync2=62 vsync1=30 vsync2=60"
761    
762   cat > ${INSTALLPATH}/root/.installrc << CHROOTEOF   cat > ${INSTALLPATH}/root/.installrc << CHROOTEOF
763  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
764  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
765  exit 0  exit 0
766  CHROOTEOF  CHROOTEOF
767    
768   ## enters chroot   ## enter chroot
769   mount -t proc proc ${INSTALLPATH}/proc   mount -t proc proc ${INSTALLPATH}/proc
770   mount -t sysfs sysfs ${INSTALLPATH}/sys   mount -t sysfs sysfs ${INSTALLPATH}/sys
771   mount -o bind /dev ${INSTALLPATH}/dev   mount -o bind /dev ${INSTALLPATH}/dev
# Line 794  install_system_settings() Line 814  install_system_settings()
814   # schreibe fstab   # schreibe fstab
815   if is_uuid_supported   if is_uuid_supported
816   then   then
817   echo -e "UUID=$(get_uuid ${BOOTHDD})\t/boot\t${FORMAT_FILESYSTEM}\tnoatime,noauto\t1 1" > ${INSTALLPATH}/etc/fstab || die   if [[ -n ${BOOTHDD} ]]
818   echo -e "UUID=$(get_uuid ${ROOTHDD})\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" >> ${INSTALLPATH}/etc/fstab || die   then
819     echo -e "UUID=$(get_uuid ${BOOTHDD})\t/boot\t${FORMAT_FILESYSTEM}\tnoatime,noauto\t1 1" > ${INSTALLPATH}/etc/fstab || die
820     fi
821     if [[ -n ${ROOTHDD} ]]
822     then
823     echo -e "UUID=$(get_uuid ${ROOTHDD})\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" >> ${INSTALLPATH}/etc/fstab || die
824     fi
825   else   else
826   echo -e "${BOOTHDD}\t/boot\t${FORMAT_FILESYSTEM}\tnoatime,noauto\t1 1" > ${INSTALLPATH}/etc/fstab || die   if [[ -n ${BOOTHDD} ]]
827   echo -e "${ROOTHDD}\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" >> ${INSTALLPATH}/etc/fstab || die   then
828     echo -e "${BOOTHDD}\t/boot\t${FORMAT_FILESYSTEM}\tnoatime,noauto\t1 1" > ${INSTALLPATH}/etc/fstab || die
829     fi
830     if [[ -n ${ROOTHDD} ]]
831     then
832     echo -e "${ROOTHDD}\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" >> ${INSTALLPATH}/etc/fstab || die
833     fi
834   fi   fi
835   # 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
836   #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" >> ${INSTALLPATH}/etc/fstab || die
# Line 807  install_system_settings() Line 839  install_system_settings()
839    
840   # install network config skeleton   # install network config skeleton
841   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
 }  
842    
843  install_system_settings_flash()   # intel framebufer quirk
844  {   if [[ -e /proc/fb ]]
  # schreibe fstab  
  if is_uuid_supported  
845   then   then
846   echo -e "UUID=$(get_uuid ${ROOTHDD})\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" > ${INSTALLPATH}/etc/fstab || die   if [[ ! -z $(grep 'inteldrmfb' /proc/fb) ]]
847   else   then
848   echo -e "${ROOTHDD}\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" > ${INSTALLPATH}/etc/fstab || die   fbdev=$(grep 'inteldrmfb' /proc/fb | sed 's:\([0-9]\).*:\1:')
849     if [[ ${fbdev} != 0 ]]
850     then
851     sed -i "s:^\(SPLASH_DEV=\).*:\1\"/dev/fb${fbdev}\":" ${INSTALLPATH}/etc/splash/splash.conf || die
852     fi
853     fi
854   fi   fi
  echo -e "proc\t/proc\tproc\tdefaults\t0 0" >> ${INSTALLPATH}/etc/fstab || die  
  echo -e "shm\t/dev/shm\ttmpfs\tdefaults\t0 0" >> ${INSTALLPATH}/etc/fstab || die  
855  }  }
856    
857  install_umount_rootfs()  install_umount_rootfs()
858  {  {
859   cd /   cd /
860   umount ${INSTALLPATH}/boot || die   if [[ -n ${BOOTHDD} ]]
861   umount ${INSTALLPATH} || die   then
862   swapoff ${SWAPHDD} || die   umount ${INSTALLPATH}/boot || die
863  }   fi
864     if [[ -n ${ROOTHDD} ]]
865  install_umount_rootfs_flash()   then
866  {   umount ${INSTALLPATH} || die
867   cd /   fi
868   umount ${INSTALLPATH} || die   if [[ -n ${SWAPHDD} ]]
869     then
870     swapoff ${SWAPHDD} || die
871     fi
872  }  }
873    
874  install_do_reboot()  install_do_reboot()
# Line 842  install_do_reboot() Line 877  install_do_reboot()
877  }  }
878    
879  #################################################  #################################################
880  #     Install Ablauf Scripte #  #     Install Main Scripts #
881  #################################################  #################################################
882    
883  run_install_normal()  run_install()
884  {  {
885     local method="$1"
886    
887     # setup install environment
888     export KERNELOPTS="${DEFAULT_KERNELOPTS}"
889     export GRUBLEGACYOPTS="${GRUBLEGACYOPTS}"
890     export GRUB2OPTS="${GRUB2OPTS}"
891     export GRUB2GFXPAYLOAD="${DEFAULT_GRUB2GFXPAYLOAD}"
892     export FORMFACTOR="${DEFAULT_FORMFACTOR}"
893     export FORMAT_FILESYSTEM="${DEFAULT_FORMAT_FILESYSTEM}"
894    
895     case "${method}" in
896     auto)
897     export INSTALL_METHOD="${method}"
898     ;;
899     normal)
900     export INSTALL_METHOD="${method}"
901     ;;
902     single)
903     export INSTALL_METHOD="${method}"
904     ;;
905     *)
906     echo "Unknown install method '${method}', aborting."
907     exit 1
908     ;;
909     esac
910    
911   dialog_hardware_detection   dialog_hardware_detection
912    
913   dialog_setup_hdd_partitions_manuell   dialog_setup_hdd_partitions
914   dialog_setup_hdd_format   dialog_setup_hdd_format
915   setup_hdd_format > /dev/null   setup_hdd_format > /dev/null
916   install_mount_rootfs   install_mount_rootfs
# Line 867  run_install_normal() Line 928  run_install_normal()
928   dialog_install_successful   dialog_install_successful
929  }  }
930    
931  run_install_flash()  # set some proper traps
932  {  trap "trap_exit" SIGINT SIGQUIT
  dialog_hardware_detection  
   
  dialog_setup_hdd_partitions_manuell_flash  
  dialog_setup_hdd_format  
  setup_hdd_format_flash > /dev/null  
  install_mount_rootfs_flash  
  (install_system_image > /tmp/install.log) 2> /tmp/install_errors.log | dialog_install_meter | dialog_install_system_image  
   
  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  
 }  
   
 run_install_auto()  
 {  
  dialog_hardware_detection  
   
  dialog_setup_hdd_partitions_auto  
  dialog_setup_hdd_format  
  setup_hdd_format_flash > /dev/null  
  install_mount_rootfs_flash  
  (install_system_image > /tmp/install.log) 2> /tmp/install_errors.log | dialog_install_meter | dialog_install_system_image  
   
  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  
 }  
933    
934  dialog_main  dialog_main
935    

Legend:
Removed from v.3199  
changed lines
  Added in v.6832