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

alx-src/trunk/alxinstall-ng/bin/alxinstall-ng.sh revision 1579 by niro, Mon Oct 18 14:21:27 2010 UTC alx-src/trunk/alxinstall-ng/bin/alxinstall-ng.sh.in revision 6829 by niro, Thu Jul 23 11:50:00 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="0.3.6"  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
25  CURRENTLINE=0  # standard kernel opts
26  #TOTALLINES=11072 # -> now in images.conf  DEFAULT_KERNELOPTS="quiet video=1024x768"
27    
28  # standart kernel opts  # grub options
29  KERNELOPTS="quiet"  DEFAULT_GRUBLEGACYOPTS=""
30    DEFAULT_GRUB2OPTS=""
31    DEFAULT_GRUB2GFXPAYLOAD="1024x768x16,1024x768"
32    
33  # default specialdevices  # default specialdevices
34    DEFAULT_FORMFACTOR="desktop"
35    
36    # target filesystem
37    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=""  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 69  dialog_warning() Line 82  dialog_warning()
82    
83  dialog_setup_hdd_info()  dialog_setup_hdd_info()
84  {  {
85     case "${INSTALL_METHOD}" in
86     auto)
87     dialog_setup_hdd_info_auto
88     dialog_setup_hdd_create_partitions
89     ;;
90     normal) dialog_setup_hdd_info_normal ;;
91     single) dialog_setup_hdd_info_single ;;
92     esac
93    }
94    
95    dialog_setup_hdd_info_normal()
96    {
97   local SHDD="$(echo ${HDD} | sed 's/\/dev\///')"   local SHDD="$(echo ${HDD} | sed 's/\/dev\///')"
98    
99   dialog \   dialog \
# Line 83  dialog_setup_hdd_info() Line 108  dialog_setup_hdd_info()
108   Bitte ${SHDD}1 als \Z3bootable\Zn markieren." 12 81   Bitte ${SHDD}1 als \Z3bootable\Zn markieren." 12 81
109  }  }
110    
111  dialog_setup_hdd_info_flash()  dialog_setup_hdd_info_single()
112  {  {
113   local SHDD="$(echo $HDD | sed 's/\/dev\///')"   local SHDD="$(echo $HDD | sed 's/\/dev\///')"
114    
# Line 126  dialog_setup_system_menu() Line 151  dialog_setup_system_menu()
151   "" "" \   "" "" \
152   "" "\Z1Experten Modi:\Zn" \   "" "\Z1Experten Modi:\Zn" \
153   "2" "Normale IDE-Disk (Manuell)" \   "2" "Normale IDE-Disk (Manuell)" \
154   "3" "Flash-Speicher (Manuell)")   "3" "Normale IDE Disk (Single)")
155   RES=$?   RES=$?
156   [[ ${RES} -eq 1 ]] && return 1   [[ ${RES} -eq 1 ]] && return 1
157   if [[ ${RES} -eq 0 ]]   if [[ ${RES} -eq 0 ]]
158   then   then
159   case "${i}" in   case "${i}" in
160   "1") run_install_auto ;;   "1") run_install auto ;;
161           "2") run_install_normal ;;   "2") run_install normal ;;
162   "3") run_install_flash ;;   "3") run_install single ;;
163   "") dialog_setup_system_menu;;   "") dialog_setup_system_menu;;
164   esac   esac
165   fi   fi
# Line 152  dialog_hardware_detection() Line 177  dialog_hardware_detection()
177   hwtmp="/tmp/hwtmp.sh"   hwtmp="/tmp/hwtmp.sh"
178   fi   fi
179    
180   [[ ! -z ${installdevs} ]] && installdevs=""   run_hardware_detection_disks
181    
182   echo "dialog \\"  > ${hwtmp}   echo "dialog \\"  > ${hwtmp}
183   echo "--backtitle \"${TITLE}\" \\" >> ${hwtmp}   echo "--backtitle \"${TITLE}\" \\" >> ${hwtmp}
# Line 162  dialog_hardware_detection() Line 187  dialog_hardware_detection()
187   echo "--msgbox \"Gefundene Hardware:\n\n \\" >> ${hwtmp}   echo "--msgbox \"Gefundene Hardware:\n\n \\" >> ${hwtmp}
188   echo " Festplatten:\n \\" >> ${hwtmp}   echo " Festplatten:\n \\" >> ${hwtmp}
189    
190   if [[ ! -z ${scsidisks} ]]   if [[ ! -z ${ALL_DISKS} ]]
191   then   then
192   for i in ${scsidisks}   for i in ${ALL_DISKS}
193   do   do
194   if [[ ${i} != ${cdromdev} ]]   echo " \\Z3${i}\\Zn\n \\" >> ${hwtmp}
  then  
  echo " \\Z7SCSI: \\Z3${i}\\Zn\n \\" >> ${hwtmp}  
  installdevs="${installdevs} ${i}"  
  fi  
195   done   done
196   fi   fi
197    
198   if [[ ! -z ${idedisks} ]]   if [[ ! -z ${ALL_CDROMS} ]]
199   then   then
200   for i in ${idedisks}   echo " \n \\" >> ${hwtmp}
201     echo " CDROM Laufwerke:\n \\" >> ${hwtmp}
202     for i in ${ALL_CDROMS}
203   do   do
204   if [[ ${i} != ${cdromdev} ]]   echo " \\Z3${i}\\Zn\n \\" >> ${hwtmp}
  then  
  echo " \\Z7IDE:  \\Z3${i}\\Zn\n \\" >> ${hwtmp}  
  installdevs="${installdevs} ${i}"  
  fi  
205   done   done
206   fi   fi
207    
  if [[ ! -z ${cdromdev} ]]  
  then  
  echo " \n \\" >> ${hwtmp}  
  echo " \\Z7andere Laufwerke:\n \\" >> ${hwtmp}  
  echo " CDROM: \\Z3${cdromdev}\\Zn\n \\" >> ${hwtmp}  
  fi  
   
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 \\Z2Zotac Device erkannt.\\Zn \\" >> ${hwtmp} ;;
212   *) echo " \n\n\n \\ZnStandard Device erkannt!\\Zn \\" >> ${hwtmp} ;;   rangee) echo " \n \\Z2Rangee Device erkannt.\\Zn \\" >> ${hwtmp} ;;
213     maxdata) echo " \n \\Z2Maxdata Device erkannt.\\Zn \\" >> ${hwtmp} ;;
214     i845) echo " \n \\Z2Intel i845 Device erkannt.\\Zn \\" >> ${hwtmp} ;;
215     *) echo " \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 211  dialog_hardware_detection() Line 230  dialog_hardware_detection()
230   fi   fi
231  }  }
232    
233  dialog_setup_hdd_partitions_manuell()  dialog_setup_hdd_partitions()
234  {  {
235   local i   local i
236    
237   if [[ -z ${installdevs} ]]   if [[ -z ${ALL_DISKS} ]]
238   then   then
239   dialog \   dialog \
240   --backtitle "${TITLE}" \   --backtitle "${TITLE}" \
# Line 231  dialog_setup_hdd_partitions_manuell() Line 250  dialog_setup_hdd_partitions_manuell()
250   echo "--stdout \\" >> /tmp/hddtmp.sh   echo "--stdout \\" >> /tmp/hddtmp.sh
251   echo "--menu \"Installations Laufwerk auswaehlen:\" 10 70 3 \\" >> /tmp/hddtmp.sh   echo "--menu \"Installations Laufwerk auswaehlen:\" 10 70 3 \\" >> /tmp/hddtmp.sh
252    
253   for i in ${installdevs}   for i in ${ALL_DISKS}
254   do   do
255   echo "\"${i}\" \"\" \\" >> /tmp/hddtmp.sh   echo "\"${i}\" \"\" \\" >> /tmp/hddtmp.sh
256   done   done
# Line 244  dialog_setup_hdd_partitions_manuell() Line 263  dialog_setup_hdd_partitions_manuell()
263   if [[ ${RES} -eq 0 ]]   if [[ ${RES} -eq 0 ]]
264   then   then
265   dialog_setup_hdd_info   dialog_setup_hdd_info
266   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  
267   fi   fi
268   fi   fi
269  }  }
# Line 367  dialog_install_meter() Line 309  dialog_install_meter()
309   return 0   return 0
310  }  }
311    
   
