devuan-desktop/helpers.md

5.8 KiB

helper functions

These functions focus on the installation of devuan directly to disk using the zfs filesystem as the root fs.

you can find these blend helper functions in blends/${blend_name}/helpers.

additional or overridden helper functions to add or test functionality or workarounds specific to the blend to avoid changes to the sdk.

build_metal_dist()

defines the sequence of calls that will result in a devuan install with root and boot zfs to one or two disks (mirrored) using either grub-pc or grub-efi to boot.

blend_bootstrap_setup()

  • Overide the post 'debootstrap stage 2' placeholder function of zlib/debootstrap bootstrap_complete_base.
  • The default is return 0

install-custdebs()

Override the helper function:

  • takes the 'apt-get -f' out of the loop so that dependency provided by other debs can be resolved.
  • inside the loop it just uninstalls the deb because of unfullfilled deps.

install-deb-from-dsc() : WIP

  • In the style of install-custdebs above but building from the source package using dsc
  • takes a list of package names, looks up the corresponding dsc using it to build and install.

install-deb-from-git_gbp() : WIP

  • take a list of package names and for each select the appropriate salsa/devuan git repo
  • pull in sources, build using gbp
  • place the resulting debs in the custdebs location.

install-custscripts()

Added function:

  • In the style of install-custdebs above but for a collection of arbitrary scripts placed in a directory alongside the blend custom debs called automate.
  • The scripts are copied from the blends scripts directory to extra/custom-scripts in blend_preinst() above.
  • Called after install-customdebs because some need checkinstall which disappears from archives.

install_custom_uname()

A helper script with a HEREDOC that outputs a script that mimics uname in its switches and outputs but whose values are derived from the blend, config files and the board file from the devuan arm-sdk. This allows this uname to provide the correct values in a chroot for programs like dkms.

  • places the script in /usr/local/bin
  • sets the script as executable

remove_custom_uname()

  • removes the script from /usr/local/bin

add-user()

Override the helper function:

  • Allow an alternative skel directory

enable_apt-proxy()

disable_apt-proxy()

bootstrap_cpio_unpack()

Overide the sdk version of this function to prevent deletion prior to unpacking the cpio as we have mountpoints in place.

image_partition_disk_zfs()

  • partition available disks using sgdisk

image_format_partitions()

If efi is used format the efi partition to fat32

image_format_partitions_zfs()

  • format the efi partions to fat32
  • make the swap partitions
  • create the zfs root and boot pools

image_connect_raw()

  • change partition numbers from p1 and p2 to p4 p5 for rockchip layout.
  • get UUID for The loop device and partitions.
  • add a symlink to /dev/disk-by/uuid for the loopback device.

image_disconnect_raw()

  • disconnect raw image from loop device.
  • unmount root and boot partitions if mounted.
  • remove the loop device.
  • remove the symlinks in /dev/disk-by/uuid

use_swap_partition()

  • calls swapon on the new swap partitions

image_zfs_mount()

  • mounts the zfs pools to the bootstrap directory
  • mounts the efi partition to the bootstrap /boot
  • mounts dev proc and sys

image_zfs_umount()

  • the reverse of image_zfs_mount

get_selections()

  • gets dpkg selections and places three files in /var/tmp:
  • /var/tmp/packages.list
  • /var/tmp/pkgs_auto.lst
  • /var/tmp/pkgs_manual.lst

set_selections()

uses three files to replicate the installed packages of another system.

  • /var/tmp/packages.list
  • /var/tmp/pkgs_auto.lst
  • /var/tmp/pkgs_manual.lst

enablessh()

this function will allow a root or user login in the bootstrapped root using:

  • ssh-copy-id default@192.168.1.x

install_kernel_headers()

could go in blends/devuan-desktop-live/config $extra_packages and remove headers in blends/devuan-desktop-live/chimaera/config $purge_packages

install_zfs()

installs zfs and supporting packages and sets some parameters.

install_grub()

installs grub related packages, configures and runs the approprate grub for the install type pc or efi.

image_raw_mount()

mounts the raw image and the boot partition under $workdir/mnt and $workdir/mnt/boot.This Override also mounts The defines partition under $workdir/mnt/boot/efi or $workdir/mnt/boot/grub

image_raw_umount()

umounts The workdir mounts of the image_raw_mount function.

rsync_to_image()

rsync's the strapdir to the $workdir/mnt created arbitrary image_raw_mount This Override removes The mount/umount from the function so they can be called before and after and operations that require a mounted system. In addition the tar_strapdirs so time consuming that it needs its own line in the wrapper sequence so that it can be disabled separately.

update_package()

takes a package name and checks the current version against the candidate, backports or experimental versions if enabled and installs the latest.

  • returns $debian_package_candidate_version

get_zfs_supported_kernel_version()

zsh versions don't alway support available kernels so we discover the latest zfs version available, install it and return the latest kernel it supports. The setting of gitbranch needs to be done with the strapdir available.

populate_schroot_custom_config()

Uses the conf_print function in blends sysconf_schroot to create the custom schroot config file.

Remove the with:

remove_schroot_entry()

remove_schroot_config_dir()

Create or remove a separate chroot suitable for build debian packages for use in the main image.

create_sbuild_chroot()

remove_sbuild_chroot()

create_sbuild_zfs_chroot()

remove_sbuild_zfs_chroot()

create_sbuild_btrfs_chroot()

remove_sbuild_btrfs_chroot()