proper partx support
This commit is contained in:
parent
22c24a992c
commit
bcfc231bdd
|
|
@ -143,20 +143,17 @@ wrapup() {
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
findloopmapp() {
|
findloopdev() {
|
||||||
fn findloopmapp
|
fn findloopdev
|
||||||
req=(workdir image_name)
|
req=(workdir image_name)
|
||||||
ckreq || return 1
|
ckreq || return 1
|
||||||
|
|
||||||
notice "finding a free loopdevice"
|
notice "finding a free loopdevice"
|
||||||
|
|
||||||
loopdevice=$(sudo losetup -f --show $workdir/${image_name}.img)
|
loopdevice=$(sudo losetup -f --show $workdir/${image_name}.img)
|
||||||
mappdevice=$(sudo partx -va $loopdevice | \
|
sudo partx -av $loopdevice || zerr
|
||||||
sed -E 's/.*(loop[0-9])p.*/\1/g' | sed 1q)
|
|
||||||
|
|
||||||
func "loopdevice: $loopdevice"
|
func "loopdevice: $loopdevice"
|
||||||
func "mappdevice: $mappdevice"
|
|
||||||
|
|
||||||
silly sleep 2
|
silly sleep 2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -45,8 +45,8 @@ image_partition_raw_dos() {
|
||||||
parted $workdir/${image_name}.img --script -- mkpart primary ${parted_boot}
|
parted $workdir/${image_name}.img --script -- mkpart primary ${parted_boot}
|
||||||
parted $workdir/${image_name}.img --script -- mkpart primary ${parted_root}
|
parted $workdir/${image_name}.img --script -- mkpart primary ${parted_root}
|
||||||
|
|
||||||
## get loopdevice and mapper device (see ./helpers)
|
## get loopdevice (see ./helpers)
|
||||||
findloopmapp
|
findloopdev
|
||||||
|
|
||||||
mappdevice="/dev/mapper/${mappdevice}"
|
mappdevice="/dev/mapper/${mappdevice}"
|
||||||
bootpart=${mappdevice}p1
|
bootpart=${mappdevice}p1
|
||||||
|
|
@ -77,11 +77,10 @@ image_partition_raw_gpt() {
|
||||||
awk '/Sec GPT table/ {print $1}') - ${gpt_root[1]}) \
|
awk '/Sec GPT table/ {print $1}') - ${gpt_root[1]}) \
|
||||||
-l Root $workdir/${image_name}.img
|
-l Root $workdir/${image_name}.img
|
||||||
|
|
||||||
findloopmapp
|
findloopdev
|
||||||
|
|
||||||
mappdevice="/dev/mapper/${mappdevice}"
|
bootpart=${loopdevice}p1
|
||||||
bootpart=${mappdevice}p1
|
rootpart=${loopdevice}p2
|
||||||
rootpart=${mappdevice}p2
|
|
||||||
|
|
||||||
notice "formatting partitions..."
|
notice "formatting partitions..."
|
||||||
sudo mkfs.ext4 -L rootfs ${rootpart}
|
sudo mkfs.ext4 -L rootfs ${rootpart}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue