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 3202 by niro, Wed Sep 14 13:12:00 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     *) echo " \n\n\n \\ZnStandard Device erkannt!\\Zn \\" >> ${hwtmp} ;;
212     esac
213    
214     echo " \" 13 70" >> ${hwtmp}
215     chmod a+x ${hwtmp}
216     ${hwtmp}
217    
218     # remove tmp file
219     if [[ -f ${hwtmp} ]]
220     then
221     rm ${hwtmp}
222     fi
223  }  }
224    
225  dialog_setup_hdd_partitions_manuell()  dialog_setup_hdd_partitions_manuell()
# Line 243  dialog_setup_hdd_partitions_manuell_flas Line 298  dialog_setup_hdd_partitions_manuell_flas
298   fi   fi
299  }  }
300    
301  dialog_setup_hdd_partitions_silent()  dialog_setup_hdd_partitions_auto()
302    {
303     local i
304    
305     if [[ -z ${installdevs} ]]
306     then
307     dialog \
308     --backtitle "${TITLE}" \
309     --ok-label "Beenden" \
310     --msgbox "Kein geeignetes Laufwerk gefunden.\nDie Installation ist fehlgeschlagen." 6 70
311     exit 1
312     else
313    
314     echo "dialog \\" > /tmp/hddtmp.sh
315     echo "--backtitle \"${TITLE}\" \\" >> /tmp/hddtmp.sh
316     echo "--ok-label \"Weiter\" \\" >> /tmp/hddtmp.sh
317     echo "--cancel-label \"Beenden\" \\" >> /tmp/hddtmp.sh
318     echo "--stdout \\" >> /tmp/hddtmp.sh
319     echo "--menu \"Installations Laufwerk auswaehlen:\" 10 70 3 \\" >> /tmp/hddtmp.sh
320    
321     for i in ${installdevs}
322     do
323     echo "\"${i}\" \"\" \\" >> /tmp/hddtmp.sh
324     done
325     echo -e "\n" >> /tmp/hddtmp.sh
326    
327     chmod a+x /tmp/hddtmp.sh
328     HDD="$(/tmp/hddtmp.sh)"
329     RES=$?
330     [[ ${RES} -eq 1 ]] && return 1
331     if [[ ${RES} -eq 0 ]]
332     then
333     dialog_setup_hdd_info_auto
334     dialog_setup_hdd_create_partitions
335     setup_hdd_partitions_auto
336     fi
337     fi
338    }
339    
340    dialog_setup_hdd_create_partitions()
341  {  {
342   dialog \   dialog \
343   --backtitle "${TITLE}" \   --backtitle "${TITLE}" \
344   --infobox "Erstelle Partitionen ..." 3 70   --infobox "Erstelle Disk Partitionen ..." 3 70
345  }  }
346    
347  dialog_setup_hdd_format()  dialog_setup_hdd_format()
# Line 275  dialog_install_meter() Line 369  dialog_install_meter()
369  {  {
370   while [[ ${CURRENTLINE} != ${TOTALLINES} ]]   while [[ ${CURRENTLINE} != ${TOTALLINES} ]]
371   do   do
372   CURRENTLINE=$(grep --count . /tmp/install.log)   CURRENTLINE=$(grep -c . /tmp/install.log)
373   PERCENT=$(expr ${CURRENTLINE} \* 100 / ${TOTALLINES})   PERCENT=$(( ${CURRENTLINE} * 100 / ${TOTALLINES}))
374   echo ${PERCENT}   echo ${PERCENT}
375   sleep 1   sleep 1
376   done   done
# Line 292  dialog_install_bootsector() Line 386  dialog_install_bootsector()
386   --infobox "Schreibe den Bootsektor ..." 3 70   --infobox "Schreibe den Bootsektor ..." 3 70
387  }  }
388    
 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  
   
 }  
   
389  dialog_install_successful()  dialog_install_successful()
390  {  {
391   dialog \   dialog \
# Line 333  dialog_install_failure() Line 404  dialog_install_failure()
404   " 10 81   " 10 81
405  }  }
406    
 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  
 }  
   
