[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
[how] mkfs.btrf and mkfs.ext4 is no exist, it will return
Signed-off-by: Hu XueJiao huxuejiao1@huawei.com --- lib/bootstrap.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/lib/bootstrap.sh b/lib/bootstrap.sh index a7776d68..9744cb84 100755 --- a/lib/bootstrap.sh +++ b/lib/bootstrap.sh @@ -456,7 +456,12 @@ mount_rootfs() ROOTFS_DIR=/opt/rootfs mkdir -p $ROOTFS_DIR mount $rootfs_partition $ROOTFS_DIR || { - mkfs.btrfs -f $rootfs_partition + if has_cmd mkfs.btrfs; then + mkfs.btrfs -f $rootfs_partition + else + mkfs.ext4 -F $rootfs_partition || return + fi + mount $rootfs_partition $ROOTFS_DIR } mkdir -p $ROOTFS_DIR/tmp