tfstypes when partitioning raw image - libdevuansdk - common library for devuan's simple distro kits HTML git clone https://git.parazyd.org/libdevuansdk DIR Log DIR Files DIR Refs DIR Submodules DIR README DIR LICENSE --- DIR commit 084f7a8f70f816ff53c6d8922a35e75e147a336a DIR parent bc7cfb1ad98066b35b7865619bd498a0f83ba83f HTML Author: parazyd <parazyd@dyne.org> Date: Thu, 9 Jun 2016 11:43:59 +0200 fstypes when partitioning raw image Diffstat: M zlibs/imaging | 41 +++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 13 deletions(-) --- DIR diff --git a/zlibs/imaging b/zlibs/imaging t@@ -29,7 +29,9 @@ img_mkimage() { fn img_mkimage $@ imgpath=${strapdir}.img local mbrtype="$1" - req=(imgpath imgsize mbrtype) + local bootfstype="$2" + local rootfstype="$3" + req=(imgpath imgsize mbrtype bootfstype rootfstype) ckreq || return 1 imgname=`basename ${imgpath}` t@@ -41,9 +43,9 @@ img_mkimage() { bs=1M count=${imgsize} if [[ $mbrtype == "dos" ]]; then - img_partition_dos + img_partition_dos $bootfstype $rootfstype elif [[ $mbrtype == "gpt" ]]; then - img_partition_gpt + img_partition_gpt $bootfstype $rootfstype else error "No valid MBR type specified..." zerr; zshexit t@@ -56,8 +58,10 @@ img_mkimage() { } img_partition_dos() { - fn img_partition_dos - req=(imgname imgpath) + fn img_partition_dos $@ + local bootfstype="$1" + local rootfstype="$2" + req=(imgname imgpath bootfstype rootfstype) ckreq || return 1 notice "Partitioning with dos" t@@ -75,16 +79,29 @@ img_partition_dos() { # setup loopdevice and mappdevice (zlibs/helpers) findloopmapp - notice "Formatting partitions..." - sudo mkfs.ext2 ${bootpart} - sudo mkfs.ext4 ${rootpart} + img_format_partitions ${bootfstype} ${rootfstype} popd } +img_format_partitions() { + fn img_format_partitions $@ + local bootfstype="$1" + local rootfstype="$2" + req=(bootfstype rootfstype bootpart rootpart) + ckreq || return 1 + + notice "Formatting partitions..." + sudo mkfs.${bootfstype} ${bootpart} + sudo mkfs.${rootfstype} ${rootpart} + +} + img_partition_gpt() { - fn img_partition_gpt - req=(imgname imgpath) + fn img_partition_gpt $@ + local bootfstype="$1" + local rootfstype="$2" + req=(imgname imgpath bootfstype rootfstype) ckreq || return 1 notice "Partitioning with gpt" t@@ -102,9 +119,7 @@ img_partition_gpt() { # setup loopdevice and mappdevice (zlibs/helpers) findloopmapp - notice "Formatting partitions..." - sudo mkfs.ext2 -L bootfs $bootpart - sudo mkfs.ext4 -L rootfs $rootpart + img_format_partitions ${bootfstype} ${rootfstype} popd }