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 2736 by niro, Thu Aug 11 14:58:15 2011 UTC revision 6834 by niro, Thu Jul 23 12:25:33 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"
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 53  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 76  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 90  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 133  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 159  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 169  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   *) echo " \n\n\n \\ZnStandard Device erkannt!\\Zn \\" >> ${hwtmp} ;;   rangee) echo " \n \\Z2Rangee Device erkannt.\\Zn \\" >> ${hwtmp} ;;
214     maxdata) echo " \n \\Z2Maxdata Device erkannt.\\Zn \\" >> ${hwtmp} ;;
215     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 218  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 238  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 251  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 374  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 421  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 431  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
374     hwinfo="$(hwinfo --bios --storage --pci --gfxcard --sys)"
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
378   local removable=0   local removable=0
379   if [[ ! -z $(hwinfo --bios --storage | grep -i zotac) ]]   if [[ ! -z $(echo "${hwinfo}" | grep -i zotac) ]]
380   then   then
381   for i in /sys/block/[hs]d*/removable   for i in /sys/block/[hs]d*/removable
382   do   do
# Line 450  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  setup_hdd_partitions_auto()   # check for special devices/clients:
401  {   # if a rangee and disk ist smaller then 256mb move partion one block further ahead
402   ROOTHDD="${HDD}1"   if [[ ! -z $(echo "${hwinfo}" | grep -i CLE266) ]]
403     then
404     # for a rangee always define partion startblock +1
405     export FDISKPARTIONBELOW256MB="1"
406     export SPECIALDEVICE="rangee"
407     export GRUBLEGACYOPTS=""
408     fi
409    
410   ## delete disk   # check for special devices/clients:
411   dd if=/dev/zero of=${HDD} count=1 &> /dev/null || die   # 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   ## setup one bootable partition   # check for i845 Chipsets and disable KMS and use 915 drm driver
419   #1. n= new disk   if [[ ! -z $(echo "${hwinfo}" | grep -i i845) ]]
420   #2. p= primary disk   then
421   #3. 1= first partition   export SPECIALDEVICE="i845"
422   #4. ''= default sector start   # unset default video=1024x768 opt or the drm driver breaks
423   #5. ''= defaul sector end   export KERNELOPTS="quiet"
424   #6. a= bootable flag   export GRUBLEGACYOPTS=""
425   #7. 1= boot flag for partition 1   # enable full kms support
426   #8. w= write/quit   export GRUB2GFXPAYLOAD="keep"
427   fdisk ${HDD} &> /dev/null << EOF   fi
 n  
 p  
 1  
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  a   # check for special devices/clients:
437  1   # check for laptops and activate cpufreq scaling
438  w   if [[ $(echo "${hwinfo}" | grep 'Formfactor:' | sed 's:.*Formfactor\:\ \"\(.*\)\":\1:') = laptop ]]
439  EOF   then
440     export FORMFACTOR="laptop"
441     export KERNELOPTS="${KERNELOPTS} cpufreq.governor=ondemand"
442     fi
443  }  }
444    
445  setup_hdd_partitions_manuell()  run_hardware_detection_disks()
446  {  {
447   BOOTHDD="${HDD}1"   local bootdev
  SWAPHDD="${HDD}2"  
  ROOTHDD="${HDD}3"  
448    
449   ## hdds partitionieren manuell   # all disks but exclude ramdisks
450   cfdisk ${HDD} || die   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  setup_hdd_partitions_manuell_flash()  hdd_size_below_256mb()
461  {  {
462   ROOTHDD="${HDD}1"   local hdd="$1"
463     local size
464     local retval
465     [[ -z ${hdd} ]] && die "Error: get_hdd_size() no \$hdd given!"
466    
467     size=$(fdisk -l ${hdd} | grep "Disk.*${hdd}" | sed 's:.*,\ \(.*\)\ byte.*:\1:')
468     if [[ ${size} -le 257000000 ]]
469     then
470     retval="0"
471     else
472     retval="1"
473     fi
474    
475   ## hdds partitionieren manuell   return "${retval}"
  cfdisk ${HDD} || die  
476  }  }
477    
478  setup_hdd_format()  setup_hdd_partitions()
479  {  {
480   mkswap ${SWAPHDD} || die   case "${INSTALL_METHOD}" in
481   mke2fs -j -q ${BOOTHDD} || die   normal)
482   mke2fs -j -q ${ROOTHDD} || die   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     if [[ ${INSTALL_METHOD} = auto ]]
495     then
496     # run this only if FDISKPARTITIONBELOW256MB is not already 1
497     if [[ ${FDISKPARTIONBELOW256MB} != 1 ]]
498     then
499     if hdd_size_below_256mb ${HDD}
500     then
501     FDISKPARTIONBELOW256MB=1
502     else
503     FDISKPARTIONBELOW256MB=0
504     fi
505     fi
506    
507     ## delete disk
508     dd if=/dev/zero of=${HDD} count=1 &> /dev/null || die
509    
510     if [[ ${FDISKPARTIONBELOW256MB} = 1 ]]
511     then
512     ## setup one bootable partition
513     #1. n= new disk
514     #2. p= primary disk
515     #3. 1= first partition
516     #4. 2= default sector start // small disk needs more space for grub2 mbr sector
517     #5. ''= defaul sector end
518     #6. a= bootable flag
519     #7. 1= boot flag for partition 1
520     #8. w= write/quit
521     fdisk ${HDD} &> /dev/null << EOF
522    n
523    p
524    1
525    2
526    
527    a
528    1
529    w
530    EOF
531     else
532     ## setup one bootable partition
533     #1. n= new disk
534     #2. p= primary disk
535     #3. 1= first partition
536     #4. ''= default sector start
537     #5. ''= defaul sector end
538     #6. a= bootable flag
539     #7. 1= boot flag for partition 1
540     #8. w= write/quit
541     fdisk ${HDD} &> /dev/null << EOF
542    n
543    p
544    1
545    
546    
547    a
548    1
549    w
550    EOF
551     fi
552     else
553     ## hdds partitionieren manuell
554     cfdisk ${HDD} || die
555     fi
556  }  }
557    
558  setup_hdd_format_flash()  setup_hdd_format()
559  {  {
560   mke2fs -j -q ${ROOTHDD} || die   if [[ -n ${SWAPHDD} ]]
561     then
562     mkswap ${SWAPHDD} || die
563     fi
564     if [[ -n ${BOOTHDD} ]]
565     then
566     mkfs.${FORMAT_FILESYSTEM} -q ${BOOTHDD} || die
567     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 538  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 552  install_bootsector_chroot() Line 615  install_bootsector_chroot()
615   if [[ -f ${INSTALLPATH}/etc/conf.d/grub ]]   if [[ -f ${INSTALLPATH}/etc/conf.d/grub ]]
616   then   then
617   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
618     sed -i "s:^\(export GRUB_GFXPAYLOAD_LINUX=\).*:\1\"${GRUB2GFXPAYLOAD}\":" ${INSTALLPATH}/etc/conf.d/grub || die
619   else   else
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
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 586  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   # bootsector schreiben chrooted schreiben (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 654  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 662  install_initrd_chroot() Line 722  install_initrd_chroot()
722   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"
723   SATAMODS="sata_via sata_sis sata_nv"   SATAMODS="sata_via sata_sis sata_nv"
724   DRMMODS="i915 mga nouveau r128 radeon savage sis tdfx ttm via"   DRMMODS="i915 mga nouveau r128 radeon savage sis tdfx ttm via"
725   FBMODS="uvesafb"   OTHERMODS=""
726     case ${SPECIALDEVICE} in
727     zotac_intel|i845) FBMODS=""; DRMMODS="i915" ;;
728     zotac_nvidia) FBMODS=""; DRMMODS="nouveau" ;;
729     rangee) FBMODS="" ;; ## fallback to vesafb, viafb does not run on all CLE266 boards
730     # not working with kms enabled drivers -> segfaults
731     #maxdata) FBMODS="i810fb" ;; ## check for maxdata / i810/ i815 Chipsets and disable KMS and use i810fb frambuffer
732     maxdata) FBMODS="" ;;
733     *) FBMODS="uvesafb" ;;
734     esac
735    
736   # install an appropriate uvesafb.conf   if [[ ${FORMFACTOR} = laptop ]]
737   install -d ${INSTALLPATH}/etc/modprobe.d || die   then
738   echo "options uvesafb mode_option=1024x768-32@60 scroll=ywrap" > ${INSTALLPATH}/etc/modprobe.d/uvesafb.conf || die   OTHERMODS="acpi-cpufreq cpufreq_ondemand cpufreq_conservative cpufreq_powersave"
739     fi
740    
741   cat > ${INSTALLPATH}/root/.installrc << CHROOTEOF   # install an appropriate uvesafb.conf
742  echo "MODULES=\"${FORMAT_FILESYSTEM} ${DISKMODS} ${OLDATAMODS} ${PATAMODS} ${SATAMODS} ${DRMMODS} ${FBMODS}\"" > /etc/conf.d/mkinitrd   CONFIG=${INSTALLPATH}/etc/modprobe.d/uvesafb.conf
743  mkinitrd -f /boot/$(readlink /boot/initrd) $(readlink /boot/vmlinuz | sed "s:kernel-::g") > /dev/null   clearconfig
744  exit 0   addconfig "options uvesafb mode_option=1024x768-32@60 scroll=ywrap"
745  CHROOTEOF  
746     # install an appropriate viafb.conf
747   ## enters chroot   CONFIG=${INSTALLPATH}/etc/modprobe.d/viafb.conf
748   mount -t proc proc ${INSTALLPATH}/proc   clearconfig
749   mount -t sysfs sysfs ${INSTALLPATH}/sys   addconfig "options viafb viafb_mode=1024x768 viafb_refresh=60"
750   mount -o bind /dev ${INSTALLPATH}/dev  
751   chroot ${INSTALLPATH} /bin/bash --rcfile /root/.installrc -i   # install an appropriate i810fb.conf
752   umount ${INSTALLPATH}/proc   CONFIG=${INSTALLPATH}/etc/modprobe.d/i810fb.conf
753   umount ${INSTALLPATH}/sys   clearconfig
754   umount ${INSTALLPATH}/dev   addconfig "options i810fb xres=1024 yres=768 bpp=16 mtrr=1 hsync1=30 hsync2=62 vsync1=30 vsync2=60"
755   rm ${INSTALLPATH}/root/.installrc  
756     CONFIG=${INSTALLPATH}/.installrc
757     clearconfig
758     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     addconfig 'exit 0'
761     ## enter chroot
762     enter_chroot_installrc
763  }  }
764    
765  is_uuid_supported()  is_uuid_supported()
# Line 723  install_system_settings() Line 800  install_system_settings()
800   # schreibe fstab   # schreibe fstab
801   if is_uuid_supported   if is_uuid_supported
802   then   then
803   echo -e "UUID=$(get_uuid ${BOOTHDD})\t/boot\t${FORMAT_FILESYSTEM}\tnoatime,noauto\t1 1" > ${INSTALLPATH}/etc/fstab || die   if [[ -n ${BOOTHDD} ]]
804   echo -e "UUID=$(get_uuid ${ROOTHDD})\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" >> ${INSTALLPATH}/etc/fstab || die   then
805     echo -e "UUID=$(get_uuid ${BOOTHDD})\t/boot\t${FORMAT_FILESYSTEM}\tnoatime,noauto\t1 1" > ${INSTALLPATH}/etc/fstab || die
806     fi
807     if [[ -n ${ROOTHDD} ]]
808     then
809     echo -e "UUID=$(get_uuid ${ROOTHDD})\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" >> ${INSTALLPATH}/etc/fstab || die
810     fi
811   else   else
812   echo -e "${BOOTHDD}\t/boot\t${FORMAT_FILESYSTEM}\tnoatime,noauto\t1 1" > ${INSTALLPATH}/etc/fstab || die   if [[ -n ${BOOTHDD} ]]
813   echo -e "${ROOTHDD}\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" >> ${INSTALLPATH}/etc/fstab || die   then
814     echo -e "${BOOTHDD}\t/boot\t${FORMAT_FILESYSTEM}\tnoatime,noauto\t1 1" > ${INSTALLPATH}/etc/fstab || die
815     fi
816     if [[ -n ${ROOTHDD} ]]
817     then
818     echo -e "${ROOTHDD}\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" >> ${INSTALLPATH}/etc/fstab || die
819     fi
820   fi   fi
821   # 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
822   #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 736  install_system_settings() Line 825  install_system_settings()
825    
826   # install network config skeleton   # install network config skeleton
827   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
 }  
