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 520 by niro, Fri Jun 27 22:27:46 2008 UTC alx-src/trunk/alxinstall-ng/bin/alxinstall-ng.sh.in revision 5575 by niro, Tue Apr 22 10:55:06 2014 UTC
# Line 1  Line 1 
1  #!/bin/sh  #!/bin/sh
2  #  #
3  # $Header: /home/cvsd/alx-cvs/alx-src/alxinstall-ng/bin/alxinstall-ng.sh,v 1.7 2008-06-27 22:27:46 niro Exp $  # $Header: /home/cvsd/alx-cvs/alx-src/alxinstall-ng/bin/alxinstall-ng.sh,v 1.15 2008-06-28 00:37:45 niro Exp $
4  #  #
5  # AutoSta_LX Installation Script  # AutoSta_LX Installation Script
6  #  #
# Line 17  source /mnt/cdrom/system/images.conf Line 17  source /mnt/cdrom/system/images.conf
17  #Includes  #Includes
18  source /usr/lib/alxinstall-ng/functions/findhdd.sh > /dev/null  source /usr/lib/alxinstall-ng/functions/findhdd.sh > /dev/null
19  ### bugfix ###############################  ### bugfix ###############################
20  cdromdev="`echo $cdromdev|sed -e 's/ //'`"  cdromdev="$(echo ${cdromdev} | sed 's/ //')"
21  ########################################  ########################################
22    
23  ### System/Config Version  ### System/Config Version
24  VERSION="0.3"  VERSION="%VERSIONTAG%"
25  TITLE="alxinstall-ng - ${VERSION}"  TITLE="alxinstall-ng - ${VERSION}"
26    
 #CONFIGS_TEMPLATE="/opt/alx-config/configs"  
   
