[why] mkfs.btrfs "command not found" when os_mount=initramfs
[how] it will user mkfs.ext4 because mkfs.ext4 is common, other mkfs.*** is not considered
Signed-off-by: Hu XueJiao 1034502035@qq.com --- lib/bootstrap.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/lib/bootstrap.sh b/lib/bootstrap.sh index a7776d68..44a7bdef 100755 --- a/lib/bootstrap.sh +++ b/lib/bootstrap.sh @@ -456,8 +456,16 @@ mount_rootfs() ROOTFS_DIR=/opt/rootfs mkdir -p $ROOTFS_DIR mount $rootfs_partition $ROOTFS_DIR || { - mkfs.btrfs -f $rootfs_partition - mount $rootfs_partition $ROOTFS_DIR + + if has_cmd mkfs.btrfs; then + mkfs.btrfs -f $rootfs_partition + mount $rootfs_partition $ROOTFS_DIR + else + has_cmd mkfs.ext4 && { + mkfs.ext4 -F $rootfs_partition + mount $rootfs_partition $ROOTFS_DIR + } + fi } mkdir -p $ROOTFS_DIR/tmp CACHE_DIR=$ROOTFS_DIR/tmp