828    
829  install_system_settings_flash()   # intel framebufer quirk
830  {   if [[ -e /proc/fb ]]
  # schreibe fstab  
  if is_uuid_supported  
831   then   then
832   echo -e "UUID=$(get_uuid ${ROOTHDD})\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" > ${INSTALLPATH}/etc/fstab || die   if [[ ! -z $(grep 'inteldrmfb' /proc/fb) ]]
833   else   then
834   echo -e "${ROOTHDD}\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" > ${INSTALLPATH}/etc/fstab || die   fbdev=$(grep 'inteldrmfb' /proc/fb | sed 's:\([0-9]\).*:\1:')
835     if [[ ${fbdev} != 0 ]]
836     then
837     sed -i "s:^\(SPLASH_DEV=\).*:\1\"/dev/fb${fbdev}\":" ${INSTALLPATH}/etc/splash/splash.conf || die
838     fi
839     fi
840   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  
841  }  }
842    
843  install_umount_rootfs()  install_umount_rootfs()
844  {  {
845   cd /   cd /
846   umount ${INSTALLPATH}/boot || die   if [[ -n ${BOOTHDD} ]]
847   umount ${INSTALLPATH} || die   then
848   swapoff ${SWAPHDD} || die   umount ${INSTALLPATH}/boot || die
849  }   fi
850     if [[ -n ${ROOTHDD} ]]
851  install_umount_rootfs_flash()   then
852  {   umount ${INSTALLPATH} || die
853   cd /   fi
854   umount ${INSTALLPATH} || die   if [[ -n ${SWAPHDD} ]]
855     then
856     swapoff ${SWAPHDD} || die
857     fi
858  }  }
859    
860  install_do_reboot()  install_do_reboot()
# Line 771  install_do_reboot() Line 863  install_do_reboot()
863  }  }
864    
865  #################################################  #################################################
866  #     Install Ablauf Scripte #  #     Install Main Scripts #
867  #################################################  #################################################
868    
869  run_install_normal()  run_install()
870  {  {
871     local method="$1"
872    
873     # setup install environment
874     export KERNELOPTS="${DEFAULT_KERNELOPTS}"
875     export GRUBLEGACYOPTS="${GRUBLEGACYOPTS}"
876     export GRUB2OPTS="${GRUB2OPTS}"
877     export GRUB2GFXPAYLOAD="${DEFAULT_GRUB2GFXPAYLOAD}"
878     export FORMFACTOR="${DEFAULT_FORMFACTOR}"
879     export FORMAT_FILESYSTEM="${DEFAULT_FORMAT_FILESYSTEM}"
880    
881     case "${method}" in
882     auto)
883     export INSTALL_METHOD="${method}"
884     ;;
885     normal)
886     export INSTALL_METHOD="${method}"
887     ;;
888     single)
889     export INSTALL_METHOD="${method}"
890     ;;
891     *)
892     echo "Unknown install method '${method}', aborting."
893     exit 1
894     ;;
895     esac
896    
897   dialog_hardware_detection   dialog_hardware_detection
898    
899   dialog_setup_hdd_partitions_manuell   dialog_setup_hdd_partitions
900   dialog_setup_hdd_format   dialog_setup_hdd_format
901   setup_hdd_format > /dev/null   setup_hdd_format > /dev/null
902   install_mount_rootfs   install_mount_rootfs
# Line 796  run_install_normal() Line 914  run_install_normal()
914   dialog_install_successful   dialog_install_successful
915  }  }
916    
917  run_install_flash()  # set some proper traps
918  {  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  
 }  
919    
920  dialog_main  dialog_main
921    

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