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

revision 2390 by niro, Wed Jun 15 08:58:22 2011 UTC revision 6821 by niro, Thu Jul 23 08:57:15 2015 UTC
# Line 1  Line 1 
1  #!/bin/sh  #!/bin/sh
2  #  # $Id$
 # $Header: /home/cvsd/alx-cvs/alx-src/alxinstall-ng/bin/alxinstall-ng.sh,v 1.15 2008-06-28 00:37:45 niro Exp $  
 #  
 # AutoSta_LX Installation Script  
 #  
 # Niels Rogalla <niro@magellan-linux.de>  
 # <rogalla@augusta-bochum.de>  
 #  
 #  
 # Install Navigation Gui  
 #  
3    
4  #images: (get ${CDIMAGENAME})  # ignore environment!
5    LC_ALL=C
6    
7    MLIBDIR="/usr/lib/alxinstall-ng"
8    
9    # images: (get ${CDIMAGENAME})
10  source /mnt/cdrom/system/images.conf  source /mnt/cdrom/system/images.conf
11    
12  #Includes  # includes
13  source /usr/lib/alxinstall-ng/functions/findhdd.sh > /dev/null  source ${MLIBDIR}/functions/hwdetection.sh
 ### bugfix ###############################  
 cdromdev="$(echo ${cdromdev} | sed 's/ //')"  
 ########################################  
14    
15  ### System/Config Version  ### System/Config Version
16  VERSION="0.3.7"  VERSION="@@VERSION@@"
17  TITLE="alxinstall-ng - ${VERSION}"  TITLE="alxinstall-ng - ${VERSION}"
18    
19  CDPATH="/mnt/cdrom"  CDPATH="/mnt/cdrom"
20  INSTALLPATH="/mnt/magellan"  INSTALLPATH="/mnt/magellan"
21    
22  ### WICHTIG: anzahl lines in der autosta_lx.tar.gz -1  ### linecount of system.tar.gz -1 !
23  CURRENTLINE=0  CURRENTLINE=0
24  #TOTALLINES=11072 # -> now in images.conf  #TOTALLINES=11072 # -> now in images.conf
25    
26  # standart kernel opts  # standard kernel opts
27  KERNELOPTS="quiet"  KERNELOPTS="quiet video=1024x768"
28    
29    # grub options
30    GRUBLEGACYOPTS=""
31    GRUB2OPTS=""
32    GRUB2GFXPAYLOAD="1024x768x16,1024x768"
33    
34    # fdisk options
35    FDISKPARTIONBELOW256MB=0
36    
37  # default specialdevices  # default specialdevices
38  SPECIALDEVICE=""  SPECIALDEVICE=""
39    FORMFACTOR="desktop"
40    
41  # target filesystem  # target filesystem
42  FORMAT_FILESYSTEM="ext4"  FORMAT_FILESYSTEM="ext4"
43    
44  #################################################  #################################################
45  #  DIALOG BOXEN #  #  DIALOG BOXES #
46  #################################################  #################################################
47    
48  die()  die()
# Line 86  dialog_setup_hdd_info() Line 87  dialog_setup_hdd_info()
87   Bitte ${SHDD}1 als \Z3bootable\Zn markieren." 12 81   Bitte ${SHDD}1 als \Z3bootable\Zn markieren." 12 81
88  }  }
89    
90  dialog_setup_hdd_info_flash()  dialog_setup_hdd_info_simple()
91  {  {
92   local SHDD="$(echo $HDD | sed 's/\/dev\///')"   local SHDD="$(echo $HDD | sed 's/\/dev\///')"
93    
# Line 136  dialog_setup_system_menu() Line 137  dialog_setup_system_menu()
137   then   then
138   case "${i}" in   case "${i}" in
139   "1") run_install_auto ;;   "1") run_install_auto ;;
140           "2") run_install_normal ;;   "2") run_install_normal ;;
141   "3") run_install_flash ;;   "3") run_install_simple ;;
142   "") dialog_setup_system_menu;;   "") dialog_setup_system_menu;;
143   esac   esac
144   fi   fi
# Line 155  dialog_hardware_detection() Line 156  dialog_hardware_detection()
156   hwtmp="/tmp/hwtmp.sh"   hwtmp="/tmp/hwtmp.sh"
157   fi   fi
158    
159   [[ ! -z ${installdevs} ]] && installdevs=""   run_hardware_detection_disks
160    
161   echo "dialog \\"  > ${hwtmp}   echo "dialog \\"  > ${hwtmp}
162   echo "--backtitle \"${TITLE}\" \\" >> ${hwtmp}   echo "--backtitle \"${TITLE}\" \\" >> ${hwtmp}
# Line 165  dialog_hardware_detection() Line 166  dialog_hardware_detection()
166   echo "--msgbox \"Gefundene Hardware:\n\n \\" >> ${hwtmp}   echo "--msgbox \"Gefundene Hardware:\n\n \\" >> ${hwtmp}
167   echo " Festplatten:\n \\" >> ${hwtmp}   echo " Festplatten:\n \\" >> ${hwtmp}
168    
169   if [[ ! -z ${scsidisks} ]]   if [[ ! -z ${ALL_DISKS} ]]
170   then   then
171   for i in ${scsidisks}   for i in ${ALL_DISKS}
172   do   do
173   if [[ ${i} != ${cdromdev} ]]   echo " \\Z3${i}\\Zn\n \\" >> ${hwtmp}
  then  
  echo " \\Z7SCSI: \\Z3${i}\\Zn\n \\" >> ${hwtmp}  
  installdevs="${installdevs} ${i}"  
  fi  