407  dialog_main()  dialog_main()
408  {  {
409   METHOD=0   METHOD=0
# Line 372  dialog_main() Line 421  dialog_main()
421   "3" "Beenden und neustarten" \   "3" "Beenden und neustarten" \
422   "4" "Beenden und eine Shell starten")   "4" "Beenden und eine Shell starten")
423   RES=$?   RES=$?
424   if [[ ${RES} -eq 1 ]] && exit 1   [[ ${RES} -eq 1 ]] && exit 1
425   if [[ ${RES} -eq 0 ]]   if [[ ${RES} -eq 0 ]]
426   then   then
427   case ${METHOD} in   case ${METHOD} in
428           "1") dialog_setup_system_menu ;;           "1") dialog_setup_system_menu ;;
429   "2") dialog_setup_hdd_found_manuell ;;   "2") dialog_hardware_detection ;;
430   "3") install_do_reboot ;;   "3") install_do_reboot ;;
431   "4") /bin/bash --login -i ;;   "4") /bin/bash --login -i ;;
432   esac   esac
# Line 388  dialog_main() Line 437  dialog_main()
437  #################################################  #################################################
438  # Install Komandos #  # Install Komandos #
439  #################################################  #################################################
440    run_hardware_detection()
441    {
442     local hwinfo
443    
444     hwinfo="$(hwinfo --bios --storage)"
445    
446     # check for special devices/clients:
447     # if zotac a zotac and the disk is a removeable device, then add rootdelay to kernelcmd
448     local removable=0
449     if [[ ! -z $(echo "${hwinfo}" | grep -i zotac) ]]
450     then
451     for i in /sys/block/[hs]d*/removable
452     do
453     if [[ $(< ${i}) = 1 ]]
454     then
455     removable=1
456     fi
457     done
458    
459     # only add this for grub legacy, grub2 detect these settings on its own
460     export GRUBLEGACYOPTS="rootdelay=8"
461     export SPECIALDEVICE="zotac"
462     fi
463    
464     # check for special devices/clients:
465     # if a rangee and disk ist smaller then 256mb move partion one block further ahead
466     if [[ ! -z $(echo "${hwinfo}" | grep -i CLE266) ]]
467     then
468     # for a rangee always define partion startblock +1
469     export FDISKPARTIONBELOW256MB="1"
470     export SPECIALDEVICE="rangee"
471     export GRUBLEGACYOPTS=""
472     fi
473    }
474    
475    hdd_size_below_256mb()
476    {
477     local hdd="$1"
478     local size
479     local retval
480     [[ -z ${hdd} ]] && die "Error: get_hdd_size() no \$hdd given!"
481    
482     size=$(fdisk -l ${hdd} | grep "Disk.*${hdd}" | sed 's:.*,\ \(.*\)\ byte.*:\1:')
483     if [[ ${size} -le 257000000 ]]
484     then
485     retval="0"
486     else
487     retval="1"
488     fi
489    
490     return "${retval}"
491    }
492    
493    setup_hdd_partitions_auto()
494    {
495     ROOTHDD="${HDD}1"
496    
497     # run this only if FDISKPARTITIONBELOW256MB is not already 1
498     if [[ ${FDISKPARTIONBELOW256MB} != 1 ]]
499     then
500     if hdd_size_below_256mb ${HDD}
501     then
502     FDISKPARTIONBELOW256MB=1
503     else
504     FDISKPARTIONBELOW256MB=0
505     fi
506     fi
507    
508     ## delete disk
509     dd if=/dev/zero of=${HDD} count=1 &> /dev/null || die
510    
511     if [[ ${FDISKPARTIONBELOW256MB} = 1 ]]
512     then
513     ## setup one bootable partition
514     #1. n= new disk
515     #2. p= primary disk
516     #3. 1= first partition
517     #4. 2= default sector start // small disk needs more space for grub2 mbr sector
518     #5. ''= defaul sector end
519     #6. a= bootable flag
520     #7. 1= boot flag for partition 1
521     #8. w= write/quit
522     fdisk ${HDD} &> /dev/null << EOF
523    n
524    p
525    1
526    2
527    
528    a
529    1
530    w
531    EOF
532     else
533     ## setup one bootable partition
534     #1. n= new disk
535     #2. p= primary disk
536     #3. 1= first partition
537     #4. ''= default sector start
538     #5. ''= defaul sector end
539     #6. a= bootable flag
540     #7. 1= boot flag for partition 1
541     #8. w= write/quit
542     fdisk ${HDD} &> /dev/null << EOF
543    n
544    p
545    1
546    
547    
548    a
549    1
550    w
551    EOF
552     fi
553    }
554    
555  setup_hdd_partitions_manuell()  setup_hdd_partitions_manuell()
556  {  {
557   BOOTHDD="${HDD}1"   BOOTHDD="${HDD}1"
# Line 406  setup_hdd_partitions_manuell_flash() Line 570  setup_hdd_partitions_manuell_flash()
570   cfdisk ${HDD} || die   cfdisk ${HDD} || die
571  }  }
572    
 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  
 }  
   
