Commit 52bbb477 authored by Valery Kartel's avatar Valery Kartel Committed by Natanael Copa

setup-disk: fix filesystem creation and help text

parent b60397f8
...@@ -436,16 +436,17 @@ stop_all_raid() { ...@@ -436,16 +436,17 @@ stop_all_raid() {
# install needed programs # install needed programs
init_progs() { init_progs() {
local raidpkg= local raidpkg= fs= fstools="e2fsprogs"
[ -n "$USE_RAID" ] && raidpkg="mdadm" [ -n "$USE_RAID" ] && raidpkg="mdadm"
case $ROOTFS in for fs in $BOOTFS $ROOTFS $VARFS; do
ext*) fstools=e2fsprogs; mkfs_args="-q";; case $fs in
xfs) fstools=xfsprogs; mkfs_args="-q";; xfs) fstools="$fstools xfsprogs"; modprobe xfs;;
# we need load btrfs module early to avoid the error message: # we need load btrfs module early to avoid the error message:
# 'failed to open /dev/btrfs-control' # 'failed to open /dev/btrfs-control'
btrfs) fstools=btrfs-progs; mkfs_args=""; modprobe btrfs;; btrfs) fstools="$fstools btrfs-progs"; modprobe btrfs;;
esac esac
apk add --quiet sfdisk e2fsprogs lvm2 $raidpkg syslinux $fstools $@ done
apk add --quiet sfdisk lvm2 $raidpkg syslinux $fstools $@
} }
show_disk_info() { show_disk_info() {
...@@ -522,7 +523,7 @@ find_lvm_partition() { ...@@ -522,7 +523,7 @@ find_lvm_partition() {
# set up optional raid and create filesystem on boot device. # set up optional raid and create filesystem on boot device.
setup_boot_dev() { setup_boot_dev() {
local disk= bootdev= local disk= bootdev= mkfs_args="-q"
local part=$(for disk in $@; do find_boot_partition $disk; done) local part=$(for disk in $@; do find_boot_partition $disk; done)
set -- $part set -- $part
bootdev=$1 bootdev=$1
...@@ -540,7 +541,8 @@ setup_boot_dev() { ...@@ -540,7 +541,8 @@ setup_boot_dev() {
--metadata=0.90 --quiet --run $@ $missing || return 1 --metadata=0.90 --quiet --run $@ $missing || return 1
bootdev=/dev/md0 bootdev=/dev/md0
fi fi
mkfs.$BOOTFS -q $bootdev [ "$BOOTFS" == "btrfs" ] && mkfs_args=""
mkfs.$BOOTFS $mkfs_args $bootdev
BOOT_DEV="$bootdev" BOOT_DEV="$bootdev"
} }
...@@ -730,7 +732,8 @@ data_only_disk_install() { ...@@ -730,7 +732,8 @@ data_only_disk_install() {
# setup # setup
setup_root() { 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" mkfs.$ROOTFS $mkfs_args "$root_dev"
mkdir -p "$SYSROOT" mkdir -p "$SYSROOT"
mount -t $ROOTFS $root_dev "$SYSROOT" || return 1 mount -t $ROOTFS $root_dev "$SYSROOT" || return 1
...@@ -917,6 +920,12 @@ options: ...@@ -917,6 +920,12 @@ options:
-s Use SWAPSIZE MB instead of autodetecting swap size (Use 0 to disable swap) -s Use SWAPSIZE MB instead of autodetecting swap size (Use 0 to disable swap)
-v Be more verbose about what is happening -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__ __EOF__
exit 1 exit 1
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment