--- alx-src/trunk/alxinstall-ng/bin/alxinstall-ng.sh.in 2015/07/23 12:28:10 6835 +++ alx-src/trunk/alxinstall-ng/bin/alxinstall-ng.sh.in 2015/07/23 12:49:52 6837 @@ -46,6 +46,7 @@ FORMAT_FILESYSTEM="" FDISKPARTIONBELOW256MB=0 SPECIALDEVICE="" +FLASHDISK=0 ### linecount of system.tar.gz -1 ! CURRENTLINE=0 #TOTALLINES=11072 # -> now in images.conf @@ -90,6 +91,7 @@ ;; normal) dialog_setup_hdd_info_normal ;; single) dialog_setup_hdd_info_single ;; + flash) dialog_setup_hdd_info_flash ;; esac } @@ -123,6 +125,21 @@ Bitte ${SHDD}1 als \Z3bootable\Zn markieren." 12 81 } +dialog_setup_hdd_info_flash() +{ + local SHDD="$(echo ${HDD} | sed 's/\/dev\///')" + + dialog \ + --colors \ + --title "[ Festplatten Partitionierung ]" \ + --backtitle "${TITLE}" \ + --ok-label "Weiter" \ + --msgbox "\nBitte legen Sie 2 Partitionen an.\n\n\ + [ \Z3${SHDD}1\Zn ] Typ: \Z3Linux\Zn mit ca. 50MB\n\ + [ \Z3${SHDD}2\Zn ] Typ: \Z3Linux \Zn mit dem Rest (min. 256MB)\n\n\ + Bitte ${SHDD}1 als \Z3bootable\Zn markieren." 12 81 +} + dialog_setup_hdd_info_auto() { local SHDD="$(echo $HDD | sed 's/\/dev\///')" @@ -152,7 +169,8 @@ "" "" \ "" "\Z1Experten Modi:\Zn" \ "2" "Normale IDE-Disk (Manuell)" \ - "3" "Normale IDE Disk (Single)") + "3" "Normale IDE Disk (Single)" \ + "4" "Flash SDHC/NAND oder USBStick (Manuell)") RES=$? [[ ${RES} -eq 1 ]] && return 1 if [[ ${RES} -eq 0 ]] @@ -161,6 +179,7 @@ "1") run_install auto ;; "2") run_install normal ;; "3") run_install single ;; + "3") run_install flash ;; "") dialog_setup_system_menu;; esac fi @@ -219,6 +238,10 @@ then echo " \n \\ZnFormfactor Laptop, Powersave Modus 'ondemand' wird aktiviert.\\Zn \\" >> ${hwtmp} fi + if [[ ${FLASHDISK} = 1 ]] + then + echo " \n \\ZnFlash Speicher erkannt, F2FS wird als Dateisystem benutzt.\\Zn \\" >> ${hwtmp} + fi echo " \" 14 70" >> ${hwtmp} chmod a+x ${hwtmp} @@ -383,6 +406,8 @@ if [[ $(< ${i}) = 1 ]] then removable=1 + # we assume that all removable disks are flash disks + export FLASHDISK=1 fi done @@ -489,6 +514,12 @@ SWAPHDD="" ROOTHDD="${HDD}1" ;; + + flash) + BOOTHDD="${HDD}1" + SWAPHDD="" + ROOTHDD="${HDD}2" + ;; esac if [[ ${INSTALL_METHOD} = auto ]] @@ -563,7 +594,13 @@ fi if [[ -n ${BOOTHDD} ]] then - mkfs.${FORMAT_FILESYSTEM} -q ${BOOTHDD} || die + # f2fs is not grub/grub2 compatible + if [[ ${FORMAT_FILESYSTEM} = f2fs ]] + then + mkfs.ext2 -q ${BOOTHDD} || die + else + mkfs.${FORMAT_FILESYSTEM} -q ${BOOTHDD} || die + fi fi if [[ -n ${ROOTHDD} ]] then @@ -573,13 +610,18 @@ install_mount_rootfs() { + local opts + if [[ -n ${SWAPHDD} ]] then swapon ${SWAPHDD} || die fi if [[ -n ${ROOTHDD} ]] then - mount ${ROOTHDD} ${INSTALL_ROOT} || die + # 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 fi if [[ -n ${BOOTHDD} ]] then @@ -717,6 +759,7 @@ # only generate initrds if the cmd exists is_initrd_supported || return 0 + FSMODS="${FORMAT_FILESYSTEM}" DISKMODS="sd_mod" OLDPATAMODS="amd74xx piix sis5513 via82cxxx" PATAMODS="ata_piix pata_amd pata_mpiix pata_oldpiix pata_sis pata_via" @@ -733,6 +776,11 @@ *) 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" @@ -755,7 +803,7 @@ CONFIG=${INSTALL_ROOT}/.installrc clearconfig - addconfig 'echo "MODULES=\"${FORMAT_FILESYSTEM} ${DISKMODS} ${OLDATAMODS} ${PATAMODS} ${SATAMODS} ${DRMMODS} ${FBMODS} ${OTHERMODS}\"" > /etc/conf.d/mkinitrd' + addconfig 'echo "MODULES=\"${FSMODS} ${DISKMODS} ${OLDATAMODS} ${PATAMODS} ${SATAMODS} ${DRMMODS} ${FBMODS} ${OTHERMODS}\"" > /etc/conf.d/mkinitrd' addconfig 'mkinitrd -f /boot/$(readlink /boot/initrd) $(readlink /boot/vmlinuz | sed "s:kernel-::g") > /dev/null' addconfig 'exit 0' ## enter chroot @@ -764,12 +812,22 @@ is_uuid_supported() { - if [[ -x $(which busybox.mkinitrd &> /dev/null) ]] + # f2fs needs special treatments as the old busybox does not support this fs + # use the blkid from util-linux instead of busybox + if [[ ${FORMAT_FILESYSTEM} = f2fs ]] then - # only detect uuids if supported - if [[ ! -z $(busybox.mkinitrd | grep blkid) ]] + if [[ -x $(which blkid &> /dev/null) ]] then - return 0 + return 0 + fi + else + if [[ -x $(which busybox.mkinitrd &> /dev/null) ]] + then + # only detect uuids if supported + if [[ ! -z $(busybox.mkinitrd | grep blkid) ]] + then + return 0 + fi fi fi @@ -781,6 +839,7 @@ local UUID local SEC_TYPE local TYPE + local blkidcmd local dev="$1" [[ -z ${dev} ]] && die "no dev given" @@ -790,7 +849,15 @@ then eval "${dev}" else - eval $(busybox.mkinitrd blkid ${dev} | grep "${dev}:" | sed 's/.*:\ //') + # f2fs needs special treatments as the old busybox does not support this fs + # use the blkid from util-linux instead of busybox + if [[ ${FORMAT_FILESYSTEM} = f2fs ]] + then + blkidcmd="blkid" + else + blkidcmd="busybox.mkinitrd blkid" + fi + eval $(${blkidcmd} ${dev} | grep "${dev}:" | sed 's/.*:\ //') fi echo "${UUID}" } @@ -888,6 +955,10 @@ single) export INSTALL_METHOD="${method}" ;; + flash) + export FORMAT_FILESYSTEM="f2fs" + export INSTALL_METHOD="${method}" + ;; *) echo "Unknown install method '${method}', aborting." exit 1