libdevuansdk

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

commit dd6f741ed6a53957320421c5c7f61f1400be849d
parent 695e767a142ca85ddb18d448ced1b9547ebb7589
Author: parazyd <parazyd@dyne.org>
Date:   Wed,  8 Jun 2016 21:54:15 +0200

documentation updates

Diffstat:
Mdoc/README-functions.md | 25++++++++++++++++++++-----
Mzlibs/helpers | 20++++++++++++--------
Mzlibs/imaging | 4++--
3 files changed, 34 insertions(+), 15 deletions(-)

diff --git a/doc/README-functions.md b/doc/README-functions.md @@ -25,8 +25,10 @@ Unpack the tarball of a base working system to the strapdir. # zlibs/imaging -## img_mkimage() ## +## img_mkimage() Uses dd to dump zeroes into a raw .img of the preconfigured size. +Goes further and rsyncs strapdir into the image, installs bootloader and a +kernel. ## img_partition_dos() ## Partitions the raw image into dos format and formats (boot=ext2; root=ext4) @@ -34,6 +36,13 @@ Partitions the raw image into dos format and formats (boot=ext2; root=ext4) ## img_partition_gpt() ## Partitions the raw image into gpt format and formats (boot=ext2; root=ext4) +## img_rsync_strapdir() ## +rsyncs the strapdir to te mounted rootfs of our raw image. + +## img_install_bootloader() ## +calls functions from sysconf: `conf_install_kernel` and `conf_install_grub` to +install the on the image + ## img_mount() ## Mounts the root and boot partitions in `$workdir/rootp` in order to work on it. @@ -54,16 +63,16 @@ escalate root "chroot /somewhere/where/i/want/to" For the raw image. Finds a free loopdevice and makes a /dev/mapper device which is then kpartx-ed to give us partitions we can mount. -## mountdevproc() -Mounts `/dev`, `/dev/pts`, and `/proc` where needed. Takes one argument, which +## mountdevprocsys() +Mounts `/sys`, `/dev`, `/dev/pts`, and `/proc` where needed. Takes one argument, which is the path containing those. ex: ``` mountdevproc /path/to/bootstrapped/chroot ``` -## umountdevproc() -Does the opposite of `mountdevproc`. +## umountdevprocsys() +Does the opposite of `mountdevprocsys`. ## silly() Because NSA @@ -72,6 +81,12 @@ Because NSA NOTE: everything is printed to stdout. Pipe or redirect if you want to write on storage. +## conf_install_grub() +Installs `grub-pc` to the target. Arg taken is a path to a chroot + +## conf_install_kernel() +Installs `linux-image-$arch` to the target. Arg taken is a path to the chroot. + ## conf_print_debconf() Prints out the config for console-common setup diff --git a/zlibs/helpers b/zlibs/helpers @@ -57,30 +57,34 @@ findloopmapp() { popd } -mountdevproc() { - fn mountdevproc $@ +mountdevprocsys() { + fn mountdevprocsys $@ local mntdir="$1" req=(mntdir) ckreq || return 1 + sudo mount -o bind /sys ${mntdir}/sys && act "mounted /sys" sudo mount -t proc proc ${mntdir}/proc && act "mounted /proc" sudo mount -o bind /dev ${mntdir}/dev && act "mounted /dev" sudo mount -o bind /dev/pts ${mntdir}/dev/pts && act "mounted /dev/pts" } -umountdevproc() { - fn umountdevproc $@ +umountdevprocsys() { + fn umountdevprocsys $@ local mntdir="$1" req=(mntdir) ckreq || return 1 sudo umount ${mntdir}/dev/pts && act "unmounted /dev/pts" && sleep 2 - sudo umount ${mntdir}/dev && act "unmounted /dev" && sleep 2 - sudo umount ${mntdir}/proc && act "unmounted /proc" && sleep 2 + sudo umount ${mntdir}/dev && act "unmounted /dev" && sleep 2 + sudo umount ${mntdir}/proc && act "unmounted /proc" && sleep 2 + sudo umount ${mntdir}/sys && act "unmounted /sys" && sleep 2 } silly() { - fn silly + fn silly $@ + local arg1="$1" + local arg2="$2" # cheers mailpile! funneh=("do not think of purple hippos" @@ -117,5 +121,5 @@ silly() { local rnd=`shuf -i1-30 -n 1` act "${funneh[$rnd]}" - [[ $1 == "sleep" ]] && sleep 4 + [[ arg1 == "sleep" ]] && sleep $arg2 } diff --git a/zlibs/imaging b/zlibs/imaging @@ -137,7 +137,7 @@ img_mount() { sudo mkdir -p ${workdir}/rootp/{boot,dev,proc,sys} sudo mount ${bootpart} ${workdir}/rootp/boot && act "mounted boot partition" - mountdevproc ${workdir}/rootp + mountdevprocsys ${workdir}/rootp } img_umount() { @@ -145,7 +145,7 @@ img_umount() { req=(bootpart rootpart workdir) ckreq || return 1 - umountdevproc ${workdir}/rootp + umountdevprocsys ${workdir}/rootp sudo umount ${workdir}/rootp/boot && act "umounted boot partition" sudo umount ${workdir}/rootp && act "umounted root partition"