174   done   done
175   fi   fi
176    
177   if [[ ! -z ${idedisks} ]]   if [[ ! -z ${ALL_CDROMS} ]]
178   then   then
179   for i in ${idedisks}   echo " \n \\" >> ${hwtmp}
180     echo " CDROM Laufwerke:\n \\" >> ${hwtmp}
181     for i in ${ALL_CDROMS}
182   do   do
183   if [[ ${i} != ${cdromdev} ]]   echo " \\Z3${i}\\Zn\n \\" >> ${hwtmp}
  then  
  echo " \\Z7IDE:  \\Z3${i}\\Zn\n \\" >> ${hwtmp}  
  installdevs="${installdevs} ${i}"  
  fi  
184   done   done
185   fi   fi
186    
  if [[ ! -z ${cdromdev} ]]  
  then  
  echo " \n \\" >> ${hwtmp}  
  echo " \\Z7andere Laufwerke:\n \\" >> ${hwtmp}  
  echo " CDROM: \\Z3${cdromdev}\\Zn\n \\" >> ${hwtmp}  
  fi  
   
187   # other devices   # other devices
188   run_hardware_detection   run_hardware_detection
189   case "${SPECIALDEVICE}" in   case "${SPECIALDEVICE}" in
190   zotac) echo " \n\n\n \\Z2Zotac Device erkannt!\\Zn \\" >> ${hwtmp} ;;   zotac*) echo " \n \\Z2Zotac Device erkannt.\\Zn \\" >> ${hwtmp} ;;
191   *) echo " \n\n\n \\ZnStandard Device erkannt!\\Zn \\" >> ${hwtmp} ;;   rangee) echo " \n \\Z2Rangee Device erkannt.\\Zn \\" >> ${hwtmp} ;;
192     maxdata) echo " \n \\Z2Maxdata Device erkannt.\\Zn \\" >> ${hwtmp} ;;
193     i845) echo " \n \\Z2Intel i845 Device erkannt.\\Zn \\" >> ${hwtmp} ;;
194     *) echo " \n \\ZnStandard Device erkannt.\\Zn \\" >> ${hwtmp} ;;
195   esac   esac
196     if [[ ${FORMFACTOR} = laptop ]]
197     then
198     echo " \n \\ZnFormfactor Laptop, Powersave Modus 'ondemand' wird aktiviert.\\Zn \\" >> ${hwtmp}
199     fi
200    
201   echo " \" 13 70" >> ${hwtmp}   echo " \" 14 70" >> ${hwtmp}
202   chmod a+x ${hwtmp}   chmod a+x ${hwtmp}
203   ${hwtmp}   ${hwtmp}
204    
# Line 218  dialog_setup_hdd_partitions_manuell() Line 213  dialog_setup_hdd_partitions_manuell()
213  {  {
214   local i   local i
215    
216   if [[ -z ${installdevs} ]]   if [[ -z ${ALL_DISKS} ]]
217   then   then
218   dialog \   dialog \
219   --backtitle "${TITLE}" \   --backtitle "${TITLE}" \
# Line 234  dialog_setup_hdd_partitions_manuell() Line 229  dialog_setup_hdd_partitions_manuell()
229   echo "--stdout \\" >> /tmp/hddtmp.sh   echo "--stdout \\" >> /tmp/hddtmp.sh
230   echo "--menu \"Installations Laufwerk auswaehlen:\" 10 70 3 \\" >> /tmp/hddtmp.sh   echo "--menu \"Installations Laufwerk auswaehlen:\" 10 70 3 \\" >> /tmp/hddtmp.sh
231    
232   for i in ${installdevs}   for i in ${ALL_DISKS}
233   do   do
234   echo "\"${i}\" \"\" \\" >> /tmp/hddtmp.sh   echo "\"${i}\" \"\" \\" >> /tmp/hddtmp.sh
235   done   done
# Line 252  dialog_setup_hdd_partitions_manuell() Line 247  dialog_setup_hdd_partitions_manuell()
247   fi   fi
248  }  }
249    
250  dialog_setup_hdd_partitions_manuell_flash()  dialog_setup_hdd_partitions_manuell_simple()
251  {  {
252   local i   local i
253    
254   if [[ -z ${installdevs} ]]   if [[ -z ${ALL_DISKS} ]]
255   then   then
256   dialog \   dialog \
257   --backtitle "${TITLE}" \   --backtitle "${TITLE}" \
# Line 272  dialog_setup_hdd_partitions_manuell_flas Line 267  dialog_setup_hdd_partitions_manuell_flas
267   echo "--stdout \\" >> /tmp/hddtmp.sh   echo "--stdout \\" >> /tmp/hddtmp.sh
268   echo "--menu \"Installations Laufwerk auswaehlen:\" 10 70 3 \\" >> /tmp/hddtmp.sh   echo "--menu \"Installations Laufwerk auswaehlen:\" 10 70 3 \\" >> /tmp/hddtmp.sh
269    
270   for i in ${installdevs}   for i in ${ALL_DISKS}
271   do   do
272   echo "\"${i}\" \"\" \\" >> /tmp/hddtmp.sh   echo "\"${i}\" \"\" \\" >> /tmp/hddtmp.sh
273   done   done
# Line 284  dialog_setup_hdd_partitions_manuell_flas Line 279  dialog_setup_hdd_partitions_manuell_flas
279   [[ ${RES} -eq 1 ]] && return 1   [[ ${RES} -eq 1 ]] && return 1
280   if [[ ${RES} -eq 0 ]]   if [[ ${RES} -eq 0 ]]
281   then   then
282   dialog_setup_hdd_info_flash   dialog_setup_hdd_info_simple
283   setup_hdd_partitions_manuell_flash   setup_hdd_partitions_manuell_simple
284   fi   fi
285   fi   fi
286  }  }
# Line 294  dialog_setup_hdd_partitions_auto() Line 289  dialog_setup_hdd_partitions_auto()
289  {  {
290   local i   local i
291    
292   if [[ -z ${installdevs} ]]   if [[ -z ${ALL_DISKS} ]]
293   then   then
294   dialog \   dialog \
295   --backtitle "${TITLE}" \   --backtitle "${TITLE}" \
# Line 310  dialog_setup_hdd_partitions_auto() Line 305  dialog_setup_hdd_partitions_auto()
305   echo "--stdout \\" >> /tmp/hddtmp.sh   echo "--stdout \\" >> /tmp/hddtmp.sh
306   echo "--menu \"Installations Laufwerk auswaehlen:\" 10 70 3 \\" >> /tmp/hddtmp.sh   echo "--menu \"Installations Laufwerk auswaehlen:\" 10 70 3 \\" >> /tmp/hddtmp.sh
307    
308   for i in ${installdevs}   for i in ${ALL_DISKS}
309   do   do
310   echo "\"${i}\" \"\" \\" >> /tmp/hddtmp.sh   echo "\"${i}\" \"\" \\" >> /tmp/hddtmp.sh
311   done   done
# Line 370  dialog_install_meter() Line 365  dialog_install_meter()
365   return 0   return 0
366  }  }
367    
   
