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 5004 by niro, Wed Aug 7 10:52:40 2013 UTC revision 6848 by niro, Thu Jul 23 14:03:36 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"  INSTALL_ROOT="/mnt/magellan"
   
 ### WICHTIG: anzahl lines in der autosta_lx.tar.gz -1  
 CURRENTLINE=0  
 #TOTALLINES=11072 # -> now in images.conf  
23    
24    # default system settings
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"
 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    FORMAT_FILESYSTEM_BOOTHDD=""
48    FORMAT_FILESYSTEM_ROOTHDD=""
49    FDISKPARTIONBELOW256MB=0
50    SPECIALDEVICE=""
51    FLASHDISK=0
52    ### linecount of system.tar.gz -1 !
53    CURRENTLINE=0
54    #TOTALLINES=11072 # -> now in images.conf
55    
56  #################################################  #################################################
57  #  DIALOG BOXEN #  #  DIALOG BOXES #
58  #################################################  #################################################
59    
60  die()  die()
# Line 57  die() Line 62  die()
62   ERROR=$1   ERROR=$1
63   RETVAL=$?   RETVAL=$?
64   dialog_install_failure   dialog_install_failure
65     trap_exit
66   exit 1   exit 1
67  }  }
68    
# Line 80  dialog_warning() Line 86  dialog_warning()
86    
87  dialog_setup_hdd_info()  dialog_setup_hdd_info()
88  {  {
89     case "${INSTALL_METHOD}" in
90     auto)
91     dialog_setup_hdd_info_auto
92     dialog_setup_hdd_create_partitions
93     ;;
94     normal) dialog_setup_hdd_info_normal ;;
95     single) dialog_setup_hdd_info_single ;;
96     flash) dialog_setup_hdd_info_flash ;;
97     esac
98    }
99    
100    dialog_setup_hdd_info_normal()
101    {
102   local SHDD="$(echo ${HDD} | sed 's/\/dev\///')"   local SHDD="$(echo ${HDD} | sed 's/\/dev\///')"
103    
104   dialog \   dialog \
# Line 94  dialog_setup_hdd_info() Line 113  dialog_setup_hdd_info()
113   Bitte ${SHDD}1 als \Z3bootable\Zn markieren." 12 81   Bitte ${SHDD}1 als \Z3bootable\Zn markieren." 12 81
114  }  }
115    
116  dialog_setup_hdd_info_flash()  dialog_setup_hdd_info_single()
117  {  {
118   local SHDD="$(echo $HDD | sed 's/\/dev\///')"   local SHDD="$(echo $HDD | sed 's/\/dev\///')"
119    
# Line 108  dialog_setup_hdd_info_flash() Line 127  dialog_setup_hdd_info_flash()
127   Bitte ${SHDD}1 als \Z3bootable\Zn markieren." 12 81   Bitte ${SHDD}1 als \Z3bootable\Zn markieren." 12 81
128  }  }
129    
130    dialog_setup_hdd_info_flash()
131    {
132     local SHDD="$(echo ${HDD} | sed 's/\/dev\///')"
133    
134     dialog \
135     --colors \
136     --title "[ Festplatten Partitionierung ]" \
137     --backtitle "${TITLE}" \
138     --ok-label "Weiter" \
139     --msgbox "\nBitte legen Sie 2 Partitionen an.\n\n\
140     [ \Z3${SHDD}1\Zn ] Typ: \Z3Linux\Zn mit ca. 50MB\n\
141     [ \Z3${SHDD}2\Zn ] Typ: \Z3Linux \Zn mit dem Rest (min. 256MB)\n\n\
142     Bitte ${SHDD}1 als \Z3bootable\Zn markieren." 12 81
143    }
144    
145  dialog_setup_hdd_info_auto()  dialog_setup_hdd_info_auto()
146  {  {
147   local SHDD="$(echo $HDD | sed 's/\/dev\///')"   local SHDD="$(echo $HDD | sed 's/\/dev\///')"
# Line 132  dialog_setup_system_menu() Line 166  dialog_setup_system_menu()
166   --ok-label "Weiter" \   --ok-label "Weiter" \
167   --stdout \   --stdout \
168   --colors \   --colors \
169   --menu "\nWaehlen Sie die Installations-Methode" 14 70 5 \   --menu "\nWaehlen Sie die Installations-Methode" 14 70 6 \
170   "1" "Automatisches Setup (Empfohlen)" \   "1" "Automatisches Setup (Empfohlen)" \
171   "" "" \   "" "" \
172   "" "\Z1Experten Modi:\Zn" \   "" "\Z1Experten Modi:\Zn" \
173   "2" "Normale IDE-Disk (Manuell)" \   "2" "Normale IDE-Disk (Manuell)" \
174   "3" "Flash-Speicher (Manuell)")   "3" "Normale IDE Disk (Single)" \
175     "4" "Flash SDHC/NAND oder USBStick (Manuell)")
176   RES=$?   RES=$?
177   [[ ${RES} -eq 1 ]] && return 1   [[ ${RES} -eq 1 ]] && return 1
178   if [[ ${RES} -eq 0 ]]   if [[ ${RES} -eq 0 ]]
179   then   then
180   case "${i}" in   case "${i}" in
181   "1") run_install_auto ;;   "1") run_install auto ;;
182           "2") run_install_normal ;;   "2") run_install normal ;;
183   "3") run_install_flash ;;   "3") run_install single ;;
184     "4") run_install flash ;;
185   "") dialog_setup_system_menu;;   "") dialog_setup_system_menu;;
186   esac   esac
187   fi   fi
# Line 156  dialog_hardware_detection() Line 192  dialog_hardware_detection()
192   local i   local i
193   local hwtmp   local hwtmp
194    
195   if [ -x $(which mktemp &> /dev/null) ]   if [ -x $(type -P mktemp) ]
196   then   then
197   hwtmp="$(mktemp)"   hwtmp="$(mktemp)"
198   else   else
199   hwtmp="/tmp/hwtmp.sh"   hwtmp="/tmp/hwtmp.sh"
200   fi   fi
201    
202   [[ ! -z ${installdevs} ]] && installdevs=""   run_hardware_detection_disks
203    
204   echo "dialog \\"  > ${hwtmp}   echo "dialog \\"  > ${hwtmp}
205   echo "--backtitle \"${TITLE}\" \\" >> ${hwtmp}   echo "--backtitle \"${TITLE}\" \\" >> ${hwtmp}
# Line 173  dialog_hardware_detection() Line 209  dialog_hardware_detection()
209   echo "--msgbox \"Gefundene Hardware:\n\n \\" >> ${hwtmp}   echo "--msgbox \"Gefundene Hardware:\n\n \\" >> ${hwtmp}
210   echo " Festplatten:\n \\" >> ${hwtmp}   echo " Festplatten:\n \\" >> ${hwtmp}
211    
212   if [[ ! -z ${scsidisks} ]]   if [[ ! -z ${ALL_DISKS} ]]
213   then   then
214   for i in ${scsidisks}   for i in ${ALL_DISKS}
215   do   do
216   if [[ ${i} != ${cdromdev} ]]   echo " \\Z3${i}\\Zn\n \\" >> ${hwtmp}
  then  
  echo " \\Z7SCSI: \\Z3${i}\\Zn\n \\" >> ${hwtmp}  
  installdevs="${installdevs} ${i}"  
  fi  