312  dialog_install_bootsector()  dialog_install_bootsector()
313  {  {
314   dialog \   dialog \
# Line 414  dialog_main() Line 355  dialog_main()
355   if [[ ${RES} -eq 0 ]]   if [[ ${RES} -eq 0 ]]
356   then   then
357   case ${METHOD} in   case ${METHOD} in
358           "1") dialog_setup_system_menu ;;   "1") dialog_setup_system_menu ;;
359   "2") dialog_hardware_detection ;;   "2") dialog_hardware_detection ;;
360   "3") install_do_reboot ;;   "3") install_do_reboot ;;
361   "4") /bin/bash --login -i ;;   "4") /bin/bash --login -i ;;
# Line 424  dialog_main() Line 365  dialog_main()
365  }  }
366    
367  #################################################  #################################################
368  # Install Komandos #  # Install Commands #
369  #################################################  #################################################
370  run_hardware_detection()  run_hardware_detection()
371  {  {
372     local hwinfo
373     hwinfo="$(hwinfo --bios --storage --pci --gfxcard --sys)"
374    
375   # check for special devices/clients:   # check for special devices/clients:
376   # 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
377   local removable=0   local removable=0
378   if [[ ! -z $(lspci -v | grep -i zotac) ]]   if [[ ! -z $(echo "${hwinfo}" | grep -i zotac) ]]
379   then   then
380   for i in /sys/block/[hs]d*/removable   for i in /sys/block/[hs]d*/removable
381   do   do
# Line 441  run_hardware_detection() Line 385  run_hardware_detection()
385   fi   fi
386   done   done
387    
388   export KERNELOPTS="${KERNELOPTS} rootdelay=8"   # only add this for grub legacy, grub2 detect these settings on its own
389   export SPECIALDEVICE="zotac"   export GRUBLEGACYOPTS="rootdelay=8"
390     # there are two zotac types in the wild, nvidia based gfx and intel
391     if [[ ! -z $(echo "${hwinfo}" | grep -i nouveau) ]]
392     then
393     export SPECIALDEVICE="zotac_nvidia"
394     else
395     export SPECIALDEVICE="zotac_intel"
396     fi
397   fi   fi
 }  
398    
399  setup_hdd_partitions_auto()   # check for special devices/clients:
400  {   # if a rangee and disk ist smaller then 256mb move partion one block further ahead
401   ROOTHDD="${HDD}1"   if [[ ! -z $(echo "${hwinfo}" | grep -i CLE266) ]]
402     then
403     # for a rangee always define partion startblock +1
404     export FDISKPARTIONBELOW256MB="1"
405     export SPECIALDEVICE="rangee"
406     export GRUBLEGACYOPTS=""
407     fi
408    
409   ## delete disk   # check for special devices/clients:
410   dd if=/dev/zero of=${HDD} count=1 &> /dev/null || die   # check for maxdata / i810/ i815 Chipsets and disable KMS and use i810fb frambuffer
411     if [[ ! -z $(echo "${hwinfo}" | grep -i i810) ]] || [[ ! -z $(echo "${hwinfo}" | grep -i i815) ]]
412     then
413     export SPECIALDEVICE="maxdata"
414     export GRUBLEGACYOPTS=""
415     fi
416    
417   ## setup one bootable partition   # check for i845 Chipsets and disable KMS and use 915 drm driver
418   #1. n= new disk   if [[ ! -z $(echo "${hwinfo}" | grep -i i845) ]]
419   #2. p= primary disk   then
420   #3. 1= first partition   export SPECIALDEVICE="i845"
421   #4. ''= default sector start   # unset default video=1024x768 opt or the drm driver breaks
422   #5. ''= defaul sector end   export KERNELOPTS="quiet"
423   #6. a= bootable flag   export GRUBLEGACYOPTS=""
424   #7. 1= boot flag for partition 1   # enable full kms support
425   #8. w= write/quit   export GRUB2GFXPAYLOAD="keep"
426   fdisk ${HDD} &> /dev/null << EOF   fi
 n  
 p  
 1  
427    
428     # check for radeon gfxcards
429     if [[ ! -z $(echo "${hwinfo}" | grep -i radeon) ]]
430     then
431     # enable full kms support
432     export GRUB2GFXPAYLOAD="keep"
433     fi
434    
435  a   # check for special devices/clients:
436  1   # check for laptops and activate cpufreq scaling
437  w   if [[ $(echo "${hwinfo}" | grep 'Formfactor:' | sed 's:.*Formfactor\:\ \"\(.*\)\":\1:') = laptop ]]
438  EOF   then
439     export FORMFACTOR="laptop"
440     export KERNELOPTS="${KERNELOPTS} cpufreq.governor=ondemand"
441     fi
442  }  }
443    
444  setup_hdd_partitions_manuell()  run_hardware_detection_disks()
445  {  {
446   BOOTHDD="${HDD}1"   local bootdev
  SWAPHDD="${HDD}2"  
  ROOTHDD="${HDD}3"  
447    
448   ## hdds partitionieren manuell   # all disks but exclude ramdisks
449   cfdisk ${HDD} || die   export ALL_DISKS=$(get_hwinfo disk | sed '/\/dev\/ram[0-9].*/d')
450     # remove the boot device from ALL_DISKS if it was an usbstick
451     if [[ $(grep '[[:space:]]/mnt/cdrom[[:space:]]' /proc/mounts | cut -d' ' -f3) != iso9660 ]]
452     then
453     bootdev="$(grep '[[:space:]]/mnt/cdrom[[:space:]]' /proc/mounts | cut -d' ' -f1 | sed 's:[0-9]::g')"
454     export ALL_DISKS=$(echo "${ALL_DISKS}" | grep -v "${bootdev}")
455     fi
456     export ALL_CDROMS="$(get_hwinfo cdrom)"
457  }  }
458    
459  setup_hdd_partitions_manuell_flash()  hdd_size_below_256mb()
460  {  {
461   ROOTHDD="${HDD}1"   local hdd="$1"
462     local size
463     local retval
464     [[ -z ${hdd} ]] && die "Error: get_hdd_size() no \$hdd given!"
465    
466     size=$(fdisk -l ${hdd} | grep "Disk.*${hdd}" | sed 's:.*,\ \(.*\)\ byte.*:\1:')
467     if [[ ${size} -le 257000000 ]]
468     then
469     retval="0"
470     else
471     retval="1"
472     fi
473    
474   ## hdds partitionieren manuell   return "${retval}"
  cfdisk ${HDD} || die  
475  }  }
476    
477  setup_hdd_format()  setup_hdd_partitions()
478  {  {
479   mkswap ${SWAPHDD} || die   case "${INSTALL_METHOD}" in
480   mke2fs -j -q ${BOOTHDD} || die   normal)
481   mke2fs -j -q ${ROOTHDD} || die   BOOTHDD="${HDD}1"
482     SWAPHDD="${HDD}2"
483     ROOTHDD="${HDD}3"
484     ;;
485    
486     single|auto)
487     BOOTHDD=""
488     SWAPHDD=""
489     ROOTHDD="${HDD}1"
490     ;;
491     esac
492    
493     if [[ ${INSTALL_METHOD} = auto ]]
494     then
495     # run this only if FDISKPARTITIONBELOW256MB is not already 1
496     if [[ ${FDISKPARTIONBELOW256MB} != 1 ]]
497     then
498     if hdd_size_below_256mb ${HDD}
499     then
500     FDISKPARTIONBELOW256MB=1
501     else
502     FDISKPARTIONBELOW256MB=0
503     fi
504     fi
505    
506     ## delete disk
507     dd if=/dev/zero of=${HDD} count=1 &> /dev/null || die
508    
509     if [[ ${FDISKPARTIONBELOW256MB} = 1 ]]
510     then
511     ## setup one bootable partition
512     #1. n= new disk
513     #2. p= primary disk
514     #3. 1= first partition
515     #4. 2= default sector start // small disk needs more space for grub2 mbr sector
516     #5. ''= defaul sector end
517     #6. a= bootable flag
518     #7. 1= boot flag for partition 1
519     #8. w= write/quit
520     fdisk ${HDD} &> /dev/null << EOF
521    n
522    p
523    1
524    2
525    
526    a
527    1
528    w
529    EOF
530     else
531     ## setup one bootable partition
532     #1. n= new disk
533     #2. p= primary disk
534     #3. 1= first partition
535     #4. ''= default sector start
536     #5. ''= defaul sector end
537     #6. a= bootable flag
538     #7. 1= boot flag for partition 1
539     #8. w= write/quit
540     fdisk ${HDD} &> /dev/null << EOF
541    n
542    p
543    1
544    
545    
546    a
547    1
548    w
549    EOF
550     fi
551     else
552     ## hdds partitionieren manuell
553     cfdisk ${HDD} || die
554     fi
555  }  }
556    
557  setup_hdd_format_flash()  setup_hdd_format()
558  {  {
559   mke2fs -j -q ${ROOTHDD} || die   if [[ -n ${SWAPHDD} ]]
560     then
561     mkswap ${SWAPHDD} || die
562     fi
563     if [[ -n ${BOOTHDD} ]]
564     then
565     mkfs.${FORMAT_FILESYSTEM} -q ${BOOTHDD} || die
566     fi
567     if [[ -n ${ROOTHDD} ]]
568     then
569     mkfs.${FORMAT_FILESYSTEM} -q ${ROOTHDD} || die
570     fi
571  }  }
572    
573  install_mount_rootfs()  install_mount_rootfs()
574  {  {
575   swapon ${SWAPHDD} || die   if [[ -n ${SWAPHDD} ]]
576   mount ${ROOTHDD} ${INSTALLPATH} || die   then
577   install -d ${INSTALLPATH}/boot || die   swapon ${SWAPHDD} || die
578   mount ${BOOTHDD} ${INSTALLPATH}/boot || die   fi
579   cd ${INSTALLPATH} || die   if [[ -n ${ROOTHDD} ]]
580  }   then
581     mount ${ROOTHDD} ${INSTALLPATH} || die
582     fi
583     if [[ -n ${BOOTHDD} ]]
584     then
585     install -d ${INSTALLPATH}/boot || die
586     mount ${BOOTHDD} ${INSTALLPATH}/boot || die
587     fi
588    
 install_mount_rootfs_flash()  
 {  
  mount ${ROOTHDD} ${INSTALLPATH} || die  
  install -d ${INSTALLPATH}/boot || die  
589   cd ${INSTALLPATH} || die   cd ${INSTALLPATH} || die
590  }  }
591    
# Line 528  install_system_image() Line 597  install_system_image()
597  install_bootsector_chroot()  install_bootsector_chroot()
598  {  {
599   local my_roothdd   local my_roothdd
600     local grubconf=${INSTALLPATH}/boot/grub/grub.conf
601     local grub2conf=/boot/grub/grub.cfg
602    
603   ### grubconf schreiben   # check for grub2
604   source ${INSTALLPATH}/boot/kernelversion   if [[ -f ${INSTALLPATH}/sbin/grub-mkconfig ]]
   
  #for alx only  
  if [ -e ${INSTALLPATH}/etc/alx_version ]  
605   then   then
606   OLD_ALXVER="${ALXVER}"   # needed by grub-mkconfig on the first run
607   source ${INSTALLPATH}/etc/alx_version   if [[ ! -f ${INSTALLPATH}/boot/grub/video.lst ]]
608   KRNVER="ALX-${ALXVER}"   then
609   ALXVER="${OLD_ALXVER}"   install -m0644 ${INSTALLPATH}/lib/grub/*/video.lst ${INSTALLPATH}/boot/grub/video.lst || die
610   fi   fi
611    
612   [[ -z ${KRNVER} ]] && KRNVER="AutoSta_LX"   # set kernelopts
613   [[ -z ${KRNINITRD} ]] && KRNINITRD="initrd"   if [[ -f ${INSTALLPATH}/etc/conf.d/grub ]]
614   [[ -z ${KRNIMG} ]] && KRNIMG="vmlinuz"   then
615     sed -i "s:^\(export GRUB_CMDLINE_LINUX_DEFAULT=\).*:\1\"${KERNELOPTS}\":" ${INSTALLPATH}/etc/conf.d/grub || die
616     sed -i "s:^\(export GRUB_GFXPAYLOAD_LINUX=\).*:\1\"${GRUB2GFXPAYLOAD}\":" ${INSTALLPATH}/etc/conf.d/grub || die
617     else
618     echo "export GRUB_CMDLINE_LINUX_DEFAULT=\"${KERNELOPTS}\"" >  ${INSTALLPATH}/etc/conf.d/grub || die
619     echo "export GRUB_GFXPAYLOAD_LINUX=\"${GRUB2GFXPAYLOAD}\"" >>  ${INSTALLPATH}/etc/conf.d/grub || die
620     fi
621     echo 'grub-mkdevicemap' > ${INSTALLPATH}/root/.installrc || die
622     echo "LC_ALL=C grub-mkconfig -o ${grub2conf}  &> /dev/null" >> ${INSTALLPATH}/root/.installrc || die
623     echo "grub-install --no-floppy ${HDD} &> /dev/null" >> ${INSTALLPATH}/root/.installrc || die
624     echo "exit 0" >> ${INSTALLPATH}/root/.installrc || die
625    
626   # uuid support   # grub-legacy
  if is_uuid_supported  
  then  
  my_roothdd="UUID=$(get_uuid ${ROOTHDD})"  
627   else   else
628   my_roothdd="${ROOTHDD}"   ### grubconf schreiben
629   fi   source ${INSTALLPATH}/boot/kernelversion
630    
631   local grubconf=${INSTALLPATH}/boot/grub/grub.conf   #for alx only
632   : > ${grubconf} || die   if [ -e ${INSTALLPATH}/etc/alx_version ]
633   echo "default 0" >> ${grubconf} || die   then
634   echo "timeout 3" >> ${grubconf} || die   OLD_ALXVER="${ALXVER}"
635   # using current root password   source ${INSTALLPATH}/etc/alx_version
636   echo "password --md5 $(cat ${INSTALLPATH}/etc/shadow | grep root | cut -d: -f2)"  >> ${grubconf} || die   KRNVER="ALX-${ALXVER}"
637     ALXVER="${OLD_ALXVER}"
638     fi
639    
640   echo  >> ${grubconf} || die   [[ -z ${KRNVER} ]] && KRNVER="AutoSta_LX"
641   echo "# normal boot" >> ${grubconf} || die   [[ -z ${KRNINITRD} ]] && KRNINITRD="initrd"
642   echo "title ${KRNVER}" >> ${grubconf} || die   [[ -z ${KRNIMG} ]] && KRNIMG="vmlinuz"
  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  
643    
644   echo >> ${grubconf} || die   # uuid support
645   echo "# admin boot" >> ${grubconf} || die   if is_uuid_supported
646   echo "title ${KRNVER} - Re-run hardware-detection" >> ${grubconf} || die   then
647   echo "lock"  >> ${grubconf} || die   my_roothdd="UUID=$(get_uuid ${ROOTHDD})"
648   echo "root (hd0,0)" >> ${grubconf} || die   else
649   echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} hardware-auto-detection" >> ${grubconf} || die   my_roothdd="${ROOTHDD}"
650   if is_initrd_supported   fi
  then  
  echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die  
  fi  
651    
652   echo >> ${grubconf} || die   : > ${grubconf} || die
653   echo "title ${KRNVER} - Reset *all* local settings" >> ${grubconf} || die   echo "default 0" >> ${grubconf} || die
654   echo "lock"  >> ${grubconf} || die   echo "timeout 3" >> ${grubconf} || die
655   echo "root (hd0,0)" >> ${grubconf} || die   # using current root password
656   echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} alx-reset-settings" >> ${grubconf} || die   echo "password --md5 $(cat ${INSTALLPATH}/etc/shadow | grep root | cut -d: -f2)"  >> ${grubconf} || die
657   if is_initrd_supported  
658   then   echo  >> ${grubconf} || die
659   echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die   echo "# normal boot" >> ${grubconf} || die
660   fi   echo "title ${KRNVER}" >> ${grubconf} || die
661     echo "root (hd0,0)" >> ${grubconf} || die
662     echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS}" >> ${grubconf} || die
663     if is_initrd_supported
664     then
665     echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die
666     fi
667    
668   # bootsector schreiben chrooted schreiben (lfs/magellan)   echo >> ${grubconf} || die
669   cat > ${INSTALLPATH}/root/.bashrc << CHROOTEOF   echo "# admin boot" >> ${grubconf} || die
670     echo "title ${KRNVER} - Re-run hardware-detection" >> ${grubconf} || die
671     echo "lock"  >> ${grubconf} || die
672     echo "root (hd0,0)" >> ${grubconf} || die
673     echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS} hardware-auto-detection" >> ${grubconf} || die
674     if is_initrd_supported
675     then
676     echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die
677     fi
678    
679     echo >> ${grubconf} || die
680     echo "title ${KRNVER} - Reset *all* local settings" >> ${grubconf} || die
681     echo "lock"  >> ${grubconf} || die
682     echo "root (hd0,0)" >> ${grubconf} || die
683     echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS} alx-reset-settings" >> ${grubconf} || die
684     if is_initrd_supported
685     then
686     echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die
687     fi
688    
689     # write bootsector chrooted (lfs/magellan)
690     cat > ${INSTALLPATH}/root/.installrc << CHROOTEOF
691  /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
692  root (hd0,0)  root (hd0,0)
693  setup (hd0)  setup (hd0)
# Line 600  quit Line 695  quit
695  EOF  EOF
696  exit 0  exit 0
697  CHROOTEOF  CHROOTEOF
698     fi
699    
700   ## enters chroot   ## enters chroot
701   mount -t proc proc ${INSTALLPATH}/proc   mount -t proc proc ${INSTALLPATH}/proc
702   mount -t sysfs sysfs ${INSTALLPATH}/sys   mount -t sysfs sysfs ${INSTALLPATH}/sys
703   mount -o bind /dev ${INSTALLPATH}/dev   mount -o bind /dev ${INSTALLPATH}/dev
704   chroot ${INSTALLPATH} /bin/bash --rcfile /root/.bashrc -i   chroot ${INSTALLPATH} /bin/bash --rcfile /root/.installrc -i
705   umount ${INSTALLPATH}/proc   umount ${INSTALLPATH}/proc
706   umount ${INSTALLPATH}/sys   umount ${INSTALLPATH}/sys
707   umount ${INSTALLPATH}/dev   umount ${INSTALLPATH}/dev
708   rm ${INSTALLPATH}/root/.bashrc   rm ${INSTALLPATH}/root/.installrc
709  }  }
710    
711  is_initrd_supported()  is_initrd_supported()
# Line 621  is_initrd_supported() Line 717  is_initrd_supported()
717    
718  install_initrd_chroot()  install_initrd_chroot()
719  {  {
720     local CONFIG
721    
722   # only generate initrds if the cmd exists   # only generate initrds if the cmd exists
723   is_initrd_supported || return 0   is_initrd_supported || return 0
724    
725   cat > ${INSTALLPATH}/root/.bashrc << CHROOTEOF   DISKMODS="sd_mod"
726  echo "MODULES=\"ext3 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   OLDPATAMODS="amd74xx piix sis5513 via82cxxx"
727     PATAMODS="ata_piix pata_amd pata_mpiix pata_oldpiix pata_sis pata_via"
728     SATAMODS="sata_via sata_sis sata_nv"
729     DRMMODS="i915 mga nouveau r128 radeon savage sis tdfx ttm via"
730     OTHERMODS=""
731     case ${SPECIALDEVICE} in
732     zotac_intel|i845) FBMODS=""; DRMMODS="i915" ;;
733     zotac_nvidia) FBMODS=""; DRMMODS="nouveau" ;;
734     rangee) FBMODS="" ;; ## fallback to vesafb, viafb does not run on all CLE266 boards
735     # not working with kms enabled drivers -> segfaults
736     #maxdata) FBMODS="i810fb" ;; ## check for maxdata / i810/ i815 Chipsets and disable KMS and use i810fb frambuffer
737     maxdata) FBMODS="" ;;
738     *) FBMODS="uvesafb" ;;
739     esac
740    
741     if [[ ${FORMFACTOR} = laptop ]]
742     then
743     OTHERMODS="acpi-cpufreq cpufreq_ondemand cpufreq_conservative cpufreq_powersave"
744     fi
745    
746     # install an appropriate uvesafb.conf
747     CONFIG=${INSTALLPATH}/etc/modprobe.d/uvesafb.conf
748     clearconfig
749     addconfig "options uvesafb mode_option=1024x768-32@60 scroll=ywrap"
750    
751     # install an appropriate viafb.conf
752     CONFIG=${INSTALLPATH}/etc/modprobe.d/viafb.conf
753     clearconfig
754     addconfig "options viafb viafb_mode=1024x768 viafb_refresh=60"
755    
756     # install an appropriate i810fb.conf
757     CONFIG=${INSTALLPATH}/etc/modprobe.d/i810fb.conf
758     clearconfig
759     addconfig "options i810fb xres=1024 yres=768 bpp=16 mtrr=1 hsync1=30 hsync2=62 vsync1=30 vsync2=60"
760    
761     cat > ${INSTALLPATH}/root/.installrc << CHROOTEOF
762    echo "MODULES=\"${FORMAT_FILESYSTEM} ${DISKMODS} ${OLDATAMODS} ${PATAMODS} ${SATAMODS} ${DRMMODS} ${FBMODS} ${OTHERMODS}\"" > /etc/conf.d/mkinitrd
763  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
764  exit 0  exit 0
765  CHROOTEOF  CHROOTEOF
# Line 634  CHROOTEOF Line 768  CHROOTEOF
768   mount -t proc proc ${INSTALLPATH}/proc   mount -t proc proc ${INSTALLPATH}/proc
769   mount -t sysfs sysfs ${INSTALLPATH}/sys   mount -t sysfs sysfs ${INSTALLPATH}/sys
770   mount -o bind /dev ${INSTALLPATH}/dev   mount -o bind /dev ${INSTALLPATH}/dev
771   chroot ${INSTALLPATH} /bin/bash --rcfile /root/.bashrc -i   chroot ${INSTALLPATH} /bin/bash --rcfile /root/.installrc -i
772   umount ${INSTALLPATH}/proc   umount ${INSTALLPATH}/proc
773   umount ${INSTALLPATH}/sys   umount ${INSTALLPATH}/sys
774   umount ${INSTALLPATH}/dev   umount ${INSTALLPATH}/dev
775   rm ${INSTALLPATH}/root/.bashrc   rm ${INSTALLPATH}/root/.installrc
776  }  }
777    
778  is_uuid_supported()  is_uuid_supported()
# Line 679  install_system_settings() Line 813  install_system_settings()
813   # schreibe fstab   # schreibe fstab
814   if is_uuid_supported   if is_uuid_supported
815   then   then
816   echo -e "UUID=$(get_uuid ${BOOTHDD})\t/boot\text3\tnoatime,noauto\t1 1" > ${INSTALLPATH}/etc/fstab || die   if [[ -n ${BOOTHDD} ]]
817   echo -e "UUID=$(get_uuid ${ROOTHDD})\t/\text3\tnoatime\t0 0" >> ${INSTALLPATH}/etc/fstab || die   then
818     echo -e "UUID=$(get_uuid ${BOOTHDD})\t/boot\t${FORMAT_FILESYSTEM}\tnoatime,noauto\t1 1" > ${INSTALLPATH}/etc/fstab || die
819     fi
820     if [[ -n ${ROOTHDD} ]]
821     then
822     echo -e "UUID=$(get_uuid ${ROOTHDD})\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" >> ${INSTALLPATH}/etc/fstab || die
823     fi
824   else   else
825   echo -e "${BOOTHDD}\t/boot\text3\tnoatime,noauto\t1 1" > ${INSTALLPATH}/etc/fstab || die   if [[ -n ${BOOTHDD} ]]
826   echo -e "${ROOTHDD}\t/\text3\tnoatime\t0 0" >> ${INSTALLPATH}/etc/fstab || die   then
827     echo -e "${BOOTHDD}\t/boot\t${FORMAT_FILESYSTEM}\tnoatime,noauto\t1 1" > ${INSTALLPATH}/etc/fstab || die
828     fi
829     if [[ -n ${ROOTHDD} ]]
830     then
831     echo -e "${ROOTHDD}\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" >> ${INSTALLPATH}/etc/fstab || die
832     fi
833   fi   fi
834   # 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
835   #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 692  install_system_settings() Line 838  install_system_settings()
838    
839   # install network config skeleton   # install network config skeleton
840   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
 }  
841    
842  install_system_settings_flash()   # intel framebufer quirk
843  {   if [[ -e /proc/fb ]]
  # schreibe fstab  
  if is_uuid_supported  
844   then   then
845   echo -e "UUID=$(get_uuid ${ROOTHDD})\t/\text3\tnoatime\t0 0" > ${INSTALLPATH}/etc/fstab || die   if [[ ! -z $(grep 'inteldrmfb' /proc/fb) ]]
846   else   then
847   echo -e "${ROOTHDD}\t/\text3\tnoatime\t0 0" > ${INSTALLPATH}/etc/fstab || die   fbdev=$(grep 'inteldrmfb' /proc/fb | sed 's:\([0-9]\).*:\1:')
848     if [[ ${fbdev} != 0 ]]
849     then
850     sed -i "s:^\(SPLASH_DEV=\).*:\1\"/dev/fb${fbdev}\":" ${INSTALLPATH}/etc/splash/splash.conf || die
851     fi
852     fi
853   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  
854  }  }
855    
856  install_umount_rootfs()  install_umount_rootfs()
857  {  {
858   cd /   cd /
859   umount ${INSTALLPATH}/boot || die   if [[ -n ${BOOTHDD} ]]
860   umount ${INSTALLPATH} || die   then
861   swapoff ${SWAPHDD} || die   umount ${INSTALLPATH}/boot || die
862  }   fi
863     if [[ -n ${ROOTHDD} ]]
864  install_umount_rootfs_flash()   then
865  {   umount ${INSTALLPATH} || die
866   cd /   fi
867   umount ${INSTALLPATH} || die   if [[ -n ${SWAPHDD} ]]
868     then
869     swapoff ${SWAPHDD} || die
870     fi
871  }  }
872    
873  install_do_reboot()  install_do_reboot()
# Line 727  install_do_reboot() Line 876  install_do_reboot()
876  }  }
877    
878  #################################################  #################################################
879  #     Install Ablauf Scripte #  #     Install Main Scripts #
880  #################################################  #################################################
881    
882  run_install_normal()  run_install()
883  {  {
884     local method="$1"
885    
886     # setup install environment
887     export KERNELOPTS="${DEFAULT_KERNELOPTS}"
888     export GRUBLEGACYOPTS="${GRUBLEGACYOPTS}"
889     export GRUB2OPTS="${GRUB2OPTS}"
890     export GRUB2GFXPAYLOAD="${DEFAULT_GRUB2GFXPAYLOAD}"
891     export FORMFACTOR="${DEFAULT_FORMFACTOR}"
892     export FORMAT_FILESYSTEM="${DEFAULT_FORMAT_FILESYSTEM}"
893    
894     case "${method}" in
895     auto)
896     export INSTALL_METHOD="${method}"
897     ;;
898     normal)
899     export INSTALL_METHOD="${method}"
900     ;;
901     single)
902     export INSTALL_METHOD="${method}"
903     ;;
904     *)
905     echo "Unknown install method '${method}', aborting."
906     exit 1
907     ;;
908     esac
909    
910   dialog_hardware_detection   dialog_hardware_detection
911    
912   dialog_setup_hdd_partitions_manuell   dialog_setup_hdd_partitions
913   dialog_setup_hdd_format   dialog_setup_hdd_format
914   setup_hdd_format > /dev/null   setup_hdd_format > /dev/null
915   install_mount_rootfs   install_mount_rootfs
916   (install_system_image > /tmp/install.log) 2> /tmp/install_errors.log | dialog_install_meter | dialog_install_system_image   (install_system_image > /tmp/install.log) 2> /tmp/install_errors.log | dialog_install_meter | dialog_install_system_image
917    
  dialog_install_bootsector  
  install_bootsector_chroot  
   
918   dialog_install_settings   dialog_install_settings
919   sleep 1   sleep 1
920   install_system_settings   install_system_settings
921   install_initrd_chroot   install_initrd_chroot
  install_umount_rootfs  
  dialog_install_successful  
 }  
   
 run_install_flash()  
 {  
  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_bootsector  
  install_bootsector_chroot  
   
  dialog_install_settings  
  sleep 1  
  install_system_settings_flash  
  install_initrd_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  
922    
923   dialog_install_bootsector   dialog_install_bootsector
924   install_bootsector_chroot   install_bootsector_chroot
925    
926   dialog_install_settings   install_umount_rootfs
  sleep 1  
  install_system_settings_flash  
  install_initrd_chroot  
  install_umount_rootfs_flash  
927   dialog_install_successful   dialog_install_successful
928  }  }
929    

Legend:
Removed from v.1579  
changed lines
  Added in v.6829