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 6837 by niro, Thu Jul 23 12:49:52 2015 UTC revision 6846 by niro, Thu Jul 23 13:53:55 2015 UTC
# Line 44  GRUB2OPTS="" Line 44  GRUB2OPTS=""
44  GRUB2GFXPAYLOAD=""  GRUB2GFXPAYLOAD=""
45  FORMFACTOR=""  FORMFACTOR=""
46  FORMAT_FILESYSTEM=""  FORMAT_FILESYSTEM=""
47    FORMAT_FILESYSTEM_BOOTHDD=""
48    FORMAT_FILESYSTEM_ROOTHDD=""
49  FDISKPARTIONBELOW256MB=0  FDISKPARTIONBELOW256MB=0
50  SPECIALDEVICE=""  SPECIALDEVICE=""
51  FLASHDISK=0  FLASHDISK=0
# Line 164  dialog_setup_system_menu() Line 166  dialog_setup_system_menu()
166   --ok-label "Weiter" \   --ok-label "Weiter" \
167   --stdout \   --stdout \
168   --colors \   --colors \
169   --menu "\nWaehlen Sie die Installations-Methode" 14 70 5 \   --menu "\nWaehlen Sie die Installations-Methode" 14 70 6 \
170   "1" "Automatisches Setup (Empfohlen)" \   "1" "Automatisches Setup (Empfohlen)" \
171   "" "" \   "" "" \
172   "" "\Z1Experten Modi:\Zn" \   "" "\Z1Experten Modi:\Zn" \
# Line 179  dialog_setup_system_menu() Line 181  dialog_setup_system_menu()
181   "1") run_install auto ;;   "1") run_install auto ;;
182   "2") run_install normal ;;   "2") run_install normal ;;
183   "3") run_install single ;;   "3") run_install single ;;
184   "3") run_install flash ;;   "4") run_install flash ;;
185   "") dialog_setup_system_menu;;   "") dialog_setup_system_menu;;
186   esac   esac
187   fi   fi
# Line 190  dialog_hardware_detection() Line 192  dialog_hardware_detection()
192   local i   local i
193   local hwtmp   local hwtmp
194    
195   if [ -x $(which mktemp &> /dev/null) ]   if [ -x $(type -P mktemp) ]
196   then   then
197   hwtmp="$(mktemp)"   hwtmp="$(mktemp)"
198   else   else
# Line 369  dialog_main() Line 371  dialog_main()
371   --no-cancel \   --no-cancel \
372   --ok-label "Weiter" \   --ok-label "Weiter" \
373   --stdout \   --stdout \
374   --menu "Konfiguration" 14 70 5 \   --menu "Konfiguration" 14 70 6 \
375   "1" "AutoSta_LX installieren" \   "1" "AutoSta_LX installieren" \
376   "2" "Uebersicht gefundener Laufwerke" \   "2" "Uebersicht gefundener Laufwerke" \
377   "3" "Beenden und neustarten" \   "3" "Beenden und neustarten" \
# Line 538  setup_hdd_partitions() Line 540  setup_hdd_partitions()
540   ## delete disk   ## delete disk
541   dd if=/dev/zero of=${HDD} count=1 &> /dev/null || die   dd if=/dev/zero of=${HDD} count=1 &> /dev/null || die
542    
543   if [[ ${FDISKPARTIONBELOW256MB} = 1 ]]   if [[ ${FLASHDISK} = 1 ]]
544   then   then
545   ## setup one bootable partition   if [[ ${FDISKPARTIONBELOW256MB} = 1 ]]
546   #1. n= new disk   then
547   #2. p= primary disk   ## setup one bootable partition
548   #3. 1= first partition   # 1. n= new disk
549   #4. 2= default sector start // small disk needs more space for grub2 mbr sector   # 2. p= primary disk
550   #5. ''= defaul sector end   # 3. 1= first partition
551   #6. a= bootable flag   # 4. 2= default sector start // small disk needs more space for grub2 mbr sector
552   #7. 1= boot flag for partition 1   # 5. ''= defaul sector end
553   #8. w= write/quit   # 6. a= bootable flag
554   fdisk ${HDD} &> /dev/null << EOF   # 7. 1= boot flag for partition 1
555     # 8. n= new disk
556     #10. p= primary disk
557     #11. 2= second partition
558     #12. ''= default sector start
559     #13. ''= defaul sector end
560     #14. w= write/quit
561     fdisk ${HDD} &> /dev/null << EOF
562  n  n
563  p  p
564  1  1
565  2  2
566    +50M
567    a
568    1
569    n
570    p
571    2
572    
573    
574    w
575    EOF
576     else
577     ## setup one bootable partition
578     # 1. n= new disk
579     # 2. p= primary disk
580     # 3. 1= first partition
581     # 4. ''= default sector start
582     # 5. ''= defaul sector end
583     # 6. a= bootable flag
584     # 7. 1= boot flag for partition 1
585     # 8. n= new disk
586     #10. p= primary disk
587     #11. 2= second partition
588     #12. ''= default sector start
589     #13. ''= defaul sector end
590     #14. w= write/quit
591     fdisk ${HDD} &> /dev/null << EOF
592    n
593    p
594    1
595    
596    +50M
597  a  a
598  1  1
599    n
600    p
601    2
602    
603    
604  w  w
605  EOF  EOF
606     fi
607   else   else
608   ## setup one bootable partition   if [[ ${FDISKPARTIONBELOW256MB} = 1 ]]
609   #1. n= new disk   then
610   #2. p= primary disk   ## setup one bootable partition
611   #3. 1= first partition   #1. n= new disk
612   #4. ''= default sector start   #2. p= primary disk
613   #5. ''= defaul sector end   #3. 1= first partition
614   #6. a= bootable flag   #4. 2= default sector start // small disk needs more space for grub2 mbr sector
615   #7. 1= boot flag for partition 1   #5. ''= defaul sector end
616   #8. w= write/quit   #6. a= bootable flag
617   fdisk ${HDD} &> /dev/null << EOF   #7. 1= boot flag for partition 1
618     #8. w= write/quit
619     fdisk ${HDD} &> /dev/null << EOF
620    n
621    p
622    1
623    2
624    
625    a
626    1
627    w
628    EOF
629     else
630     ## setup one bootable partition
631     #1. n= new disk
632     #2. p= primary disk
633     #3. 1= first partition
634     #4. ''= default sector start
635     #5. ''= defaul sector end
636     #6. a= bootable flag
637     #7. 1= boot flag for partition 1
638     #8. w= write/quit
639     fdisk ${HDD} &> /dev/null << EOF
640  n  n
641  p  p
642  1  1
# Line 579  a Line 646  a
646  1  1
647  w  w
648  EOF  EOF
649     fi
650   fi   fi
651   else   else
652   ## hdds partitionieren manuell   ## hdds partitionieren manuell
# Line 588  EOF Line 656  EOF
656    
657  setup_hdd_format()  setup_hdd_format()
658  {  {
659     install -d /tmp
660     :> /tmp/format.log
661    
662   if [[ -n ${SWAPHDD} ]]   if [[ -n ${SWAPHDD} ]]
663   then   then
664   mkswap ${SWAPHDD} || die   mkswap ${SWAPHDD} || die
665   fi   fi
666   if [[ -n ${BOOTHDD} ]]   if [[ -n ${BOOTHDD} ]]
667   then   then
668   # f2fs is not grub/grub2 compatible   mkfs.${FORMAT_FILESYSTEM_BOOTHDD} ${BOOTHDD} &> /tmp/format.log || die
  if [[ ${FORMAT_FILESYSTEM} = f2fs ]]  
  then  
  mkfs.ext2 -q ${BOOTHDD} || die  
  else  
  mkfs.${FORMAT_FILESYSTEM} -q ${BOOTHDD} || die  
  fi  
669   fi   fi
670   if [[ -n ${ROOTHDD} ]]   if [[ -n ${ROOTHDD} ]]
671   then   then
672   mkfs.${FORMAT_FILESYSTEM} -q ${ROOTHDD} || die   mkfs.${FORMAT_FILESYSTEM_ROOTHDD} ${ROOTHDD} &> /tmp/format.log || die
673   fi   fi
674  }  }
675    
# Line 618  install_mount_rootfs() Line 683  install_mount_rootfs()
683   fi   fi
684   if [[ -n ${ROOTHDD} ]]   if [[ -n ${ROOTHDD} ]]
685   then   then
686   # be safe here, append file system type to mount   mount -t ${FORMAT_FILESYSTEM_ROOTHDD} ${ROOTHDD} ${INSTALL_ROOT} || die
  # just in case the f2fs module was not autoloaded  
  [[ ${FORMAT_FILESYSTEM} = f2fs ]] && opts="-t fs2fs"  
  mount ${opts} ${ROOTHDD} ${INSTALL_ROOT} || die  
687   fi   fi
688   if [[ -n ${BOOTHDD} ]]   if [[ -n ${BOOTHDD} ]]
689   then   then
690   install -d ${INSTALL_ROOT}/boot || die   install -d ${INSTALL_ROOT}/boot || die
691   mount ${BOOTHDD} ${INSTALL_ROOT}/boot || die   mount -t ${FORMAT_FILESYSTEM_BOOTHDD} ${BOOTHDD} ${INSTALL_ROOT}/boot || die
692   fi   fi
693    
694   cd ${INSTALL_ROOT} || die   cd ${INSTALL_ROOT} || die
# Line 659  install_bootsector_chroot() Line 721  install_bootsector_chroot()
721   sed -i "s:^\(export GRUB_CMDLINE_LINUX_DEFAULT=\).*:\1\"${KERNELOPTS}\":" ${INSTALL_ROOT}/etc/conf.d/grub || die   sed -i "s:^\(export GRUB_CMDLINE_LINUX_DEFAULT=\).*:\1\"${KERNELOPTS}\":" ${INSTALL_ROOT}/etc/conf.d/grub || die
722   sed -i "s:^\(export GRUB_GFXPAYLOAD_LINUX=\).*:\1\"${GRUB2GFXPAYLOAD}\":" ${INSTALL_ROOT}/etc/conf.d/grub || die   sed -i "s:^\(export GRUB_GFXPAYLOAD_LINUX=\).*:\1\"${GRUB2GFXPAYLOAD}\":" ${INSTALL_ROOT}/etc/conf.d/grub || die
723   else   else
724   echo "export GRUB_CMDLINE_LINUX_DEFAULT=\"${KERNELOPTS}\"" >  ${INSTALL_ROOT}/etc/conf.d/grub || die   CONFIG=${INSTALL_ROOT}/etc/conf.d/grub
725   echo "export GRUB_GFXPAYLOAD_LINUX=\"${GRUB2GFXPAYLOAD}\"" >>  ${INSTALL_ROOT}/etc/conf.d/grub || die   clearconfig
726     addconfig "export GRUB_CMDLINE_LINUX_DEFAULT=\"${KERNELOPTS}\""
727     addconfig "export GRUB_GFXPAYLOAD_LINUX=\"${GRUB2GFXPAYLOAD}\""
728   fi   fi
729   CONFIG=${INSTALL_ROOT}/.installrc   CONFIG=${INSTALL_ROOT}/.installrc
730   clearconfig   clearconfig
# Line 759  install_initrd_chroot() Line 823  install_initrd_chroot()
823   # only generate initrds if the cmd exists   # only generate initrds if the cmd exists
824   is_initrd_supported || return 0   is_initrd_supported || return 0
825    
826   FSMODS="${FORMAT_FILESYSTEM}"   FSMODS="${FORMAT_FILESYSTEM_BOOTHDD} ${FORMAT_FILESYSTEM_ROOTHDD}"
827   DISKMODS="sd_mod"   DISKMODS="sd_mod"
828   OLDPATAMODS="amd74xx piix sis5513 via82cxxx"   OLDPATAMODS="amd74xx piix sis5513 via82cxxx"
829   PATAMODS="ata_piix pata_amd pata_mpiix pata_oldpiix pata_sis pata_via"   PATAMODS="ata_piix pata_amd pata_mpiix pata_oldpiix pata_sis pata_via"
# Line 776  install_initrd_chroot() Line 840  install_initrd_chroot()
840   *) FBMODS="uvesafb" ;;   *) FBMODS="uvesafb" ;;
841   esac   esac
842    
  # add a filesystems recoqnized by the bootloader if the current ${FORMAT_FILESYSTEM} is not supported  
  case "${FORMAT_FILESYSTEM}" in  
  f2fs) FSMODS+=" ext2" ;;  
  esac  
   
