libdevuansdk

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

commit 68c90d1ae9ee8c1462594730f3c3b6009a7a0b28
parent 1fdbd917d8f92333f826491b6cecef078a0f5167
Author: Johny Mattsson <johny.mattsson+github@gmail.com>
Date:   Mon,  2 Oct 2017 13:04:58 +1100

Added explicit var to control boot fs type.

Since use of GPT does not necessarily imply lack of wanting the boot
partition formatted and mounted.

Diffstat:
Mdocs/creating_wrappers.7.md | 6++++++
Mdocs/helper_functions.7.md | 2+-
Mzlibs/imaging | 43++++++++++++++++++++++++++++++++++---------
3 files changed, 41 insertions(+), 10 deletions(-)

diff --git a/docs/creating_wrappers.7.md b/docs/creating_wrappers.7.md @@ -84,6 +84,12 @@ the [zuper](https://github.com/dyne/zuper) zsh library. available space. again, see the `image_partition_raw_gpt()` function for a better understanding. +* `$bootfs` + This variable controls the file system type of the boot partition. Recognised + values are `none`, `vfat` (or the synonyms `fat` and `dos`), and `ext4`. + When `none` is specified, the boot partition is left raw and not mounted, + so /boot becomes part of the root partition. + * `$qemu_bin` declare this if you are bootstrapping for an architecture different than yours. it should hold the path to `qemu-user-static` or a similarly named diff --git a/docs/helper_functions.7.md b/docs/helper_functions.7.md @@ -10,7 +10,7 @@ libdevuansdk to properly work as well. ## build_image_dist() this function is kind of a wrapper function, mostly used in `arm-sdk` to build a complete "dd-able" image from start to end. to run, it requires `$arch`, -`$size`, `$parted_type`, `$workdir`, and `$strapdir` to be declared. as well as +`$size`, `$parted_type`, `$bootfs`, `$workdir`, and `$strapdir` to be declared. as well as `$parted_root`, `$parted_boot` if `$parted_type=dos`, or `$gpt_root`, `$gpt_boot` if `$parted_type=gpt`. see `creating_wrappers(7)` for insight on these variables. diff --git a/zlibs/imaging b/zlibs/imaging @@ -35,6 +35,34 @@ image_prepare_raw() { count=$size } +image_format_partitions() { + fn image_format_partitions + req=(bootfs bootpart rootpart) + ckreq || return 1 + + notice "formatting partitions..." + case "$bootfs" in + none) + act "skipping boot partition" + ;; + vfat|fat|dos) + act "formatting boot as vfat" + sudo mkfs.vfat ${bootpart} + ;; + ext4) + act "formatting boot as ext4" + sudo mkfs.ext4 ${bootpart} + ;; + *) + error "unknown parted_bootfs type '$bootfs'" + zerr + ;; + esac + + act "formatting root as ext4" + sudo mkfs.ext4 ${rootpart} +} + image_partition_raw_dos() { fn image_partition_raw_dos req=(workdir image_name parted_boot parted_root) @@ -54,14 +82,12 @@ image_partition_raw_dos() { bootpart=${loopdevice}p1 rootpart=${loopdevice}p2 - notice "formatting partitions..." - sudo mkfs.vfat ${bootpart} - sudo mkfs.ext4 ${rootpart} + image_format_partitions } image_partition_raw_gpt() { fn image_partition_raw_gpt - req=(workdir image_name) + req=(workdir image_name gpt_boot gpt_root) ckreq || return 1 notice "partitioning raw gpt image..." @@ -84,8 +110,7 @@ image_partition_raw_gpt() { bootpart="${loopdevice}p1" rootpart="${loopdevice}p2" - notice "formatting partitions..." - sudo mkfs.ext4 -L rootfs ${rootpart} + image_format_partitions } image_pack_dist() { @@ -139,14 +164,14 @@ image_pack_dist() { image_raw_mount() { fn image_raw_mount - req=(workdir bootpart rootpart) + req=(workdir bootpart rootpart bootfs) ckreq || return 1 mkdir -p $workdir/mnt sudo mount $rootpart $workdir/mnt && \ act "mounted root partition" || zerr - [[ "$parted_type" == gpt ]] || { + [[ "$bootfs" == none ]] || { sudo mkdir $workdir/mnt/boot sudo mount $bootpart $workdir/mnt/boot && \ act "mounted boot partition" || zerr @@ -158,7 +183,7 @@ image_raw_umount() { req=(workdir bootpart rootpart) ckreq || return 1 - [[ "$parted_type" == gpt ]] || { + [[ "$bootfs" == none ]] || { sudo umount $workdir/mnt/boot && act "unmounted boot partition" || zerr sleep 1 }