documentation updates

This commit is contained in:
parazyd 2016-06-08 21:54:15 +02:00
parent 695e767a14
commit dd6f741ed6
No known key found for this signature in database
GPG Key ID: F0CB28FCF78637DE
3 changed files with 34 additions and 15 deletions

View File

@ -25,8 +25,10 @@ Unpack the tarball of a base working system to the strapdir.
# zlibs/imaging # zlibs/imaging
## img_mkimage() ## ## img_mkimage()
Uses dd to dump zeroes into a raw .img of the preconfigured size. 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() ## ## img_partition_dos() ##
Partitions the raw image into dos format and formats (boot=ext2; root=ext4) 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() ## ## img_partition_gpt() ##
Partitions the raw image into gpt format and formats (boot=ext2; root=ext4) 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() ## ## img_mount() ##
Mounts the root and boot partitions in `$workdir/rootp` in order to work on it. 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 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. is then kpartx-ed to give us partitions we can mount.
## mountdevproc() ## mountdevprocsys()
Mounts `/dev`, `/dev/pts`, and `/proc` where needed. Takes one argument, which Mounts `/sys`, `/dev`, `/dev/pts`, and `/proc` where needed. Takes one argument, which
is the path containing those. ex: is the path containing those. ex:
``` ```
mountdevproc /path/to/bootstrapped/chroot mountdevproc /path/to/bootstrapped/chroot
``` ```
## umountdevproc() ## umountdevprocsys()
Does the opposite of `mountdevproc`. Does the opposite of `mountdevprocsys`.
## silly() ## silly()
Because NSA Because NSA
@ -72,6 +81,12 @@ Because NSA
NOTE: everything is printed to stdout. Pipe or redirect if you want to write on NOTE: everything is printed to stdout. Pipe or redirect if you want to write on
storage. 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() ## conf_print_debconf()
Prints out the config for console-common setup Prints out the config for console-common setup

View File

@ -57,30 +57,34 @@ findloopmapp() {
popd popd
} }
mountdevproc() { mountdevprocsys() {
fn mountdevproc $@ fn mountdevprocsys $@
local mntdir="$1" local mntdir="$1"
req=(mntdir) req=(mntdir)
ckreq || return 1 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 -t proc proc ${mntdir}/proc && act "mounted /proc"
sudo mount -o bind /dev ${mntdir}/dev && act "mounted /dev" sudo mount -o bind /dev ${mntdir}/dev && act "mounted /dev"
sudo mount -o bind /dev/pts ${mntdir}/dev/pts && act "mounted /dev/pts" sudo mount -o bind /dev/pts ${mntdir}/dev/pts && act "mounted /dev/pts"
} }
umountdevproc() { umountdevprocsys() {
fn umountdevproc $@ fn umountdevprocsys $@
local mntdir="$1" local mntdir="$1"
req=(mntdir) req=(mntdir)
ckreq || return 1 ckreq || return 1
sudo umount ${mntdir}/dev/pts && act "unmounted /dev/pts" && sleep 2 sudo umount ${mntdir}/dev/pts && act "unmounted /dev/pts" && sleep 2
sudo umount ${mntdir}/dev && act "unmounted /dev" && sleep 2 sudo umount ${mntdir}/dev && act "unmounted /dev" && sleep 2
sudo umount ${mntdir}/proc && act "unmounted /proc" && sleep 2 sudo umount ${mntdir}/proc && act "unmounted /proc" && sleep 2
sudo umount ${mntdir}/sys && act "unmounted /sys" && sleep 2
} }
silly() { silly() {
fn silly fn silly $@
local arg1="$1"
local arg2="$2"
# cheers mailpile! # cheers mailpile!
funneh=("do not think of purple hippos" funneh=("do not think of purple hippos"
@ -117,5 +121,5 @@ silly() {
local rnd=`shuf -i1-30 -n 1` local rnd=`shuf -i1-30 -n 1`
act "${funneh[$rnd]}" act "${funneh[$rnd]}"
[[ $1 == "sleep" ]] && sleep 4 [[ arg1 == "sleep" ]] && sleep $arg2
} }

View File

@ -137,7 +137,7 @@ img_mount() {
sudo mkdir -p ${workdir}/rootp/{boot,dev,proc,sys} sudo mkdir -p ${workdir}/rootp/{boot,dev,proc,sys}
sudo mount ${bootpart} ${workdir}/rootp/boot && act "mounted boot partition" sudo mount ${bootpart} ${workdir}/rootp/boot && act "mounted boot partition"
mountdevproc ${workdir}/rootp mountdevprocsys ${workdir}/rootp
} }
img_umount() { img_umount() {
@ -145,7 +145,7 @@ img_umount() {
req=(bootpart rootpart workdir) req=(bootpart rootpart workdir)
ckreq || return 1 ckreq || return 1
umountdevproc ${workdir}/rootp umountdevprocsys ${workdir}/rootp
sudo umount ${workdir}/rootp/boot && act "umounted boot partition" sudo umount ${workdir}/rootp/boot && act "umounted boot partition"
sudo umount ${workdir}/rootp && act "umounted root partition" sudo umount ${workdir}/rootp && act "umounted root partition"