573  setup_hdd_format()  setup_hdd_format()
574  {  {
575   mkswap ${SWAPHDD} || die   mkswap ${SWAPHDD} || die
# Line 449  install_system_image() Line 603  install_system_image()
603   tar xvjpf ${CDPATH}/system/${CDIMAGENAME} -C ${INSTALLPATH}   tar xvjpf ${CDPATH}/system/${CDIMAGENAME} -C ${INSTALLPATH}
604  }  }
605    
606    install_bootsector_chroot()
 install_kernel_image()  
607  {  {
608   declare -i CPUTYPE=$(cat /proc/cpuinfo | grep "cpu family" | cut -d ' ' -f3)   local my_roothdd
609     local grubconf=${INSTALLPATH}/boot/grub/grub.conf
610     local grub2conf=/boot/grub/grub.cfg
611    
612   if [[ ${CPUTYPE} -le 5 ]]   # check for grub2
613     if [[ -f ${INSTALLPATH}/sbin/grub-mkconfig ]]
614   then   then
615   lastdir="$(pwd)"   # needed by grub-mkconfig on the first run
616     if [[ ! -f ${INSTALLPATH}/boot/grub/video.lst ]]
617   mkdir -p ${INSTALLPATH}/INSTALL/kernel || die   then
618   cd ${INSTALLPATH}/INSTALL/kernel || die   install -m0644 ${INSTALLPATH}/lib/grub/*/video.lst ${INSTALLPATH}/boot/grub/video.lst || die
619   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)"  
620    
621   mkdir -p ${INSTALLPATH}/INSTALL/kernel || die   # set kernelopts
622   cd ${INSTALLPATH}/INSTALL/kernel || die   if [[ -f ${INSTALLPATH}/etc/conf.d/grub ]]
623   tar xzpf ${CDPATH}/kernels/kernel-i686.tar.gz || die   then
624   source ${INSTALLPATH}/INSTALL/kernel/kernelversion || die   sed -i "s:^\(export GRUB_CMDLINE_LINUX_DEFAULT=\).*:\1\"${KERNELOPTS}\":" ${INSTALLPATH}/etc/conf.d/grub || die
625     else
626     echo "export GRUB_CMDLINE_LINUX_DEFAULT=\"${KERNELOPTS}\"" >  ${INSTALLPATH}/etc/conf.d/grub || die
627     fi
628     echo 'grub-mkdevicemap' > ${INSTALLPATH}/root/.installrc || die
629     echo "LC_ALL=C grub-mkconfig -o ${grub2conf}  &> /dev/null" >> ${INSTALLPATH}/root/.installrc || die
630     echo "grub-install --no-floppy ${HDD} &> /dev/null" >> ${INSTALLPATH}/root/.installrc || die
631     echo "exit 0" >> ${INSTALLPATH}/root/.installrc || die
632    
633   cp -aRf ${INSTALLPATH}/INSTALL/kernel/${KRNLIB} ${INSTALLPATH}/lib/modules || die   # grub-legacy
634   cp -aRf ${INSTALLPATH}/INSTALL/kernel/${KRNIMG} ${INSTALLPATH}/boot || die   else
635   cp -aRf ${INSTALLPATH}/INSTALL/kernel/${KRNINITRD} ${INSTALLPATH}/boot || die   ### grubconf schreiben
636   cp -aRf ${INSTALLPATH}/INSTALL/kernel/kernelversion ${INSTALLPATH}/boot || die   source ${INSTALLPATH}/boot/kernelversion
637    
638   cd ${lastdir} || die   #for alx only
639          fi   if [ -e ${INSTALLPATH}/etc/alx_version ]
640  }   then
641     OLD_ALXVER="${ALXVER}"
642     source ${INSTALLPATH}/etc/alx_version
643     KRNVER="ALX-${ALXVER}"
644     ALXVER="${OLD_ALXVER}"
645     fi
646    
647  install_bootsector()   [[ -z ${KRNVER} ]] && KRNVER="AutoSta_LX"
648  {   [[ -z ${KRNINITRD} ]] && KRNINITRD="initrd"
649   ### grubconf schreiben   [[ -z ${KRNIMG} ]] && KRNIMG="vmlinuz"
  source ${INSTALLPATH}/INSTALL/kernel/kernelversion  
650    
651   [[ -z ${KRNVER} ]] && KRNVER="AutoSta_LX"   # uuid support
652   [[ -z ${KRNIMG} ]] && KRNIMG="bzImage"   if is_uuid_supported
653   [[ -z ${KRNINITRD} ]] && KRNINITRD="initrd"   then
654     my_roothdd="UUID=$(get_uuid ${ROOTHDD})"
655     else
656     my_roothdd="${ROOTHDD}"
657     fi
658    
659     : > ${grubconf} || die
660     echo "default 0" >> ${grubconf} || die
661     echo "timeout 3" >> ${grubconf} || die
662     # using current root password
663     echo "password --md5 $(cat ${INSTALLPATH}/etc/shadow | grep root | cut -d: -f2)"  >> ${grubconf} || die
664    
665     echo  >> ${grubconf} || die
666     echo "# normal boot" >> ${grubconf} || die
667     echo "title ${KRNVER}" >> ${grubconf} || die
668     echo "root (hd0,0)" >> ${grubconf} || die
669     echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS}" >> ${grubconf} || die
670     if is_initrd_supported
671     then
672     echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die
673     fi
674    
675   echo -e "default 0" > ${INSTALLPATH}/boot/grub/grub.conf || die   echo >> ${grubconf} || die
676   echo -e "timeout 03" >> ${INSTALLPATH}/boot/grub/grub.conf ||die   echo "# admin boot" >> ${grubconf} || die
677   echo -e "\ntitle=${KRNVER}" >> ${INSTALLPATH}/boot/grub/grub.conf || die   echo "title ${KRNVER} - Re-run hardware-detection" >> ${grubconf} || die
678   echo -e "root (hd0,0)" >> ${INSTALLPATH}/boot/grub/grub.conf || die   echo "lock"  >> ${grubconf} || die
679     echo "root (hd0,0)" >> ${grubconf} || die
680     echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS} hardware-auto-detection" >> ${grubconf} || die
681     if is_initrd_supported
682     then
683     echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die
684     fi
685    
686   echo -e "kernel (hd0,0)/boot/${KRNIMG} root=${ROOTHDD} quiet" >> ${INSTALLPATH}/boot/grub/grub.conf || die   echo >> ${grubconf} || die
687     echo "title ${KRNVER} - Reset *all* local settings" >> ${grubconf} || die
688     echo "lock"  >> ${grubconf} || die
689     echo "root (hd0,0)" >> ${grubconf} || die
690     echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS} alx-reset-settings" >> ${grubconf} || die
691     if is_initrd_supported
692     then
693     echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die
694     fi
695    
696   ### bootsector schreiben   # bootsector schreiben chrooted schreiben (lfs/magellan)
697   /sbin/grub --no-floppy --batch << "EOF" 1> /dev/null 2> /dev/null || die   cat > ${INSTALLPATH}/root/.installrc << CHROOTEOF
698    /usr/sbin/grub --no-floppy --batch << "EOF" 1> /dev/null 2> /dev/null
699  root (hd0,0)  root (hd0,0)
700  setup (hd0)  setup (hd0)
701  quit  quit
702  EOF  EOF
703    exit 0
704    CHROOTEOF
705     fi
706    
707     ## enters chroot
708     mount -t proc proc ${INSTALLPATH}/proc
709     mount -t sysfs sysfs ${INSTALLPATH}/sys
710     mount -o bind /dev ${INSTALLPATH}/dev
711     chroot ${INSTALLPATH} /bin/bash --rcfile /root/.installrc -i
712     umount ${INSTALLPATH}/proc
713     umount ${INSTALLPATH}/sys
714     umount ${INSTALLPATH}/dev
715     rm ${INSTALLPATH}/root/.installrc
716  }  }
717    
718  install_bootsector_chroot()  is_initrd_supported()
719  {  {
720   ### grubconf schreiben   # only generate initrds if the cmd exists
721   source ${INSTALLPATH}/boot/kernelversion   [[ -x ${INSTALLPATH}/sbin/mkinitrd ]] && return 0
722     return 1
723    }
724    
725   #for alx only  install_initrd_chroot()
726   if [ -e ${INSTALLPATH}/etc/alx_version ]  {
727   then   # only generate initrds if the cmd exists
728   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"  
729    
730   echo -e "default 0" > ${INSTALLPATH}/boot/grub/grub.conf || die   DISKMODS="sd_mod"
731   echo -e "timeout 0" >> ${INSTALLPATH}/boot/grub/grub.conf ||die   OLDPATAMODS="amd74xx piix sis5513 via82cxxx"
732     PATAMODS="ata_piix pata_amd pata_mpiix pata_oldpiix pata_sis pata_via"
733   echo -e "\ntitle=${KRNVER}" >> ${INSTALLPATH}/boot/grub/grub.conf || die   SATAMODS="sata_via sata_sis sata_nv"
734   echo -e "root (hd0,0)" >> ${INSTALLPATH}/boot/grub/grub.conf || die   DRMMODS="i915 mga nouveau r128 radeon savage sis tdfx ttm via"
735     case ${SPECIALDEVICE} in
736   echo -e "kernel (hd0,0)/boot/${KRNIMG} root=${ROOTHDD} quiet" >> ${INSTALLPATH}/boot/grub/grub.conf || die   zotac) FBMODS="" ;;
737     rangee) FBMODS="viafb" ;;
738   ### bootsector schreiben chrooted schreiben (gentoo)   *) FBMODS="uvesafb" ;;
739   if [ -f ${INSTALLPATH}/sbin/grub ]   esac
  then  
  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  
740    
741   ### bootsector schreiben chrooted schreiben (lfs/magellan)   # install an appropriate uvesafb.conf
742   if [ -f ${INSTALLPATH}/usr/sbin/grub ]   install -d ${INSTALLPATH}/etc/modprobe.d || die
743   then   echo "options uvesafb mode_option=1024x768-32@60 scroll=ywrap" > ${INSTALLPATH}/etc/modprobe.d/uvesafb.conf || die
744   cat > ${INSTALLPATH}/root/.bashrc << CHROOTEOF  
745  /usr/sbin/grub --no-floppy --batch << "EOF" 1> /dev/null 2> /dev/null   # install an appropriate viafb.conf
746  root (hd0,0)   echo "options viafb viafb_mode=1024x768 viafb_refresh=60" > ${INSTALLPATH}/etc/modprobe.d/viafb.conf || die
747  setup (hd0)  
748  quit   cat > ${INSTALLPATH}/root/.installrc << CHROOTEOF
749  EOF  echo "MODULES=\"${FORMAT_FILESYSTEM} ${DISKMODS} ${OLDATAMODS} ${PATAMODS} ${SATAMODS} ${DRMMODS} ${FBMODS}\"" > /etc/conf.d/mkinitrd
750    mkinitrd -f /boot/$(readlink /boot/initrd) $(readlink /boot/vmlinuz | sed "s:kernel-::g") > /dev/null
751  exit 0  exit 0
752  CHROOTEOF  CHROOTEOF
  fi  
753    
754   ##enters chroot   ## enters chroot
755   mount -t proc none ${INSTALLPATH}/proc   mount -t proc proc ${INSTALLPATH}/proc
756     mount -t sysfs sysfs ${INSTALLPATH}/sys
757   mount -o bind /dev ${INSTALLPATH}/dev   mount -o bind /dev ${INSTALLPATH}/dev
758   chroot ${INSTALLPATH} /bin/bash --rcfile /root/.bashrc -i   chroot ${INSTALLPATH} /bin/bash --rcfile /root/.installrc -i
759   umount ${INSTALLPATH}/proc   umount ${INSTALLPATH}/proc
760     umount ${INSTALLPATH}/sys
761   umount ${INSTALLPATH}/dev   umount ${INSTALLPATH}/dev
762   rm ${INSTALLPATH}/root/.bashrc   rm ${INSTALLPATH}/root/.installrc
763  }  }
764    
765  install_alxconfig()  is_uuid_supported()
766  {  {
767   lastdir="$(pwd)"   if [[ -x $(which busybox.mkinitrd &> /dev/null) ]]
768     then
769   mkdir -p ${INSTALLPATH}/opt/alx-config || die   # only detect uuids if supported
770   cd ${INSTALLPATH}/opt/alx-config || die   if [[ ! -z $(busybox.mkinitrd | grep blkid) ]]
771   tar xzpf ${CDPATH}/alx-config/alx-config.tar.gz || die   then
772   chmod a+x ${INSTALLPATH}/opt/alx-config/Configurator/config_functions.sh || die   return 0
773   chmod a+x ${INSTALLPATH}/opt/alx-config/Configurator/config_menu.sh || die   fi
774   ln -sf /opt/alx-config/Configurator/config_menu.sh ${INSTALLPATH}/bin/ALXConfig || die   fi
775    
776   cd ${lastdir} || die   return 1
777  }  }
778    
779    get_uuid()
 install_system_settings()  
780  {  {
781   ### schreibe fstab   local UUID
782   echo -e "${BOOTHDD}\t/boot\text3\tnoatime,noauto\t1 1" > ${INSTALLPATH}/etc/fstab || die   local SEC_TYPE
783   echo -e "${ROOTHDD}\t/\text3\tnoatime\t0 0" >> ${INSTALLPATH}/etc/fstab || die   local TYPE
784   echo -e "${SWAPHDD}\tswap\tswap\tpri=1\t0 0" >> ${INSTALLPATH}/etc/fstab || die  
785   echo -e "none\t/proc\tproc\tdefaults\t0 0" >> ${INSTALLPATH}/etc/fstab || die   local dev="$1"
786     [[ -z ${dev} ]] && die "no dev given"
787    
788   echo -e "none\t/dev/shm\ttmpfs\tdefaults\t0 0" >> ${INSTALLPATH}/etc/fstab || die   # check if given device is already an UUID
789   echo -e "none\t/proc/bus/usb\tusbfs\tdefaults\t0 0" >> ${INSTALLPATH}/etc/fstab || die   if [[ ${dev/UUID=/}x != ${dev}x ]]
790     then
791     eval "${dev}"
792     else
793     eval $(busybox.mkinitrd blkid ${dev} | grep "${dev}:" | sed 's/.*:\ //')
794     fi
795     echo "${UUID}"
796  }  }
797    
798  install_system_settings_flash()  install_system_settings()
799  {  {
800   ### schreibe fstab   # schreibe fstab
801   echo -e "${ROOTHDD}\t/\text3\tnoatime\t0 0" > ${INSTALLPATH}/etc/fstab || die   if is_uuid_supported
802   echo -e "none\t/proc\tproc\tdefaults\t0 0" >> ${INSTALLPATH}/etc/fstab || die   then
803     echo -e "UUID=$(get_uuid ${BOOTHDD})\t/boot\t${FORMAT_FILESYSTEM}\tnoatime,noauto\t1 1" > ${INSTALLPATH}/etc/fstab || die
804     echo -e "UUID=$(get_uuid ${ROOTHDD})\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" >> ${INSTALLPATH}/etc/fstab || die
805     else
806     echo -e "${BOOTHDD}\t/boot\t${FORMAT_FILESYSTEM}\tnoatime,noauto\t1 1" > ${INSTALLPATH}/etc/fstab || die
807     echo -e "${ROOTHDD}\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" >> ${INSTALLPATH}/etc/fstab || die
808     fi
809     # not needed busybox loads all with swapon -a, even if not mentioned in fstab
810     #echo -e "UUID='$(get_uuid ${SWAPHDD})'\tswap\tswap\tpri=1\t0 0" >> ${INSTALLPATH}/etc/fstab || die
811     echo -e "proc\t/proc\tproc\tdefaults\t0 0" >> ${INSTALLPATH}/etc/fstab || die
812     echo -e "shm\t/dev/shm\ttmpfs\tdefaults\t0 0" >> ${INSTALLPATH}/etc/fstab || die
813    
814   echo -e "none\t/dev/shm\ttmpfs\tdefaults\t0 0" >> ${INSTALLPATH}/etc/fstab || die   # install network config skeleton
815   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
816  }  }
817    
818  install_hotfixes()  install_system_settings_flash()
819  {  {
820   if [ -f ${CDPATH}/hotfixes/hotfixes.sh ]   # schreibe fstab
821     if is_uuid_supported
822   then   then
823   dialog_hotfixes   echo -e "UUID=$(get_uuid ${ROOTHDD})\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" > ${INSTALLPATH}/etc/fstab || die
824   sleep1   else
825   ${CDPATH}/hotfixes/hotfixes.sh   echo -e "${ROOTHDD}\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" > ${INSTALLPATH}/etc/fstab || die
826   fi   fi
827     echo -e "proc\t/proc\tproc\tdefaults\t0 0" >> ${INSTALLPATH}/etc/fstab || die
828     echo -e "shm\t/dev/shm\ttmpfs\tdefaults\t0 0" >> ${INSTALLPATH}/etc/fstab || die
829  }  }
830    
831  install_umount_rootfs()  install_umount_rootfs()
# Line 646  install_do_reboot() Line 853  install_do_reboot()
853    
854  run_install_normal()  run_install_normal()
855  {  {
856   dialog_setup_hdd_found_manuell   dialog_hardware_detection
857    
858   dialog_setup_hdd_partitions_manuell   dialog_setup_hdd_partitions_manuell
859   dialog_setup_hdd_format   dialog_setup_hdd_format
# Line 654  run_install_normal() Line 861  run_install_normal()
861   install_mount_rootfs   install_mount_rootfs
862   (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
863    
  dialog_install_bootsector  
  install_bootsector_chroot  
   
864   dialog_install_settings   dialog_install_settings
865   sleep 1   sleep 1
866   install_system_settings   install_system_settings
867   install_hotfixes   install_initrd_chroot
868    
869     dialog_install_bootsector
870     install_bootsector_chroot
871    
872   install_umount_rootfs   install_umount_rootfs
873   dialog_install_successful   dialog_install_successful
874  }  }
875    
876  run_install_flash()  run_install_flash()
877  {  {
878   dialog_setup_hdd_found_manuell   dialog_hardware_detection
879    
880   dialog_setup_hdd_partitions_manuell_flash   dialog_setup_hdd_partitions_manuell_flash
881   dialog_setup_hdd_format   dialog_setup_hdd_format
# Line 675  run_install_flash() Line 883  run_install_flash()
883   install_mount_rootfs_flash   install_mount_rootfs_flash
884   (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
885    
  dialog_install_bootsector  
  install_bootsector_chroot  
   
886   dialog_install_settings   dialog_install_settings
887   sleep 1   sleep 1
888   install_system_settings_flash   install_system_settings_flash
889   install_hotfixes   install_initrd_chroot
890    
891     dialog_install_bootsector
892     install_bootsector_chroot
893    
894   install_umount_rootfs_flash   install_umount_rootfs_flash
895   dialog_install_successful   dialog_install_successful
896  }  }
897    
898  run_install_silent()  run_install_auto()
899  {  {
900   echo "starting silent install ..."   dialog_hardware_detection
  sleep 1  
 }  
901    
902  run_install_unattended()   dialog_setup_hdd_partitions_auto
903  {   dialog_setup_hdd_format
904   echo "starting unattended install ..."   setup_hdd_format_flash > /dev/null
905     install_mount_rootfs_flash
906     (install_system_image > /tmp/install.log) 2> /tmp/install_errors.log | dialog_install_meter | dialog_install_system_image
907    
908     dialog_install_settings
909   sleep 1   sleep 1
910     install_system_settings_flash
911     install_initrd_chroot
912    
913     dialog_install_bootsector
914     install_bootsector_chroot
915    
916     install_umount_rootfs_flash
917     dialog_install_successful
918  }  }
919    
920  if [[ $1 = unattended ]]  dialog_main
 then  
  run_install_unattended  
 else  
  dialog_main  
 fi  
921    
922  exit 0  exit 0

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