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 2736 by niro, Thu Aug 11 14:58:15 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    # default specialdevices
42    SPECIALDEVICE=""
43    
44    # target filesystem
45    FORMAT_FILESYSTEM="ext4"
46    
47  #################################################  #################################################
48  #  DIALOG BOXEN #  #  DIALOG BOXEN #
# Line 94  dialog_setup_hdd_info_flash() Line 104  dialog_setup_hdd_info_flash()
104   Bitte ${SHDD}1 als \Z3bootable\Zn markieren." 12 81   Bitte ${SHDD}1 als \Z3bootable\Zn markieren." 12 81
105  }  }
106    
107    dialog_setup_hdd_info_auto()
108    {
109     local SHDD="$(echo $HDD | sed 's/\/dev\///')"
110    
111     dialog \
112     --colors \
113     --title "[ Festplatten Partitionierung ]" \
114     --backtitle "${TITLE}" \
115     --ok-label "Weiter" \
116     --msgbox "\nAchtung!\n\
117     Alle Daten werden von der Disk [ \Z3${HDD}\Zn ] gelöscht!" 12 81
118    }
119    
120  dialog_setup_system_menu()  dialog_setup_system_menu()
121  {  {
122   local i   local i
# Line 104  dialog_setup_system_menu() Line 127  dialog_setup_system_menu()
127   --cancel-label "Abbrechen" \   --cancel-label "Abbrechen" \
128   --ok-label "Weiter" \   --ok-label "Weiter" \
129   --stdout \   --stdout \
130     --colors \
131   --menu "\nWaehlen Sie die Installations-Methode" 14 70 5 \   --menu "\nWaehlen Sie die Installations-Methode" 14 70 5 \
132   "1" "Normale IDE-Disk" \   "1" "Automatisches Setup (Empfohlen)" \
133   "2" "Flash-Speicher")   "" "" \
134     "" "\Z1Experten Modi:\Zn" \
135     "2" "Normale IDE-Disk (Manuell)" \
136     "3" "Flash-Speicher (Manuell)")
137   RES=$?   RES=$?
138   [[ ${RES} -eq 1 ]] && return 1   [[ ${RES} -eq 1 ]] && return 1
139   if [[ ${RES} -eq 0 ]]   if [[ ${RES} -eq 0 ]]
140   then   then
141   case "${i}" in   case "${i}" in
142           "1") run_install_normal ;;   "1") run_install_auto ;;
143   "2") run_install_flash ;;           "2") run_install_normal ;;
144     "3") run_install_flash ;;
145     "") dialog_setup_system_menu;;
146   esac   esac
147   fi   fi
148  }  }
149    
150  dialog_setup_hdd_found_manuell()  dialog_hardware_detection()
151  {  {
152   local i   local i
153     local hwtmp
154    
155     if [ -x $(which mktemp &> /dev/null) ]
156     then
157     hwtmp="$(mktemp)"
158     else
159     hwtmp="/tmp/hwtmp.sh"
160     fi
161    
162   [[ ! -z ${installdevs} ]] && installdevs=""   [[ ! -z ${installdevs} ]] && installdevs=""
163    
164   echo "dialog \\"  > /tmp/hddtmp.sh   echo "dialog \\"  > ${hwtmp}
165   echo "--backtitle \"${TITLE}\" \\" >> /tmp/hddtmp.sh   echo "--backtitle \"${TITLE}\" \\" >> ${hwtmp}
166   echo "--ok-label \"Weiter\" \\" >> /tmp/hddtmp.sh   echo "--ok-label \"Weiter\" \\" >> ${hwtmp}
167   echo "--stdout \\" >> /tmp/hddtmp.sh   echo "--stdout \\" >> ${hwtmp}
168   echo "--colors \\" >> /tmp/hddtmp.sh   echo "--colors \\" >> ${hwtmp}
169   echo "--msgbox \"Gefundene Hardware:\n\n \\" >> /tmp/hddtmp.sh   echo "--msgbox \"Gefundene Hardware:\n\n \\" >> ${hwtmp}
170   echo " Festplatten:\n \\" >> /tmp/hddtmp.sh   echo " Festplatten:\n \\" >> ${hwtmp}
171    
172   if [[ ! -z ${scsidisks} ]]   if [[ ! -z ${scsidisks} ]]
173   then   then
# Line 138  dialog_setup_hdd_found_manuell() Line 175  dialog_setup_hdd_found_manuell()
175   do   do
176   if [[ ${i} != ${cdromdev} ]]   if [[ ${i} != ${cdromdev} ]]
177   then   then
178   echo " \\Z7SCSI: \\Z3${i}\\Zn\n \\" >> /tmp/hddtmp.sh   echo " \\Z7SCSI: \\Z3${i}\\Zn\n \\" >> ${hwtmp}
179   installdevs="${installdevs} ${i}"   installdevs="${installdevs} ${i}"
180   fi   fi
181   done   done
# Line 150  dialog_setup_hdd_found_manuell() Line 187  dialog_setup_hdd_found_manuell()
187   do   do
188   if [[ ${i} != ${cdromdev} ]]   if [[ ${i} != ${cdromdev} ]]
189   then   then
190   echo " \\Z7IDE:  \\Z3${i}\\Zn\n \\" >> /tmp/hddtmp.sh   echo " \\Z7IDE:  \\Z3${i}\\Zn\n \\" >> ${hwtmp}
191   installdevs="${installdevs} ${i}"   installdevs="${installdevs} ${i}"
192   fi   fi
193   done   done
# Line 158  dialog_setup_hdd_found_manuell() Line 195  dialog_setup_hdd_found_manuell()
195    
196   if [[ ! -z ${cdromdev} ]]   if [[ ! -z ${cdromdev} ]]
197   then   then
198   echo " \n \\" >> /tmp/hddtmp.sh   echo " \n \\" >> ${hwtmp}
199   echo " \\Z7andere Laufwerke:\n \\" >> /tmp/hddtmp.sh   echo " \\Z7andere Laufwerke:\n \\" >> ${hwtmp}
200   echo " CDROM: \\Z3${cdromdev}\\Zn\n \\" >> /tmp/hddtmp.sh   echo " CDROM: \\Z3${cdromdev}\\Zn\n \\" >> ${hwtmp}
201   fi   fi
202   echo " \" 13 70" >> /tmp/hddtmp.sh  
203   chmod a+x /tmp/hddtmp.sh   # other devices
204   /tmp/hddtmp.sh   run_hardware_detection
205     case "${SPECIALDEVICE}" in
206     zotac) echo " \n\n\n \\Z2Zotac Device erkannt!\\Zn \\" >> ${hwtmp} ;;
207     *) echo " \n\n\n \\ZnStandard Device erkannt!\\Zn \\" >> ${hwtmp} ;;
208     esac
209    
210     echo " \" 13 70" >> ${hwtmp}
211     chmod a+x ${hwtmp}
212     ${hwtmp}
213    
214     # remove tmp file
215     if [[ -f ${hwtmp} ]]
216     then
217     rm ${hwtmp}
218     fi
219  }  }
220    
221  dialog_setup_hdd_partitions_manuell()  dialog_setup_hdd_partitions_manuell()
# Line 243  dialog_setup_hdd_partitions_manuell_flas Line 294  dialog_setup_hdd_partitions_manuell_flas
294   fi   fi
295  }  }
296    
297  dialog_setup_hdd_partitions_silent()  dialog_setup_hdd_partitions_auto()
298    {
299     local i
300    
301     if [[ -z ${installdevs} ]]
302     then
303     dialog \
304     --backtitle "${TITLE}" \
305     --ok-label "Beenden" \
306     --msgbox "Kein geeignetes Laufwerk gefunden.\nDie Installation ist fehlgeschlagen." 6 70
307     exit 1
308     else
309    
310     echo "dialog \\" > /tmp/hddtmp.sh
311     echo "--backtitle \"${TITLE}\" \\" >> /tmp/hddtmp.sh
312     echo "--ok-label \"Weiter\" \\" >> /tmp/hddtmp.sh
313     echo "--cancel-label \"Beenden\" \\" >> /tmp/hddtmp.sh
314     echo "--stdout \\" >> /tmp/hddtmp.sh
315     echo "--menu \"Installations Laufwerk auswaehlen:\" 10 70 3 \\" >> /tmp/hddtmp.sh
316    
317     for i in ${installdevs}
318     do
319     echo "\"${i}\" \"\" \\" >> /tmp/hddtmp.sh
320     done
321     echo -e "\n" >> /tmp/hddtmp.sh
322    
323     chmod a+x /tmp/hddtmp.sh
324     HDD="$(/tmp/hddtmp.sh)"
325     RES=$?
326     [[ ${RES} -eq 1 ]] && return 1
327     if [[ ${RES} -eq 0 ]]
328     then
329     dialog_setup_hdd_info_auto
330     dialog_setup_hdd_create_partitions
331     setup_hdd_partitions_auto
332     fi
333     fi
334    }
335    
336    dialog_setup_hdd_create_partitions()
337  {  {
338   dialog \   dialog \
339   --backtitle "${TITLE}" \   --backtitle "${TITLE}" \
340   --infobox "Erstelle Partitionen ..." 3 70   --infobox "Erstelle Disk Partitionen ..." 3 70
341  }  }
342    
343  dialog_setup_hdd_format()  dialog_setup_hdd_format()
# Line 275  dialog_install_meter() Line 365  dialog_install_meter()
365  {  {
366   while [[ ${CURRENTLINE} != ${TOTALLINES} ]]   while [[ ${CURRENTLINE} != ${TOTALLINES} ]]
367   do   do
368   CURRENTLINE=$(grep --count . /tmp/install.log)   CURRENTLINE=$(grep -c . /tmp/install.log)
369   PERCENT=$(expr ${CURRENTLINE} \* 100 / ${TOTALLINES})   PERCENT=$(( ${CURRENTLINE} * 100 / ${TOTALLINES}))
370   echo ${PERCENT}   echo ${PERCENT}
371   sleep 1   sleep 1
372   done   done
# Line 292  dialog_install_bootsector() Line 382  dialog_install_bootsector()
382   --infobox "Schreibe den Bootsektor ..." 3 70   --infobox "Schreibe den Bootsektor ..." 3 70
383  }  }
384    
 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  
   
 }  
   