217   done   done
218   fi   fi
219    
220   if [[ ! -z ${idedisks} ]]   if [[ ! -z ${ALL_CDROMS} ]]
221   then   then
222   for i in ${idedisks}   echo " \n \\" >> ${hwtmp}
223     echo " CDROM Laufwerke:\n \\" >> ${hwtmp}
224     for i in ${ALL_CDROMS}
225   do   do
226   if [[ ${i} != ${cdromdev} ]]   echo " \\Z3${i}\\Zn\n \\" >> ${hwtmp}
  then  
  echo " \\Z7IDE:  \\Z3${i}\\Zn\n \\" >> ${hwtmp}  
  installdevs="${installdevs} ${i}"  
  fi  
227   done   done
228   fi   fi
229    
  if [[ ! -z ${cdromdev} ]]  
  then  
  echo " \n \\" >> ${hwtmp}  
  echo " \\Z7andere Laufwerke:\n \\" >> ${hwtmp}  
  echo " CDROM: \\Z3${cdromdev}\\Zn\n \\" >> ${hwtmp}  
  fi  
   
230   # other devices   # other devices
231   run_hardware_detection   run_hardware_detection
232   case "${SPECIALDEVICE}" in   case "${SPECIALDEVICE}" in
233   zotac*) echo " \n\n\n \\Z2Zotac Device erkannt!\\Zn \\" >> ${hwtmp} ;;   zotac*) echo " \n \\Z2Zotac Device erkannt.\\Zn \\" >> ${hwtmp} ;;
234   rangee) echo " \n\n\n \\Z2Rangee Device erkannt!\\Zn \\" >> ${hwtmp} ;;   rangee) echo " \n \\Z2Rangee Device erkannt.\\Zn \\" >> ${hwtmp} ;;
235   maxdata) echo " \n\n\n \\Z2Maxdata Device erkannt!\\Zn \\" >> ${hwtmp} ;;   maxdata) echo " \n \\Z2Maxdata Device erkannt.\\Zn \\" >> ${hwtmp} ;;
236   *) echo " \n\n\n \\ZnStandard Device erkannt!\\Zn \\" >> ${hwtmp} ;;   i845) echo " \n \\Z2Intel i845 Device erkannt.\\Zn \\" >> ${hwtmp} ;;
237     *) echo " \n \\ZnStandard Device erkannt.\\Zn \\" >> ${hwtmp} ;;
238   esac   esac
239   if [[ ${FORMFACTOR} = laptop ]]   if [[ ${FORMFACTOR} = laptop ]]
240   then   then
241   echo " \n\n\n \\ZnFormfactor Laptop erkannt, Powersave Modus 'ondemand' wird aktiviert!\\Zn \\" >> ${hwtmp}   echo " \n \\ZnFormfactor Laptop, Powersave Modus 'ondemand' wird aktiviert.\\Zn \\" >> ${hwtmp}
242     fi
243     if [[ ${FLASHDISK} = 1 ]]
244     then
245     echo " \n \\ZnFlash Speicher erkannt, F2FS wird als Dateisystem benutzt.\\Zn \\" >> ${hwtmp}
246   fi   fi
247    
248   echo " \" 13 70" >> ${hwtmp}   echo " \" 14 70" >> ${hwtmp}
249   chmod a+x ${hwtmp}   chmod a+x ${hwtmp}
250   ${hwtmp}   ${hwtmp}
251    
# Line 228  dialog_hardware_detection() Line 256  dialog_hardware_detection()
256   fi   fi
257  }  }
258    
259  dialog_setup_hdd_partitions_manuell()  dialog_setup_hdd_partitions()
260  {  {
261   local i   local i
262    
263   if [[ -z ${installdevs} ]]   if [[ -z ${ALL_DISKS} ]]
264   then   then
265   dialog \   dialog \
266   --backtitle "${TITLE}" \   --backtitle "${TITLE}" \
# Line 248  dialog_setup_hdd_partitions_manuell() Line 276  dialog_setup_hdd_partitions_manuell()
276   echo "--stdout \\" >> /tmp/hddtmp.sh   echo "--stdout \\" >> /tmp/hddtmp.sh
277   echo "--menu \"Installations Laufwerk auswaehlen:\" 10 70 3 \\" >> /tmp/hddtmp.sh   echo "--menu \"Installations Laufwerk auswaehlen:\" 10 70 3 \\" >> /tmp/hddtmp.sh
278    
279   for i in ${installdevs}   for i in ${ALL_DISKS}
280   do   do
281   echo "\"${i}\" \"\" \\" >> /tmp/hddtmp.sh   echo "\"${i}\" \"\" \\" >> /tmp/hddtmp.sh
282   done   done
# Line 261  dialog_setup_hdd_partitions_manuell() Line 289  dialog_setup_hdd_partitions_manuell()
289   if [[ ${RES} -eq 0 ]]   if [[ ${RES} -eq 0 ]]
290   then   then
291   dialog_setup_hdd_info   dialog_setup_hdd_info
292   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  
293   fi   fi
294   fi   fi
295  }  }
# Line 384  dialog_install_meter() Line 335  dialog_install_meter()
335   return 0   return 0
336  }  }
337    
   
338  dialog_install_bootsector()  dialog_install_bootsector()
339  {  {
340   dialog \   dialog \
# Line 421  dialog_main() Line 371  dialog_main()
371   --no-cancel \   --no-cancel \
372   --ok-label "Weiter" \   --ok-label "Weiter" \
373   --stdout \   --stdout \
374   --menu "Konfiguration" 14 70 5 \   --menu "Konfiguration" 14 70 6 \
375   "1" "AutoSta_LX installieren" \   "1" "AutoSta_LX installieren" \
376   "2" "Uebersicht gefundener Laufwerke" \   "2" "Uebersicht gefundener Laufwerke" \
377   "3" "Beenden und neustarten" \   "3" "Beenden und neustarten" \
# Line 431  dialog_main() Line 381  dialog_main()
381   if [[ ${RES} -eq 0 ]]   if [[ ${RES} -eq 0 ]]
382   then   then
383   case ${METHOD} in   case ${METHOD} in
384           "1") dialog_setup_system_menu ;;   "1") dialog_setup_system_menu ;;
385   "2") dialog_hardware_detection ;;   "2") dialog_hardware_detection ;;
386   "3") install_do_reboot ;;   "3") install_do_reboot ;;
387   "4") /bin/bash --login -i ;;   "4") /bin/bash --login -i ;;
# Line 441  dialog_main() Line 391  dialog_main()
391  }  }
392    
393  #################################################  #################################################
394  # Install Komandos #  # Install Commands #
395  #################################################  #################################################
396  run_hardware_detection()  run_hardware_detection()
397  {  {
398   local hwinfo   local hwinfo
   
399   hwinfo="$(hwinfo --bios --storage --pci --gfxcard --sys)"   hwinfo="$(hwinfo --bios --storage --pci --gfxcard --sys)"
400    
401   # check for special devices/clients:   # check for special devices/clients:
# Line 459  run_hardware_detection() Line 408  run_hardware_detection()
408   if [[ $(< ${i}) = 1 ]]   if [[ $(< ${i}) = 1 ]]
409   then   then
410   removable=1   removable=1
411     # we assume that all removable disks are flash disks
412     export FLASHDISK=1
413   fi   fi
414   done   done
415    
416   # 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
417   export GRUBLEGACYOPTS="rootdelay=8"   export GRUBLEGACYOPTS="rootdelay=8"
418   # there are to zotac types in the wild, nvidia based gfx and intel   # there are two zotac types in the wild, nvidia based gfx and intel
419   if [[ ! -z $(echo "${hwinfo}" | grep -i nouveau) ]]   if [[ ! -z $(echo "${hwinfo}" | grep -i nouveau) ]]
420   then   then
421   export SPECIALDEVICE="zotac_nvidia"   export SPECIALDEVICE="zotac_nvidia"
# Line 491  run_hardware_detection() Line 442  run_hardware_detection()
442   export GRUBLEGACYOPTS=""   export GRUBLEGACYOPTS=""
443   fi   fi
444    
445     # check for i845 Chipsets and disable KMS and use 915 drm driver
446     if [[ ! -z $(echo "${hwinfo}" | grep -i i845) ]]
447     then
448     export SPECIALDEVICE="i845"
449     # unset default video=1024x768 opt or the drm driver breaks
450     export KERNELOPTS="quiet"
451     export GRUBLEGACYOPTS=""
452     # enable full kms support
453     export GRUB2GFXPAYLOAD="keep"
454     fi
455    
456     # check for radeon gfxcards
457     if [[ ! -z $(echo "${hwinfo}" | grep -i radeon) ]]
458     then
459     # enable full kms support
460     export GRUB2GFXPAYLOAD="keep"
461     fi
462    
463   # check for special devices/clients:   # check for special devices/clients:
464   # check for laptops and activate cpufreq scaling   # check for laptops and activate cpufreq scaling
465   if [[ $(echo "${hwinfo}" | grep 'Formfactor:' | sed 's:.*Formfactor\:\ \"\(.*\)\":\1:') = laptop ]]   if [[ $(echo "${hwinfo}" | grep 'Formfactor:' | sed 's:.*Formfactor\:\ \"\(.*\)\":\1:') = laptop ]]
# Line 500  run_hardware_detection() Line 469  run_hardware_detection()
469   fi   fi
470  }  }
471    
472    run_hardware_detection_disks()
473    {
474     local bootdev
475    
476     # all disks but exclude ramdisks
477     export ALL_DISKS=$(get_hwinfo disk | sed '/\/dev\/ram[0-9].*/d')
478     # remove the boot device from ALL_DISKS if it was an usbstick
479     if [[ $(grep '[[:space:]]/mnt/cdrom[[:space:]]' /proc/mounts | cut -d' ' -f3) != iso9660 ]]
480     then
481     bootdev="$(grep '[[:space:]]/mnt/cdrom[[:space:]]' /proc/mounts | cut -d' ' -f1 | sed 's:[0-9]::g')"
482     export ALL_DISKS=$(echo "${ALL_DISKS}" | grep -v "${bootdev}")
483     fi
484     export ALL_CDROMS="$(get_hwinfo cdrom)"
485    }
486    
487  hdd_size_below_256mb()  hdd_size_below_256mb()
488  {  {
489   local hdd="$1"   local hdd="$1"
# Line 518  hdd_size_below_256mb() Line 502  hdd_size_below_256mb()
502   return "${retval}"   return "${retval}"
503  }  }
504    
505  setup_hdd_partitions_auto()  setup_hdd_partitions()
506  {  {
507   ROOTHDD="${HDD}1"   case "${INSTALL_METHOD}" in
508     normal)
509     BOOTHDD="${HDD}1"
510     SWAPHDD="${HDD}2"
511     ROOTHDD="${HDD}3"
512     ;;
513    
514     single|auto)
515     BOOTHDD=""
516     SWAPHDD=""
517     ROOTHDD="${HDD}1"
518     ;;
519    
520     flash)
521     BOOTHDD="${HDD}1"
522     SWAPHDD=""
523     ROOTHDD="${HDD}2"
524     ;;
525     esac
526    
527   # run this only if FDISKPARTITIONBELOW256MB is not already 1   if [[ ${INSTALL_METHOD} = auto ]]
  if [[ ${FDISKPARTIONBELOW256MB} != 1 ]]  
528   then   then
529   if hdd_size_below_256mb ${HDD}   # run this only if FDISKPARTITIONBELOW256MB is not already 1
530     if [[ ${FDISKPARTIONBELOW256MB} != 1 ]]
531   then   then
532   FDISKPARTIONBELOW256MB=1   if hdd_size_below_256mb ${HDD}
533   else   then
534   FDISKPARTIONBELOW256MB=0   FDISKPARTIONBELOW256MB=1
535     else
536     FDISKPARTIONBELOW256MB=0
537     fi
538   fi   fi
  fi  
539    
540   ## delete disk   ## delete disk
541   dd if=/dev/zero of=${HDD} count=1 &> /dev/null || die   dd if=/dev/zero of=${HDD} count=1 &> /dev/null || die
542    
543   if [[ ${FDISKPARTIONBELOW256MB} = 1 ]]   if [[ ${FLASHDISK} = 1 ]]
544   then   then
545   ## setup one bootable partition   if [[ ${FDISKPARTIONBELOW256MB} = 1 ]]
546   #1. n= new disk   then
547   #2. p= primary disk   ## setup one bootable partition
548   #3. 1= first partition   # 1. n= new disk
549   #4. 2= default sector start // small disk needs more space for grub2 mbr sector   # 2. p= primary disk
550   #5. ''= defaul sector end   # 3. 1= first partition
551   #6. a= bootable flag   # 4. 2= default sector start // small disk needs more space for grub2 mbr sector
552   #7. 1= boot flag for partition 1   # 5. ''= defaul sector end
553   #8. w= write/quit   # 6. a= bootable flag
554   fdisk ${HDD} &> /dev/null << EOF   # 7. 1= boot flag for partition 1
555     # 8. n= new disk
556     #10. p= primary disk
557     #11. 2= second partition
558     #12. ''= default sector start
559     #13. ''= defaul sector end
560     #14. w= write/quit
561     fdisk ${HDD} &> /dev/null << EOF
562  n  n
563  p  p
564  1  1
565  2  2
566    +50M
567  a  a
568  1  1
569    n
570    p
571    2
572    
573    
574  w  w
575  EOF  EOF
576   else   else
577   ## setup one bootable partition   ## setup one bootable partition
578   #1. n= new disk   # 1. n= new disk
579   #2. p= primary disk   # 2. p= primary disk
580   #3. 1= first partition   # 3. 1= first partition
581   #4. ''= default sector start   # 4. ''= default sector start
582   #5. ''= defaul sector end   # 5. ''= defaul sector end
583   #6. a= bootable flag   # 6. a= bootable flag
584   #7. 1= boot flag for partition 1   # 7. 1= boot flag for partition 1
585   #8. w= write/quit   # 8. n= new disk
586   fdisk ${HDD} &> /dev/null << EOF   #10. p= primary disk
587     #11. 2= second partition
588     #12. ''= default sector start
589     #13. ''= defaul sector end
590     #14. w= write/quit
591     fdisk ${HDD} &> /dev/null << EOF
592  n  n
593  p  p
594  1  1
595    
596    +50M
597  a  a
598  1  1
599    n
600    p
601    2
602    
603    
604  w  w
605  EOF  EOF
606   fi   fi
607  }   else
608     if [[ ${FDISKPARTIONBELOW256MB} = 1 ]]
609  setup_hdd_partitions_manuell()   then
610  {   ## setup one bootable partition
611   BOOTHDD="${HDD}1"   #1. n= new disk
612   SWAPHDD="${HDD}2"   #2. p= primary disk
613   ROOTHDD="${HDD}3"   #3. 1= first partition
614     #4. 2= default sector start // small disk needs more space for grub2 mbr sector
615     #5. ''= defaul sector end
616     #6. a= bootable flag
617     #7. 1= boot flag for partition 1
618     #8. w= write/quit
619     fdisk ${HDD} &> /dev/null << EOF
620    n
621    p
622    1
623    2
624    
625   ## hdds partitionieren manuell  a
626   cfdisk ${HDD} || die  1
627  }  w
628    EOF
629     else
630     ## setup one bootable partition
631     #1. n= new disk
632     #2. p= primary disk
633     #3. 1= first partition
634     #4. ''= default sector start
635     #5. ''= defaul sector end
636     #6. a= bootable flag
637     #7. 1= boot flag for partition 1
638     #8. w= write/quit
639     fdisk ${HDD} &> /dev/null << EOF
640    n
641    p
642    1
643    
 setup_hdd_partitions_manuell_flash()  
 {  
  ROOTHDD="${HDD}1"  
644    
645   ## hdds partitionieren manuell  a
646   cfdisk ${HDD} || die  1
647    w
648    EOF
649     fi
650     fi
651     else
652     ## hdds partitionieren manuell
653     cfdisk ${HDD} || die
654     fi
655  }  }
656    
657  setup_hdd_format()  setup_hdd_format()
658  {  {
659   mkswap ${SWAPHDD} || die   install -d /tmp
660   mke2fs -j -q ${BOOTHDD} || die   :> /tmp/format.log
  mke2fs -j -q ${ROOTHDD} || die  
 }  
661    
662  setup_hdd_format_flash()   if [[ -n ${SWAPHDD} ]]
663  {   then
664   mke2fs -j -q ${ROOTHDD} || die   mkswap ${SWAPHDD} || die
665     fi
666     if [[ -n ${BOOTHDD} ]]
667     then
668     mkfs.${FORMAT_FILESYSTEM_BOOTHDD} ${BOOTHDD} &> /tmp/format.log || die
669     fi
670     if [[ -n ${ROOTHDD} ]]
671     then
672     mkfs.${FORMAT_FILESYSTEM_ROOTHDD} ${ROOTHDD} &> /tmp/format.log || die
673     fi
674  }  }
675    
676  install_mount_rootfs()  install_mount_rootfs()
677  {  {
678   swapon ${SWAPHDD} || die   local opts
679   mount ${ROOTHDD} ${INSTALLPATH} || die  
680   install -d ${INSTALLPATH}/boot || die   if [[ -n ${SWAPHDD} ]]
681   mount ${BOOTHDD} ${INSTALLPATH}/boot || die   then
682   cd ${INSTALLPATH} || die   swapon ${SWAPHDD} || die
683  }   fi
684     if [[ -n ${ROOTHDD} ]]
685     then
686     mount -t ${FORMAT_FILESYSTEM_ROOTHDD} ${ROOTHDD} ${INSTALL_ROOT} || die
687     fi
688     if [[ -n ${BOOTHDD} ]]
689     then
690     install -d ${INSTALL_ROOT}/boot || die
691     mount -t ${FORMAT_FILESYSTEM_BOOTHDD} ${BOOTHDD} ${INSTALL_ROOT}/boot || die
692     fi
693    
694  install_mount_rootfs_flash()   cd ${INSTALL_ROOT} || die
 {  
  mount ${ROOTHDD} ${INSTALLPATH} || die  
  install -d ${INSTALLPATH}/boot || die  
  cd ${INSTALLPATH} || die  
695  }  }
696    
697  install_system_image()  install_system_image()
698  {  {
699   tar xvjpf ${CDPATH}/system/${CDIMAGENAME} -C ${INSTALLPATH}   tar xvjpf ${CDPATH}/system/${CDIMAGENAME} -C ${INSTALL_ROOT}
700  }  }
701    
702  install_bootsector_chroot()  install_bootsector_chroot()
703  {  {
704   local my_roothdd   local my_roothdd
705   local grubconf=${INSTALLPATH}/boot/grub/grub.conf   local grubconf=${INSTALL_ROOT}/boot/grub/grub.conf
706   local grub2conf=/boot/grub/grub.cfg   local grub2conf=/boot/grub/grub.cfg
707     local CONFIG
708    
709   # check for grub2   # check for grub2
710   if [[ -f ${INSTALLPATH}/sbin/grub-mkconfig ]]   if [[ -f ${INSTALL_ROOT}/sbin/grub-mkconfig ]]
711   then   then
712   # needed by grub-mkconfig on the first run   # needed by grub-mkconfig on the first run
713   if [[ ! -f ${INSTALLPATH}/boot/grub/video.lst ]]   if [[ ! -f ${INSTALL_ROOT}/boot/grub/video.lst ]]
714   then   then
715   install -m0644 ${INSTALLPATH}/lib/grub/*/video.lst ${INSTALLPATH}/boot/grub/video.lst || die   install -m0644 ${INSTALL_ROOT}/lib/grub/*/video.lst ${INSTALL_ROOT}/boot/grub/video.lst || die
716   fi   fi
717    
718   # set kernelopts   # set kernelopts
719   if [[ -f ${INSTALLPATH}/etc/conf.d/grub ]]   if [[ -f ${INSTALL_ROOT}/etc/conf.d/grub ]]
720   then   then
721   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}\":" ${INSTALL_ROOT}/etc/conf.d/grub || die
722     sed -i "s:^\(export GRUB_GFXPAYLOAD_LINUX=\).*:\1\"${GRUB2GFXPAYLOAD}\":" ${INSTALL_ROOT}/etc/conf.d/grub || die
723   else   else
724   echo "export GRUB_CMDLINE_LINUX_DEFAULT=\"${KERNELOPTS}\"" >  ${INSTALLPATH}/etc/conf.d/grub || die   CONFIG=${INSTALL_ROOT}/etc/conf.d/grub
725     clearconfig
726     addconfig "export GRUB_CMDLINE_LINUX_DEFAULT=\"${KERNELOPTS}\""
727     addconfig "export GRUB_GFXPAYLOAD_LINUX=\"${GRUB2GFXPAYLOAD}\""
728   fi   fi
729   echo 'grub-mkdevicemap' > ${INSTALLPATH}/root/.installrc || die   CONFIG=${INSTALL_ROOT}/.installrc
730   echo "LC_ALL=C grub-mkconfig -o ${grub2conf}  &> /dev/null" >> ${INSTALLPATH}/root/.installrc || die   clearconfig
731   echo "grub-install --no-floppy ${HDD} &> /dev/null" >> ${INSTALLPATH}/root/.installrc || die   addconfig 'grub-mkdevicemap'
732   echo "exit 0" >> ${INSTALLPATH}/root/.installrc || die   addconfig "LC_ALL=C grub-mkconfig -o ${grub2conf}  &> /dev/null"
733     addconfig "grub-install --no-floppy ${HDD} &> /dev/null"
734     addconfig "exit 0"
735    
736   # grub-legacy   # grub-legacy
737   else   else
738   ### grubconf schreiben   ### grubconf schreiben
739   source ${INSTALLPATH}/boot/kernelversion   source ${INSTALL_ROOT}/boot/kernelversion
740    
741   #for alx only   #for alx only
742   if [ -e ${INSTALLPATH}/etc/alx_version ]   if [ -e ${INSTALL_ROOT}/etc/alx_version ]
743   then   then
744   OLD_ALXVER="${ALXVER}"   OLD_ALXVER="${ALXVER}"
745   source ${INSTALLPATH}/etc/alx_version   source ${INSTALL_ROOT}/etc/alx_version
746   KRNVER="ALX-${ALXVER}"   KRNVER="ALX-${ALXVER}"
747   ALXVER="${OLD_ALXVER}"   ALXVER="${OLD_ALXVER}"
748   fi   fi
# Line 684  install_bootsector_chroot() Line 759  install_bootsector_chroot()
759   my_roothdd="${ROOTHDD}"   my_roothdd="${ROOTHDD}"
760   fi   fi
761    
762   : > ${grubconf} || die   CONFIG="${grubconf}"
763   echo "default 0" >> ${grubconf} || die   clearconfig
764   echo "timeout 3" >> ${grubconf} || die   addconfig "default 0"
765     addconfig "timeout 3"
766   # using current root password   # using current root password
767   echo "password --md5 $(cat ${INSTALLPATH}/etc/shadow | grep root | cut -d: -f2)"  >> ${grubconf} || die   addconfig "password --md5 $(cat ${INSTALL_ROOT}/etc/shadow | grep root | cut -d: -f2)"
768     addconfig
769   echo  >> ${grubconf} || die   addconfig "# normal boot"
770   echo "# normal boot" >> ${grubconf} || die   addconfig "title ${KRNVER}"
771   echo "title ${KRNVER}" >> ${grubconf} || die   addconfig "root (hd0,0)"
772   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  
773   if is_initrd_supported   if is_initrd_supported
774   then   then
775   echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die   addconfig "initrd /boot/${KRNINITRD}"
776   fi   fi
777     addconfig
778   echo >> ${grubconf} || die   addconfig "# admin boot"
779   echo "# admin boot" >> ${grubconf} || die   addconfig "title ${KRNVER} - Re-run hardware-detection"
780   echo "title ${KRNVER} - Re-run hardware-detection" >> ${grubconf} || die   addconfig "lock"
781   echo "lock"  >> ${grubconf} || die   addconfig "root (hd0,0)"
782   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  
783   if is_initrd_supported   if is_initrd_supported
784   then   then
785   echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die   addconfig "initrd /boot/${KRNINITRD}"
786   fi   fi
787     addconfig
788   echo >> ${grubconf} || die   addconfig "title ${KRNVER} - Reset *all* local settings"
789   echo "title ${KRNVER} - Reset *all* local settings" >> ${grubconf} || die   addconfig "lock"
790   echo "lock"  >> ${grubconf} || die   addconfig "root (hd0,0)"
791   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  
792   if is_initrd_supported   if is_initrd_supported
793   then   then
794   echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die   addconfig "initrd /boot/${KRNINITRD}"
795   fi   fi
796    
797   # bootsector schreiben chrooted schreiben (lfs/magellan)   # write bootsector chrooted (lfs/magellan)
798   cat > ${INSTALLPATH}/root/.installrc << CHROOTEOF   CONFIG=${INSTALL_ROOT}/.installrc
799  /usr/sbin/grub --no-floppy --batch << "EOF" 1> /dev/null 2> /dev/null   clearconfig
800  root (hd0,0)   addconfig '/usr/sbin/grub --no-floppy --batch << "EOF" 1> /dev/null 2> /dev/null'
801  setup (hd0)   addconfig 'root (hd0,0)'
802  quit   addconfig 'setup (hd0)'
803  EOF   addconfig 'quit'
804  exit 0   addconfig 'EOF'
805  CHROOTEOF   addconfig 'exit 0'
806   fi   fi
807    
808   ## enters chroot   ## enter chroot
809   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  
810  }  }
811    
812  is_initrd_supported()  is_initrd_supported()
813  {  {
814   # only generate initrds if the cmd exists   # only generate initrds if the cmd exists
815   [[ -x ${INSTALLPATH}/sbin/mkinitrd ]] && return 0   [[ -x ${INSTALL_ROOT}/sbin/mkinitrd ]] && return 0
816   return 1   return 1
817  }  }
818    
819  install_initrd_chroot()  install_initrd_chroot()
820  {  {
821     local CONFIG
822    
823   # only generate initrds if the cmd exists   # only generate initrds if the cmd exists
824   is_initrd_supported || return 0   is_initrd_supported || return 0
825    
826     FSMODS="${FORMAT_FILESYSTEM_BOOTHDD} ${FORMAT_FILESYSTEM_ROOTHDD}"
827   DISKMODS="sd_mod"   DISKMODS="sd_mod"
828   OLDPATAMODS="amd74xx piix sis5513 via82cxxx"   OLDPATAMODS="amd74xx piix sis5513 via82cxxx"
829   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"
# Line 762  install_initrd_chroot() Line 831  install_initrd_chroot()
831   DRMMODS="i915 mga nouveau r128 radeon savage sis tdfx ttm via"   DRMMODS="i915 mga nouveau r128 radeon savage sis tdfx ttm via"
832   OTHERMODS=""   OTHERMODS=""
833   case ${SPECIALDEVICE} in   case ${SPECIALDEVICE} in
834   zotac_intel) FBMODS=""; DRMMODS="i915" ;;   zotac_intel|i845) FBMODS=""; DRMMODS="i915" ;;
835   zotac_nvidia) FBMODS=""; DRMMODS="nouveau" ;;   zotac_nvidia) FBMODS=""; DRMMODS="nouveau" ;;
836   rangee) FBMODS="" ;; ## fallback to vesafb, viafb does not run on all CLE266 boards   rangee) FBMODS="" ;; ## fallback to vesafb, viafb does not run on all CLE266 boards
837   # not working with kms enabled drivers -> segfaults   # not working with kms enabled drivers -> segfaults
# Line 777  install_initrd_chroot() Line 846  install_initrd_chroot()
846   fi   fi
847    
848   # install an appropriate uvesafb.conf   # install an appropriate uvesafb.conf
849   install -d ${INSTALLPATH}/etc/modprobe.d || die   CONFIG=${INSTALL_ROOT}/etc/modprobe.d/uvesafb.conf
850   echo "options uvesafb mode_option=1024x768-32@60 scroll=ywrap" > ${INSTALLPATH}/etc/modprobe.d/uvesafb.conf || die   clearconfig
851     addconfig "options uvesafb mode_option=1024x768-32@60 scroll=ywrap"
852    
853   # install an appropriate viafb.conf   # install an appropriate viafb.conf
854   echo "options viafb viafb_mode=1024x768 viafb_refresh=60" > ${INSTALLPATH}/etc/modprobe.d/viafb.conf || die   CONFIG=${INSTALL_ROOT}/etc/modprobe.d/viafb.conf
855     clearconfig
856     addconfig "options viafb viafb_mode=1024x768 viafb_refresh=60"
857    
858   # install an appropriate i810fb.conf   # install an appropriate i810fb.conf
859   echo "options i810fb xres=1024 yres=768 bpp=16 mtrr=1 hsync1=30 hsync2=62 vsync1=30 vsync2=60"  > ${INSTALLPATH}/etc/modprobe.d/i810fb.conf || die   CONFIG=${INSTALL_ROOT}/etc/modprobe.d/i810fb.conf
860     clearconfig
861   cat > ${INSTALLPATH}/root/.installrc << CHROOTEOF   addconfig "options i810fb xres=1024 yres=768 bpp=16 mtrr=1 hsync1=30 hsync2=62 vsync1=30 vsync2=60"
862  echo "MODULES=\"${FORMAT_FILESYSTEM} ${DISKMODS} ${OLDATAMODS} ${PATAMODS} ${SATAMODS} ${DRMMODS} ${FBMODS} ${OTHERMODS}\"" > /etc/conf.d/mkinitrd  
863  mkinitrd -f /boot/$(readlink /boot/initrd) $(readlink /boot/vmlinuz | sed "s:kernel-::g") > /dev/null   CONFIG=${INSTALL_ROOT}/.installrc
864  exit 0   clearconfig
865  CHROOTEOF   addconfig 'echo "MODULES=\"${FSMODS} ${DISKMODS} ${OLDATAMODS} ${PATAMODS} ${SATAMODS} ${DRMMODS} ${FBMODS} ${OTHERMODS}\"" > /etc/conf.d/mkinitrd'
866     addconfig 'mkinitrd -f /boot/$(readlink /boot/initrd) $(readlink /boot/vmlinuz | sed "s:kernel-::g") > /dev/null'
867   ## enters chroot   addconfig 'exit 0'
868   mount -t proc proc ${INSTALLPATH}/proc   ## enter chroot
869   mount -t sysfs sysfs ${INSTALLPATH}/sys   enter_chroot_installrc
  mount -o bind /dev ${INSTALLPATH}/dev  
  chroot ${INSTALLPATH} /bin/bash --rcfile /root/.installrc -i  
  umount ${INSTALLPATH}/proc  
  umount ${INSTALLPATH}/sys  
  umount ${INSTALLPATH}/dev  
  rm ${INSTALLPATH}/root/.installrc  
870  }  }
871    
872  is_uuid_supported()  is_uuid_supported()
873  {  {
874   if [[ -x $(which busybox.mkinitrd &> /dev/null) ]]   # f2fs needs special treatments as the old busybox does not support this fs
875     # use the blkid from util-linux instead of busybox
876     if [[ ${FORMAT_FILESYSTEM} = f2fs ]]
877   then   then
878   # only detect uuids if supported   if [[ -x $(type -P blkid) ]]
879   if [[ ! -z $(busybox.mkinitrd | grep blkid) ]]   then
880     return 0
881     fi
882     else
883     if [[ -x $(type -P busybox.mkinitrd) ]]
884   then   then
885   return 0   # only detect uuids if supported
886     if [[ ! -z $(busybox.mkinitrd | grep blkid) ]]
887     then
888     return 0
889     fi
890   fi   fi
891   fi   fi
892    
# Line 822  get_uuid() Line 898  get_uuid()
898   local UUID   local UUID
899   local SEC_TYPE   local SEC_TYPE
900   local TYPE   local TYPE
901     local blkidcmd
902    
903   local dev="$1"   local dev="$1"
904   [[ -z ${dev} ]] && die "no dev given"   [[ -z ${dev} ]] && die "no dev given"
# Line 831  get_uuid() Line 908  get_uuid()
908   then   then
909   eval "${dev}"   eval "${dev}"
910   else   else
911   eval $(busybox.mkinitrd blkid ${dev} | grep "${dev}:" | sed 's/.*:\ //')   # f2fs needs special treatments as the old busybox does not support this fs
912     # use the blkid from util-linux instead of busybox
913     if [[ ${FORMAT_FILESYSTEM} = f2fs ]]
914     then
915     blkidcmd="blkid"
916     else
917     blkidcmd="busybox.mkinitrd blkid"
918     fi
919     eval $(${blkidcmd} ${dev} | grep "${dev}:" | sed 's/.*:\ //')
920   fi   fi
921   echo "${UUID}"   echo "${UUID}"
922  }  }
923    
924  install_system_settings()  install_system_settings()
925  {  {
926   # schreibe fstab   local CONFIG
927   if is_uuid_supported   local fstype
928    
929     # write fstab
930     CONFIG=${INSTALL_ROOT}/etc/fstab
931     clearconfig
932    
933     if [[ -n ${BOOTHDD} ]]
934   then   then
935   echo -e "UUID=$(get_uuid ${BOOTHDD})\t/boot\t${FORMAT_FILESYSTEM}\tnoatime,noauto\t1 1" > ${INSTALLPATH}/etc/fstab || die   if is_uuid_supported
936   echo -e "UUID=$(get_uuid ${ROOTHDD})\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" >> ${INSTALLPATH}/etc/fstab || die   then
937   else   addconfig -e "UUID=$(get_uuid ${BOOTHDD})\t/boot\t${FORMAT_FILESYSTEM_BOOTHDD}\tnoatime,noauto\t1 1"
938   echo -e "${BOOTHDD}\t/boot\t${FORMAT_FILESYSTEM}\tnoatime,noauto\t1 1" > ${INSTALLPATH}/etc/fstab || die   else
939   echo -e "${ROOTHDD}\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" >> ${INSTALLPATH}/etc/fstab || die   addconfig -e "${BOOTHDD}\t/boot\t${FORMAT_FILESYSTEM_BOOTHDD}\tnoatime,noauto\t1 1"
940     fi
941   fi   fi
942    
943     if [[ -n ${ROOTHDD} ]]
944     then
945     if is_uuid_supported
946     then
947     addconfig -e "UUID=$(get_uuid ${ROOTHDD})\t/\t${FORMAT_FILESYSTEM_ROOTHDD}\tnoatime\t0 0"
948     else
949     addconfig -e "${ROOTHDD}\t/\t${FORMAT_FILESYSTEM_ROOTHDD}\tnoatime\t0 0"
950     fi
951     fi
952    
953   # 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
954   #echo -e "UUID='$(get_uuid ${SWAPHDD})'\tswap\tswap\tpri=1\t0 0" >> ${INSTALLPATH}/etc/fstab || die   #addconfig -e "UUID='$(get_uuid ${SWAPHDD})'\tswap\tswap\tpri=1\t0 0"
955   echo -e "proc\t/proc\tproc\tdefaults\t0 0" >> ${INSTALLPATH}/etc/fstab || die   addconfig -e "proc\t/proc\tproc\tdefaults\t0 0"
956   echo -e "shm\t/dev/shm\ttmpfs\tdefaults\t0 0" >> ${INSTALLPATH}/etc/fstab || die   addconfig -e "shm\t/dev/shm\ttmpfs\tdefaults\t0 0"
957    
958   # install network config skeleton   # install network config skeleton
959   install -m0644 ${INSTALLPATH}/etc/alxconfig-ng/skel/net/net.eth0 ${INSTALLPATH}/etc/conf.d/ || die   install -m0644 ${INSTALL_ROOT}/etc/alxconfig-ng/skel/net/net.eth0 ${INSTALL_ROOT}/etc/conf.d/ || die
960    
961   # intel framebufer quirk   # intel framebufer quirk
962   if [[ -e /proc/fb ]]   if [[ -e /proc/fb ]]
# Line 863  install_system_settings() Line 966  install_system_settings()
966   fbdev=$(grep 'inteldrmfb' /proc/fb | sed 's:\([0-9]\).*:\1:')   fbdev=$(grep 'inteldrmfb' /proc/fb | sed 's:\([0-9]\).*:\1:')
967   if [[ ${fbdev} != 0 ]]   if [[ ${fbdev} != 0 ]]
968   then   then
969   sed -i "s:^\(SPLASH_DEV=\).*:\1\"/dev/fb${fbdev}\":" ${INSTALLPATH}/etc/splash/splash.conf || die   sed -i "s:^\(SPLASH_DEV=\).*:\1\"/dev/fb${fbdev}\":" ${INSTALL_ROOT}/etc/splash/splash.conf || die
970   fi   fi
971   fi   fi
972   fi   fi
973  }  }
974    
 install_system_settings_flash()  
 {  
  # schreibe fstab  
  if is_uuid_supported  
  then  
  echo -e "UUID=$(get_uuid ${ROOTHDD})\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" > ${INSTALLPATH}/etc/fstab || die  
  else  
  echo -e "${ROOTHDD}\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" > ${INSTALLPATH}/etc/fstab || die  
  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  
 }  
   
