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 6824 by niro, Thu Jul 23 09:33:29 2015 UTC revision 6825 by niro, Thu Jul 23 10:50:11 2015 UTC
# Line 16  source ${MLIBDIR}/functions/hwdetection. Line 16  source ${MLIBDIR}/functions/hwdetection.
16  VERSION="@@VERSION@@"  VERSION="@@VERSION@@"
17  TITLE="alxinstall-ng - ${VERSION}"  TITLE="alxinstall-ng - ${VERSION}"
18    
19    # locations
20  CDPATH="/mnt/cdrom"  CDPATH="/mnt/cdrom"
21  INSTALLPATH="/mnt/magellan"  INSTALLPATH="/mnt/magellan"
22    
23  ### linecount of system.tar.gz -1 !  # default system settings
 CURRENTLINE=0  
 #TOTALLINES=11072 # -> now in images.conf  
   
24  # standard kernel opts  # standard kernel opts
25  KERNELOPTS="quiet video=1024x768"  DEFAULT_KERNELOPTS="quiet video=1024x768"
26    
27  # grub options  # grub options
28  GRUBLEGACYOPTS=""  DEFAULT_GRUBLEGACYOPTS=""
29  GRUB2OPTS=""  DEFAULT_GRUB2OPTS=""
30  GRUB2GFXPAYLOAD="1024x768x16,1024x768"  DEFAULT_GRUB2GFXPAYLOAD="1024x768x16,1024x768"
   
 # fdisk options  
 FDISKPARTIONBELOW256MB=0  
31    
32  # default specialdevices  # default specialdevices
33  SPECIALDEVICE=""  DEFAULT_FORMFACTOR="desktop"
 FORMFACTOR="desktop"  