27  CDPATH="/mnt/cdrom"  CDPATH="/mnt/cdrom"
28  INSTALLPATH="/mnt/magellan"  INSTALLPATH="/mnt/magellan"
29    
# Line 33  INSTALLPATH="/mnt/magellan" Line 31  INSTALLPATH="/mnt/magellan"
31  CURRENTLINE=0  CURRENTLINE=0
32  #TOTALLINES=11072 # -> now in images.conf  #TOTALLINES=11072 # -> now in images.conf
33    
34    # standard kernel opts
35    KERNELOPTS="quiet video=1024x768"
36    
37    # grub options
38    GRUBLEGACYOPTS=""
39    GRUB2OPTS=""
40    GRUB2GFXPAYLOAD="1024x768x16,1024x768"
41    
42    # fdisk options
43    FDISKPARTIONBELOW256MB=0
44    
45    # default specialdevices
46    SPECIALDEVICE=""
47    FORMFACTOR="desktop"
48    
49    # target filesystem
50    FORMAT_FILESYSTEM="ext4"
51    
52  #################################################  #################################################
53  #  DIALOG BOXEN #  #  DIALOG BOXEN #
# Line 94  dialog_setup_hdd_info_flash() Line 109  dialog_setup_hdd_info_flash()
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_auto()
113    {
114     local SHDD="$(echo $HDD | sed 's/\/dev\///')"
115    
116     dialog \
117     --colors \
118     --title "[ Festplatten Partitionierung ]" \
119     --backtitle "${TITLE}" \
120     --ok-label "Weiter" \
121     --msgbox "\nAchtung!\n\
122     Alle Daten werden von der Disk [ \Z3${HDD}\Zn ] gelöscht!" 12 81
123    }
124    
125  dialog_setup_system_menu()  dialog_setup_system_menu()
126  {  {
127   local i   local i
# Line 104  dialog_setup_system_menu() Line 132  dialog_setup_system_menu()
132   --cancel-label "Abbrechen" \   --cancel-label "Abbrechen" \
133   --ok-label "Weiter" \   --ok-label "Weiter" \
134   --stdout \   --stdout \
135     --colors \
136   --menu "\nWaehlen Sie die Installations-Methode" 14 70 5 \   --menu "\nWaehlen Sie die Installations-Methode" 14 70 5 \
137   "1" "Normale IDE-Disk" \   "1" "Automatisches Setup (Empfohlen)" \
138   "2" "Flash-Speicher")   "" "" \
139     "" "\Z1Experten Modi:\Zn" \
140     "2" "Normale IDE-Disk (Manuell)" \
141     "3" "Flash-Speicher (Manuell)")
142   RES=$?   RES=$?
143   [[ ${RES} -eq 1 ]] && return 1   [[ ${RES} -eq 1 ]] && return 1
144   if [[ ${RES} -eq 0 ]]   if [[ ${RES} -eq 0 ]]
145   then   then
146   case "${i}" in   case "${i}" in
147           "1") run_install_normal ;;   "1") run_install_auto ;;
148   "2") run_install_flash ;;           "2") run_install_normal ;;
149     "3") run_install_flash ;;
150     "") dialog_setup_system_menu;;
151   esac   esac
152   fi   fi
153  }  }
154    
155  dialog_setup_hdd_found_manuell()  dialog_hardware_detection()
156  {  {
157   local i   local i
158     local hwtmp
159    
160     if [ -x $(which mktemp &> /dev/null) ]
161     then
162     hwtmp="$(mktemp)"
163     else
164     hwtmp="/tmp/hwtmp.sh"
165     fi
166    
167   [[ ! -z ${installdevs} ]] && installdevs=""   [[ ! -z ${installdevs} ]] && installdevs=""
168    
169   echo "dialog \\"  > /tmp/hddtmp.sh   echo "dialog \\"  > ${hwtmp}
170   echo "--backtitle \"${TITLE}\" \\" >> /tmp/hddtmp.sh   echo "--backtitle \"${TITLE}\" \\" >> ${hwtmp}
171   echo "--ok-label \"Weiter\" \\" >> /tmp/hddtmp.sh   echo "--ok-label \"Weiter\" \\" >> ${hwtmp}
172   echo "--stdout \\" >> /tmp/hddtmp.sh   echo "--stdout \\" >> ${hwtmp}
173   echo "--colors \\" >> /tmp/hddtmp.sh   echo "--colors \\" >> ${hwtmp}
174   echo "--msgbox \"Gefundene Hardware:\n\n \\" >> /tmp/hddtmp.sh   echo "--msgbox \"Gefundene Hardware:\n\n \\" >> ${hwtmp}
175   echo " Festplatten:\n \\" >> /tmp/hddtmp.sh   echo " Festplatten:\n \\" >> ${hwtmp}
176    
177   if [[ ! -z ${scsidisks} ]]   if [[ ! -z ${scsidisks} ]]
178   then   then
# Line 138  dialog_setup_hdd_found_manuell() Line 180  dialog_setup_hdd_found_manuell()
180   do   do
181   if [[ ${i} != ${cdromdev} ]]   if [[ ${i} != ${cdromdev} ]]
182   then   then
183   echo " \\Z7SCSI: \\Z3${i}\\Zn\n \\" >> /tmp/hddtmp.sh   echo " \\Z7SCSI: \\Z3${i}\\Zn\n \\" >> ${hwtmp}
184   installdevs="${installdevs} ${i}"   installdevs="${installdevs} ${i}"
185   fi   fi
186   done   done
# Line 150  dialog_setup_hdd_found_manuell() Line 192  dialog_setup_hdd_found_manuell()
192   do   do
193   if [[ ${i} != ${cdromdev} ]]   if [[ ${i} != ${cdromdev} ]]
194   then   then
195   echo " \\Z7IDE:  \\Z3${i}\\Zn\n \\" >> /tmp/hddtmp.sh   echo " \\Z7IDE:  \\Z3${i}\\Zn\n \\" >> ${hwtmp}
196   installdevs="${installdevs} ${i}"   installdevs="${installdevs} ${i}"
197   fi   fi
198   done   done
# Line 158  dialog_setup_hdd_found_manuell() Line 200  dialog_setup_hdd_found_manuell()
200    
201   if [[ ! -z ${cdromdev} ]]   if [[ ! -z ${cdromdev} ]]
202   then   then
203   echo " \n \\" >> /tmp/hddtmp.sh   echo " \n \\" >> ${hwtmp}
204   echo " \\Z7andere Laufwerke:\n \\" >> /tmp/hddtmp.sh   echo " \\Z7andere Laufwerke:\n \\" >> ${hwtmp}
205   echo " CDROM: \\Z3${cdromdev}\\Zn\n \\" >> /tmp/hddtmp.sh   echo " CDROM: \\Z3${cdromdev}\\Zn\n \\" >> ${hwtmp}
206   fi   fi
207   echo " \" 13 70" >> /tmp/hddtmp.sh  
208   chmod a+x /tmp/hddtmp.sh   # other devices
209   /tmp/hddtmp.sh   run_hardware_detection
210     case "${SPECIALDEVICE}" in
211     zotac*) echo " \n\n\n \\Z2Zotac Device erkannt.\\Zn \\" >> ${hwtmp} ;;
212     rangee) echo " \n\n\n \\Z2Rangee Device erkannt.\\Zn \\" >> ${hwtmp} ;;
213     maxdata) echo " \n\n\n \\Z2Maxdata Device erkannt.\\Zn \\" >> ${hwtmp} ;;
214     i845) echo " \n\n\n \\Z2Intel i845 Device erkannt.\\Zn \\" >> ${hwtmp} ;;
215     *) echo " \n\n\n \\ZnStandard Device erkannt.\\Zn \\" >> ${hwtmp} ;;
216     esac
217     if [[ ${FORMFACTOR} = laptop ]]
218     then
219     echo " \n \\ZnFormfactor Laptop, Powersave Modus 'ondemand' wird aktiviert.\\Zn \\" >> ${hwtmp}
220     fi
221    
222     echo " \" 14 70" >> ${hwtmp}
223     chmod a+x ${hwtmp}
224     ${hwtmp}
225    
226     # remove tmp file
227     if [[ -f ${hwtmp} ]]
228     then
229     rm ${hwtmp}
230     fi
231  }  }
232    
233  dialog_setup_hdd_partitions_manuell()  dialog_setup_hdd_partitions_manuell()
# Line 243  dialog_setup_hdd_partitions_manuell_flas Line 306  dialog_setup_hdd_partitions_manuell_flas
306   fi   fi
307  }  }
308    
309  dialog_setup_hdd_partitions_silent()  dialog_setup_hdd_partitions_auto()
310    {
311     local i
312    
313     if [[ -z ${installdevs} ]]
314     then
315     dialog \
316     --backtitle "${TITLE}" \
317     --ok-label "Beenden" \
318     --msgbox "Kein geeignetes Laufwerk gefunden.\nDie Installation ist fehlgeschlagen." 6 70
319     exit 1
320     else
321    
322     echo "dialog \\" > /tmp/hddtmp.sh
323     echo "--backtitle \"${TITLE}\" \\" >> /tmp/hddtmp.sh
324     echo "--ok-label \"Weiter\" \\" >> /tmp/hddtmp.sh
325     echo "--cancel-label \"Beenden\" \\" >> /tmp/hddtmp.sh
326     echo "--stdout \\" >> /tmp/hddtmp.sh
327     echo "--menu \"Installations Laufwerk auswaehlen:\" 10 70 3 \\" >> /tmp/hddtmp.sh
328    
329     for i in ${installdevs}
330     do
331     echo "\"${i}\" \"\" \\" >> /tmp/hddtmp.sh
332     done
333     echo -e "\n" >> /tmp/hddtmp.sh
334    
335     chmod a+x /tmp/hddtmp.sh
336     HDD="$(/tmp/hddtmp.sh)"
337     RES=$?
338     [[ ${RES} -eq 1 ]] && return 1
339     if [[ ${RES} -eq 0 ]]
340     then
341     dialog_setup_hdd_info_auto
342     dialog_setup_hdd_create_partitions
343     setup_hdd_partitions_auto
344     fi
345     fi
346    }
347    
348    dialog_setup_hdd_create_partitions()
349  {  {
350   dialog \   dialog \
351   --backtitle "${TITLE}" \   --backtitle "${TITLE}" \
352   --infobox "Erstelle Partitionen ..." 3 70   --infobox "Erstelle Disk Partitionen ..." 3 70
353  }  }
354    
355  dialog_setup_hdd_format()  dialog_setup_hdd_format()
# Line 275  dialog_install_meter() Line 377  dialog_install_meter()
377  {  {
378   while [[ ${CURRENTLINE} != ${TOTALLINES} ]]   while [[ ${CURRENTLINE} != ${TOTALLINES} ]]
379   do   do
380   CURRENTLINE=$(grep --count . /tmp/install.log)   CURRENTLINE=$(grep -c . /tmp/install.log)
381   PERCENT=$(expr ${CURRENTLINE} \* 100 / ${TOTALLINES})   PERCENT=$(( ${CURRENTLINE} * 100 / ${TOTALLINES}))
382   echo ${PERCENT}   echo ${PERCENT}
383   sleep 1   sleep 1
384   done   done
# Line 292  dialog_install_bootsector() Line 394  dialog_install_bootsector()
394   --infobox "Schreibe den Bootsektor ..." 3 70   --infobox "Schreibe den Bootsektor ..." 3 70
395  }  }
396    
 dialog_install_alxconfig()  
 {  
  dialog \  
  --backtitle "${TITLE}" \  
  --infobox "Installiere die ALX Setup-Tools ..." 3 70  
 }  
   
 dialog_install_kernel_image()  
 {  
  dialog \  
  --backtitle "${TITLE}" \  
  --infobox "Installiere den System-Kernel ..." 3 70  
   
 }  
   
 dialog_install_hotfixes()  
 {  
  dialog \  
  --backtitle "${TITLE}" \  
  --infobox "Installiere Hotfixes ..." 3 70  
   
 }  
   
