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

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