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 6819 by niro, Thu Jul 23 08:53:26 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="%VERSIONTAG%"
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 417  dialog_main() Line 412  dialog_main()
412   if [[ ${RES} -eq 0 ]]   if [[ ${RES} -eq 0 ]]
413   then   then
414   case ${METHOD} in   case ${METHOD} in
415           "1") dialog_setup_system_menu ;;   "1") dialog_setup_system_menu ;;
416   "2") dialog_hardware_detection ;;   "2") dialog_hardware_detection ;;
417   "3") install_do_reboot ;;   "3") install_do_reboot ;;
418   "4") /bin/bash --login -i ;;   "4") /bin/bash --login -i ;;
# Line 427  dialog_main() Line 422  dialog_main()
422  }  }
423    
424  #################################################  #################################################
425  # Install Komandos #  # Install Commands #
426  #################################################  #################################################
427  run_hardware_detection()  run_hardware_detection()
428  {  {
429     local hwinfo
430    
431     hwinfo="$(hwinfo --bios --storage --pci --gfxcard --sys)"
432    
433   # check for special devices/clients:   # check for special devices/clients:
434   # 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
435   local removable=0   local removable=0
436   if [[ ! -z $(hwinfo --bios --storage | grep -i zotac) ]]   if [[ ! -z $(echo "${hwinfo}" | grep -i zotac) ]]
437   then   then
438   for i in /sys/block/[hs]d*/removable   for i in /sys/block/[hs]d*/removable
439   do   do
# Line 444  run_hardware_detection() Line 443  run_hardware_detection()
443   fi   fi
444   done   done
445    
446   export KERNELOPTS="${KERNELOPTS} rootdelay=8"   # only add this for grub legacy, grub2 detect these settings on its own
447   export SPECIALDEVICE="zotac"   export GRUBLEGACYOPTS="rootdelay=8"
448     # there are two zotac types in the wild, nvidia based gfx and intel
449     if [[ ! -z $(echo "${hwinfo}" | grep -i nouveau) ]]
450     then
451     export SPECIALDEVICE="zotac_nvidia"
452     else
453     export SPECIALDEVICE="zotac_intel"
454     fi
455     fi
456    
457     # check for special devices/clients:
458     # if a rangee and disk ist smaller then 256mb move partion one block further ahead
459     if [[ ! -z $(echo "${hwinfo}" | grep -i CLE266) ]]
460     then
461     # for a rangee always define partion startblock +1
462     export FDISKPARTIONBELOW256MB="1"
463     export SPECIALDEVICE="rangee"
464     export GRUBLEGACYOPTS=""
465     fi
466    
467     # check for special devices/clients:
468     # check for maxdata / i810/ i815 Chipsets and disable KMS and use i810fb frambuffer
469     if [[ ! -z $(echo "${hwinfo}" | grep -i i810) ]] || [[ ! -z $(echo "${hwinfo}" | grep -i i815) ]]
470     then
471     export SPECIALDEVICE="maxdata"
472     export GRUBLEGACYOPTS=""
473     fi
474    
475     # check for i845 Chipsets and disable KMS and use 915 drm driver
476     if [[ ! -z $(echo "${hwinfo}" | grep -i i845) ]]
477     then
478     export SPECIALDEVICE="i845"
479     # unset default video=1024x768 opt or the drm driver breaks
480     export KERNELOPTS="quiet"
481     export GRUBLEGACYOPTS=""
482     # enable full kms support
483     export GRUB2GFXPAYLOAD="keep"
484     fi
485    
486     # check for radeon gfxcards
487     if [[ ! -z $(echo "${hwinfo}" | grep -i radeon) ]]
488     then
489     # enable full kms support
490     export GRUB2GFXPAYLOAD="keep"
491     fi
492    
493     # check for special devices/clients:
494     # check for laptops and activate cpufreq scaling
495     if [[ $(echo "${hwinfo}" | grep 'Formfactor:' | sed 's:.*Formfactor\:\ \"\(.*\)\":\1:') = laptop ]]
496     then
497     export FORMFACTOR="laptop"
498     export KERNELOPTS="${KERNELOPTS} cpufreq.governor=ondemand"
499   fi   fi
500  }  }
501    
502    run_hardware_detection_disks()
503    {
504     local bootdev
505    
506     # all disks but exclude ramdisks
507     export ALL_DISKS=$(get_hwinfo disk | sed '/\/dev\/ram[0-9].*/d')
508     # remove the boot device from ALL_DISKS if it was an usbstick
509     if [[ $(grep '[[:space:]]/mnt/cdrom[[:space:]]' /proc/mounts | cut -d' ' -f3) != iso9660 ]]
510     then
511     bootdev="$(grep '[[:space:]]/mnt/cdrom[[:space:]]' /proc/mounts | cut -d' ' -f1 | sed 's:[0-9]::g')"
512     export ALL_DISKS=$(echo "${ALL_DISKS}" | grep -v "${bootdev}")
513     fi
514     export ALL_CDROMS="$(get_hwinfo cdrom)"
515    }
516    
517    hdd_size_below_256mb()
518    {
519     local hdd="$1"
520     local size
521     local retval
522     [[ -z ${hdd} ]] && die "Error: get_hdd_size() no \$hdd given!"
523    
524     size=$(fdisk -l ${hdd} | grep "Disk.*${hdd}" | sed 's:.*,\ \(.*\)\ byte.*:\1:')
525     if [[ ${size} -le 257000000 ]]
526     then
527     retval="0"
528     else
529     retval="1"
530     fi
531    
532     return "${retval}"
533    }
534    
535  setup_hdd_partitions_auto()  setup_hdd_partitions_auto()
536  {  {
537   ROOTHDD="${HDD}1"   ROOTHDD="${HDD}1"
538    
539     # run this only if FDISKPARTITIONBELOW256MB is not already 1
540     if [[ ${FDISKPARTIONBELOW256MB} != 1 ]]
541     then
542     if hdd_size_below_256mb ${HDD}
543     then
544     FDISKPARTIONBELOW256MB=1
545     else
546     FDISKPARTIONBELOW256MB=0
547     fi
548     fi
549    
550   ## delete disk   ## delete disk
551   dd if=/dev/zero of=${HDD} count=1 &> /dev/null || die   dd if=/dev/zero of=${HDD} count=1 &> /dev/null || die
552    
553   ## setup one bootable partition   if [[ ${FDISKPARTIONBELOW256MB} = 1 ]]
554   #1. n= new disk   then
555   #2. p= primary disk   ## setup one bootable partition
556   #3. 1= first partition   #1. n= new disk
557   #4. ''= default sector start   #2. p= primary disk
558   #5. ''= defaul sector end   #3. 1= first partition
559   #6. a= bootable flag   #4. 2= default sector start // small disk needs more space for grub2 mbr sector
560   #7. 1= boot flag for partition 1   #5. ''= defaul sector end
561   #8. w= write/quit   #6. a= bootable flag
562   fdisk ${HDD} &> /dev/null << EOF   #7. 1= boot flag for partition 1
563     #8. w= write/quit
564     fdisk ${HDD} &> /dev/null << EOF
565    n
566    p
567    1
568    2
569    
570    a
571    1
572    w
573    EOF
574     else
575     ## setup one bootable partition
576     #1. n= new disk
577     #2. p= primary disk
578     #3. 1= first partition
579     #4. ''= default sector start
580     #5. ''= defaul sector end
581     #6. a= bootable flag
582     #7. 1= boot flag for partition 1
583     #8. w= write/quit
584     fdisk ${HDD} &> /dev/null << EOF
585  n  n
586  p  p
587  1  1
# Line 475  a Line 591  a
591  1  1
592  w  w
593  EOF  EOF
594     fi
595  }  }
596    
597  setup_hdd_partitions_manuell()  setup_hdd_partitions_manuell()
# Line 487  setup_hdd_partitions_manuell() Line 604  setup_hdd_partitions_manuell()
604   cfdisk ${HDD} || die   cfdisk ${HDD} || die
605  }  }
606    
607  setup_hdd_partitions_manuell_flash()  setup_hdd_partitions_manuell_simple()
608  {  {
609   ROOTHDD="${HDD}1"   ROOTHDD="${HDD}1"
610    
# Line 502  setup_hdd_format() Line 619  setup_hdd_format()
619   mke2fs -j -q ${ROOTHDD} || die   mke2fs -j -q ${ROOTHDD} || die
620  }  }
621    
622  setup_hdd_format_flash()  setup_hdd_format_simple()
623  {  {
624   mke2fs -j -q ${ROOTHDD} || die   mke2fs -j -q ${ROOTHDD} || die
625  }  }
# Line 516  install_mount_rootfs() Line 633  install_mount_rootfs()
633   cd ${INSTALLPATH} || die   cd ${INSTALLPATH} || die
634  }  }
635    
636  install_mount_rootfs_flash()  install_mount_rootfs_simple()
637  {  {
638   mount ${ROOTHDD} ${INSTALLPATH} || die   mount ${ROOTHDD} ${INSTALLPATH} || die
639   install -d ${INSTALLPATH}/boot || die   install -d ${INSTALLPATH}/boot || die
# Line 531  install_system_image() Line 648  install_system_image()
648  install_bootsector_chroot()  install_bootsector_chroot()
649  {  {
650   local my_roothdd   local my_roothdd
651     local grubconf=${INSTALLPATH}/boot/grub/grub.conf
652     local grub2conf=/boot/grub/grub.cfg
653    
654   ### grubconf schreiben   # check for grub2
655   source ${INSTALLPATH}/boot/kernelversion   if [[ -f ${INSTALLPATH}/sbin/grub-mkconfig ]]
   
  #for alx only  
  if [ -e ${INSTALLPATH}/etc/alx_version ]  
656   then   then
657   OLD_ALXVER="${ALXVER}"   # needed by grub-mkconfig on the first run
658   source ${INSTALLPATH}/etc/alx_version   if [[ ! -f ${INSTALLPATH}/boot/grub/video.lst ]]
659   KRNVER="ALX-${ALXVER}"   then
660   ALXVER="${OLD_ALXVER}"   install -m0644 ${INSTALLPATH}/lib/grub/*/video.lst ${INSTALLPATH}/boot/grub/video.lst || die
661   fi   fi
662    
663   [[ -z ${KRNVER} ]] && KRNVER="AutoSta_LX"   # set kernelopts
664   [[ -z ${KRNINITRD} ]] && KRNINITRD="initrd"   if [[ -f ${INSTALLPATH}/etc/conf.d/grub ]]
665   [[ -z ${KRNIMG} ]] && KRNIMG="vmlinuz"   then
666     sed -i "s:^\(export GRUB_CMDLINE_LINUX_DEFAULT=\).*:\1\"${KERNELOPTS}\":" ${INSTALLPATH}/etc/conf.d/grub || die
667     sed -i "s:^\(export GRUB_GFXPAYLOAD_LINUX=\).*:\1\"${GRUB2GFXPAYLOAD}\":" ${INSTALLPATH}/etc/conf.d/grub || die
668     else
669     echo "export GRUB_CMDLINE_LINUX_DEFAULT=\"${KERNELOPTS}\"" >  ${INSTALLPATH}/etc/conf.d/grub || die
670     echo "export GRUB_GFXPAYLOAD_LINUX=\"${GRUB2GFXPAYLOAD}\"" >>  ${INSTALLPATH}/etc/conf.d/grub || die
671     fi
672     echo 'grub-mkdevicemap' > ${INSTALLPATH}/root/.installrc || die
673     echo "LC_ALL=C grub-mkconfig -o ${grub2conf}  &> /dev/null" >> ${INSTALLPATH}/root/.installrc || die
674     echo "grub-install --no-floppy ${HDD} &> /dev/null" >> ${INSTALLPATH}/root/.installrc || die
675     echo "exit 0" >> ${INSTALLPATH}/root/.installrc || die
676    
677   # uuid support   # grub-legacy
  if is_uuid_supported  
  then  
  my_roothdd="UUID=$(get_uuid ${ROOTHDD})"  
678   else   else
679   my_roothdd="${ROOTHDD}"   ### grubconf schreiben
680   fi   source ${INSTALLPATH}/boot/kernelversion
681    
682   local grubconf=${INSTALLPATH}/boot/grub/grub.conf   #for alx only
683   : > ${grubconf} || die   if [ -e ${INSTALLPATH}/etc/alx_version ]
684   echo "default 0" >> ${grubconf} || die   then
685   echo "timeout 3" >> ${grubconf} || die   OLD_ALXVER="${ALXVER}"
686   # using current root password   source ${INSTALLPATH}/etc/alx_version
687   echo "password --md5 $(cat ${INSTALLPATH}/etc/shadow | grep root | cut -d: -f2)"  >> ${grubconf} || die   KRNVER="ALX-${ALXVER}"
688     ALXVER="${OLD_ALXVER}"
689     fi
690    
691   echo  >> ${grubconf} || die   [[ -z ${KRNVER} ]] && KRNVER="AutoSta_LX"
692   echo "# normal boot" >> ${grubconf} || die   [[ -z ${KRNINITRD} ]] && KRNINITRD="initrd"
693   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  
694    
695   echo >> ${grubconf} || die   # uuid support
696   echo "# admin boot" >> ${grubconf} || die   if is_uuid_supported
697   echo "title ${KRNVER} - Re-run hardware-detection" >> ${grubconf} || die   then
698   echo "lock"  >> ${grubconf} || die   my_roothdd="UUID=$(get_uuid ${ROOTHDD})"
699   echo "root (hd0,0)" >> ${grubconf} || die   else
700   echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} hardware-auto-detection" >> ${grubconf} || die   my_roothdd="${ROOTHDD}"
701   if is_initrd_supported   fi
  then  
  echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die  
  fi  
702    
703   echo >> ${grubconf} || die   : > ${grubconf} || die
704   echo "title ${KRNVER} - Reset *all* local settings" >> ${grubconf} || die   echo "default 0" >> ${grubconf} || die
705   echo "lock"  >> ${grubconf} || die   echo "timeout 3" >> ${grubconf} || die
706   echo "root (hd0,0)" >> ${grubconf} || die   # using current root password
707   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
708   if is_initrd_supported  
709   then   echo  >> ${grubconf} || die
710   echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die   echo "# normal boot" >> ${grubconf} || die
711   fi   echo "title ${KRNVER}" >> ${grubconf} || die
712     echo "root (hd0,0)" >> ${grubconf} || die
713     echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS}" >> ${grubconf} || die
714     if is_initrd_supported
715     then
716     echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die
717     fi
718    
719     echo >> ${grubconf} || die
720     echo "# admin boot" >> ${grubconf} || die
721     echo "title ${KRNVER} - Re-run hardware-detection" >> ${grubconf} || die
722     echo "lock"  >> ${grubconf} || die
723     echo "root (hd0,0)" >> ${grubconf} || die
724     echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS} hardware-auto-detection" >> ${grubconf} || die
725     if is_initrd_supported
726     then
727     echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die
728     fi
729    
730   # bootsector schreiben chrooted schreiben (lfs/magellan)   echo >> ${grubconf} || die
731   cat > ${INSTALLPATH}/root/.bashrc << CHROOTEOF   echo "title ${KRNVER} - Reset *all* local settings" >> ${grubconf} || die
732     echo "lock"  >> ${grubconf} || die
733     echo "root (hd0,0)" >> ${grubconf} || die
734     echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS} alx-reset-settings" >> ${grubconf} || die
735     if is_initrd_supported
736     then
737     echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die
738     fi
739    
740     # write bootsector chrooted (lfs/magellan)
741     cat > ${INSTALLPATH}/root/.installrc << CHROOTEOF
742  /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
743  root (hd0,0)  root (hd0,0)
744  setup (hd0)  setup (hd0)
# Line 603  quit Line 746  quit
746  EOF  EOF
747  exit 0  exit 0
748  CHROOTEOF  CHROOTEOF
749     fi
750    
751   ## enters chroot   ## enters chroot
752   mount -t proc proc ${INSTALLPATH}/proc   mount -t proc proc ${INSTALLPATH}/proc
753   mount -t sysfs sysfs ${INSTALLPATH}/sys   mount -t sysfs sysfs ${INSTALLPATH}/sys
754   mount -o bind /dev ${INSTALLPATH}/dev   mount -o bind /dev ${INSTALLPATH}/dev
755   chroot ${INSTALLPATH} /bin/bash --rcfile /root/.bashrc -i   chroot ${INSTALLPATH} /bin/bash --rcfile /root/.installrc -i
756   umount ${INSTALLPATH}/proc   umount ${INSTALLPATH}/proc
757   umount ${INSTALLPATH}/sys   umount ${INSTALLPATH}/sys
758   umount ${INSTALLPATH}/dev   umount ${INSTALLPATH}/dev
759   rm ${INSTALLPATH}/root/.bashrc   rm ${INSTALLPATH}/root/.installrc
760  }  }
761    
762  is_initrd_supported()  is_initrd_supported()
# Line 627  install_initrd_chroot() Line 771  install_initrd_chroot()
771   # only generate initrds if the cmd exists   # only generate initrds if the cmd exists
772   is_initrd_supported || return 0   is_initrd_supported || return 0
773    
774   cat > ${INSTALLPATH}/root/.bashrc << CHROOTEOF   DISKMODS="sd_mod"
775  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"
776     PATAMODS="ata_piix pata_amd pata_mpiix pata_oldpiix pata_sis pata_via"
777     SATAMODS="sata_via sata_sis sata_nv"
778     DRMMODS="i915 mga nouveau r128 radeon savage sis tdfx ttm via"
779     OTHERMODS=""
780     case ${SPECIALDEVICE} in
781     zotac_intel|i845) FBMODS=""; DRMMODS="i915" ;;
782     zotac_nvidia) FBMODS=""; DRMMODS="nouveau" ;;
783     rangee) FBMODS="" ;; ## fallback to vesafb, viafb does not run on all CLE266 boards
784     # not working with kms enabled drivers -> segfaults
785     #maxdata) FBMODS="i810fb" ;; ## check for maxdata / i810/ i815 Chipsets and disable KMS and use i810fb frambuffer
786     maxdata) FBMODS="" ;;
787     *) FBMODS="uvesafb" ;;
788     esac
789    
790     if [[ ${FORMFACTOR} = laptop ]]
791     then
792     OTHERMODS="acpi-cpufreq cpufreq_ondemand cpufreq_conservative cpufreq_powersave"
793     fi
794    
795     # install an appropriate uvesafb.conf
796     install -d ${INSTALLPATH}/etc/modprobe.d || die
797     echo "options uvesafb mode_option=1024x768-32@60 scroll=ywrap" > ${INSTALLPATH}/etc/modprobe.d/uvesafb.conf || die
798    
799     # install an appropriate viafb.conf
800     echo "options viafb viafb_mode=1024x768 viafb_refresh=60" > ${INSTALLPATH}/etc/modprobe.d/viafb.conf || die
801    
802     # install an appropriate i810fb.conf
803     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
804    
805     cat > ${INSTALLPATH}/root/.installrc << CHROOTEOF
806    echo "MODULES=\"${FORMAT_FILESYSTEM} ${DISKMODS} ${OLDATAMODS} ${PATAMODS} ${SATAMODS} ${DRMMODS} ${FBMODS} ${OTHERMODS}\"" > /etc/conf.d/mkinitrd
807  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
808  exit 0  exit 0
809  CHROOTEOF  CHROOTEOF
# Line 637  CHROOTEOF Line 812  CHROOTEOF
812   mount -t proc proc ${INSTALLPATH}/proc   mount -t proc proc ${INSTALLPATH}/proc
813   mount -t sysfs sysfs ${INSTALLPATH}/sys   mount -t sysfs sysfs ${INSTALLPATH}/sys
814   mount -o bind /dev ${INSTALLPATH}/dev   mount -o bind /dev ${INSTALLPATH}/dev
815   chroot ${INSTALLPATH} /bin/bash --rcfile /root/.bashrc -i   chroot ${INSTALLPATH} /bin/bash --rcfile /root/.installrc -i
816   umount ${INSTALLPATH}/proc   umount ${INSTALLPATH}/proc
817   umount ${INSTALLPATH}/sys   umount ${INSTALLPATH}/sys
818   umount ${INSTALLPATH}/dev   umount ${INSTALLPATH}/dev
819   rm ${INSTALLPATH}/root/.bashrc   rm ${INSTALLPATH}/root/.installrc
820  }  }
821    
822  is_uuid_supported()  is_uuid_supported()
# Line 695  install_system_settings() Line 870  install_system_settings()
870    
871   # install network config skeleton   # install network config skeleton
872   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
873    
874     # intel framebufer quirk
875     if [[ -e /proc/fb ]]
876     then
877     if [[ ! -z $(grep 'inteldrmfb' /proc/fb) ]]
878     then
879     fbdev=$(grep 'inteldrmfb' /proc/fb | sed 's:\([0-9]\).*:\1:')
880     if [[ ${fbdev} != 0 ]]
881     then
882     sed -i "s:^\(SPLASH_DEV=\).*:\1\"/dev/fb${fbdev}\":" ${INSTALLPATH}/etc/splash/splash.conf || die
883     fi
884     fi
885     fi
886  }  }
887    
888  install_system_settings_flash()  install_system_settings_simple()
889  {  {
890   # schreibe fstab   # write fstab
891   if is_uuid_supported   if is_uuid_supported
892   then   then
893   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 906  install_umount_rootfs()
906   swapoff ${SWAPHDD} || die   swapoff ${SWAPHDD} || die
907  }  }
908    
909  install_umount_rootfs_flash()  install_umount_rootfs_simple()
910  {  {
911   cd /   cd /
912   umount ${INSTALLPATH} || die   umount ${INSTALLPATH} || die
# Line 730  install_do_reboot() Line 918  install_do_reboot()
918  }  }
919    
920  #################################################  #################################################
921  #     Install Ablauf Scripte #  #     Install Main Scripts #
922  #################################################  #################################################
923    
924  run_install_normal()  run_install_normal()
# Line 743  run_install_normal() Line 931  run_install_normal()
931   install_mount_rootfs   install_mount_rootfs
932   (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
933    
  dialog_install_bootsector  
  install_bootsector_chroot  
   
934   dialog_install_settings   dialog_install_settings
935   sleep 1   sleep 1
936   install_system_settings   install_system_settings
937   install_initrd_chroot   install_initrd_chroot
938    
939     dialog_install_bootsector
940     install_bootsector_chroot
941    
942   install_umount_rootfs   install_umount_rootfs
943   dialog_install_successful   dialog_install_successful
944  }  }
945    
946  run_install_flash()  run_install_simple()
947  {  {
948   dialog_hardware_detection   dialog_hardware_detection
949    
950   dialog_setup_hdd_partitions_manuell_flash   dialog_setup_hdd_partitions_manuell_simple
951   dialog_setup_hdd_format   dialog_setup_hdd_format
952   setup_hdd_format_flash > /dev/null   setup_hdd_format_simple > /dev/null
953   install_mount_rootfs_flash   install_mount_rootfs_simple
954   (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
955    
  dialog_install_bootsector  
  install_bootsector_chroot  
   
956   dialog_install_settings   dialog_install_settings
957   sleep 1   sleep 1
958   install_system_settings_flash   install_system_settings_simple
959   install_initrd_chroot   install_initrd_chroot
960   install_umount_rootfs_flash  
961     dialog_install_bootsector
962     install_bootsector_chroot
963    
964     install_umount_rootfs_simple
965   dialog_install_successful   dialog_install_successful
966  }  }
967    
# Line 781  run_install_auto() Line 971  run_install_auto()
971    
972   dialog_setup_hdd_partitions_auto   dialog_setup_hdd_partitions_auto
973   dialog_setup_hdd_format   dialog_setup_hdd_format
974   setup_hdd_format_flash > /dev/null   setup_hdd_format_simple > /dev/null
975   install_mount_rootfs_flash   install_mount_rootfs_simple
976   (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
977    
  dialog_install_bootsector  
  install_bootsector_chroot  
   
978   dialog_install_settings   dialog_install_settings
979   sleep 1   sleep 1
980   install_system_settings_flash   install_system_settings_simple
981   install_initrd_chroot   install_initrd_chroot
982   install_umount_rootfs_flash  
983     dialog_install_bootsector
984     install_bootsector_chroot
985    
986     install_umount_rootfs_simple
987   dialog_install_successful   dialog_install_successful
988  }  }
989    

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