843   if [[ ${FORMFACTOR} = laptop ]]   if [[ ${FORMFACTOR} = laptop ]]
844   then   then
845   OTHERMODS="acpi-cpufreq cpufreq_ondemand cpufreq_conservative cpufreq_powersave"   OTHERMODS="acpi-cpufreq cpufreq_ondemand cpufreq_conservative cpufreq_powersave"
# Line 816  is_uuid_supported() Line 875  is_uuid_supported()
875   # use the blkid from util-linux instead of busybox   # use the blkid from util-linux instead of busybox
876   if [[ ${FORMAT_FILESYSTEM} = f2fs ]]   if [[ ${FORMAT_FILESYSTEM} = f2fs ]]
877   then   then
878   if [[ -x $(which blkid &> /dev/null) ]]   if [[ -x $(type -P blkid) ]]
879   then   then
880   return 0   return 0
881   fi   fi
882   else   else
883   if [[ -x $(which busybox.mkinitrd &> /dev/null) ]]   if [[ -x $(type -P busybox.mkinitrd) ]]
884   then   then
885   # only detect uuids if supported   # only detect uuids if supported
886   if [[ ! -z $(busybox.mkinitrd | grep blkid) ]]   if [[ ! -z $(busybox.mkinitrd | grep blkid) ]]
# Line 864  get_uuid() Line 923  get_uuid()
923    
924  install_system_settings()  install_system_settings()
925  {  {
926   # schreibe fstab   local CONFIG
927   if is_uuid_supported   local fstype
928    
929     # write fstab
930     CONFIG=${INSTALL_ROOT}/etc/fstab
931     clearconfig
932    
933     if [[ -n ${BOOTHDD} ]]
934   then   then
935   if [[ -n ${BOOTHDD} ]]   if is_uuid_supported
  then  
  echo -e "UUID=$(get_uuid ${BOOTHDD})\t/boot\t${FORMAT_FILESYSTEM}\tnoatime,noauto\t1 1" > ${INSTALL_ROOT}/etc/fstab || die  
  fi  
  if [[ -n ${ROOTHDD} ]]  
  then  
  echo -e "UUID=$(get_uuid ${ROOTHDD})\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" >> ${INSTALL_ROOT}/etc/fstab || die  
  fi  
  else  
  if [[ -n ${BOOTHDD} ]]  
936   then   then
937   echo -e "${BOOTHDD}\t/boot\t${FORMAT_FILESYSTEM}\tnoatime,noauto\t1 1" > ${INSTALL_ROOT}/etc/fstab || die   addconfig -e "UUID=$(get_uuid ${BOOTHDD})\t/boot\t${FORMAT_FILESYSTEM_BOOTHDD}\tnoatime,noauto\t1 1"
938     else
939     addconfig -e "${BOOTHDD}\t/boot\t${FORMAT_FILESYSTEM_BOOTHDD}\tnoatime,noauto\t1 1"
940   fi   fi
941   if [[ -n ${ROOTHDD} ]]   fi
942    
943     if [[ -n ${ROOTHDD} ]]
944     then
945     if is_uuid_supported
946   then   then
947   echo -e "${ROOTHDD}\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" >> ${INSTALL_ROOT}/etc/fstab || die   addconfig -e "UUID=$(get_uuid ${ROOTHDD})\t/\t${FORMAT_FILESYSTEM_ROOTHDD}\tnoatime\t0 0"
948     else
949     addconfig -e "${ROOTHDD}\t/\t${FORMAT_FILESYSTEM_ROOTHDD}\tnoatime\t0 0"
950   fi   fi
951   fi   fi
952    
953   # 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
954   #echo -e "UUID='$(get_uuid ${SWAPHDD})'\tswap\tswap\tpri=1\t0 0" >> ${INSTALL_ROOT}/etc/fstab || die   #addconfig -e "UUID='$(get_uuid ${SWAPHDD})'\tswap\tswap\tpri=1\t0 0"
955   echo -e "proc\t/proc\tproc\tdefaults\t0 0" >> ${INSTALL_ROOT}/etc/fstab || die   addconfig -e "proc\t/proc\tproc\tdefaults\t0 0"
956   echo -e "shm\t/dev/shm\ttmpfs\tdefaults\t0 0" >> ${INSTALL_ROOT}/etc/fstab || die   addconfig -e "shm\t/dev/shm\ttmpfs\tdefaults\t0 0"
957    
958   # install network config skeleton   # install network config skeleton
959   install -m0644 ${INSTALL_ROOT}/etc/alxconfig-ng/skel/net/net.eth0 ${INSTALL_ROOT}/etc/conf.d/ || die   install -m0644 ${INSTALL_ROOT}/etc/alxconfig-ng/skel/net/net.eth0 ${INSTALL_ROOT}/etc/conf.d/ || die
# Line 947  run_install() Line 1012  run_install()
1012    
1013   case "${method}" in   case "${method}" in
1014   auto)   auto)
1015     if [[ ${FLASHDISK} = 1 ]]
1016     then
1017     export FORMAT_FILESYSTEM="f2fs"
1018     export FORMAT_FILESYSTEM_BOOTHDD="ext2"
1019     export FORMAT_FILESYSTEM_ROOTHDD="${FORMAT_FILESYSTEM}"
1020     else
1021     export FORMAT_FILESYSTEM_BOOTHDD=""
1022     export FORMAT_FILESYSTEM_ROOTHDD="${FORMAT_FILESYSTEM}"
1023     fi
1024   export INSTALL_METHOD="${method}"   export INSTALL_METHOD="${method}"
1025   ;;   ;;
1026   normal)   normal)
1027     export FORMAT_FILESYSTEM_BOOTHDD="${FORMAT_FILESYSTEM}"
1028     export FORMAT_FILESYSTEM_ROOTHDD="${FORMAT_FILESYSTEM}"
1029   export INSTALL_METHOD="${method}"   export INSTALL_METHOD="${method}"
1030   ;;   ;;
1031   single)   single)
1032     export FORMAT_FILESYSTEM_BOOTHDD=""
1033     export FORMAT_FILESYSTEM_ROOTHDD="${FORMAT_FILESYSTEM}"
1034   export INSTALL_METHOD="${method}"   export INSTALL_METHOD="${method}"
1035   ;;   ;;
1036   flash)   flash)
1037   export FORMAT_FILESYSTEM="f2fs"   export FORMAT_FILESYSTEM="f2fs"
1038     export FORMAT_FILESYSTEM_BOOTHDD="ext2"
1039     export FORMAT_FILESYSTEM_ROOTHDD="${FORMAT_FILESYSTEM}"
1040   export INSTALL_METHOD="${method}"   export INSTALL_METHOD="${method}"
1041   ;;   ;;
1042   *)   *)
1043   echo "Unknown install method '${method}', aborting."   die "Unknown install method '${method}', aborting."
  exit 1  
1044   ;;   ;;
1045   esac   esac
1046    

Legend:
Removed from v.6837  
changed lines
  Added in v.6846