[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
Let's install btrfs tools instead. Since btrfs supports snapshot and multi-subvolume. It's more handy to use when installing many versions of OS.
Refer to ~/lkp-tests/bin/rsync-rootfs
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
if/else不对称, 导致多了一层缩进。
Thanks, Fengguang
mount $rootfs_partition $ROOTFS_DIR
}
} mkdir -p $ROOTFS_DIR/tmp CACHE_DIR=$ROOTFS_DIR/tmpfi
-- 2.23.0