975  install_umount_rootfs()  install_umount_rootfs()
976  {  {
977   cd /   cd /
978   umount ${INSTALLPATH}/boot || die   if [[ -n ${BOOTHDD} ]]
979   umount ${INSTALLPATH} || die   then
980   swapoff ${SWAPHDD} || die   umount ${INSTALL_ROOT}/boot || die
981  }   fi
982     if [[ -n ${ROOTHDD} ]]
983  install_umount_rootfs_flash()   then
984  {   umount ${INSTALL_ROOT} || die
985   cd /   fi
986   umount ${INSTALLPATH} || die   if [[ -n ${SWAPHDD} ]]
987     then
988     swapoff ${SWAPHDD} || die
989     fi
990  }  }
991    
992  install_do_reboot()  install_do_reboot()
# Line 902  install_do_reboot() Line 995  install_do_reboot()
995  }  }
996    
997  #################################################  #################################################
998  #     Install Ablauf Scripte #  #     Install Main Scripts #
999  #################################################  #################################################
1000    
1001  run_install_normal()  run_install()
1002  {  {
1003     local method="$1"
1004    
1005     # setup install environment
1006     export KERNELOPTS="${DEFAULT_KERNELOPTS}"
1007     export GRUBLEGACYOPTS="${GRUBLEGACYOPTS}"
1008     export GRUB2OPTS="${GRUB2OPTS}"
1009     export GRUB2GFXPAYLOAD="${DEFAULT_GRUB2GFXPAYLOAD}"
1010     export FORMFACTOR="${DEFAULT_FORMFACTOR}"
1011     export FORMAT_FILESYSTEM="${DEFAULT_FORMAT_FILESYSTEM}"
1012    
1013     case "${method}" in
1014     auto)
1015     if [[ ${FLASHDISK} = 1 ]]
1016     then
1017     export FORMAT_FILESYSTEM="f2fs"
1018     export FORMAT_FILESYSTEM_BOOTHDD="ext2"
1019     export FORMAT_FILESYSTEM_ROOTHDD="${FORMAT_FILESYSTEM}"
1020     else
1021     export FORMAT_FILESYSTEM_BOOTHDD=""
1022     export FORMAT_FILESYSTEM_ROOTHDD="${FORMAT_FILESYSTEM}"
1023     fi
1024     export INSTALL_METHOD="${method}"
1025     ;;
1026     normal)
1027     export FORMAT_FILESYSTEM_BOOTHDD="${FORMAT_FILESYSTEM}"
1028     export FORMAT_FILESYSTEM_ROOTHDD="${FORMAT_FILESYSTEM}"
1029     export INSTALL_METHOD="${method}"
1030     ;;
1031     single)
1032     export FORMAT_FILESYSTEM_BOOTHDD=""
1033     export FORMAT_FILESYSTEM_ROOTHDD="${FORMAT_FILESYSTEM}"
1034     export INSTALL_METHOD="${method}"
1035     ;;
1036     flash)
1037     export FORMAT_FILESYSTEM="f2fs"
1038     export FORMAT_FILESYSTEM_BOOTHDD="ext2"
1039     export FORMAT_FILESYSTEM_ROOTHDD="${FORMAT_FILESYSTEM}"
1040     export INSTALL_METHOD="${method}"
1041     ;;
1042     *)
1043     die "Unknown install method '${method}', aborting."
1044     ;;
1045     esac
1046    
1047   dialog_hardware_detection   dialog_hardware_detection
1048    
1049   dialog_setup_hdd_partitions_manuell   dialog_setup_hdd_partitions
1050   dialog_setup_hdd_format   dialog_setup_hdd_format
1051   setup_hdd_format > /dev/null   setup_hdd_format > /dev/null
1052   install_mount_rootfs   install_mount_rootfs
# Line 927  run_install_normal() Line 1064  run_install_normal()
1064   dialog_install_successful   dialog_install_successful
1065  }  }
1066    
1067  run_install_flash()  # set some proper traps
1068  {  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  
 }  
1069    
1070  dialog_main  dialog_main
1071    

Legend:
Removed from v.5004  
changed lines
  Added in v.6848