--- old/setup-disk.in +++ new/setup-disk.in @@ -436,16 +436,17 @@ # install needed programs init_progs() { - local raidpkg= + local raidpkg= fs= fstools="e2fsprogs" [ -n "$USE_RAID" ] && raidpkg="mdadm" - case $ROOTFS in - ext*) fstools=e2fsprogs; mkfs_args="-q";; - xfs) fstools=xfsprogs; mkfs_args="-q";; - # we need load btrfs module early to avoid the error message: - # 'failed to open /dev/btrfs-control' - btrfs) fstools=btrfs-progs; mkfs_args=""; modprobe btrfs;; - esac - apk add --quiet sfdisk e2fsprogs lvm2 $raidpkg syslinux $fstools $@ + for fs in $BOOTFS $ROOTFS $VARFS; do + case $fs in + xfs) fstools="$fstools xfsprogs"; modprobe xfs;; + # we need load btrfs module early to avoid the error message: + # 'failed to open /dev/btrfs-control' + btrfs) fstools="$fstools btrfs-progs"; modprobe btrfs;; + esac + done + apk add --quiet sfdisk lvm2 $raidpkg syslinux $fstools $@ } show_disk_info() { @@ -522,7 +523,7 @@ # set up optional raid and create filesystem on boot device. setup_boot_dev() { - local disk= bootdev= + local disk= bootdev= mkfs_args="-q" local part=$(for disk in $@; do find_boot_partition $disk; done) set -- $part bootdev=$1 @@ -540,7 +541,8 @@ --metadata=0.90 --quiet --run $@ $missing || return 1 bootdev=/dev/md0 fi - mkfs.$BOOTFS -q $bootdev + [ "$BOOTFS" == "btrfs" ] && mkfs_args="" + mkfs.$BOOTFS $mkfs_args $bootdev BOOT_DEV="$bootdev" } @@ -730,7 +732,8 @@ # setup setup_root() { - local root_dev="$1" boot_dev="$2" + local root_dev="$1" boot_dev="$2" mkfs_args="-q" + [ "$ROOTFS" == "btrfs" ] && mkfs_args="" mkfs.$ROOTFS $mkfs_args "$root_dev" mkdir -p "$SYSROOT" mount -t $ROOTFS $root_dev "$SYSROOT" || return 1 @@ -917,6 +920,12 @@ -s Use SWAPSIZE MB instead of autodetecting swap size (Use 0 to disable swap) -v Be more verbose about what is happening +If BOOTFS, ROOTFS, VARFS are specified, then format a partition with specified +filesystem. If not specified, the default filesystem is ext4. +Supported filesystems for + boot: ext2, ext3, ext4, btrfs + root: ext2, ext3, ext4, btrfs, xfs + var: ext2, ext3, ext4, btrfs, xfs __EOF__ exit 1 }