libdevuansdk

common library for devuan's simple distro kits
git clone https://git.parazyd.org/libdevuansdk
Log | Files | Refs | Submodules | README | LICENSE

commit 09d62450cb6192e1102a65843beb0c850f064e0c
parent 51f8be65091b9325346db0fc3727d14c997cc2b0
Author: parazyd <parazyd@dyne.org>
Date:   Mon, 15 May 2017 16:05:03 +0200

proper partx support

Diffstat:
Mzlibs/helpers | 11+++++------
Mzlibs/imaging | 16+++++++---------
2 files changed, 12 insertions(+), 15 deletions(-)

diff --git a/zlibs/helpers b/zlibs/helpers @@ -19,6 +19,8 @@ ## helper functions that make my life easier +vars+=(loopdevice) + build_image_dist() { fn build_image_dist req=(arch size parted_type) @@ -143,20 +145,17 @@ wrapup() { exit 1 } -findloopmapp() { - fn findloopmapp +findloopdev() { + fn findloopdev req=(workdir image_name) ckreq || return 1 notice "finding a free loopdevice" loopdevice=$(sudo losetup -f --show $workdir/${image_name}.img) - mappdevice=$(sudo partx -va $loopdevice | \ - sed -E 's/.*(loop[0-9])p.*/\1/g' | sed 1q) + sudo partx -av $loopdevice || zerr func "loopdevice: $loopdevice" - func "mappdevice: $mappdevice" - silly sleep 2 } diff --git a/zlibs/imaging b/zlibs/imaging @@ -45,12 +45,11 @@ image_partition_raw_dos() { parted $workdir/${image_name}.img --script -- mkpart primary ${parted_boot} parted $workdir/${image_name}.img --script -- mkpart primary ${parted_root} - ## get loopdevice and mapper device (see ./helpers) - findloopmapp + ## get loopdevice (see ./helpers) + findloopdev - mappdevice="/dev/mapper/${mappdevice}" - bootpart=${mappdevice}p1 - rootpart=${mappdevice}p2 + bootpart=${loopdevice}p1 + rootpart=${loopdevice}p2 notice "formatting partitions..." sudo mkfs.vfat ${bootpart} @@ -77,11 +76,10 @@ image_partition_raw_gpt() { awk '/Sec GPT table/ {print $1}') - ${gpt_root[1]}) \ -l Root $workdir/${image_name}.img - findloopmapp + findloopdev - mappdevice="/dev/mapper/${mappdevice}" - bootpart=${mappdevice}p1 - rootpart=${mappdevice}p2 + bootpart="${loopdevice}p1" + rootpart="${loopdevice}p2" notice "formatting partitions..." sudo mkfs.ext4 -L rootfs ${rootpart}