-
Notifications
You must be signed in to change notification settings - Fork 16
[Request for comment] Support for system-level modifications in the image #22
Description
The problem
Currently the system at its base is set up in frzr-bootstrap with some key system components:
- Partition scheme
- Bootloader
- Core generic
/etc/fstab
This comes with a couple problems:
- Impossible to add persistent swap space (to support hibernation, for example)
- Impossible to change bootloader (that was an issue with some kernels that made impossible to boot UEFI mode with
syslinuxon AMD hardware)
Current state
The above issues could be worked around on a new installation by modifying bootstrap but that would mean the user needs to reinstall the whole system to apply those changes. Far from ideal and not a solution.
Proposed change
We should prepare frzr-deploy to pick up system scripts from the just installed image (let's call them "migrations") in a special place to be able to make changes in the low-level system. Those scripts are the image responsibility to be safe across different image (prior or post) versions. The scripts are run as root, must check all conditions for applying changes and should be able to revert changes if they fail not to break an installation. Reverting a image version could be supported but is not mandatory.
Example "migration"
Let's assume we want to add a persistent swap support and hibernation resume via a swap file. The script should check:
- Swap not present and not configured in
/etc/fstab - Sufficient disk space.
Then the script can create a swap file and enable it:
- Create a swap directory and file for a new btrfs subvolume.
- Create the file with appropriate size with
ddandmkswap - Add line to
/etc/fstabfor automatic swap mount - For hibernation support:
- The bootloader line should be recreated adding
resumeandresume_offsetkernel parameters - Add
resumehook in mkinicpio.conf and rebuild (this can be done in the image itself at creation)