Design/Interface: The provisioning process is divided into three phases: 1) pre-chroot (2 hardcoded scripts that is executed in order) - disk and filsystem preparation (1_provision_fs.sh) - installation of base system (unzipping stage3) (2_install_system.sh) 2) during chroot (executes an arbitraty amount of scripts arranged by the number indicated in filename) - Running all of Gentoo-specific things (portage prep, timezone, profile setting)
Assumptions:
- The provisioning process assumes that you can chroot into the device. This simplifies the design for my peanut brain.
Question marks/ possible additional learning points:
- Bootable disk creation
- dd works but it takes up the whole drive and putting it in one partition doesnt work
- Rufus does it as I expect (1 bootable partition and the rest for data like provisioning scripts)
- Manual steps when it comes to provisioning the device
- BIOS setup (like making it boot into the USB instead of the out-of-the-box OS)
- Required post-creation steps
- efibootmgr clean up. What if there is already an efiboot entry for the out-of-the-box OS.
Improvements:
- put /etc/portage as part of source control. Maybe it's own git repo?
- For configuration setup a config.json or config.toml or config.yaml (which ever you prefer) to configure input for the scripts. Maybe a good naming convention would be PYCONF_* PYCONF_TARGET_DRIVE PYCONF_ROOT_PARTITION It might be a bit complicated for now, park it. 1) Phase 1 install root 2) Phase 2 configure system chroot
- Distcc fun. Include cross compilation.
Also, think about making ths whole process reproducible. Possible routes:
- Using a fixed stage3 and version controlled portage repo (/var/db/repos/gentoo)
- Creating a stage 4 image (will likely need a bigger bootstrap drive)
TODO:
- hardcorded shits (/etc/fstab, mount points /dev/nvme vs /dev/sda)
- Hard coded to have 3 partitions for /efi, root, and swap.
- Kernel version is automatically selected. Maybe improve this when we decide root build kernel from source.
- Create a profiles flag so different profiles can be documented
- Support possible profile scripts so that different types of devices can be automatically provisioned
- Types of machines so far: personal, rpi3b+, rpi5, un100d, another personal machine.
- Support for possible chrooting on another machine so provisioning is easier
- this will mean creating a post-provisioning script that will be run on first startup.
- cleanup is missing.