convert varius scripts mkfs_partitions

This commit is contained in:
Fran
2021-11-06 14:00:40 +01:00
parent 03598819b6
commit a7088adddc
13 changed files with 19 additions and 113 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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