385  dialog_install_successful()  dialog_install_successful()
386  {  {
387   dialog \   dialog \
# Line 333  dialog_install_failure() Line 400  dialog_install_failure()
400   " 10 81   " 10 81
401  }  }
402    
 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  
 }  
   
403  dialog_main()  dialog_main()
404  {  {
405   METHOD=0   METHOD=0
# Line 372  dialog_main() Line 417  dialog_main()
417   "3" "Beenden und neustarten" \   "3" "Beenden und neustarten" \
418   "4" "Beenden und eine Shell starten")   "4" "Beenden und eine Shell starten")
419   RES=$?   RES=$?
420   if [[ ${RES} -eq 1 ]] && exit 1   [[ ${RES} -eq 1 ]] && exit 1
421   if [[ ${RES} -eq 0 ]]   if [[ ${RES} -eq 0 ]]
422   then   then
423   case ${METHOD} in   case ${METHOD} in
424           "1") dialog_setup_system_menu ;;           "1") dialog_setup_system_menu ;;
425   "2") dialog_setup_hdd_found_manuell ;;   "2") dialog_hardware_detection ;;
426   "3") install_do_reboot ;;   "3") install_do_reboot ;;
427   "4") /bin/bash --login -i ;;   "4") /bin/bash --login -i ;;
428   esac   esac
# Line 388  dialog_main() Line 433  dialog_main()
433  #################################################  #################################################
434  # Install Komandos #  # Install Komandos #
435  #################################################  #################################################
436    run_hardware_detection()
437    {
438     # check for special devices/clients:
439     # if zotac a zotac and the disk is a removeable device, then add rootdelay to kernelcmd
440     local removable=0
441     if [[ ! -z $(hwinfo --bios --storage | grep -i zotac) ]]
442     then
443     for i in /sys/block/[hs]d*/removable
444     do
445     if [[ $(< ${i}) = 1 ]]
446     then
447     removable=1
448     fi
449     done
450    
451     # only add this for grub legacy, grub2 detect these settings on its own
452     export GRUBLEGACYOPTS="rootdelay=8"
453     export SPECIALDEVICE="zotac"
454     fi
455    }
456    
457    setup_hdd_partitions_auto()
458    {
459     ROOTHDD="${HDD}1"
460    
461     ## delete disk
462     dd if=/dev/zero of=${HDD} count=1 &> /dev/null || die
463    
464     ## setup one bootable partition
465     #1. n= new disk
466     #2. p= primary disk
467     #3. 1= first partition
468     #4. ''= default sector start
469     #5. ''= defaul sector end
470     #6. a= bootable flag
471     #7. 1= boot flag for partition 1
472     #8. w= write/quit
473     fdisk ${HDD} &> /dev/null << EOF
474    n
475    p
476    1
477    
478    
479    a
480    1
481    w
482    EOF
483    }
484    
485  setup_hdd_partitions_manuell()  setup_hdd_partitions_manuell()
486  {  {
487   BOOTHDD="${HDD}1"   BOOTHDD="${HDD}1"
# Line 406  setup_hdd_partitions_manuell_flash() Line 500  setup_hdd_partitions_manuell_flash()
500   cfdisk ${HDD} || die   cfdisk ${HDD} || die
501  }  }
502    
 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  
 }  
   
