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

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