397  dialog_install_successful()  dialog_install_successful()
398  {  {
399   dialog \   dialog \
# Line 333  dialog_install_failure() Line 412  dialog_install_failure()
412   " 10 81   " 10 81
413  }  }
414    
 dialog_install_method()  
 {  
   
  METHOD=$(dialog \  
  --backtitle "${TITLE}" \  
  --cancel-label "Abbrechen" \  
  --ok-label "Weiter" \  
  --stdout \  
  --menu "Konfiguration" 14 70 5 \  
  "1" "Normale Installation" \  
  "2" "Silent Installation")  
  RES=$?  
  [[ ${RES} -eq 1 ]] && return 1  
  if [[ ${RES} -eq 0 ]]  
  then  
  case ${METHOD} in  
          "1") run_install_normal ;;  
  "2") dialog_warning ; run_install_silent ;;  
  esac  
  fi  
 }  
   
415  dialog_main()  dialog_main()
416  {  {
417   METHOD=0   METHOD=0
# Line 372  dialog_main() Line 429  dialog_main()
429   "3" "Beenden und neustarten" \   "3" "Beenden und neustarten" \
430   "4" "Beenden und eine Shell starten")   "4" "Beenden und eine Shell starten")
431   RES=$?   RES=$?
432   if [[ ${RES} -eq 1 ]] && exit 1   [[ ${RES} -eq 1 ]] && exit 1
433   if [[ ${RES} -eq 0 ]]   if [[ ${RES} -eq 0 ]]
434   then   then
435   case ${METHOD} in   case ${METHOD} in
436           "1") dialog_setup_system_menu ;;           "1") dialog_setup_system_menu ;;
437   "2") dialog_setup_hdd_found_manuell ;;   "2") dialog_hardware_detection ;;
438   "3") install_do_reboot ;;   "3") install_do_reboot ;;
439   "4") /bin/bash --login -i ;;   "4") /bin/bash --login -i ;;
440   esac   esac
# Line 388  dialog_main() Line 445  dialog_main()
445  #################################################  #################################################
446  # Install Komandos #  # Install Komandos #
447  #################################################  #################################################
448    run_hardware_detection()
449    {
450     local hwinfo
451    
452     hwinfo="$(hwinfo --bios --storage --pci --gfxcard --sys)"
453    
454     # check for special devices/clients:
455     # if zotac a zotac and the disk is a removeable device, then add rootdelay to kernelcmd
456     local removable=0
457     if [[ ! -z $(echo "${hwinfo}" | grep -i zotac) ]]
458     then
459     for i in /sys/block/[hs]d*/removable
460     do
461     if [[ $(< ${i}) = 1 ]]
462     then
463     removable=1
464     fi
465     done
466    
467     # only add this for grub legacy, grub2 detect these settings on its own
468     export GRUBLEGACYOPTS="rootdelay=8"
469     # there are two zotac types in the wild, nvidia based gfx and intel
470     if [[ ! -z $(echo "${hwinfo}" | grep -i nouveau) ]]
471     then
472     export SPECIALDEVICE="zotac_nvidia"
473     else
474     export SPECIALDEVICE="zotac_intel"
475     fi
476     fi
477    
478     # check for special devices/clients:
479     # if a rangee and disk ist smaller then 256mb move partion one block further ahead
480     if [[ ! -z $(echo "${hwinfo}" | grep -i CLE266) ]]
481     then
482     # for a rangee always define partion startblock +1
483     export FDISKPARTIONBELOW256MB="1"
484     export SPECIALDEVICE="rangee"
485     export GRUBLEGACYOPTS=""
486     fi
487    
488     # check for special devices/clients:
489     # check for maxdata / i810/ i815 Chipsets and disable KMS and use i810fb frambuffer
490     if [[ ! -z $(echo "${hwinfo}" | grep -i i810) ]] || [[ ! -z $(echo "${hwinfo}" | grep -i i815) ]]
491     then
492     export SPECIALDEVICE="maxdata"
493     export GRUBLEGACYOPTS=""
494     fi
495    
496     # check for i845 Chipsets and disable KMS and use 915 drm driver
497     if [[ ! -z $(echo "${hwinfo}" | grep -i i845) ]]
498     then
499     export SPECIALDEVICE="i845"
500     # unset default video=1024x768 opt or the drm driver breaks
501     export KERNELOPTS="quiet"
502     export GRUBLEGACYOPTS=""
503     # enable full kms support
504     export GRUB2GFXPAYLOAD="keep"
505     fi
506    
507     # check for special devices/clients:
508     # check for laptops and activate cpufreq scaling
509     if [[ $(echo "${hwinfo}" | grep 'Formfactor:' | sed 's:.*Formfactor\:\ \"\(.*\)\":\1:') = laptop ]]
510     then
511     export FORMFACTOR="laptop"
512     export KERNELOPTS="${KERNELOPTS} cpufreq.governor=ondemand"
513     fi
514    }
515    
516    hdd_size_below_256mb()
517    {
518     local hdd="$1"
519     local size
520     local retval
521     [[ -z ${hdd} ]] && die "Error: get_hdd_size() no \$hdd given!"
522    
523     size=$(fdisk -l ${hdd} | grep "Disk.*${hdd}" | sed 's:.*,\ \(.*\)\ byte.*:\1:')
524     if [[ ${size} -le 257000000 ]]
525     then
526     retval="0"
527     else
528     retval="1"
529     fi
530    
531     return "${retval}"
532    }
533    
534    setup_hdd_partitions_auto()
535    {
536     ROOTHDD="${HDD}1"
537    
538     # run this only if FDISKPARTITIONBELOW256MB is not already 1
539     if [[ ${FDISKPARTIONBELOW256MB} != 1 ]]
540     then
541     if hdd_size_below_256mb ${HDD}
542     then
543     FDISKPARTIONBELOW256MB=1
544     else
545     FDISKPARTIONBELOW256MB=0
546     fi
547     fi
548    
549     ## delete disk
550     dd if=/dev/zero of=${HDD} count=1 &> /dev/null || die
551    
552     if [[ ${FDISKPARTIONBELOW256MB} = 1 ]]
553     then
554     ## setup one bootable partition
555     #1. n= new disk
556     #2. p= primary disk
557     #3. 1= first partition
558     #4. 2= default sector start // small disk needs more space for grub2 mbr sector
559     #5. ''= defaul sector end
560     #6. a= bootable flag
561     #7. 1= boot flag for partition 1
562     #8. w= write/quit
563     fdisk ${HDD} &> /dev/null << EOF
564    n
565    p
566    1
567    2
568    
569    a
570    1
571    w
572    EOF
573     else
574     ## setup one bootable partition
575     #1. n= new disk
576     #2. p= primary disk
577     #3. 1= first partition
578     #4. ''= default sector start
579     #5. ''= defaul sector end
580     #6. a= bootable flag
581     #7. 1= boot flag for partition 1
582     #8. w= write/quit
583     fdisk ${HDD} &> /dev/null << EOF
584    n
585    p
586    1
587    
588    
589    a
590    1
591    w
592    EOF
593     fi
594    }
595    
596  setup_hdd_partitions_manuell()  setup_hdd_partitions_manuell()
597  {  {
598   BOOTHDD="${HDD}1"   BOOTHDD="${HDD}1"
# Line 406  setup_hdd_partitions_manuell_flash() Line 611  setup_hdd_partitions_manuell_flash()
611   cfdisk ${HDD} || die   cfdisk ${HDD} || die
612  }  }
613    
 setup_hdd_partitions_silent()  
 {  
  ## hdds löschen  
  dd if=/dev/zero of=${HDD} bs=1024k count=1 || die  
  ## hdds partitionieren silent  
  fdisk ${HDD} < ${CONFIGS_TEMPLATE}/fdisksettings  
   
  read  
 }  
   