368  dialog_install_bootsector()  dialog_install_bootsector()
369  {  {
370   dialog \   dialog \
# Line 417  dialog_main() Line 411  dialog_main()
411   if [[ ${RES} -eq 0 ]]   if [[ ${RES} -eq 0 ]]
412   then   then
413   case ${METHOD} in   case ${METHOD} in
414           "1") dialog_setup_system_menu ;;   "1") dialog_setup_system_menu ;;
415   "2") dialog_hardware_detection ;;   "2") dialog_hardware_detection ;;
416   "3") install_do_reboot ;;   "3") install_do_reboot ;;
417   "4") /bin/bash --login -i ;;   "4") /bin/bash --login -i ;;
# Line 427  dialog_main() Line 421  dialog_main()
421  }  }
422    
423  #################################################  #################################################
424  # Install Komandos #  # Install Commands #
425  #################################################  #################################################
426  run_hardware_detection()  run_hardware_detection()
427  {  {
428     local hwinfo
429    
430     hwinfo="$(hwinfo --bios --storage --pci --gfxcard --sys)"
431    
432   # check for special devices/clients:   # check for special devices/clients:
433   # if zotac a zotac and the disk is a removeable device, then add rootdelay to kernelcmd   # if zotac a zotac and the disk is a removeable device, then add rootdelay to kernelcmd
434   local removable=0   local removable=0
435   if [[ ! -z $(hwinfo --bios --storage | grep -i zotac) ]]   if [[ ! -z $(echo "${hwinfo}" | grep -i zotac) ]]
436   then   then
437   for i in /sys/block/[hs]d*/removable   for i in /sys/block/[hs]d*/removable
438   do   do
# Line 444  run_hardware_detection() Line 442  run_hardware_detection()
442   fi   fi
443   done   done
444    
445   export KERNELOPTS="${KERNELOPTS} rootdelay=8"   # only add this for grub legacy, grub2 detect these settings on its own
446   export SPECIALDEVICE="zotac"   export GRUBLEGACYOPTS="rootdelay=8"
447     # there are two zotac types in the wild, nvidia based gfx and intel
448     if [[ ! -z $(echo "${hwinfo}" | grep -i nouveau) ]]
449     then
450     export SPECIALDEVICE="zotac_nvidia"
451     else
452     export SPECIALDEVICE="zotac_intel"
453     fi
454   fi   fi
455    
456     # check for special devices/clients:
457     # if a rangee and disk ist smaller then 256mb move partion one block further ahead
458     if [[ ! -z $(echo "${hwinfo}" | grep -i CLE266) ]]
459     then
460     # for a rangee always define partion startblock +1
461     export FDISKPARTIONBELOW256MB="1"
462     export SPECIALDEVICE="rangee"
463     export GRUBLEGACYOPTS=""
464     fi
465    
466     # check for special devices/clients:
467     # check for maxdata / i810/ i815 Chipsets and disable KMS and use i810fb frambuffer
468     if [[ ! -z $(echo "${hwinfo}" | grep -i i810) ]] || [[ ! -z $(echo "${hwinfo}" | grep -i i815) ]]
469     then
470     export SPECIALDEVICE="maxdata"
471     export GRUBLEGACYOPTS=""
472     fi
473    
474     # check for i845 Chipsets and disable KMS and use 915 drm driver
475     if [[ ! -z $(echo "${hwinfo}" | grep -i i845) ]]
476     then
477     export SPECIALDEVICE="i845"
478     # unset default video=1024x768 opt or the drm driver breaks
479     export KERNELOPTS="quiet"
480     export GRUBLEGACYOPTS=""
481     # enable full kms support
482     export GRUB2GFXPAYLOAD="keep"
483     fi
484    
485     # check for radeon gfxcards
486     if [[ ! -z $(echo "${hwinfo}" | grep -i radeon) ]]
487     then
488     # enable full kms support
489     export GRUB2GFXPAYLOAD="keep"
490     fi
491    
492     # check for special devices/clients:
493     # check for laptops and activate cpufreq scaling
494     if [[ $(echo "${hwinfo}" | grep 'Formfactor:' | sed 's:.*Formfactor\:\ \"\(.*\)\":\1:') = laptop ]]
495     then
496     export FORMFACTOR="laptop"
497     export KERNELOPTS="${KERNELOPTS} cpufreq.governor=ondemand"
498     fi
499    }
500    
501    run_hardware_detection_disks()
502    {
503     local bootdev
504    
505     # all disks but exclude ramdisks
506     export ALL_DISKS=$(get_hwinfo disk | sed '/\/dev\/ram[0-9].*/d')
507     # remove the boot device from ALL_DISKS if it was an usbstick
508     if [[ $(grep '[[:space:]]/mnt/cdrom[[:space:]]' /proc/mounts | cut -d' ' -f3) != iso9660 ]]
509     then
510     bootdev="$(grep '[[:space:]]/mnt/cdrom[[:space:]]' /proc/mounts | cut -d' ' -f1 | sed 's:[0-9]::g')"
511     export ALL_DISKS=$(echo "${ALL_DISKS}" | grep -v "${bootdev}")
512     fi
513     export ALL_CDROMS="$(get_hwinfo cdrom)"
514    }
515    
516    hdd_size_below_256mb()
517    {
518     local hdd="$1"
519     local size
520     local retval
521     [[ -z ${hdd} ]] && die "Error: get_hdd_size() no \$hdd given!"
522    
523     size=$(fdisk -l ${hdd} | grep "Disk.*${hdd}" | sed 's:.*,\ \(.*\)\ byte.*:\1:')
524     if [[ ${size} -le 257000000 ]]
525     then
526     retval="0"
527     else
528     retval="1"
529     fi
530    
531     return "${retval}"
532  }  }
533    
534  setup_hdd_partitions_auto()  setup_hdd_partitions_auto()
535  {  {
536   ROOTHDD="${HDD}1"   ROOTHDD="${HDD}1"
537    
538     # run this only if FDISKPARTITIONBELOW256MB is not already 1
539     if [[ ${FDISKPARTIONBELOW256MB} != 1 ]]
540     then
541     if hdd_size_below_256mb ${HDD}
542     then
543     FDISKPARTIONBELOW256MB=1
544     else
545     FDISKPARTIONBELOW256MB=0
546     fi
547     fi
548    
549   ## delete disk   ## delete disk
550   dd if=/dev/zero of=${HDD} count=1 &> /dev/null || die   dd if=/dev/zero of=${HDD} count=1 &> /dev/null || die
551    
552   ## setup one bootable partition   if [[ ${FDISKPARTIONBELOW256MB} = 1 ]]
553   #1. n= new disk   then
554   #2. p= primary disk   ## setup one bootable partition
555   #3. 1= first partition   #1. n= new disk
556   #4. ''= default sector start   #2. p= primary disk
557   #5. ''= defaul sector end   #3. 1= first partition
558   #6. a= bootable flag   #4. 2= default sector start // small disk needs more space for grub2 mbr sector
559   #7. 1= boot flag for partition 1   #5. ''= defaul sector end
560   #8. w= write/quit   #6. a= bootable flag
561   fdisk ${HDD} &> /dev/null << EOF   #7. 1= boot flag for partition 1
562     #8. w= write/quit
563     fdisk ${HDD} &> /dev/null << EOF
564    n
565    p
566    1
567    2
568    
569    a
570    1
571    w
572    EOF
573     else
574     ## setup one bootable partition
575     #1. n= new disk
576     #2. p= primary disk
577     #3. 1= first partition
578     #4. ''= default sector start
579     #5. ''= defaul sector end
580     #6. a= bootable flag
581     #7. 1= boot flag for partition 1
582     #8. w= write/quit
583     fdisk ${HDD} &> /dev/null << EOF
584  n  n
585  p  p
586  1  1
# Line 475  a Line 590  a
590  1  1
591  w  w
592  EOF  EOF
593     fi
594  }  }
595    
596  setup_hdd_partitions_manuell()  setup_hdd_partitions_manuell()
# Line 487  setup_hdd_partitions_manuell() Line 603  setup_hdd_partitions_manuell()
603   cfdisk ${HDD} || die   cfdisk ${HDD} || die
604  }  }
605    
606  setup_hdd_partitions_manuell_flash()  setup_hdd_partitions_manuell_simple()
607  {  {
608   ROOTHDD="${HDD}1"   ROOTHDD="${HDD}1"
609    
# Line 502  setup_hdd_format() Line 618  setup_hdd_format()
618   mke2fs -j -q ${ROOTHDD} || die   mke2fs -j -q ${ROOTHDD} || die
619  }  }
620    
621  setup_hdd_format_flash()  setup_hdd_format_simple()
622  {  {
623   mke2fs -j -q ${ROOTHDD} || die   mke2fs -j -q ${ROOTHDD} || die
624  }  }
# Line 516  install_mount_rootfs() Line 632  install_mount_rootfs()
632   cd ${INSTALLPATH} || die   cd ${INSTALLPATH} || die
633  }  }
634    
635  install_mount_rootfs_flash()  install_mount_rootfs_simple()
636  {  {
637   mount ${ROOTHDD} ${INSTALLPATH} || die   mount ${ROOTHDD} ${INSTALLPATH} || die
638   install -d ${INSTALLPATH}/boot || die   install -d ${INSTALLPATH}/boot || die
# Line 531  install_system_image() Line 647  install_system_image()
647  install_bootsector_chroot()  install_bootsector_chroot()
648  {  {
649   local my_roothdd   local my_roothdd
650     local grubconf=${INSTALLPATH}/boot/grub/grub.conf
651     local grub2conf=/boot/grub/grub.cfg
652    
653   ### grubconf schreiben   # check for grub2
654   source ${INSTALLPATH}/boot/kernelversion   if [[ -f ${INSTALLPATH}/sbin/grub-mkconfig ]]
   
  #for alx only  
  if [ -e ${INSTALLPATH}/etc/alx_version ]  
655   then   then
656   OLD_ALXVER="${ALXVER}"   # needed by grub-mkconfig on the first run
657   source ${INSTALLPATH}/etc/alx_version   if [[ ! -f ${INSTALLPATH}/boot/grub/video.lst ]]
658   KRNVER="ALX-${ALXVER}"   then
659   ALXVER="${OLD_ALXVER}"   install -m0644 ${INSTALLPATH}/lib/grub/*/video.lst ${INSTALLPATH}/boot/grub/video.lst || die
660   fi   fi
661    
662   [[ -z ${KRNVER} ]] && KRNVER="AutoSta_LX"   # set kernelopts
663   [[ -z ${KRNINITRD} ]] && KRNINITRD="initrd"   if [[ -f ${INSTALLPATH}/etc/conf.d/grub ]]
664   [[ -z ${KRNIMG} ]] && KRNIMG="vmlinuz"   then
665     sed -i "s:^\(export GRUB_CMDLINE_LINUX_DEFAULT=\).*:\1\"${KERNELOPTS}\":" ${INSTALLPATH}/etc/conf.d/grub || die
666     sed -i "s:^\(export GRUB_GFXPAYLOAD_LINUX=\).*:\1\"${GRUB2GFXPAYLOAD}\":" ${INSTALLPATH}/etc/conf.d/grub || die
667     else
668     echo "export GRUB_CMDLINE_LINUX_DEFAULT=\"${KERNELOPTS}\"" >  ${INSTALLPATH}/etc/conf.d/grub || die
669     echo "export GRUB_GFXPAYLOAD_LINUX=\"${GRUB2GFXPAYLOAD}\"" >>  ${INSTALLPATH}/etc/conf.d/grub || die
670     fi
671     echo 'grub-mkdevicemap' > ${INSTALLPATH}/root/.installrc || die
672     echo "LC_ALL=C grub-mkconfig -o ${grub2conf}  &> /dev/null" >> ${INSTALLPATH}/root/.installrc || die
673     echo "grub-install --no-floppy ${HDD} &> /dev/null" >> ${INSTALLPATH}/root/.installrc || die
674     echo "exit 0" >> ${INSTALLPATH}/root/.installrc || die
675    
676   # uuid support   # grub-legacy
  if is_uuid_supported  
  then  
  my_roothdd="UUID=$(get_uuid ${ROOTHDD})"  
677   else   else
678   my_roothdd="${ROOTHDD}"   ### grubconf schreiben
679   fi   source ${INSTALLPATH}/boot/kernelversion
680    
681   local grubconf=${INSTALLPATH}/boot/grub/grub.conf   #for alx only
682   : > ${grubconf} || die   if [ -e ${INSTALLPATH}/etc/alx_version ]
683   echo "default 0" >> ${grubconf} || die   then
684   echo "timeout 3" >> ${grubconf} || die   OLD_ALXVER="${ALXVER}"
685   # using current root password   source ${INSTALLPATH}/etc/alx_version
686   echo "password --md5 $(cat ${INSTALLPATH}/etc/shadow | grep root | cut -d: -f2)"  >> ${grubconf} || die   KRNVER="ALX-${ALXVER}"
687     ALXVER="${OLD_ALXVER}"
688     fi
689    
690   echo  >> ${grubconf} || die   [[ -z ${KRNVER} ]] && KRNVER="AutoSta_LX"
691   echo "# normal boot" >> ${grubconf} || die   [[ -z ${KRNINITRD} ]] && KRNINITRD="initrd"
692   echo "title ${KRNVER}" >> ${grubconf} || die   [[ -z ${KRNIMG} ]] && KRNIMG="vmlinuz"
  echo "root (hd0,0)" >> ${grubconf} || die  
  echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS}" >> ${grubconf} || die  
  if is_initrd_supported  
  then  
  echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die  
  fi  
693    
694   echo >> ${grubconf} || die   # uuid support
695   echo "# admin boot" >> ${grubconf} || die   if is_uuid_supported
696   echo "title ${KRNVER} - Re-run hardware-detection" >> ${grubconf} || die   then
697   echo "lock"  >> ${grubconf} || die   my_roothdd="UUID=$(get_uuid ${ROOTHDD})"
698   echo "root (hd0,0)" >> ${grubconf} || die   else
699   echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} hardware-auto-detection" >> ${grubconf} || die   my_roothdd="${ROOTHDD}"
700   if is_initrd_supported   fi
  then  
  echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die  
  fi  
701    
702   echo >> ${grubconf} || die   : > ${grubconf} || die
703   echo "title ${KRNVER} - Reset *all* local settings" >> ${grubconf} || die   echo "default 0" >> ${grubconf} || die
704   echo "lock"  >> ${grubconf} || die   echo "timeout 3" >> ${grubconf} || die
705   echo "root (hd0,0)" >> ${grubconf} || die   # using current root password
706   echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} alx-reset-settings" >> ${grubconf} || die   echo "password --md5 $(cat ${INSTALLPATH}/etc/shadow | grep root | cut -d: -f2)"  >> ${grubconf} || die
707   if is_initrd_supported  
708   then   echo  >> ${grubconf} || die
709   echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die   echo "# normal boot" >> ${grubconf} || die
710   fi   echo "title ${KRNVER}" >> ${grubconf} || die
711     echo "root (hd0,0)" >> ${grubconf} || die
712     echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS}" >> ${grubconf} || die
713     if is_initrd_supported
714     then
715     echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die
716     fi
717    
718     echo >> ${grubconf} || die
719     echo "# admin boot" >> ${grubconf} || die
720     echo "title ${KRNVER} - Re-run hardware-detection" >> ${grubconf} || die
721     echo "lock"  >> ${grubconf} || die
722     echo "root (hd0,0)" >> ${grubconf} || die
723     echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS} hardware-auto-detection" >> ${grubconf} || die
724     if is_initrd_supported
725     then
726     echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die
727     fi
728    
729   # bootsector schreiben chrooted schreiben (lfs/magellan)   echo >> ${grubconf} || die
730   cat > ${INSTALLPATH}/root/.bashrc << CHROOTEOF   echo "title ${KRNVER} - Reset *all* local settings" >> ${grubconf} || die
731     echo "lock"  >> ${grubconf} || die
732     echo "root (hd0,0)" >> ${grubconf} || die
733     echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS} alx-reset-settings" >> ${grubconf} || die
734     if is_initrd_supported
735     then
736     echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die
737     fi
738    
739     # write bootsector chrooted (lfs/magellan)
740     cat > ${INSTALLPATH}/root/.installrc << CHROOTEOF
741  /usr/sbin/grub --no-floppy --batch << "EOF" 1> /dev/null 2> /dev/null  /usr/sbin/grub --no-floppy --batch << "EOF" 1> /dev/null 2> /dev/null
742  root (hd0,0)  root (hd0,0)
743  setup (hd0)  setup (hd0)
# Line 603  quit Line 745  quit
745  EOF  EOF
746  exit 0  exit 0
747  CHROOTEOF  CHROOTEOF
748     fi
749    
750   ## enters chroot   ## enters chroot
751   mount -t proc proc ${INSTALLPATH}/proc   mount -t proc proc ${INSTALLPATH}/proc
752   mount -t sysfs sysfs ${INSTALLPATH}/sys   mount -t sysfs sysfs ${INSTALLPATH}/sys
753   mount -o bind /dev ${INSTALLPATH}/dev   mount -o bind /dev ${INSTALLPATH}/dev
754   chroot ${INSTALLPATH} /bin/bash --rcfile /root/.bashrc -i   chroot ${INSTALLPATH} /bin/bash --rcfile /root/.installrc -i
755   umount ${INSTALLPATH}/proc   umount ${INSTALLPATH}/proc
756   umount ${INSTALLPATH}/sys   umount ${INSTALLPATH}/sys
757   umount ${INSTALLPATH}/dev   umount ${INSTALLPATH}/dev
758   rm ${INSTALLPATH}/root/.bashrc   rm ${INSTALLPATH}/root/.installrc
759  }  }
760    
761  is_initrd_supported()  is_initrd_supported()
# Line 627  install_initrd_chroot() Line 770  install_initrd_chroot()
770   # only generate initrds if the cmd exists   # only generate initrds if the cmd exists
771   is_initrd_supported || return 0   is_initrd_supported || return 0
772    
773   cat > ${INSTALLPATH}/root/.bashrc << CHROOTEOF   DISKMODS="sd_mod"
774  echo "MODULES=\"${FORMAT_FILESYSTEM} amd74xx piix sis5513 via82cxxx sd_mod ata_piix pata_amd pata_mpiix pata_oldpiix pata_sis pata_via sata_via sata_sis sata_nv\"" > /etc/conf.d/mkinitrd   OLDPATAMODS="amd74xx piix sis5513 via82cxxx"
775     PATAMODS="ata_piix pata_amd pata_mpiix pata_oldpiix pata_sis pata_via"
776     SATAMODS="sata_via sata_sis sata_nv"
777     DRMMODS="i915 mga nouveau r128 radeon savage sis tdfx ttm via"
778     OTHERMODS=""
779     case ${SPECIALDEVICE} in
780     zotac_intel|i845) FBMODS=""; DRMMODS="i915" ;;
781     zotac_nvidia) FBMODS=""; DRMMODS="nouveau" ;;
782     rangee) FBMODS="" ;; ## fallback to vesafb, viafb does not run on all CLE266 boards
783     # not working with kms enabled drivers -> segfaults
784     #maxdata) FBMODS="i810fb" ;; ## check for maxdata / i810/ i815 Chipsets and disable KMS and use i810fb frambuffer
785     maxdata) FBMODS="" ;;
786     *) FBMODS="uvesafb" ;;
787     esac
788    
789     if [[ ${FORMFACTOR} = laptop ]]
790     then
791     OTHERMODS="acpi-cpufreq cpufreq_ondemand cpufreq_conservative cpufreq_powersave"
792     fi
793    
794     # install an appropriate uvesafb.conf
795     install -d ${INSTALLPATH}/etc/modprobe.d || die
796     echo "options uvesafb mode_option=1024x768-32@60 scroll=ywrap" > ${INSTALLPATH}/etc/modprobe.d/uvesafb.conf || die
797    
798     # install an appropriate viafb.conf
799     echo "options viafb viafb_mode=1024x768 viafb_refresh=60" > ${INSTALLPATH}/etc/modprobe.d/viafb.conf || die
800    
801     # install an appropriate i810fb.conf
802     echo "options i810fb xres=1024 yres=768 bpp=16 mtrr=1 hsync1=30 hsync2=62 vsync1=30 vsync2=60"  > ${INSTALLPATH}/etc/modprobe.d/i810fb.conf || die
803    
804     cat > ${INSTALLPATH}/root/.installrc << CHROOTEOF
805    echo "MODULES=\"${FORMAT_FILESYSTEM} ${DISKMODS} ${OLDATAMODS} ${PATAMODS} ${SATAMODS} ${DRMMODS} ${FBMODS} ${OTHERMODS}\"" > /etc/conf.d/mkinitrd
806  mkinitrd -f /boot/$(readlink /boot/initrd) $(readlink /boot/vmlinuz | sed "s:kernel-::g") > /dev/null  mkinitrd -f /boot/$(readlink /boot/initrd) $(readlink /boot/vmlinuz | sed "s:kernel-::g") > /dev/null
807  exit 0  exit 0
808  CHROOTEOF  CHROOTEOF
# Line 637  CHROOTEOF Line 811  CHROOTEOF
811   mount -t proc proc ${INSTALLPATH}/proc   mount -t proc proc ${INSTALLPATH}/proc
812   mount -t sysfs sysfs ${INSTALLPATH}/sys   mount -t sysfs sysfs ${INSTALLPATH}/sys
813   mount -o bind /dev ${INSTALLPATH}/dev   mount -o bind /dev ${INSTALLPATH}/dev
814   chroot ${INSTALLPATH} /bin/bash --rcfile /root/.bashrc -i   chroot ${INSTALLPATH} /bin/bash --rcfile /root/.installrc -i
815   umount ${INSTALLPATH}/proc   umount ${INSTALLPATH}/proc
816   umount ${INSTALLPATH}/sys   umount ${INSTALLPATH}/sys
817   umount ${INSTALLPATH}/dev   umount ${INSTALLPATH}/dev
818   rm ${INSTALLPATH}/root/.bashrc   rm ${INSTALLPATH}/root/.installrc
819  }  }
820    
821  is_uuid_supported()  is_uuid_supported()
# Line 695  install_system_settings() Line 869  install_system_settings()
869    
870   # install network config skeleton   # install network config skeleton
871   install -m0644 ${INSTALLPATH}/etc/alxconfig-ng/skel/net/net.eth0 ${INSTALLPATH}/etc/conf.d/ || die   install -m0644 ${INSTALLPATH}/etc/alxconfig-ng/skel/net/net.eth0 ${INSTALLPATH}/etc/conf.d/ || die
872    
873     # intel framebufer quirk
874     if [[ -e /proc/fb ]]
875     then
876     if [[ ! -z $(grep 'inteldrmfb' /proc/fb) ]]
877     then
878     fbdev=$(grep 'inteldrmfb' /proc/fb | sed 's:\([0-9]\).*:\1:')
879     if [[ ${fbdev} != 0 ]]
880     then
881     sed -i "s:^\(SPLASH_DEV=\).*:\1\"/dev/fb${fbdev}\":" ${INSTALLPATH}/etc/splash/splash.conf || die
882     fi
883     fi
884     fi
885  }  }
886    
887  install_system_settings_flash()  install_system_settings_simple()
888  {  {
889   # schreibe fstab   # write fstab
890   if is_uuid_supported   if is_uuid_supported
891   then   then
892   echo -e "UUID=$(get_uuid ${ROOTHDD})\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" > ${INSTALLPATH}/etc/fstab || die   echo -e "UUID=$(get_uuid ${ROOTHDD})\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" > ${INSTALLPATH}/etc/fstab || die
# Line 718  install_umount_rootfs() Line 905  install_umount_rootfs()
905   swapoff ${SWAPHDD} || die   swapoff ${SWAPHDD} || die
906  }  }
907    
908  install_umount_rootfs_flash()  install_umount_rootfs_simple()
909  {  {
910   cd /   cd /
911   umount ${INSTALLPATH} || die   umount ${INSTALLPATH} || die
# Line 730  install_do_reboot() Line 917  install_do_reboot()
917  }  }
918    
919  #################################################  #################################################
920  #     Install Ablauf Scripte #  #     Install Main Scripts #
921  #################################################  #################################################
922    
923  run_install_normal()  run_install_normal()
# Line 743  run_install_normal() Line 930  run_install_normal()
930   install_mount_rootfs   install_mount_rootfs
931   (install_system_image > /tmp/install.log) 2> /tmp/install_errors.log | dialog_install_meter | dialog_install_system_image   (install_system_image > /tmp/install.log) 2> /tmp/install_errors.log | dialog_install_meter | dialog_install_system_image
932    
  dialog_install_bootsector  
  install_bootsector_chroot  
   
933   dialog_install_settings   dialog_install_settings
934   sleep 1   sleep 1
935   install_system_settings   install_system_settings
936   install_initrd_chroot   install_initrd_chroot
937    
938     dialog_install_bootsector
939     install_bootsector_chroot
940    
941   install_umount_rootfs   install_umount_rootfs
942   dialog_install_successful   dialog_install_successful
943  }  }
944    
945  run_install_flash()  run_install_simple()
946  {  {
947   dialog_hardware_detection   dialog_hardware_detection
948    
949   dialog_setup_hdd_partitions_manuell_flash   dialog_setup_hdd_partitions_manuell_simple
950   dialog_setup_hdd_format   dialog_setup_hdd_format
951   setup_hdd_format_flash > /dev/null   setup_hdd_format_simple > /dev/null
952   install_mount_rootfs_flash   install_mount_rootfs_simple
953   (install_system_image > /tmp/install.log) 2> /tmp/install_errors.log | dialog_install_meter | dialog_install_system_image   (install_system_image > /tmp/install.log) 2> /tmp/install_errors.log | dialog_install_meter | dialog_install_system_image
954    
  dialog_install_bootsector  
  install_bootsector_chroot  
   
955   dialog_install_settings   dialog_install_settings
956   sleep 1   sleep 1
957   install_system_settings_flash   install_system_settings_simple
958   install_initrd_chroot   install_initrd_chroot
959   install_umount_rootfs_flash  
960     dialog_install_bootsector
961     install_bootsector_chroot
962    
963     install_umount_rootfs_simple
964   dialog_install_successful   dialog_install_successful
965  }  }
966    
# Line 781  run_install_auto() Line 970  run_install_auto()
970    
971   dialog_setup_hdd_partitions_auto   dialog_setup_hdd_partitions_auto
972   dialog_setup_hdd_format   dialog_setup_hdd_format
973   setup_hdd_format_flash > /dev/null   setup_hdd_format_simple > /dev/null
974   install_mount_rootfs_flash   install_mount_rootfs_simple
975   (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
976    
  dialog_install_bootsector  
  install_bootsector_chroot  
   
977   dialog_install_settings   dialog_install_settings
978   sleep 1   sleep 1
979   install_system_settings_flash   install_system_settings_simple
980   install_initrd_chroot   install_initrd_chroot
981   install_umount_rootfs_flash  
982     dialog_install_bootsector
983     install_bootsector_chroot
984    
985     install_umount_rootfs_simple
986   dialog_install_successful   dialog_install_successful
987  }  }
988    

Legend:
Removed from v.2390  
changed lines
  Added in v.6821