From a7088adddc8f7ed8c4b6540e42b3aced316fb0d2 Mon Sep 17 00:00:00 2001 From: Fran Date: Sat, 6 Nov 2021 14:00:40 +0100 Subject: [PATCH] convert varius scripts mkfs_partitions --- banana-pi.sh | 9 +-------- banana-pro.sh | 9 +-------- beaglebone-black.sh | 10 +--------- cubietruck.sh | 10 +--------- cubox-i4pro.sh | 9 +-------- cubox.sh | 9 +-------- nanopc-t.sh | 10 +--------- nanopi-neo-plus2.sh | 9 +-------- nanopi2.sh | 10 +--------- odroid-c2.sh | 9 +-------- odroid-xu3.sh | 14 +++----------- pinebook-pro.sh | 12 +++--------- pinebook.sh | 12 +++--------- 13 files changed, 19 insertions(+), 113 deletions(-) diff --git a/banana-pi.sh b/banana-pi.sh index 956c6df..55a2d3e 100755 --- a/banana-pi.sh +++ b/banana-pi.sh @@ -58,14 +58,7 @@ loopdevice=$(losetup --show -fP "${image_dir}/${image_name}.img") rootp="${loopdevice}p1" # Create file systems -status "Formatting partitions" -if [[ "$fstype" == "ext4" ]]; then - features="^64bit,^metadata_csum" -elif [[ "$fstype" == "ext3" ]]; then - features="^64bit" -fi -mkfs -U "$root_uuid" -O "$features" -t "$fstype" -L ROOTFS "${rootp}" - +mkfs_partitions # Make fstab. make_fstab diff --git a/banana-pro.sh b/banana-pro.sh index fa5ca27..c921426 100755 --- a/banana-pro.sh +++ b/banana-pro.sh @@ -51,14 +51,7 @@ loopdevice=$(losetup --show -fP "${image_dir}/${image_name}.img") rootp="${loopdevice}p1" # Create file systems -status "Formatting partitions" -if [[ "$fstype" == "ext4" ]]; then - features="^64bit,^metadata_csum" -elif [[ "$fstype" == "ext3" ]]; then - features="^64bit" -fi -mkfs -U "$root_uuid" -O "$features" -t "$fstype" -L ROOTFS "${rootp}" - +mkfs_partitions # Make fstab. make_fstab diff --git a/beaglebone-black.sh b/beaglebone-black.sh index 69a7aea..3958e55 100755 --- a/beaglebone-black.sh +++ b/beaglebone-black.sh @@ -170,15 +170,7 @@ bootp="${loopdevice}p1" rootp="${loopdevice}p2" # Create file systems -status "Formatting partitions" -mkfs.vfat -n BOOT -F 16 "${bootp}" -if [[ "$fstype" == "ext4" ]]; then - features="^64bit,^metadata_csum" -elif [[ "$fstype" == "ext3" ]]; then - features="^64bit" -fi -mkfs -U "$root_uuid" -O "$features" -t "$fstype" -L ROOTFS "${rootp}" - +mkfs_partitions # Make fstab. make_fstab diff --git a/cubietruck.sh b/cubietruck.sh index f42994d..b510a0a 100755 --- a/cubietruck.sh +++ b/cubietruck.sh @@ -96,15 +96,7 @@ bootp="${loopdevice}p1" rootp="${loopdevice}p2" # Create file systems -status "Formatting partitions" -mkfs.vfat -n BOOT -F 32 "${bootp}" -if [[ "$fstype" == "ext4" ]]; then - features="^64bit,^metadata_csum" -elif [[ "$fstype" == "ext3" ]]; then - features="^64bit" -fi -mkfs -U "$root_uuid" -O "$features" -t "$fstype" -L ROOTFS "${rootp}" - +mkfs_partitions # Make fstab. make_fstab diff --git a/cubox-i4pro.sh b/cubox-i4pro.sh index bbe0ffa..10f602a 100755 --- a/cubox-i4pro.sh +++ b/cubox-i4pro.sh @@ -55,14 +55,7 @@ loopdevice=$(losetup --show -fP "${image_dir}/${image_name}.img") rootp="${loopdevice}p1" # Create file systems -status "Formatting partitions" -if [[ "$fstype" == "ext4" ]]; then - features="^64bit,^metadata_csum" -elif [[ "$fstype" == "ext3" ]]; then - features="^64bit" -fi -mkfs -U "$root_uuid" -O "$features" -t "$fstype" -L ROOTFS "${rootp}" - +mkfs_partitions # Make fstab. make_fstab diff --git a/cubox.sh b/cubox.sh index 43089f2..ff74bb3 100755 --- a/cubox.sh +++ b/cubox.sh @@ -109,14 +109,7 @@ loopdevice=$(losetup --show -fP "${image_dir}/${image_name}.img") rootp="${loopdevice}p1" # Create file systems -status "Formatting partitions" -if [[ "$fstype" == "ext4" ]]; then - features="^64bit,^metadata_csum" -elif [[ "$fstype" == "ext3" ]]; then - features="^64bit" -fi -mkfs -U "$root_uuid" -O "$features" -t "$fstype" -L ROOTFS "${rootp}" - +mkfs_partitions # Make fstab. make_fstab diff --git a/nanopc-t.sh b/nanopc-t.sh index a0fd889..7441745 100755 --- a/nanopc-t.sh +++ b/nanopc-t.sh @@ -98,15 +98,7 @@ bootp="${loopdevice}p1" rootp="${loopdevice}p2" # Create file systems -status "Formatting partitions" -if [[ "$fstype" == "ext4" ]]; then - features="^64bit,^metadata_csum" -elif [[ "$fstype" == "ext3" ]]; then - features="^64bit" -fi -mkfs -O "$features" -t "$fstype" -L BOOT "${bootp}" -mkfs -U "$root_uuid" -O "$features" -t "$fstype" -L ROOTFS "${rootp}" - +mkfs_partitions # Make fstab. make_fstab diff --git a/nanopi-neo-plus2.sh b/nanopi-neo-plus2.sh index 329410c..22610b0 100755 --- a/nanopi-neo-plus2.sh +++ b/nanopi-neo-plus2.sh @@ -69,14 +69,7 @@ loopdevice=$(losetup --show -fP "${image_dir}/${image_name}.img") rootp="${loopdevice}p1" # Create file systems -status "Formatting partitions" -if [[ "$fstype" == "ext4" ]]; then - features="^64bit,^metadata_csum" -elif [[ "$fstype" == "ext3" ]]; then - features="^64bit" -fi -mkfs -U "$root_uuid" -O "$features" -t "$fstype" -L ROOTFS "${rootp}" - +mkfs_partitions # Make fstab. make_fstab diff --git a/nanopi2.sh b/nanopi2.sh index 001f510..49c6e97 100755 --- a/nanopi2.sh +++ b/nanopi2.sh @@ -148,15 +148,7 @@ bootp="${loopdevice}p1" rootp="${loopdevice}p2" # Create file systems -status "Formatting partitions" -mkfs.ext2 -L BOOT "${bootp}" -if [[ "$fstype" == "ext4" ]]; then - features="^64bit,^metadata_csum" -elif [[ "$fstype" == "ext3" ]]; then - features="^64bit" -fi -mkfs -U "$root_uuid" -O "$features" -t "$fstype" -L ROOTFS "${rootp}" - +mkfs_partitions # Make fstab. make_fstab diff --git a/odroid-c2.sh b/odroid-c2.sh index 9eba62a..32da814 100755 --- a/odroid-c2.sh +++ b/odroid-c2.sh @@ -87,14 +87,7 @@ loopdevice=$(losetup --show -fP "${image_dir}/${image_name}.img") rootp="${loopdevice}p1" # Create file systems -status "Formatting partitions" -if [[ "$fstype" == "ext4" ]]; then - features="^64bit,^metadata_csum" -elif [[ "$fstype" == "ext3" ]]; then - features="^64bit" -fi -mkfs -U "$root_uuid" -O "$features" -t "$fstype" -L ROOTFS "${rootp}" - +mkfs_partitions # Make fstab. make_fstab diff --git a/odroid-xu3.sh b/odroid-xu3.sh index e671c45..3e81d16 100755 --- a/odroid-xu3.sh +++ b/odroid-xu3.sh @@ -159,14 +159,9 @@ bootp="${loopdevice}p1" rootp="${loopdevice}p2" # Create file systems -status "Formatting partitions" -if [[ "$fstype" == "ext4" ]]; then - features="^64bit,^metadata_csum" -elif [[ "$fstype" == "ext3" ]]; then - features="^64bit" -fi -mkfs -O "$features" -t "$fstype" -L BOOT "${bootp}" -mkfs -U "$root_uuid" -O "$features" -t "$fstype" -L ROOTFS "${rootp}" +mkfs_partitions +# Make fstab. +make_fstab # Create the dirs for the partitions and mount them status "Create the dirs for the partitions and mount them" @@ -175,9 +170,6 @@ mount "${rootp}" "${base_dir}"/root mkdir -p "${base_dir}"/root/boot mount "${bootp}" "${base_dir}"/root/boot -# Make fstab. -make_fstab - status "Rsyncing rootfs into image file" rsync -HPavz -q "${work_dir}"/ "${base_dir}"/root/ sync diff --git a/pinebook-pro.sh b/pinebook-pro.sh index 0e65542..377bc68 100755 --- a/pinebook-pro.sh +++ b/pinebook-pro.sh @@ -197,21 +197,15 @@ loopdevice=$(losetup --show -fP "${image_dir}/${image_name}.img") rootp="${loopdevice}p1" # Create file systems -status "Formatting partitions" -if [[ "$fstype" == "ext4" ]]; then - features="^64bit,^metadata_csum" -elif [[ "$fstype" == "ext3" ]]; then - features="^64bit" -fi -mkfs -U "$root_uuid" -O "$features" -t "$fstype" -L ROOTFS "${rootp}" +mkfs_partitions +# Make fstab. +make_fstab # Create the dirs for the partitions and mount them status "Create the dirs for the partitions and mount them" mkdir -p "${base_dir}"/root/ mount "${rootp}" "${base_dir}"/root -# Make fstab. -make_fstab # FUTURE: Move to debian u-boot when it works properly # Ensure we don't have root=/dev/sda3 in the extlinux.conf which comes from running u-boot-menu in a cross chroot diff --git a/pinebook.sh b/pinebook.sh index 15f8c48..12fe550 100755 --- a/pinebook.sh +++ b/pinebook.sh @@ -116,21 +116,15 @@ loopdevice=$(losetup --show -fP "${image_dir}/${image_name}.img") rootp="${loopdevice}p1" # Create file systems -status "Formatting partitions" -if [[ "$fstype" == "ext4" ]]; then - features="^64bit,^metadata_csum" -elif [[ "$fstype" == "ext3" ]]; then - features="^64bit" -fi -mkfs -U "$root_uuid " -O "$features" -t "$fstype" -L ROOTFS "${rootp}" +mkfs_partitions +# Make fstab. +make_fstab # Create the dirs for the partitions and mount them status "Create the dirs for the partitions and mount them" mkdir -p "${base_dir}"/root/ mount "${rootp}" "${base_dir}"/root -# Make fstab. -make_fstab # Ensure we don't have root=/dev/sda3 in the extlinux.conf which comes from running u-boot-menu in a cross chroot # We do this down here because we don't know the UUID until after the image is created