--- alx-src/trunk/alxinstall-ng/bin/alxinstall-ng.sh.in 2015/07/23 12:51:57 6838 +++ alx-src/trunk/alxinstall-ng/bin/alxinstall-ng.sh.in 2015/07/23 13:53:55 6846 @@ -44,6 +44,8 @@ GRUB2GFXPAYLOAD="" FORMFACTOR="" FORMAT_FILESYSTEM="" +FORMAT_FILESYSTEM_BOOTHDD="" +FORMAT_FILESYSTEM_ROOTHDD="" FDISKPARTIONBELOW256MB=0 SPECIALDEVICE="" FLASHDISK=0 @@ -164,7 +166,7 @@ --ok-label "Weiter" \ --stdout \ --colors \ - --menu "\nWaehlen Sie die Installations-Methode" 14 70 5 \ + --menu "\nWaehlen Sie die Installations-Methode" 14 70 6 \ "1" "Automatisches Setup (Empfohlen)" \ "" "" \ "" "\Z1Experten Modi:\Zn" \ @@ -179,7 +181,7 @@ "1") run_install auto ;; "2") run_install normal ;; "3") run_install single ;; - "3") run_install flash ;; + "4") run_install flash ;; "") dialog_setup_system_menu;; esac fi @@ -369,7 +371,7 @@ --no-cancel \ --ok-label "Weiter" \ --stdout \ - --menu "Konfiguration" 14 70 5 \ + --menu "Konfiguration" 14 70 6 \ "1" "AutoSta_LX installieren" \ "2" "Uebersicht gefundener Laufwerke" \ "3" "Beenden und neustarten" \ @@ -538,38 +540,103 @@ ## delete disk dd if=/dev/zero of=${HDD} count=1 &> /dev/null || die - if [[ ${FDISKPARTIONBELOW256MB} = 1 ]] + if [[ ${FLASHDISK} = 1 ]] then - ## setup one bootable partition - #1. n= new disk - #2. p= primary disk - #3. 1= first partition - #4. 2= default sector start // small disk needs more space for grub2 mbr sector - #5. ''= defaul sector end - #6. a= bootable flag - #7. 1= boot flag for partition 1 - #8. w= write/quit - fdisk ${HDD} &> /dev/null << EOF + if [[ ${FDISKPARTIONBELOW256MB} = 1 ]] + then + ## setup one bootable partition + # 1. n= new disk + # 2. p= primary disk + # 3. 1= first partition + # 4. 2= default sector start // small disk needs more space for grub2 mbr sector + # 5. ''= defaul sector end + # 6. a= bootable flag + # 7. 1= boot flag for partition 1 + # 8. n= new disk + #10. p= primary disk + #11. 2= second partition + #12. ''= default sector start + #13. ''= defaul sector end + #14. w= write/quit + fdisk ${HDD} &> /dev/null << EOF n p 1 2 ++50M +a +1 +n +p +2 + + +w +EOF + else + ## setup one bootable partition + # 1. n= new disk + # 2. p= primary disk + # 3. 1= first partition + # 4. ''= default sector start + # 5. ''= defaul sector end + # 6. a= bootable flag + # 7. 1= boot flag for partition 1 + # 8. n= new disk + #10. p= primary disk + #11. 2= second partition + #12. ''= default sector start + #13. ''= defaul sector end + #14. w= write/quit + fdisk ${HDD} &> /dev/null << EOF +n +p +1 ++50M a 1 +n +p +2 + + w EOF + fi else - ## setup one bootable partition - #1. n= new disk - #2. p= primary disk - #3. 1= first partition - #4. ''= default sector start - #5. ''= defaul sector end - #6. a= bootable flag - #7. 1= boot flag for partition 1 - #8. w= write/quit - fdisk ${HDD} &> /dev/null << EOF + if [[ ${FDISKPARTIONBELOW256MB} = 1 ]] + then + ## setup one bootable partition + #1. n= new disk + #2. p= primary disk + #3. 1= first partition + #4. 2= default sector start // small disk needs more space for grub2 mbr sector + #5. ''= defaul sector end + #6. a= bootable flag + #7. 1= boot flag for partition 1 + #8. w= write/quit + fdisk ${HDD} &> /dev/null << EOF +n +p +1 +2 + +a +1 +w +EOF + else + ## setup one bootable partition + #1. n= new disk + #2. p= primary disk + #3. 1= first partition + #4. ''= default sector start + #5. ''= defaul sector end + #6. a= bootable flag + #7. 1= boot flag for partition 1 + #8. w= write/quit + fdisk ${HDD} &> /dev/null << EOF n p 1 @@ -579,6 +646,7 @@ 1 w EOF + fi fi else ## hdds partitionieren manuell @@ -588,23 +656,20 @@ setup_hdd_format() { + install -d /tmp + :> /tmp/format.log + if [[ -n ${SWAPHDD} ]] then mkswap ${SWAPHDD} || die fi if [[ -n ${BOOTHDD} ]] then - # f2fs is not grub/grub2 compatible - if [[ ${FORMAT_FILESYSTEM} = f2fs ]] - then - mkfs.ext2 -q ${BOOTHDD} || die - else - mkfs.${FORMAT_FILESYSTEM} -q ${BOOTHDD} || die - fi + mkfs.${FORMAT_FILESYSTEM_BOOTHDD} ${BOOTHDD} &> /tmp/format.log || die fi if [[ -n ${ROOTHDD} ]] then - mkfs.${FORMAT_FILESYSTEM} -q ${ROOTHDD} || die + mkfs.${FORMAT_FILESYSTEM_ROOTHDD} ${ROOTHDD} &> /tmp/format.log || die fi } @@ -618,15 +683,12 @@ fi if [[ -n ${ROOTHDD} ]] then - # be safe here, append file system type to mount - # just in case the f2fs module was not autoloaded - [[ ${FORMAT_FILESYSTEM} = f2fs ]] && opts="-t fs2fs" - mount ${opts} ${ROOTHDD} ${INSTALL_ROOT} || die + mount -t ${FORMAT_FILESYSTEM_ROOTHDD} ${ROOTHDD} ${INSTALL_ROOT} || die fi if [[ -n ${BOOTHDD} ]] then install -d ${INSTALL_ROOT}/boot || die - mount ${BOOTHDD} ${INSTALL_ROOT}/boot || die + mount -t ${FORMAT_FILESYSTEM_BOOTHDD} ${BOOTHDD} ${INSTALL_ROOT}/boot || die fi cd ${INSTALL_ROOT} || die @@ -659,8 +721,10 @@ sed -i "s:^\(export GRUB_CMDLINE_LINUX_DEFAULT=\).*:\1\"${KERNELOPTS}\":" ${INSTALL_ROOT}/etc/conf.d/grub || die sed -i "s:^\(export GRUB_GFXPAYLOAD_LINUX=\).*:\1\"${GRUB2GFXPAYLOAD}\":" ${INSTALL_ROOT}/etc/conf.d/grub || die else - echo "export GRUB_CMDLINE_LINUX_DEFAULT=\"${KERNELOPTS}\"" > ${INSTALL_ROOT}/etc/conf.d/grub || die - echo "export GRUB_GFXPAYLOAD_LINUX=\"${GRUB2GFXPAYLOAD}\"" >> ${INSTALL_ROOT}/etc/conf.d/grub || die + CONFIG=${INSTALL_ROOT}/etc/conf.d/grub + clearconfig + addconfig "export GRUB_CMDLINE_LINUX_DEFAULT=\"${KERNELOPTS}\"" + addconfig "export GRUB_GFXPAYLOAD_LINUX=\"${GRUB2GFXPAYLOAD}\"" fi CONFIG=${INSTALL_ROOT}/.installrc clearconfig @@ -759,7 +823,7 @@ # only generate initrds if the cmd exists is_initrd_supported || return 0 - FSMODS="${FORMAT_FILESYSTEM}" + FSMODS="${FORMAT_FILESYSTEM_BOOTHDD} ${FORMAT_FILESYSTEM_ROOTHDD}" DISKMODS="sd_mod" OLDPATAMODS="amd74xx piix sis5513 via82cxxx" PATAMODS="ata_piix pata_amd pata_mpiix pata_oldpiix pata_sis pata_via" @@ -776,11 +840,6 @@ *) FBMODS="uvesafb" ;; esac - # add a filesystems recoqnized by the bootloader if the current ${FORMAT_FILESYSTEM} is not supported - case "${FORMAT_FILESYSTEM}" in - f2fs) FSMODS+=" ext2" ;; - esac - if [[ ${FORMFACTOR} = laptop ]] then OTHERMODS="acpi-cpufreq cpufreq_ondemand cpufreq_conservative cpufreq_powersave" @@ -864,31 +923,37 @@ install_system_settings() { - # schreibe fstab - if is_uuid_supported + local CONFIG + local fstype + + # write fstab + CONFIG=${INSTALL_ROOT}/etc/fstab + clearconfig + + if [[ -n ${BOOTHDD} ]] then - if [[ -n ${BOOTHDD} ]] - 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} ]] + if is_uuid_supported then - 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" + else + addconfig -e "${BOOTHDD}\t/boot\t${FORMAT_FILESYSTEM_BOOTHDD}\tnoatime,noauto\t1 1" fi - if [[ -n ${ROOTHDD} ]] + fi + + if [[ -n ${ROOTHDD} ]] + then + if is_uuid_supported then - 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" + else + addconfig -e "${ROOTHDD}\t/\t${FORMAT_FILESYSTEM_ROOTHDD}\tnoatime\t0 0" fi fi + # not needed busybox loads all with swapon -a, even if not mentioned in fstab - #echo -e "UUID='$(get_uuid ${SWAPHDD})'\tswap\tswap\tpri=1\t0 0" >> ${INSTALL_ROOT}/etc/fstab || die - echo -e "proc\t/proc\tproc\tdefaults\t0 0" >> ${INSTALL_ROOT}/etc/fstab || die - echo -e "shm\t/dev/shm\ttmpfs\tdefaults\t0 0" >> ${INSTALL_ROOT}/etc/fstab || die + #addconfig -e "UUID='$(get_uuid ${SWAPHDD})'\tswap\tswap\tpri=1\t0 0" + addconfig -e "proc\t/proc\tproc\tdefaults\t0 0" + addconfig -e "shm\t/dev/shm\ttmpfs\tdefaults\t0 0" # install network config skeleton install -m0644 ${INSTALL_ROOT}/etc/alxconfig-ng/skel/net/net.eth0 ${INSTALL_ROOT}/etc/conf.d/ || die @@ -947,21 +1012,35 @@ case "${method}" in auto) + if [[ ${FLASHDISK} = 1 ]] + then + export FORMAT_FILESYSTEM="f2fs" + export FORMAT_FILESYSTEM_BOOTHDD="ext2" + export FORMAT_FILESYSTEM_ROOTHDD="${FORMAT_FILESYSTEM}" + else + export FORMAT_FILESYSTEM_BOOTHDD="" + export FORMAT_FILESYSTEM_ROOTHDD="${FORMAT_FILESYSTEM}" + fi export INSTALL_METHOD="${method}" ;; normal) + export FORMAT_FILESYSTEM_BOOTHDD="${FORMAT_FILESYSTEM}" + export FORMAT_FILESYSTEM_ROOTHDD="${FORMAT_FILESYSTEM}" export INSTALL_METHOD="${method}" ;; single) + export FORMAT_FILESYSTEM_BOOTHDD="" + export FORMAT_FILESYSTEM_ROOTHDD="${FORMAT_FILESYSTEM}" export INSTALL_METHOD="${method}" ;; flash) export FORMAT_FILESYSTEM="f2fs" + export FORMAT_FILESYSTEM_BOOTHDD="ext2" + export FORMAT_FILESYSTEM_ROOTHDD="${FORMAT_FILESYSTEM}" export INSTALL_METHOD="${method}" ;; *) - echo "Unknown install method '${method}', aborting." - exit 1 + die "Unknown install method '${method}', aborting." ;; esac