fstypes when partitioning raw image
This commit is contained in:
parent
bc7cfb1ad9
commit
084f7a8f70
|
|
@ -29,7 +29,9 @@ img_mkimage() {
|
||||||
fn img_mkimage $@
|
fn img_mkimage $@
|
||||||
imgpath=${strapdir}.img
|
imgpath=${strapdir}.img
|
||||||
local mbrtype="$1"
|
local mbrtype="$1"
|
||||||
req=(imgpath imgsize mbrtype)
|
local bootfstype="$2"
|
||||||
|
local rootfstype="$3"
|
||||||
|
req=(imgpath imgsize mbrtype bootfstype rootfstype)
|
||||||
ckreq || return 1
|
ckreq || return 1
|
||||||
|
|
||||||
imgname=`basename ${imgpath}`
|
imgname=`basename ${imgpath}`
|
||||||
|
|
@ -41,9 +43,9 @@ img_mkimage() {
|
||||||
bs=1M count=${imgsize}
|
bs=1M count=${imgsize}
|
||||||
|
|
||||||
if [[ $mbrtype == "dos" ]]; then
|
if [[ $mbrtype == "dos" ]]; then
|
||||||
img_partition_dos
|
img_partition_dos $bootfstype $rootfstype
|
||||||
elif [[ $mbrtype == "gpt" ]]; then
|
elif [[ $mbrtype == "gpt" ]]; then
|
||||||
img_partition_gpt
|
img_partition_gpt $bootfstype $rootfstype
|
||||||
else
|
else
|
||||||
error "No valid MBR type specified..."
|
error "No valid MBR type specified..."
|
||||||
zerr; zshexit
|
zerr; zshexit
|
||||||
|
|
@ -56,8 +58,10 @@ img_mkimage() {
|
||||||
}
|
}
|
||||||
|
|
||||||
img_partition_dos() {
|
img_partition_dos() {
|
||||||
fn img_partition_dos
|
fn img_partition_dos $@
|
||||||
req=(imgname imgpath)
|
local bootfstype="$1"
|
||||||
|
local rootfstype="$2"
|
||||||
|
req=(imgname imgpath bootfstype rootfstype)
|
||||||
ckreq || return 1
|
ckreq || return 1
|
||||||
|
|
||||||
notice "Partitioning with dos"
|
notice "Partitioning with dos"
|
||||||
|
|
@ -75,16 +79,29 @@ img_partition_dos() {
|
||||||
# setup loopdevice and mappdevice (zlibs/helpers)
|
# setup loopdevice and mappdevice (zlibs/helpers)
|
||||||
findloopmapp
|
findloopmapp
|
||||||
|
|
||||||
notice "Formatting partitions..."
|
img_format_partitions ${bootfstype} ${rootfstype}
|
||||||
sudo mkfs.ext2 ${bootpart}
|
|
||||||
sudo mkfs.ext4 ${rootpart}
|
|
||||||
|
|
||||||
popd
|
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() {
|
img_partition_gpt() {
|
||||||
fn img_partition_gpt
|
fn img_partition_gpt $@
|
||||||
req=(imgname imgpath)
|
local bootfstype="$1"
|
||||||
|
local rootfstype="$2"
|
||||||
|
req=(imgname imgpath bootfstype rootfstype)
|
||||||
ckreq || return 1
|
ckreq || return 1
|
||||||
|
|
||||||
notice "Partitioning with gpt"
|
notice "Partitioning with gpt"
|
||||||
|
|
@ -102,9 +119,7 @@ img_partition_gpt() {
|
||||||
# setup loopdevice and mappdevice (zlibs/helpers)
|
# setup loopdevice and mappdevice (zlibs/helpers)
|
||||||
findloopmapp
|
findloopmapp
|
||||||
|
|
||||||
notice "Formatting partitions..."
|
img_format_partitions ${bootfstype} ${rootfstype}
|
||||||
sudo mkfs.ext2 -L bootfs $bootpart
|
|
||||||
sudo mkfs.ext4 -L rootfs $rootpart
|
|
||||||
|
|
||||||
popd
|
popd
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue