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 1574 by niro, Mon Oct 18 11:46:02 2010 UTC alx-src/trunk/alxinstall-ng/bin/alxinstall-ng.sh.in revision 2573 by niro, Mon Jul 4 21:24:46 2011 UTC
# Line 21  cdromdev="$(echo ${cdromdev} | sed 's/ / Line 21  cdromdev="$(echo ${cdromdev} | sed 's/ /
21  ########################################  ########################################
22    
23  ### System/Config Version  ### System/Config Version
24  VERSION="0.3.5"  VERSION="%VERSIONTAG%"
25  TITLE="alxinstall-ng - ${VERSION}"  TITLE="alxinstall-ng - ${VERSION}"
26    
27  CDPATH="/mnt/cdrom"  CDPATH="/mnt/cdrom"
# Line 31  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  # standart kernel opts  # standard kernel opts
35  KERNELOPTS="quiet"  KERNELOPTS="quiet video=1024x768"
36    
37  # default specialdevices  # default specialdevices
38  SPECIALDEVICE=""  SPECIALDEVICE=""
39    
40    # target filesystem
41    FORMAT_FILESYSTEM="ext4"
42    
43  #################################################  #################################################
44  #  DIALOG BOXEN #  #  DIALOG BOXEN #
45  #################################################  #################################################
# Line 120  dialog_setup_system_menu() Line 123  dialog_setup_system_menu()
123   --cancel-label "Abbrechen" \   --cancel-label "Abbrechen" \
124   --ok-label "Weiter" \   --ok-label "Weiter" \
125   --stdout \   --stdout \
126     --colors \
127   --menu "\nWaehlen Sie die Installations-Methode" 14 70 5 \   --menu "\nWaehlen Sie die Installations-Methode" 14 70 5 \
128   "1" "Automatisches Setup" \   "1" "Automatisches Setup (Empfohlen)" \
129   "2" "Normale IDE-Disk (manuell)" \   "" "" \
130   "3" "Flash-Speicher (manuell)")   "" "\Z1Experten Modi:\Zn" \
131     "2" "Normale IDE-Disk (Manuell)" \
132     "3" "Flash-Speicher (Manuell)")
133   RES=$?   RES=$?
134   [[ ${RES} -eq 1 ]] && return 1   [[ ${RES} -eq 1 ]] && return 1
135   if [[ ${RES} -eq 0 ]]   if [[ ${RES} -eq 0 ]]
# Line 132  dialog_setup_system_menu() Line 138  dialog_setup_system_menu()
138   "1") run_install_auto ;;   "1") run_install_auto ;;
139           "2") run_install_normal ;;           "2") run_install_normal ;;
140   "3") run_install_flash ;;   "3") run_install_flash ;;
141     "") dialog_setup_system_menu;;
142   esac   esac
143   fi   fi
144  }  }
# Line 427  run_hardware_detection() Line 434  run_hardware_detection()
434   # check for special devices/clients:   # check for special devices/clients:
435   # 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
436   local removable=0   local removable=0
437   if [[ ! -z $(lspci -v | grep -i zotac) ]]   if [[ ! -z $(hwinfo --bios --storage | grep -i zotac) ]]
438   then   then
439   for i in /sys/block/[hs]d*/removable   for i in /sys/block/[hs]d*/removable
440   do   do
# Line 524  install_system_image() Line 531  install_system_image()
531  install_bootsector_chroot()  install_bootsector_chroot()
532  {  {
533   local my_roothdd   local my_roothdd
534     local grubconf=${INSTALLPATH}/boot/grub/grub.conf
535     local grub2conf=/boot/grub/grub.cfg
536    
537   ### grubconf schreiben   # check for grub2
538   source ${INSTALLPATH}/boot/kernelversion   if [[ -f ${INSTALLPATH}/sbin/grub-mkconfig ]]
   
  #for alx only  
  if [ -e ${INSTALLPATH}/etc/alx_version ]  
539   then   then
540   OLD_ALXVER="${ALXVER}"   # needed by grub-mkconfig on the first run
541   source ${INSTALLPATH}/etc/alx_version   if [[ ! -f ${INSTALLPATH}/boot/grub/video.lst ]]
542   KRNVER="ALX-${ALXVER}"   then
543   ALXVER="${OLD_ALXVER}"   install -m0644 ${INSTALLPATH}/lib/grub/*/video.lst ${INSTALLPATH}/boot/grub/video.lst || die
544   fi   fi
545    
546   [[ -z ${KRNVER} ]] && KRNVER="AutoSta_LX"   # set kernelopts
547   [[ -z ${KRNINITRD} ]] && KRNINITRD="initrd"   if [[ -f ${INSTALLPATH}/etc/conf.d/grub ]]
548   [[ -z ${KRNIMG} ]] && KRNIMG="vmlinuz"   then
549     sed -i "s:^\(export GRUB_CMDLINE_LINUX_DEFAULT=\).*:\1\"${KERNELOPTS}\":" ${INSTALLPATH}/etc/conf.d/grub || die
550     else
551     echo "export GRUB_CMDLINE_LINUX_DEFAULT=\"${KERNELOPTS}\"" >  ${INSTALLPATH}/etc/conf.d/grub || die
552     fi
553     echo 'grub-mkdevicemap' > ${INSTALLPATH}/root/.installrc || die
554     echo "LC_ALL=C grub-mkconfig -o ${grub2conf}  &> /dev/null" >> ${INSTALLPATH}/root/.installrc || die
555     echo "grub-install --no-floppy ${HDD} &> /dev/null" >> ${INSTALLPATH}/root/.installrc || die
556     echo "exit 0" >> ${INSTALLPATH}/root/.installrc || die
557    
558   # uuid support   # grub-legacy
  if is_uuid_supported  
  then  
  my_roothdd="UUID=$(get_uuid ${ROOTHDD})"  
559   else   else
560   my_roothdd="${ROOTHDD}"   ### grubconf schreiben
561   fi   source ${INSTALLPATH}/boot/kernelversion
562    
563   local grubconf=${INSTALLPATH}/boot/grub/grub.conf   #for alx only
564   : > ${grubconf} || die   if [ -e ${INSTALLPATH}/etc/alx_version ]
565   echo "default 0" >> ${grubconf} || die   then
566   echo "timeout 3" >> ${grubconf} || die   OLD_ALXVER="${ALXVER}"
567   # using current root password   source ${INSTALLPATH}/etc/alx_version
568   echo "password --md5 $(cat ${INSTALLPATH}/etc/shadow | grep root | cut -d: -f2)"  >> ${grubconf} || die   KRNVER="ALX-${ALXVER}"
569     ALXVER="${OLD_ALXVER}"
570     fi
571    
572   echo  >> ${grubconf} || die   [[ -z ${KRNVER} ]] && KRNVER="AutoSta_LX"
573   echo "# normal boot" >> ${grubconf} || die   [[ -z ${KRNINITRD} ]] && KRNINITRD="initrd"
574   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  
575    
576   echo >> ${grubconf} || die   # uuid support
577   echo "# admin boot" >> ${grubconf} || die   if is_uuid_supported
578   echo "title ${KRNVER} - Re-run hardware-detection" >> ${grubconf} || die   then
579   echo "lock"  >> ${grubconf} || die   my_roothdd="UUID=$(get_uuid ${ROOTHDD})"
580   echo "root (hd0,0)" >> ${grubconf} || die   else
581   echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} hardware-auto-detection" >> ${grubconf} || die   my_roothdd="${ROOTHDD}"
582   if is_initrd_supported   fi
  then  
  echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die  
  fi  
583    
584   echo >> ${grubconf} || die   : > ${grubconf} || die
585   echo "title ${KRNVER} - Reset *all* local settings" >> ${grubconf} || die   echo "default 0" >> ${grubconf} || die
586   echo "lock"  >> ${grubconf} || die   echo "timeout 3" >> ${grubconf} || die
587   echo "root (hd0,0)" >> ${grubconf} || die   # using current root password
588   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
589   if is_initrd_supported  
590   then   echo  >> ${grubconf} || die
591   echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die   echo "# normal boot" >> ${grubconf} || die
592   fi   echo "title ${KRNVER}" >> ${grubconf} || die
593     echo "root (hd0,0)" >> ${grubconf} || die
594     echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS}" >> ${grubconf} || die
595     if is_initrd_supported
596     then
597     echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die
598     fi
599    
600     echo >> ${grubconf} || die
601     echo "# admin boot" >> ${grubconf} || die
602     echo "title ${KRNVER} - Re-run hardware-detection" >> ${grubconf} || die
603     echo "lock"  >> ${grubconf} || die
604     echo "root (hd0,0)" >> ${grubconf} || die
605     echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} hardware-auto-detection" >> ${grubconf} || die
606     if is_initrd_supported
607     then
608     echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die
609     fi
610    
611     echo >> ${grubconf} || die
612     echo "title ${KRNVER} - Reset *all* local settings" >> ${grubconf} || die
613     echo "lock"  >> ${grubconf} || die
614     echo "root (hd0,0)" >> ${grubconf} || die
615     echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} alx-reset-settings" >> ${grubconf} || die
616     if is_initrd_supported
617     then
618     echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die
619     fi
620    
621   # bootsector schreiben chrooted schreiben (lfs/magellan)   # bootsector schreiben chrooted schreiben (lfs/magellan)
622   cat > ${INSTALLPATH}/root/.bashrc << CHROOTEOF   cat > ${INSTALLPATH}/root/.installrc << CHROOTEOF
623  /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
624  root (hd0,0)  root (hd0,0)
625  setup (hd0)  setup (hd0)
# Line 596  quit Line 627  quit
627  EOF  EOF
628  exit 0  exit 0
629  CHROOTEOF  CHROOTEOF
630     fi
631    
632   ## enters chroot   ## enters chroot
633   mount -t proc proc ${INSTALLPATH}/proc   mount -t proc proc ${INSTALLPATH}/proc
634   mount -t sysfs sysfs ${INSTALLPATH}/sys   mount -t sysfs sysfs ${INSTALLPATH}/sys
635   mount -o bind /dev ${INSTALLPATH}/dev   mount -o bind /dev ${INSTALLPATH}/dev
636   chroot ${INSTALLPATH} /bin/bash --rcfile /root/.bashrc -i   chroot ${INSTALLPATH} /bin/bash --rcfile /root/.installrc -i
637   umount ${INSTALLPATH}/proc   umount ${INSTALLPATH}/proc
638   umount ${INSTALLPATH}/sys   umount ${INSTALLPATH}/sys
639   umount ${INSTALLPATH}/dev   umount ${INSTALLPATH}/dev
640   rm ${INSTALLPATH}/root/.bashrc   rm ${INSTALLPATH}/root/.installrc
641  }  }
642    
643  is_initrd_supported()  is_initrd_supported()
# Line 620  install_initrd_chroot() Line 652  install_initrd_chroot()
652   # only generate initrds if the cmd exists   # only generate initrds if the cmd exists
653   is_initrd_supported || return 0   is_initrd_supported || return 0
654    
655   cat > ${INSTALLPATH}/root/.bashrc << CHROOTEOF   DISKMODS="sd_mod"
656  echo "MODULES=\"ext3 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"
657     PATAMODS="ata_piix pata_amd pata_mpiix pata_oldpiix pata_sis pata_via"
658     SATAMODS="sata_via sata_sis sata_nv"
659     DRMMODS="i915 mga nouveau r128 radeon savage sis tdfx ttm via"
660     FBMODS="uvesafb"
661    
662     # install an appropriate uvesafb.conf
663     install -d ${INSTALLPATH}/etc/modprobe.d || die
664     echo "options uvesafb mode_option=1024x768-32@60 scroll=ywrap" > ${INSTALLPATH}/etc/modprobe.d/uvesafb.conf || die
665    
666     cat > ${INSTALLPATH}/root/.installrc << CHROOTEOF
667    echo "MODULES=\"${FORMAT_FILESYSTEM} ${DISKMODS} ${OLDATAMODS} ${PATAMODS} ${SATAMODS} ${DRMMODS} ${FBMODS}\"" > /etc/conf.d/mkinitrd
668  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
669  exit 0  exit 0
670  CHROOTEOF  CHROOTEOF
# Line 630  CHROOTEOF Line 673  CHROOTEOF
673   mount -t proc proc ${INSTALLPATH}/proc   mount -t proc proc ${INSTALLPATH}/proc
674   mount -t sysfs sysfs ${INSTALLPATH}/sys   mount -t sysfs sysfs ${INSTALLPATH}/sys
675   mount -o bind /dev ${INSTALLPATH}/dev   mount -o bind /dev ${INSTALLPATH}/dev
676   chroot ${INSTALLPATH} /bin/bash --rcfile /root/.bashrc -i   chroot ${INSTALLPATH} /bin/bash --rcfile /root/.installrc -i
677   umount ${INSTALLPATH}/proc   umount ${INSTALLPATH}/proc
678   umount ${INSTALLPATH}/sys   umount ${INSTALLPATH}/sys
679   umount ${INSTALLPATH}/dev   umount ${INSTALLPATH}/dev
680   rm ${INSTALLPATH}/root/.bashrc   rm ${INSTALLPATH}/root/.installrc
681  }  }
682    
683  is_uuid_supported()  is_uuid_supported()
# Line 675  install_system_settings() Line 718  install_system_settings()
718   # schreibe fstab   # schreibe fstab
719   if is_uuid_supported   if is_uuid_supported
720   then   then
721   echo -e "UUID=$(get_uuid ${BOOTHDD})\t/boot\text3\tnoatime,noauto\t1 1" > ${INSTALLPATH}/etc/fstab || die   echo -e "UUID=$(get_uuid ${BOOTHDD})\t/boot\t${FORMAT_FILESYSTEM}\tnoatime,noauto\t1 1" > ${INSTALLPATH}/etc/fstab || die
722   echo -e "UUID=$(get_uuid ${ROOTHDD})\t/\text3\tnoatime\t0 0" >> ${INSTALLPATH}/etc/fstab || die   echo -e "UUID=$(get_uuid ${ROOTHDD})\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" >> ${INSTALLPATH}/etc/fstab || die
723   else   else
724   echo -e "${BOOTHDD}\t/boot\text3\tnoatime,noauto\t1 1" > ${INSTALLPATH}/etc/fstab || die   echo -e "${BOOTHDD}\t/boot\t${FORMAT_FILESYSTEM}\tnoatime,noauto\t1 1" > ${INSTALLPATH}/etc/fstab || die
725   echo -e "${ROOTHDD}\t/\text3\tnoatime\t0 0" >> ${INSTALLPATH}/etc/fstab || die   echo -e "${ROOTHDD}\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" >> ${INSTALLPATH}/etc/fstab || die
726   fi   fi
727   # not needed busybox loads all with swapon -a, even if not mentioned in fstab   # not needed busybox loads all with swapon -a, even if not mentioned in fstab
728   #echo -e "UUID='$(get_uuid ${SWAPHDD})'\tswap\tswap\tpri=1\t0 0" >> ${INSTALLPATH}/etc/fstab || die   #echo -e "UUID='$(get_uuid ${SWAPHDD})'\tswap\tswap\tpri=1\t0 0" >> ${INSTALLPATH}/etc/fstab || die
# Line 695  install_system_settings_flash() Line 738  install_system_settings_flash()
738   # schreibe fstab   # schreibe fstab
739   if is_uuid_supported   if is_uuid_supported
740   then   then
741   echo -e "UUID=$(get_uuid ${ROOTHDD})\t/\text3\tnoatime\t0 0" > ${INSTALLPATH}/etc/fstab || die   echo -e "UUID=$(get_uuid ${ROOTHDD})\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" > ${INSTALLPATH}/etc/fstab || die
742   else   else
743   echo -e "${ROOTHDD}\t/\text3\tnoatime\t0 0" > ${INSTALLPATH}/etc/fstab || die   echo -e "${ROOTHDD}\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" > ${INSTALLPATH}/etc/fstab || die
744   fi   fi
745   echo -e "proc\t/proc\tproc\tdefaults\t0 0" >> ${INSTALLPATH}/etc/fstab || die   echo -e "proc\t/proc\tproc\tdefaults\t0 0" >> ${INSTALLPATH}/etc/fstab || die
746   echo -e "shm\t/dev/shm\ttmpfs\tdefaults\t0 0" >> ${INSTALLPATH}/etc/fstab || die   echo -e "shm\t/dev/shm\ttmpfs\tdefaults\t0 0" >> ${INSTALLPATH}/etc/fstab || die
# Line 736  run_install_normal() Line 779  run_install_normal()
779   install_mount_rootfs   install_mount_rootfs
780   (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
781    
  dialog_install_bootsector  
  install_bootsector_chroot  
   
782   dialog_install_settings   dialog_install_settings
783   sleep 1   sleep 1
784   install_system_settings   install_system_settings
785   install_initrd_chroot   install_initrd_chroot
786    
787     dialog_install_bootsector
788     install_bootsector_chroot
789    
790   install_umount_rootfs   install_umount_rootfs
791   dialog_install_successful   dialog_install_successful
792  }  }
# Line 757  run_install_flash() Line 801  run_install_flash()
801   install_mount_rootfs_flash   install_mount_rootfs_flash
802   (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
803    
  dialog_install_bootsector  
  install_bootsector_chroot  
   
804   dialog_install_settings   dialog_install_settings
805   sleep 1   sleep 1
806   install_system_settings_flash   install_system_settings_flash
807   install_initrd_chroot   install_initrd_chroot
808    
809     dialog_install_bootsector
810     install_bootsector_chroot
811    
812   install_umount_rootfs_flash   install_umount_rootfs_flash
813   dialog_install_successful   dialog_install_successful
814  }  }
# Line 778  run_install_auto() Line 823  run_install_auto()
823   install_mount_rootfs_flash   install_mount_rootfs_flash
824   (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
825    
  dialog_install_bootsector  
  install_bootsector_chroot  
   
826   dialog_install_settings   dialog_install_settings
827   sleep 1   sleep 1
828   install_system_settings_flash   install_system_settings_flash
829   install_initrd_chroot   install_initrd_chroot
830    
831     dialog_install_bootsector
832     install_bootsector_chroot
833    
834   install_umount_rootfs_flash   install_umount_rootfs_flash
835   dialog_install_successful   dialog_install_successful
836  }  }

Legend:
Removed from v.1574  
changed lines
  Added in v.2573