503  setup_hdd_format()  setup_hdd_format()
504  {  {
505   mkswap ${SWAPHDD} || die   mkswap ${SWAPHDD} || die
# Line 449  install_system_image() Line 533  install_system_image()
533   tar xvjpf ${CDPATH}/system/${CDIMAGENAME} -C ${INSTALLPATH}   tar xvjpf ${CDPATH}/system/${CDIMAGENAME} -C ${INSTALLPATH}
534  }  }
535    
536    install_bootsector_chroot()
 install_kernel_image()  
537  {  {
538   declare -i CPUTYPE=$(cat /proc/cpuinfo | grep "cpu family" | cut -d ' ' -f3)   local my_roothdd
539     local grubconf=${INSTALLPATH}/boot/grub/grub.conf
540     local grub2conf=/boot/grub/grub.cfg
541    
542   if [[ ${CPUTYPE} -le 5 ]]   # check for grub2
543     if [[ -f ${INSTALLPATH}/sbin/grub-mkconfig ]]
544   then   then
545   lastdir="$(pwd)"   # needed by grub-mkconfig on the first run
546     if [[ ! -f ${INSTALLPATH}/boot/grub/video.lst ]]
547   mkdir -p ${INSTALLPATH}/INSTALL/kernel || die   then
548   cd ${INSTALLPATH}/INSTALL/kernel || die   install -m0644 ${INSTALLPATH}/lib/grub/*/video.lst ${INSTALLPATH}/boot/grub/video.lst || die
549   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)"  
550    
551   mkdir -p ${INSTALLPATH}/INSTALL/kernel || die   # set kernelopts
552   cd ${INSTALLPATH}/INSTALL/kernel || die   if [[ -f ${INSTALLPATH}/etc/conf.d/grub ]]
553   tar xzpf ${CDPATH}/kernels/kernel-i686.tar.gz || die   then
554   source ${INSTALLPATH}/INSTALL/kernel/kernelversion || die   sed -i "s:^\(export GRUB_CMDLINE_LINUX_DEFAULT=\).*:\1\"${KERNELOPTS}\":" ${INSTALLPATH}/etc/conf.d/grub || die
555     else
556     echo "export GRUB_CMDLINE_LINUX_DEFAULT=\"${KERNELOPTS}\"" >  ${INSTALLPATH}/etc/conf.d/grub || die
557     fi
558     echo 'grub-mkdevicemap' > ${INSTALLPATH}/root/.installrc || die
559     echo "LC_ALL=C grub-mkconfig -o ${grub2conf}  &> /dev/null" >> ${INSTALLPATH}/root/.installrc || die
560     echo "grub-install --no-floppy ${HDD} &> /dev/null" >> ${INSTALLPATH}/root/.installrc || die
561     echo "exit 0" >> ${INSTALLPATH}/root/.installrc || die
562    
563   cp -aRf ${INSTALLPATH}/INSTALL/kernel/${KRNLIB} ${INSTALLPATH}/lib/modules || die   # grub-legacy
564   cp -aRf ${INSTALLPATH}/INSTALL/kernel/${KRNIMG} ${INSTALLPATH}/boot || die   else
565   cp -aRf ${INSTALLPATH}/INSTALL/kernel/${KRNINITRD} ${INSTALLPATH}/boot || die   ### grubconf schreiben
566   cp -aRf ${INSTALLPATH}/INSTALL/kernel/kernelversion ${INSTALLPATH}/boot || die   source ${INSTALLPATH}/boot/kernelversion
567    
568   cd ${lastdir} || die   #for alx only
569          fi   if [ -e ${INSTALLPATH}/etc/alx_version ]
570  }   then
571     OLD_ALXVER="${ALXVER}"
572     source ${INSTALLPATH}/etc/alx_version
573     KRNVER="ALX-${ALXVER}"
574     ALXVER="${OLD_ALXVER}"
575     fi
576    
577  install_bootsector()   [[ -z ${KRNVER} ]] && KRNVER="AutoSta_LX"
578  {   [[ -z ${KRNINITRD} ]] && KRNINITRD="initrd"
579   ### grubconf schreiben   [[ -z ${KRNIMG} ]] && KRNIMG="vmlinuz"
  source ${INSTALLPATH}/INSTALL/kernel/kernelversion  
580    
581   [[ -z ${KRNVER} ]] && KRNVER="AutoSta_LX"   # uuid support
582   [[ -z ${KRNIMG} ]] && KRNIMG="bzImage"   if is_uuid_supported
583   [[ -z ${KRNINITRD} ]] && KRNINITRD="initrd"   then
584     my_roothdd="UUID=$(get_uuid ${ROOTHDD})"
585     else
586     my_roothdd="${ROOTHDD}"
587     fi
588    
589     : > ${grubconf} || die
590     echo "default 0" >> ${grubconf} || die
591     echo "timeout 3" >> ${grubconf} || die
592     # using current root password
593     echo "password --md5 $(cat ${INSTALLPATH}/etc/shadow | grep root | cut -d: -f2)"  >> ${grubconf} || die
594    
595     echo  >> ${grubconf} || die
596     echo "# normal boot" >> ${grubconf} || die
597     echo "title ${KRNVER}" >> ${grubconf} || die
598     echo "root (hd0,0)" >> ${grubconf} || die
599     echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS}" >> ${grubconf} || die
600     if is_initrd_supported
601     then
602     echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die
603     fi
604    
605   echo -e "default 0" > ${INSTALLPATH}/boot/grub/grub.conf || die   echo >> ${grubconf} || die
606   echo -e "timeout 03" >> ${INSTALLPATH}/boot/grub/grub.conf ||die   echo "# admin boot" >> ${grubconf} || die
607   echo -e "\ntitle=${KRNVER}" >> ${INSTALLPATH}/boot/grub/grub.conf || die   echo "title ${KRNVER} - Re-run hardware-detection" >> ${grubconf} || die
608   echo -e "root (hd0,0)" >> ${INSTALLPATH}/boot/grub/grub.conf || die   echo "lock"  >> ${grubconf} || die
609     echo "root (hd0,0)" >> ${grubconf} || die
610     echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS} hardware-auto-detection" >> ${grubconf} || die
611     if is_initrd_supported
612     then
613     echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die
614     fi
615    
616   echo -e "kernel (hd0,0)/boot/${KRNIMG} root=${ROOTHDD} quiet" >> ${INSTALLPATH}/boot/grub/grub.conf || die   echo >> ${grubconf} || die
617     echo "title ${KRNVER} - Reset *all* local settings" >> ${grubconf} || die
618     echo "lock"  >> ${grubconf} || die
619     echo "root (hd0,0)" >> ${grubconf} || die
620     echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS} alx-reset-settings" >> ${grubconf} || die
621     if is_initrd_supported
622     then
623     echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die
624     fi
625    
626   ### bootsector schreiben   # bootsector schreiben chrooted schreiben (lfs/magellan)
627   /sbin/grub --no-floppy --batch << "EOF" 1> /dev/null 2> /dev/null || die   cat > ${INSTALLPATH}/root/.installrc << CHROOTEOF
628    /usr/sbin/grub --no-floppy --batch << "EOF" 1> /dev/null 2> /dev/null
629  root (hd0,0)  root (hd0,0)
630  setup (hd0)  setup (hd0)
631  quit  quit
632  EOF  EOF
633    exit 0
634    CHROOTEOF
635     fi
636    
637     ## enters chroot
638     mount -t proc proc ${INSTALLPATH}/proc
639     mount -t sysfs sysfs ${INSTALLPATH}/sys
640     mount -o bind /dev ${INSTALLPATH}/dev
641     chroot ${INSTALLPATH} /bin/bash --rcfile /root/.installrc -i
642     umount ${INSTALLPATH}/proc
643     umount ${INSTALLPATH}/sys
644     umount ${INSTALLPATH}/dev
645     rm ${INSTALLPATH}/root/.installrc
646  }  }
647    
648  install_bootsector_chroot()  is_initrd_supported()
649  {  {
650   ### grubconf schreiben   # only generate initrds if the cmd exists
651   source ${INSTALLPATH}/boot/kernelversion   [[ -x ${INSTALLPATH}/sbin/mkinitrd ]] && return 0
652     return 1
653    }
654    
655   #for alx only  install_initrd_chroot()
656   if [ -e ${INSTALLPATH}/etc/alx_version ]  {
657   then   # only generate initrds if the cmd exists
658   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"  
   
  echo -e "default 0" > ${INSTALLPATH}/boot/grub/grub.conf || die  
  echo -e "timeout 0" >> ${INSTALLPATH}/boot/grub/grub.conf ||die  
   
  echo -e "\ntitle=${KRNVER}" >> ${INSTALLPATH}/boot/grub/grub.conf || die  
  echo -e "root (hd0,0)" >> ${INSTALLPATH}/boot/grub/grub.conf || die  
   
  echo -e "kernel (hd0,0)/boot/${KRNIMG} root=${ROOTHDD} quiet" >> ${INSTALLPATH}/boot/grub/grub.conf || die  
   
  ### bootsector schreiben chrooted schreiben (gentoo)  
  if [ -f ${INSTALLPATH}/sbin/grub ]  
  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  
659    
660   ### bootsector schreiben chrooted schreiben (lfs/magellan)   DISKMODS="sd_mod"
661   if [ -f ${INSTALLPATH}/usr/sbin/grub ]   OLDPATAMODS="amd74xx piix sis5513 via82cxxx"
662   then   PATAMODS="ata_piix pata_amd pata_mpiix pata_oldpiix pata_sis pata_via"
663   cat > ${INSTALLPATH}/root/.bashrc << CHROOTEOF   SATAMODS="sata_via sata_sis sata_nv"
664  /usr/sbin/grub --no-floppy --batch << "EOF" 1> /dev/null 2> /dev/null   DRMMODS="i915 mga nouveau r128 radeon savage sis tdfx ttm via"
665  root (hd0,0)   FBMODS="uvesafb"
666  setup (hd0)  
667  quit   # install an appropriate uvesafb.conf
668  EOF   install -d ${INSTALLPATH}/etc/modprobe.d || die
669     echo "options uvesafb mode_option=1024x768-32@60 scroll=ywrap" > ${INSTALLPATH}/etc/modprobe.d/uvesafb.conf || die
670    
671     cat > ${INSTALLPATH}/root/.installrc << CHROOTEOF
672    echo "MODULES=\"${FORMAT_FILESYSTEM} ${DISKMODS} ${OLDATAMODS} ${PATAMODS} ${SATAMODS} ${DRMMODS} ${FBMODS}\"" > /etc/conf.d/mkinitrd
673    mkinitrd -f /boot/$(readlink /boot/initrd) $(readlink /boot/vmlinuz | sed "s:kernel-::g") > /dev/null
674  exit 0  exit 0
675  CHROOTEOF  CHROOTEOF
  fi  
676    
677   ##enters chroot   ## enters chroot
678   mount -t proc none ${INSTALLPATH}/proc   mount -t proc proc ${INSTALLPATH}/proc
679     mount -t sysfs sysfs ${INSTALLPATH}/sys
680   mount -o bind /dev ${INSTALLPATH}/dev   mount -o bind /dev ${INSTALLPATH}/dev
681   chroot ${INSTALLPATH} /bin/bash --rcfile /root/.bashrc -i   chroot ${INSTALLPATH} /bin/bash --rcfile /root/.installrc -i
682   umount ${INSTALLPATH}/proc   umount ${INSTALLPATH}/proc
683     umount ${INSTALLPATH}/sys
684   umount ${INSTALLPATH}/dev   umount ${INSTALLPATH}/dev
685   rm ${INSTALLPATH}/root/.bashrc   rm ${INSTALLPATH}/root/.installrc
686  }  }
687    
688  install_alxconfig()  is_uuid_supported()
689  {  {
690   lastdir="$(pwd)"   if [[ -x $(which busybox.mkinitrd &> /dev/null) ]]
691     then
692   mkdir -p ${INSTALLPATH}/opt/alx-config || die   # only detect uuids if supported
693   cd ${INSTALLPATH}/opt/alx-config || die   if [[ ! -z $(busybox.mkinitrd | grep blkid) ]]
694   tar xzpf ${CDPATH}/alx-config/alx-config.tar.gz || die   then
695   chmod a+x ${INSTALLPATH}/opt/alx-config/Configurator/config_functions.sh || die   return 0
696   chmod a+x ${INSTALLPATH}/opt/alx-config/Configurator/config_menu.sh || die   fi
697   ln -sf /opt/alx-config/Configurator/config_menu.sh ${INSTALLPATH}/bin/ALXConfig || die   fi
698    
699   cd ${lastdir} || die   return 1
700  }  }
701    
702    get_uuid()
 install_system_settings()  
703  {  {
704   ### schreibe fstab   local UUID
705   echo -e "${BOOTHDD}\t/boot\text3\tnoatime,noauto\t1 1" > ${INSTALLPATH}/etc/fstab || die   local SEC_TYPE
706   echo -e "${ROOTHDD}\t/\text3\tnoatime\t0 0" >> ${INSTALLPATH}/etc/fstab || die   local TYPE
707   echo -e "${SWAPHDD}\tswap\tswap\tpri=1\t0 0" >> ${INSTALLPATH}/etc/fstab || die  
708   echo -e "none\t/proc\tproc\tdefaults\t0 0" >> ${INSTALLPATH}/etc/fstab || die   local dev="$1"
709     [[ -z ${dev} ]] && die "no dev given"
710    
711   echo -e "none\t/dev/shm\ttmpfs\tdefaults\t0 0" >> ${INSTALLPATH}/etc/fstab || die   # check if given device is already an UUID
712   echo -e "none\t/proc/bus/usb\tusbfs\tdefaults\t0 0" >> ${INSTALLPATH}/etc/fstab || die   if [[ ${dev/UUID=/}x != ${dev}x ]]
713     then
714     eval "${dev}"
715     else
716     eval $(busybox.mkinitrd blkid ${dev} | grep "${dev}:" | sed 's/.*:\ //')
717     fi
718     echo "${UUID}"
719  }  }
720    
721  install_system_settings_flash()  install_system_settings()
722  {  {
723   ### schreibe fstab   # schreibe fstab
724   echo -e "${ROOTHDD}\t/\text3\tnoatime\t0 0" > ${INSTALLPATH}/etc/fstab || die   if is_uuid_supported
725   echo -e "none\t/proc\tproc\tdefaults\t0 0" >> ${INSTALLPATH}/etc/fstab || die   then
726     echo -e "UUID=$(get_uuid ${BOOTHDD})\t/boot\t${FORMAT_FILESYSTEM}\tnoatime,noauto\t1 1" > ${INSTALLPATH}/etc/fstab || die
727     echo -e "UUID=$(get_uuid ${ROOTHDD})\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" >> ${INSTALLPATH}/etc/fstab || die
728     else
729     echo -e "${BOOTHDD}\t/boot\t${FORMAT_FILESYSTEM}\tnoatime,noauto\t1 1" > ${INSTALLPATH}/etc/fstab || die
730     echo -e "${ROOTHDD}\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" >> ${INSTALLPATH}/etc/fstab || die
731     fi
732     # not needed busybox loads all with swapon -a, even if not mentioned in fstab
733     #echo -e "UUID='$(get_uuid ${SWAPHDD})'\tswap\tswap\tpri=1\t0 0" >> ${INSTALLPATH}/etc/fstab || die
734     echo -e "proc\t/proc\tproc\tdefaults\t0 0" >> ${INSTALLPATH}/etc/fstab || die
735     echo -e "shm\t/dev/shm\ttmpfs\tdefaults\t0 0" >> ${INSTALLPATH}/etc/fstab || die
736    
737   echo -e "none\t/dev/shm\ttmpfs\tdefaults\t0 0" >> ${INSTALLPATH}/etc/fstab || die   # install network config skeleton
738   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
739  }  }
740    
741  install_hotfixes()  install_system_settings_flash()
742  {  {
743   if [ -f ${CDPATH}/hotfixes/hotfixes.sh ]   # schreibe fstab
744     if is_uuid_supported
745   then   then
746   dialog_hotfixes   echo -e "UUID=$(get_uuid ${ROOTHDD})\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" > ${INSTALLPATH}/etc/fstab || die
747   sleep1   else
748   ${CDPATH}/hotfixes/hotfixes.sh   echo -e "${ROOTHDD}\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" > ${INSTALLPATH}/etc/fstab || die
749   fi   fi
750     echo -e "proc\t/proc\tproc\tdefaults\t0 0" >> ${INSTALLPATH}/etc/fstab || die
751     echo -e "shm\t/dev/shm\ttmpfs\tdefaults\t0 0" >> ${INSTALLPATH}/etc/fstab || die
752  }  }
753    
754  install_umount_rootfs()  install_umount_rootfs()
# Line 646  install_do_reboot() Line 776  install_do_reboot()
776    
777  run_install_normal()  run_install_normal()
778  {  {
779   dialog_setup_hdd_found_manuell   dialog_hardware_detection
780    
781   dialog_setup_hdd_partitions_manuell   dialog_setup_hdd_partitions_manuell
782   dialog_setup_hdd_format   dialog_setup_hdd_format
# Line 654  run_install_normal() Line 784  run_install_normal()
784   install_mount_rootfs   install_mount_rootfs
785   (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
786    
  dialog_install_bootsector  
  install_bootsector_chroot  
   
787   dialog_install_settings   dialog_install_settings
788   sleep 1   sleep 1
789   install_system_settings   install_system_settings
790   install_hotfixes   install_initrd_chroot
791    
792     dialog_install_bootsector
793     install_bootsector_chroot
794    
795   install_umount_rootfs   install_umount_rootfs
796   dialog_install_successful   dialog_install_successful
797  }  }
798    
799  run_install_flash()  run_install_flash()
800  {  {
801   dialog_setup_hdd_found_manuell   dialog_hardware_detection
802    
803   dialog_setup_hdd_partitions_manuell_flash   dialog_setup_hdd_partitions_manuell_flash
804   dialog_setup_hdd_format   dialog_setup_hdd_format
# Line 675  run_install_flash() Line 806  run_install_flash()
806   install_mount_rootfs_flash   install_mount_rootfs_flash
807   (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
808    
  dialog_install_bootsector  
  install_bootsector_chroot  
   
809   dialog_install_settings   dialog_install_settings
810   sleep 1   sleep 1
811   install_system_settings_flash   install_system_settings_flash
812   install_hotfixes   install_initrd_chroot
813    
814     dialog_install_bootsector
815     install_bootsector_chroot
816    
817   install_umount_rootfs_flash   install_umount_rootfs_flash
818   dialog_install_successful   dialog_install_successful
819  }  }
820    
821  run_install_silent()  run_install_auto()
822  {  {
823   echo "starting silent install ..."   dialog_hardware_detection
  sleep 1  
 }  
824    
825  run_install_unattended()   dialog_setup_hdd_partitions_auto
826  {   dialog_setup_hdd_format
827   echo "starting unattended install ..."   setup_hdd_format_flash > /dev/null
828     install_mount_rootfs_flash
829     (install_system_image > /tmp/install.log) 2> /tmp/install_errors.log | dialog_install_meter | dialog_install_system_image
830    
831     dialog_install_settings
832   sleep 1   sleep 1
833     install_system_settings_flash
834     install_initrd_chroot
835    
836     dialog_install_bootsector
837     install_bootsector_chroot
838    
839     install_umount_rootfs_flash
840     dialog_install_successful
841  }  }
842    
843  if [[ $1 = unattended ]]  dialog_main
 then  
  run_install_unattended  
 else  
  dialog_main  
 fi  
844    
845  exit 0  exit 0

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