614  setup_hdd_format()  setup_hdd_format()
615  {  {
616   mkswap ${SWAPHDD} || die   mkswap ${SWAPHDD} || die
# Line 449  install_system_image() Line 644  install_system_image()
644   tar xvjpf ${CDPATH}/system/${CDIMAGENAME} -C ${INSTALLPATH}   tar xvjpf ${CDPATH}/system/${CDIMAGENAME} -C ${INSTALLPATH}
645  }  }
646    
647    install_bootsector_chroot()
 install_kernel_image()  
648  {  {
649   declare -i CPUTYPE=$(cat /proc/cpuinfo | grep "cpu family" | cut -d ' ' -f3)   local my_roothdd
650     local grubconf=${INSTALLPATH}/boot/grub/grub.conf
651   if [[ ${CPUTYPE} -le 5 ]]   local grub2conf=/boot/grub/grub.cfg
  then  
  lastdir="$(pwd)"  
   
  mkdir -p ${INSTALLPATH}/INSTALL/kernel || die  
  cd ${INSTALLPATH}/INSTALL/kernel || die  
  tar xzpf ${CDPATH}/kernels/kernel-i386.tar.gz || die  
  source ${INSTALLPATH}/INSTALL/kernel/kernelversion || die  
652    
653   cp -aRf ${INSTALLPATH}/INSTALL/kernel/${KRNLIB} ${INSTALLPATH}/lib/modules || die   # check for grub2
654   cp -aRf ${INSTALLPATH}/INSTALL/kernel/${KRNIMG} ${INSTALLPATH}/boot || die   if [[ -f ${INSTALLPATH}/sbin/grub-mkconfig ]]
  cp -aRf ${INSTALLPATH}/INSTALL/kernel/${KRNINITRD} ${INSTALLPATH}/boot || die  
  cp -aRf ${INSTALLPATH}/INSTALL/kernel/kernelversion ${INSTALLPATH}/boot || die  
   
  cd ${lastdir} || die  
   
         elif [[ ${CPUTYPE} -ge 6 ]]  
655   then   then
656   lastdir="$(pwd)"   # needed by grub-mkconfig on the first run
657     if [[ ! -f ${INSTALLPATH}/boot/grub/video.lst ]]
658     then
659     install -m0644 ${INSTALLPATH}/lib/grub/*/video.lst ${INSTALLPATH}/boot/grub/video.lst || die
660     fi
661    
662   mkdir -p ${INSTALLPATH}/INSTALL/kernel || die   # set kernelopts
663   cd ${INSTALLPATH}/INSTALL/kernel || die   if [[ -f ${INSTALLPATH}/etc/conf.d/grub ]]
664   tar xzpf ${CDPATH}/kernels/kernel-i686.tar.gz || die   then
665   source ${INSTALLPATH}/INSTALL/kernel/kernelversion || die   sed -i "s:^\(export GRUB_CMDLINE_LINUX_DEFAULT=\).*:\1\"${KERNELOPTS}\":" ${INSTALLPATH}/etc/conf.d/grub || die
666     sed -i "s:^\(export GRUB_GFXPAYLOAD_LINUX=\).*:\1\"${GRUB2GFXPAYLOAD}\":" ${INSTALLPATH}/etc/conf.d/grub || die
667     else
668     echo "export GRUB_CMDLINE_LINUX_DEFAULT=\"${KERNELOPTS}\"" >  ${INSTALLPATH}/etc/conf.d/grub || die
669     echo "export GRUB_GFXPAYLOAD_LINUX=\"${GRUB2GFXPAYLOAD}\"" >>  ${INSTALLPATH}/etc/conf.d/grub || die
670     fi
671     echo 'grub-mkdevicemap' > ${INSTALLPATH}/root/.installrc || die
672     echo "LC_ALL=C grub-mkconfig -o ${grub2conf}  &> /dev/null" >> ${INSTALLPATH}/root/.installrc || die
673     echo "grub-install --no-floppy ${HDD} &> /dev/null" >> ${INSTALLPATH}/root/.installrc || die
674     echo "exit 0" >> ${INSTALLPATH}/root/.installrc || die
675    
676   cp -aRf ${INSTALLPATH}/INSTALL/kernel/${KRNLIB} ${INSTALLPATH}/lib/modules || die   # grub-legacy
677   cp -aRf ${INSTALLPATH}/INSTALL/kernel/${KRNIMG} ${INSTALLPATH}/boot || die   else
678   cp -aRf ${INSTALLPATH}/INSTALL/kernel/${KRNINITRD} ${INSTALLPATH}/boot || die   ### grubconf schreiben
679   cp -aRf ${INSTALLPATH}/INSTALL/kernel/kernelversion ${INSTALLPATH}/boot || die   source ${INSTALLPATH}/boot/kernelversion
680    
681   cd ${lastdir} || die   #for alx only
682          fi   if [ -e ${INSTALLPATH}/etc/alx_version ]
683  }   then
684     OLD_ALXVER="${ALXVER}"
685     source ${INSTALLPATH}/etc/alx_version
686     KRNVER="ALX-${ALXVER}"
687     ALXVER="${OLD_ALXVER}"
688     fi
689    
690  install_bootsector()   [[ -z ${KRNVER} ]] && KRNVER="AutoSta_LX"
691  {   [[ -z ${KRNINITRD} ]] && KRNINITRD="initrd"
692   ### grubconf schreiben   [[ -z ${KRNIMG} ]] && KRNIMG="vmlinuz"
  source ${INSTALLPATH}/INSTALL/kernel/kernelversion  
693    
694   [[ -z ${KRNVER} ]] && KRNVER="AutoSta_LX"   # uuid support
695   [[ -z ${KRNIMG} ]] && KRNIMG="bzImage"   if is_uuid_supported
696   [[ -z ${KRNINITRD} ]] && KRNINITRD="initrd"   then
697     my_roothdd="UUID=$(get_uuid ${ROOTHDD})"
698     else
699     my_roothdd="${ROOTHDD}"
700     fi
701    
702     : > ${grubconf} || die
703     echo "default 0" >> ${grubconf} || die
704     echo "timeout 3" >> ${grubconf} || die
705     # using current root password
706     echo "password --md5 $(cat ${INSTALLPATH}/etc/shadow | grep root | cut -d: -f2)"  >> ${grubconf} || die
707    
708     echo  >> ${grubconf} || die
709     echo "# normal boot" >> ${grubconf} || die
710     echo "title ${KRNVER}" >> ${grubconf} || die
711     echo "root (hd0,0)" >> ${grubconf} || die
712     echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS}" >> ${grubconf} || die
713     if is_initrd_supported
714     then
715     echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die
716     fi
717    
718   echo -e "default 0" > ${INSTALLPATH}/boot/grub/grub.conf || die   echo >> ${grubconf} || die
719   echo -e "timeout 03" >> ${INSTALLPATH}/boot/grub/grub.conf ||die   echo "# admin boot" >> ${grubconf} || die
720   echo -e "\ntitle=${KRNVER}" >> ${INSTALLPATH}/boot/grub/grub.conf || die   echo "title ${KRNVER} - Re-run hardware-detection" >> ${grubconf} || die
721   echo -e "root (hd0,0)" >> ${INSTALLPATH}/boot/grub/grub.conf || die   echo "lock"  >> ${grubconf} || die
722     echo "root (hd0,0)" >> ${grubconf} || die
723     echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS} hardware-auto-detection" >> ${grubconf} || die
724     if is_initrd_supported
725     then
726     echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die
727     fi
728    
729   echo -e "kernel (hd0,0)/boot/${KRNIMG} root=${ROOTHDD} quiet" >> ${INSTALLPATH}/boot/grub/grub.conf || die   echo >> ${grubconf} || die
730     echo "title ${KRNVER} - Reset *all* local settings" >> ${grubconf} || die
731     echo "lock"  >> ${grubconf} || die
732     echo "root (hd0,0)" >> ${grubconf} || die
733     echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS} alx-reset-settings" >> ${grubconf} || die
734     if is_initrd_supported
735     then
736     echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die
737     fi
738    
739   ### bootsector schreiben   # bootsector schreiben chrooted schreiben (lfs/magellan)
740   /sbin/grub --no-floppy --batch << "EOF" 1> /dev/null 2> /dev/null || die   cat > ${INSTALLPATH}/root/.installrc << CHROOTEOF
741    /usr/sbin/grub --no-floppy --batch << "EOF" 1> /dev/null 2> /dev/null
742  root (hd0,0)  root (hd0,0)
743  setup (hd0)  setup (hd0)
744  quit  quit
745  EOF  EOF
746    exit 0
747    CHROOTEOF
748     fi
749    
750     ## enters chroot
751     mount -t proc proc ${INSTALLPATH}/proc
752     mount -t sysfs sysfs ${INSTALLPATH}/sys
753     mount -o bind /dev ${INSTALLPATH}/dev
754     chroot ${INSTALLPATH} /bin/bash --rcfile /root/.installrc -i
755     umount ${INSTALLPATH}/proc
756     umount ${INSTALLPATH}/sys
757     umount ${INSTALLPATH}/dev
758     rm ${INSTALLPATH}/root/.installrc
759  }  }
760    
761  install_bootsector_chroot()  is_initrd_supported()
762  {  {
763   ### grubconf schreiben   # only generate initrds if the cmd exists
764   source ${INSTALLPATH}/boot/kernelversion   [[ -x ${INSTALLPATH}/sbin/mkinitrd ]] && return 0
765     return 1
766    }
767    
768   #for alx only  install_initrd_chroot()
769   if [ -e ${INSTALLPATH}/etc/alx_version ]  {
770   then   # only generate initrds if the cmd exists
771   OLD_ALXVER="${ALXVER}"   is_initrd_supported || return 0
  source ${INSTALLPATH}/etc/alx_version  
  KRNVER="ALX-${ALXVER}"  
  ALXVER="${OLD_ALXVER}"  
  fi  
   
  [[ -z ${KRNVER} ]] && KRNVER="AutoSta_LX"  
  [[ -z ${KRNIMG} ]] && KRNIMG="bzImage"  
  [[ -z ${KRNINITRD} ]] && KRNINITRD="initrd"  
772    
773   echo -e "default 0" > ${INSTALLPATH}/boot/grub/grub.conf || die   DISKMODS="sd_mod"
774   echo -e "timeout 0" >> ${INSTALLPATH}/boot/grub/grub.conf ||die   OLDPATAMODS="amd74xx piix sis5513 via82cxxx"
775     PATAMODS="ata_piix pata_amd pata_mpiix pata_oldpiix pata_sis pata_via"
776   echo -e "\ntitle=${KRNVER}" >> ${INSTALLPATH}/boot/grub/grub.conf || die   SATAMODS="sata_via sata_sis sata_nv"
777   echo -e "root (hd0,0)" >> ${INSTALLPATH}/boot/grub/grub.conf || die   DRMMODS="i915 mga nouveau r128 radeon savage sis tdfx ttm via"
778     OTHERMODS=""
779   echo -e "kernel (hd0,0)/boot/${KRNIMG} root=${ROOTHDD} quiet" >> ${INSTALLPATH}/boot/grub/grub.conf || die   case ${SPECIALDEVICE} in
780     zotac_intel|i845) FBMODS=""; DRMMODS="i915" ;;
781   ### bootsector schreiben chrooted schreiben (gentoo)   zotac_nvidia) FBMODS=""; DRMMODS="nouveau" ;;
782   if [ -f ${INSTALLPATH}/sbin/grub ]   rangee) FBMODS="" ;; ## fallback to vesafb, viafb does not run on all CLE266 boards
783     # not working with kms enabled drivers -> segfaults
784     #maxdata) FBMODS="i810fb" ;; ## check for maxdata / i810/ i815 Chipsets and disable KMS and use i810fb frambuffer
785     maxdata) FBMODS="" ;;
786     *) FBMODS="uvesafb" ;;
787     esac
788    
789     if [[ ${FORMFACTOR} = laptop ]]
790   then   then
791   cat > ${INSTALLPATH}/root/.bashrc << CHROOTEOF   OTHERMODS="acpi-cpufreq cpufreq_ondemand cpufreq_conservative cpufreq_powersave"
 /sbin/grub --no-floppy --batch << "EOF" 1> /dev/null 2> /dev/null  
 root (hd0,0)  
 setup (hd0)  
 quit  
 EOF  
 exit 0  
 CHROOTEOF  
792   fi   fi
793    
794   ### bootsector schreiben chrooted schreiben (lfs/magellan)   # install an appropriate uvesafb.conf
795   if [ -f ${INSTALLPATH}/usr/sbin/grub ]   install -d ${INSTALLPATH}/etc/modprobe.d || die
796   then   echo "options uvesafb mode_option=1024x768-32@60 scroll=ywrap" > ${INSTALLPATH}/etc/modprobe.d/uvesafb.conf || die
797   cat > ${INSTALLPATH}/root/.bashrc << CHROOTEOF  
798  /usr/sbin/grub --no-floppy --batch << "EOF" 1> /dev/null 2> /dev/null   # install an appropriate viafb.conf
799  root (hd0,0)   echo "options viafb viafb_mode=1024x768 viafb_refresh=60" > ${INSTALLPATH}/etc/modprobe.d/viafb.conf || die
800  setup (hd0)  
801  quit   # install an appropriate i810fb.conf
802  EOF   echo "options i810fb xres=1024 yres=768 bpp=16 mtrr=1 hsync1=30 hsync2=62 vsync1=30 vsync2=60"  > ${INSTALLPATH}/etc/modprobe.d/i810fb.conf || die
803    
804     cat > ${INSTALLPATH}/root/.installrc << CHROOTEOF
805    echo "MODULES=\"${FORMAT_FILESYSTEM} ${DISKMODS} ${OLDATAMODS} ${PATAMODS} ${SATAMODS} ${DRMMODS} ${FBMODS} ${OTHERMODS}\"" > /etc/conf.d/mkinitrd
806    mkinitrd -f /boot/$(readlink /boot/initrd) $(readlink /boot/vmlinuz | sed "s:kernel-::g") > /dev/null
807  exit 0  exit 0
808  CHROOTEOF  CHROOTEOF
  fi  
809    
810   ##enters chroot   ## enters chroot
811   mount -t proc none ${INSTALLPATH}/proc   mount -t proc proc ${INSTALLPATH}/proc
812     mount -t sysfs sysfs ${INSTALLPATH}/sys
813   mount -o bind /dev ${INSTALLPATH}/dev   mount -o bind /dev ${INSTALLPATH}/dev
814   chroot ${INSTALLPATH} /bin/bash --rcfile /root/.bashrc -i   chroot ${INSTALLPATH} /bin/bash --rcfile /root/.installrc -i
815   umount ${INSTALLPATH}/proc   umount ${INSTALLPATH}/proc
816     umount ${INSTALLPATH}/sys
817   umount ${INSTALLPATH}/dev   umount ${INSTALLPATH}/dev
818   rm ${INSTALLPATH}/root/.bashrc   rm ${INSTALLPATH}/root/.installrc
819  }  }
820    
821  install_alxconfig()  is_uuid_supported()
822  {  {
823   lastdir="$(pwd)"   if [[ -x $(which busybox.mkinitrd &> /dev/null) ]]
824     then
825   mkdir -p ${INSTALLPATH}/opt/alx-config || die   # only detect uuids if supported
826   cd ${INSTALLPATH}/opt/alx-config || die   if [[ ! -z $(busybox.mkinitrd | grep blkid) ]]
827   tar xzpf ${CDPATH}/alx-config/alx-config.tar.gz || die   then
828   chmod a+x ${INSTALLPATH}/opt/alx-config/Configurator/config_functions.sh || die   return 0
829   chmod a+x ${INSTALLPATH}/opt/alx-config/Configurator/config_menu.sh || die   fi
830   ln -sf /opt/alx-config/Configurator/config_menu.sh ${INSTALLPATH}/bin/ALXConfig || die   fi
831    
832   cd ${lastdir} || die   return 1
833  }  }
834    
835    get_uuid()
 install_system_settings()  
836  {  {
837   ### schreibe fstab   local UUID
838   echo -e "${BOOTHDD}\t/boot\text3\tnoatime,noauto\t1 1" > ${INSTALLPATH}/etc/fstab || die   local SEC_TYPE
839   echo -e "${ROOTHDD}\t/\text3\tnoatime\t0 0" >> ${INSTALLPATH}/etc/fstab || die   local TYPE
  echo -e "${SWAPHDD}\tswap\tswap\tpri=1\t0 0" >> ${INSTALLPATH}/etc/fstab || die  
  echo -e "none\t/proc\tproc\tdefaults\t0 0" >> ${INSTALLPATH}/etc/fstab || die  
840    
841   echo -e "none\t/dev/shm\ttmpfs\tdefaults\t0 0" >> ${INSTALLPATH}/etc/fstab || die   local dev="$1"
842   echo -e "none\t/proc/bus/usb\tusbfs\tdefaults\t0 0" >> ${INSTALLPATH}/etc/fstab || die   [[ -z ${dev} ]] && die "no dev given"
843    
844     # check if given device is already an UUID
845     if [[ ${dev/UUID=/}x != ${dev}x ]]
846     then
847     eval "${dev}"
848     else
849     eval $(busybox.mkinitrd blkid ${dev} | grep "${dev}:" | sed 's/.*:\ //')
850     fi
851     echo "${UUID}"
852  }  }
853    
854  install_system_settings_flash()  install_system_settings()
855  {  {
856   ### schreibe fstab   # schreibe fstab
857   echo -e "${ROOTHDD}\t/\text3\tnoatime\t0 0" > ${INSTALLPATH}/etc/fstab || die   if is_uuid_supported
858   echo -e "none\t/proc\tproc\tdefaults\t0 0" >> ${INSTALLPATH}/etc/fstab || die   then
859     echo -e "UUID=$(get_uuid ${BOOTHDD})\t/boot\t${FORMAT_FILESYSTEM}\tnoatime,noauto\t1 1" > ${INSTALLPATH}/etc/fstab || die
860     echo -e "UUID=$(get_uuid ${ROOTHDD})\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" >> ${INSTALLPATH}/etc/fstab || die
861     else
862     echo -e "${BOOTHDD}\t/boot\t${FORMAT_FILESYSTEM}\tnoatime,noauto\t1 1" > ${INSTALLPATH}/etc/fstab || die
863     echo -e "${ROOTHDD}\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" >> ${INSTALLPATH}/etc/fstab || die
864     fi
865     # not needed busybox loads all with swapon -a, even if not mentioned in fstab
866     #echo -e "UUID='$(get_uuid ${SWAPHDD})'\tswap\tswap\tpri=1\t0 0" >> ${INSTALLPATH}/etc/fstab || die
867     echo -e "proc\t/proc\tproc\tdefaults\t0 0" >> ${INSTALLPATH}/etc/fstab || die
868     echo -e "shm\t/dev/shm\ttmpfs\tdefaults\t0 0" >> ${INSTALLPATH}/etc/fstab || die
869    
870     # install network config skeleton
871     install -m0644 ${INSTALLPATH}/etc/alxconfig-ng/skel/net/net.eth0 ${INSTALLPATH}/etc/conf.d/ || die
872    
873   echo -e "none\t/dev/shm\ttmpfs\tdefaults\t0 0" >> ${INSTALLPATH}/etc/fstab || die   # intel framebufer quirk
874   echo -e "none\t/proc/bus/usb\tusbfs\tdefaults\t0 0" >> ${INSTALLPATH}/etc/fstab || die   if [[ -e /proc/fb ]]
875     then
876     if [[ ! -z $(grep 'inteldrmfb' /proc/fb) ]]
877     then
878     fbdev=$(grep 'inteldrmfb' /proc/fb | sed 's:\([0-9]\).*:\1:')
879     if [[ ${fbdev} != 0 ]]
880     then
881     sed -i "s:^\(SPLASH_DEV=\).*:\1\"/dev/fb${fbdev}\":" ${INSTALLPATH}/etc/splash/splash.conf || die
882     fi
883     fi
884     fi
885  }  }
886    
887  install_hotfixes()  install_system_settings_flash()
888  {  {
889   if [ -f ${CDPATH}/hotfixes/hotfixes.sh ]   # schreibe fstab
890     if is_uuid_supported
891   then   then
892   dialog_hotfixes   echo -e "UUID=$(get_uuid ${ROOTHDD})\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" > ${INSTALLPATH}/etc/fstab || die
893   sleep1   else
894   ${CDPATH}/hotfixes/hotfixes.sh   echo -e "${ROOTHDD}\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" > ${INSTALLPATH}/etc/fstab || die
895   fi   fi
896     echo -e "proc\t/proc\tproc\tdefaults\t0 0" >> ${INSTALLPATH}/etc/fstab || die
897     echo -e "shm\t/dev/shm\ttmpfs\tdefaults\t0 0" >> ${INSTALLPATH}/etc/fstab || die
898  }  }
899    
900  install_umount_rootfs()  install_umount_rootfs()
# Line 646  install_do_reboot() Line 922  install_do_reboot()
922    
923  run_install_normal()  run_install_normal()
924  {  {
925   dialog_setup_hdd_found_manuell   dialog_hardware_detection
926    
927   dialog_setup_hdd_partitions_manuell   dialog_setup_hdd_partitions_manuell
928   dialog_setup_hdd_format   dialog_setup_hdd_format
# Line 654  run_install_normal() Line 930  run_install_normal()
930   install_mount_rootfs   install_mount_rootfs
931   (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
932    
  dialog_install_bootsector  
  install_bootsector_chroot  
   
933   dialog_install_settings   dialog_install_settings
934   sleep 1   sleep 1
935   install_system_settings   install_system_settings
936   install_hotfixes   install_initrd_chroot
937    
938     dialog_install_bootsector
939     install_bootsector_chroot
940    
941   install_umount_rootfs   install_umount_rootfs
942   dialog_install_successful   dialog_install_successful
943  }  }
944    
945  run_install_flash()  run_install_flash()
946  {  {
947   dialog_setup_hdd_found_manuell   dialog_hardware_detection
948    
949   dialog_setup_hdd_partitions_manuell_flash   dialog_setup_hdd_partitions_manuell_flash
950   dialog_setup_hdd_format   dialog_setup_hdd_format
# Line 675  run_install_flash() Line 952  run_install_flash()
952   install_mount_rootfs_flash   install_mount_rootfs_flash
953   (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
954    
  dialog_install_bootsector  
  install_bootsector_chroot  
   
955   dialog_install_settings   dialog_install_settings
956   sleep 1   sleep 1
957   install_system_settings_flash   install_system_settings_flash
958   install_hotfixes   install_initrd_chroot
959    
960     dialog_install_bootsector
961     install_bootsector_chroot
962    
963   install_umount_rootfs_flash   install_umount_rootfs_flash
964   dialog_install_successful   dialog_install_successful
965  }  }
966    
967  run_install_silent()  run_install_auto()
968  {  {
969   echo "starting silent install ..."   dialog_hardware_detection
  sleep 1  
 }  
970    
971  run_install_unattended()   dialog_setup_hdd_partitions_auto
972  {   dialog_setup_hdd_format
973   echo "starting unattended install ..."   setup_hdd_format_flash > /dev/null
974     install_mount_rootfs_flash
975     (install_system_image > /tmp/install.log) 2> /tmp/install_errors.log | dialog_install_meter | dialog_install_system_image
976    
977     dialog_install_settings
978   sleep 1   sleep 1
979     install_system_settings_flash
980     install_initrd_chroot
981    
982     dialog_install_bootsector
983     install_bootsector_chroot
984    
985     install_umount_rootfs_flash
986     dialog_install_successful
987  }  }
988    
989  if [[ $1 = unattended ]]  dialog_main
 then  
  run_install_unattended  
 else  
  dialog_main  
 fi  
990    
991  exit 0  exit 0

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