34    
35  # target filesystem  # target filesystem
36  FORMAT_FILESYSTEM="ext4"  DEFAULT_FORMAT_FILESYSTEM="ext4"
37    
38    # initialize global variables so they are exportable
39    INSTALL_METHOD=""
40    KERNELOPTS=""
41    GRUBLEGACYOPTS=""
42    GRUB2OPTS=""
43    GRUB2GFXPAYLOAD=""
44    FORMFACTOR=""
45    FORMAT_FILESYSTEM=""
46    FDISKPARTIONBELOW256MB=0
47    SPECIALDEVICE=""
48    ### linecount of system.tar.gz -1 !
49    CURRENTLINE=0
50    #TOTALLINES=11072 # -> now in images.conf
51    
52  #################################################  #################################################
53  #  DIALOG BOXES #  #  DIALOG BOXES #
# Line 136  dialog_setup_system_menu() Line 144  dialog_setup_system_menu()
144   if [[ ${RES} -eq 0 ]]   if [[ ${RES} -eq 0 ]]
145   then   then
146   case "${i}" in   case "${i}" in
147   "1") run_install_auto ;;   "1") run_install auto ;;
148   "2") run_install_normal ;;   "2") run_install normal ;;
149   "3") run_install_single ;;   "3") run_install single ;;
150   "") dialog_setup_system_menu;;   "") dialog_setup_system_menu;;
151   esac   esac
152   fi   fi
# Line 594  EOF Line 602  EOF
602    
603  setup_hdd_partitions_manuell()  setup_hdd_partitions_manuell()
604  {  {
605   BOOTHDD="${HDD}1"   case "${INSTALL_METHOD}" in
606   SWAPHDD="${HDD}2"   normal)
607   ROOTHDD="${HDD}3"   BOOTHDD="${HDD}1"
608     SWAPHDD="${HDD}2"
609   ## hdds partitionieren manuell   ROOTHDD="${HDD}3"
610   cfdisk ${HDD} || die   ;;
611  }  
612     single|auto)
613  setup_hdd_partitions_manuell_single()   ROOTHDD="${HDD}1"
614  {   ;;
615   ROOTHDD="${HDD}1"   esac
616    
617   ## hdds partitionieren manuell   ## hdds partitionieren manuell
618   cfdisk ${HDD} || die   cfdisk ${HDD} || die
# Line 612  setup_hdd_partitions_manuell_single() Line 620  setup_hdd_partitions_manuell_single()
620    
621  setup_hdd_format()  setup_hdd_format()
622  {  {
623   mkswap ${SWAPHDD} || die   if [[ -n ${SWAPHDD} ]]
624   mke2fs -j -q ${BOOTHDD} || die   then
625   mke2fs -j -q ${ROOTHDD} || die   mkswap ${SWAPHDD} || die
626  }   fi
627     if [[ -n ${BOOTHDD} ]]
628  setup_hdd_format_single()   then
629  {   mke2fs -j -q ${BOOTHDD} || die
630   mke2fs -j -q ${ROOTHDD} || die   fi
631     if [[ -n ${ROOTHDD} ]]
632     then
633     mke2fs -j -q ${ROOTHDD} || die
634     fi
635  }  }
636    
637  install_mount_rootfs()  install_mount_rootfs()
638  {  {
639   swapon ${SWAPHDD} || die   if [[ -n ${SWAPHDD} ]]
640   mount ${ROOTHDD} ${INSTALLPATH} || die   then
641   install -d ${INSTALLPATH}/boot || die   swapon ${SWAPHDD} || die
642   mount ${BOOTHDD} ${INSTALLPATH}/boot || die   fi
643   cd ${INSTALLPATH} || die   if [[ -n ${ROOTHDD} ]]
644  }   then
645     mount ${ROOTHDD} ${INSTALLPATH} || die
646     fi
647     if [[ -n ${BOOTHDD} ]]
648     then
649     install -d ${INSTALLPATH}/boot || die
650     mount ${BOOTHDD} ${INSTALLPATH}/boot || die
651     fi
652    
 install_mount_rootfs_single()  
 {  
  mount ${ROOTHDD} ${INSTALLPATH} || die  
  install -d ${INSTALLPATH}/boot || die  
653   cd ${INSTALLPATH} || die   cd ${INSTALLPATH} || die
654  }  }
655    
# Line 855  install_system_settings() Line 870  install_system_settings()
870   # schreibe fstab   # schreibe fstab
871   if is_uuid_supported   if is_uuid_supported
872   then   then
873   echo -e "UUID=$(get_uuid ${BOOTHDD})\t/boot\t${FORMAT_FILESYSTEM}\tnoatime,noauto\t1 1" > ${INSTALLPATH}/etc/fstab || die   if [[ -n ${BOOTHDD} ]]
874   echo -e "UUID=$(get_uuid ${ROOTHDD})\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" >> ${INSTALLPATH}/etc/fstab || die   then
875     echo -e "UUID=$(get_uuid ${BOOTHDD})\t/boot\t${FORMAT_FILESYSTEM}\tnoatime,noauto\t1 1" > ${INSTALLPATH}/etc/fstab || die
876     fi
877     if [[ -n ${ROOTHDD} ]]
878     then
879     echo -e "UUID=$(get_uuid ${ROOTHDD})\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" >> ${INSTALLPATH}/etc/fstab || die
880     fi
881   else   else
882   echo -e "${BOOTHDD}\t/boot\t${FORMAT_FILESYSTEM}\tnoatime,noauto\t1 1" > ${INSTALLPATH}/etc/fstab || die   if [[ -n ${BOOTHDD} ]]
883   echo -e "${ROOTHDD}\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" >> ${INSTALLPATH}/etc/fstab || die   then
884     echo -e "${BOOTHDD}\t/boot\t${FORMAT_FILESYSTEM}\tnoatime,noauto\t1 1" > ${INSTALLPATH}/etc/fstab || die
885     fi
886     if [[ -n ${ROOTHDD} ]]
887     then
888     echo -e "${ROOTHDD}\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" >> ${INSTALLPATH}/etc/fstab || die
889     fi
890   fi   fi
891   # 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
892   #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 883  install_system_settings() Line 910  install_system_settings()
910   fi   fi
911  }  }
912    
 install_system_settings_single()  
 {  
  # write fstab  
  if is_uuid_supported  
  then  
  echo -e "UUID=$(get_uuid ${ROOTHDD})\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" > ${INSTALLPATH}/etc/fstab || die  
  else  
  echo -e "${ROOTHDD}\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" > ${INSTALLPATH}/etc/fstab || die  
  fi  
  echo -e "proc\t/proc\tproc\tdefaults\t0 0" >> ${INSTALLPATH}/etc/fstab || die  
  echo -e "shm\t/dev/shm\ttmpfs\tdefaults\t0 0" >> ${INSTALLPATH}/etc/fstab || die  
 }  
   
913  install_umount_rootfs()  install_umount_rootfs()
914  {  {
915   cd /   cd /
916   umount ${INSTALLPATH}/boot || die   if [[ -n ${BOOTHDD} ]]
917   umount ${INSTALLPATH} || die   then
918   swapoff ${SWAPHDD} || die   umount ${INSTALLPATH}/boot || die
919  }   fi
920     if [[ -n ${ROOTHDD} ]]
921  install_umount_rootfs_single()   then
922  {   umount ${INSTALLPATH} || die
923   cd /   fi
924   umount ${INSTALLPATH} || die   if [[ -n ${SWAPHDD} ]]
925     then
926     swapoff ${SWAPHDD} || die
927     fi
928  }  }
929    
930  install_do_reboot()  install_do_reboot()
# Line 919  install_do_reboot() Line 936  install_do_reboot()
936  #     Install Main Scripts #  #     Install Main Scripts #
937  #################################################  #################################################
938    
939  run_install_normal()  run_install()
940  {  {
941     local method="$1"
942    
943     # setup install environment
944     export KERNELOPTS="${DEFAULT_KERNELOPTS}"
945     export GRUBLEGACYOPTS="${GRUBLEGACYOPTS}"
946     export GRUB2OPTS="${GRUB2OPTS}"
947     export GRUB2GFXPAYLOAD="${DEFAULT_GRUB2GFXPAYLOAD}"
948     export FORMFACTOR="${DEFAULT_FORMFACTOR}"
949     export FORMAT_FILESYSTEM="${DEFAULT_FORMAT_FILESYSTEM}"
950    
951     case "${method}" in
952     auto)
953     export INSTALL_METHOD="${method}"
954     ;;
955     normal)
956     export INSTALL_METHOD="${method}"
957     ;;
958     single)
959     export INSTALL_METHOD="${method}"
960     ;;
961     *)
962     echo "Unknown install method '${method}', aborting."
963     exit 1
964     ;;
965     esac
966    
967   dialog_hardware_detection   dialog_hardware_detection
968    
969   dialog_setup_hdd_partitions_manuell   case "${INSTALL_METHOD}" in
970     auto) dialog_setup_hdd_partitions_auto ;;
971     *) dialog_setup_hdd_partitions_manuell ;;
972     esac
973   dialog_setup_hdd_format   dialog_setup_hdd_format
974   setup_hdd_format > /dev/null   setup_hdd_format > /dev/null
975   install_mount_rootfs   install_mount_rootfs
# Line 941  run_install_normal() Line 987  run_install_normal()
987   dialog_install_successful   dialog_install_successful
988  }  }
989    
 run_install_single()  
 {  
  dialog_hardware_detection  
   
  dialog_setup_hdd_partitions_manuell_single  
  dialog_setup_hdd_format  
  setup_hdd_format_single > /dev/null  
  install_mount_rootfs_single  
  (install_system_image > /tmp/install.log) 2> /tmp/install_errors.log | dialog_install_meter | dialog_install_system_image  
   
  dialog_install_settings  
  sleep 1  
  install_system_settings_single  
  install_initrd_chroot  
   
  dialog_install_bootsector  
  install_bootsector_chroot  
   
  install_umount_rootfs_single  
  dialog_install_successful  
 }  
   
 run_install_auto()  
 {  
  dialog_hardware_detection  
   
  dialog_setup_hdd_partitions_auto  
  dialog_setup_hdd_format  
  setup_hdd_format_single > /dev/null  
  install_mount_rootfs_single  
  (install_system_image > /tmp/install.log) 2> /tmp/install_errors.log | dialog_install_meter | dialog_install_system_image  
   
  dialog_install_settings  
  sleep 1  
  install_system_settings_single  
  install_initrd_chroot  
   
  dialog_install_bootsector  
  install_bootsector_chroot  
   
  install_umount_rootfs_single  
  dialog_install_successful  
 }  
   
990  dialog_main  dialog_main
991    
992  exit 0  exit 0

Legend:
Removed from v.6824  
changed lines
  Added in v.6825