libdevuansdk

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

helper_functions.7.md (2018B)


      1 helper functions
      2 ================
      3 
      4 you can find useful helper functions in `libdevuansdk/zlibs/helpers`. they are
      5 intended to help you with writing wrappers, as well as making my job easier
      6 within developing libdevuansdk. some of these functions are required for
      7 libdevuansdk to properly work as well.
      8 
      9 
     10 ## build_arm_dist()
     11 this function is kind of a wrapper function, mostly used in `arm-sdk` to build
     12 a complete "dd-able" image from start to end. to run, it requires `$workdir`
     13 `$strapdir`, and `$os`, `$arch`, `$size`, `$parted_type`, `$bootfs`, defined.
     14 additionally, `$dos_root`, `$dos_boot` if `$parted_type=dos`, or `$gpt_root`,
     15 `$gpt_boot` if `$parted_type=gpt`. see `creating_wrappers(7)` for insight on
     16 these variables.
     17 
     18 the workflow of this function is bootstrapping a complete rootfs, creating a raw
     19 image, installing/compiling a kernel, rsyncing everything to the raw image, and
     20 finally, compressing the raw image.
     21 
     22 
     23 ## devprocsys()  
     24 this function is a simple helper function that takes two arguments: `watdo` and
     25 `werdo`. it mounts or umounts `/sys`, `/dev`, `/dev/pts`, and `procfs` where you
     26 tell it to. for example:
     27 
     28 ```
     29 devprocsys mount $strapdir
     30 devprocsys umount $strapdir
     31 ```
     32 
     33 
     34 ## findloopmapp()  
     35 this functions takes the raw image and finds a free loopdevice for it to be
     36 mounted. it calls `losetup(8)` and `kpartx(8)`.
     37 
     38 
     39 ## qemu_install_user()  
     40 helper function to install the userspace qemu to `$strapdir`.
     41 
     42 
     43 ## dpkgdivert()  
     44 this one takes two arguments, `watdo` and `werdo` (much like `devprocsys`). it
     45 will create a dpkg diversion in the place you tell it to and remove invoke-rc.d
     46 so that apt doesn't autostart daemons when they are installed.
     47 
     48 
     49 ## enablessh()  
     50 this function will allow root login with password in the bootstrapped rootfs.
     51 
     52 
     53 ## chroot-script()  
     54 allows you to chroot inside the `$strapdir` and execute the
     55 script/binary that's given to it.
     56 takes an optional argument: `-d` (will call dpkgdivert on and off)
     57 
     58 
     59 ## silly()  
     60 a funny function printing out random messages.