tcreating_wrappers.7.md - libdevuansdk - common library for devuan's simple distro kits
 (HTM) git clone https://git.parazyd.org/libdevuansdk
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) Submodules
 (DIR) README
 (DIR) LICENSE
       ---
       tcreating_wrappers.7.md (3620B)
       ---
            1 creating wrappers around libdevuansdk
            2 =====================================
            3 
            4 libdevuansdk holds all the helper functions you might need, but it does not
            5 allow you to simply use it in a completely automated fashion. for that you
            6 will have to wrap some zsh around libdevuansdk.
            7 
            8 there are a few mandatory variables that you are required to declare before
            9 sourcing libdevuansdk. otherwise libdevuansdk might write to some places of the
           10 system you wouldn't want to.
           11 
           12 ## requirements
           13 
           14 before sourcing it, libdevuansdk assumes you already loaded and initialized
           15 the [zuper](https://github.com/dyne/zuper) zsh library.
           16 
           17 
           18 ### mandatory variables
           19 
           20 * `$R`  
           21   the root directory of your wrapper. in almost every situation you can set
           22   it as `$PWD`
           23 
           24 * `$workdir`  
           25   the working directory of the current "build". a sane default is
           26   `$R/tmp/workdir`
           27 
           28 * `$strapdir`  
           29    the bootstrap directory of the current "build". it holds the rootfs when
           30    you debootstrap. sane default: `$workdir/rootfs`
           31 
           32 * `$arch`  
           33   the CPU architecture of the current "build". values like: `amd64`, `i386`,
           34   `armhf`, etc...
           35 
           36 
           37 ### Optional variables
           38 
           39 * `$extra_packages`  
           40   this should hold an array of packages that exist in the devuan package tree.
           41   they will get installed as a part of the bootstrap process.
           42 
           43 * `$purge_packages`  
           44   this is an array that holds a list of packages that will get removed at the
           45   final steps of the bootstrap process. note that this array is not empty by
           46   default, so you should only add to it in your wrapper, not override it. 
           47   just to be safe.
           48 
           49 * `$size`  
           50   This variable will hold the value in MiB for `dd` to know how many zeroes it
           51   should put in the raw image.  
           52   ex: `size=1337`
           53 
           54 * `$parted_type`  
           55   if you are creating a raw (dd-able) image, this variable will tell
           56   libdevuansdk how to partition that image. either `dos` or `gpt`.
           57 
           58 * `$parted_boot`  
           59   used if `$parted_type=dos`. it holds the values for `parted` and the
           60   formatting of the `boot` partition.  
           61   ex: `parted_boot="fat32 2048s 264191s"`.  
           62   see the `image_partition_raw_dos()` function in `libdevuansdk/zlibs/imaging`
           63   for a better understanding on how the variable is used.
           64 
           65 * `$parted_root`  
           66   used if `$parted_type=dos`. it holds the values for `parted` and the
           67   formatting of the `root` partition.  
           68   ex: `parted_root="ext4 264192s 100%"`.  
           69   see the `image_partition_raw_dos()` function in `libdevuansdk/zlibs/imaging`
           70   for a better understanding on how the variable is used.
           71 
           72 * `$gpt_boot`  
           73   used if `$parted_type=gpt`. it is an array holding the start and end values
           74   for partitioning the `boot` partition.  
           75   ex: `gpt_boot=(8192 32768)`  
           76   see the `image_partition_raw_gpt()` function in `libdevuansdk/zlibs/imaging
           77   for a better understanding on how the variable is used.
           78 
           79 * `$gpt_root`  
           80   used if `$parted_type=gpt`. it is an array holding the start value for
           81   partitioning the `root` partition.  
           82   ex: `gpt_root=(40960)`  
           83   currently libdevuansdk chooses this as a startpoint, and maxes out remaining
           84   available space. again, see the `image_partition_raw_gpt()` function for a
           85   better understanding.
           86 
           87 * `$bootfs`
           88   This variable controls the file system type of the boot partition. Recognised
           89   values are `none`, `vfat` (or the synonyms `fat` and `dos`), and `ext4`.
           90   When `none` is specified, the boot partition is left raw and not mounted,
           91   so /boot becomes part of the root partition.
           92 
           93 * `$qemu_bin`  
           94   declare this if you are bootstrapping for an architecture different than
           95   yours. it should hold the path to `qemu-user-static` or a similarly named
           96   statically compiled qemu for userspace.