Hello everyone,
I’m sharing the WIP project on the off chance it’s interesting/useful to someone.
What
This installer written in OCaml allows installing Arch Linux with optional disk encryption (where all key files placements, boot parameters adjustment etc are adjusted for you). The installer aims to be somewhat smart and hassle free to use.
Right now
- It recognises whehter your Arch Linux live CD is running in BIOS or EFI mode, and adjusts prompts/partitioning accordingly (not technically difficult at all, but just so you know it does that)
- Handles optional disk encryption, with encrypted boot (haven’t added code for toggling boot partition encryption yet)
- Allows two disk layout schemes atm
-
- use a single disk, installer does partitioning for you
-
- you tell installer partitions for
/
,/boot
and/efi
if in EFO mode, and installer use those info instead
- you tell installer partitions for
-
WIP
- Installation of SaltStack files (for package management) and other helper scripts
- Section below gives more context on these things
TODO
- Resumable installation (add logging etc)
- Static config file support (so installation is fully automated)
- Add disk layout scheme where it’s system partition + USB key
- Whatever is missing from the original script
- Travis CI (or other CI) builds for static binary to published on GitHub release
- So one can download the installer directly instead of building it locally first
Context
This installer is essentially a rewrite of the install script I’ve been using for a while.
I especially needed an semi-automated solution to installing Arch Linux as I was using a encrypted USB key + encrypted system partition setup, where manual installation is error prone and time consuming.
The install script was thus born, written in bash, accompanied by salt files for package management, and various helper scripts for easier handling of the USB key in day-to-day operations.
This is all fine and dandy until I wanted to have different disk layout, and pick whether I want encryption or not. Bash script is not terribly good for these somewhat decision/logic heavy tasks for obvious reasons.
And so rewrite in OCaml began, and stuck with OCaml even after considering various other choices (e.g. elvish, xonsh, fish, python, racket).
Intention
The code aims to facilitate customisation (make a copy and adjust things your way) by providing a sane starting point, but does not aim to provide a proper “library” type of code base due to the somewhat volatile nature of Arch, and assumptions made may not be directly portable to other distros.
Navigation
-
scripts/
-
setup.sh
is the original bash installer script, which this installer is based on - remaining files are helpers, and misc scripts
-
-
saltstack/
- SaltStack files for package management
-
installer_ml/
contains the OCaml installer code-
src/
-
installer.ml
somewhat show cases the intended high level use, the install workflow is specified here -
disk_layout.ml
handles formatting, LUKS setup, mounting, unmounting of partitions etc -
task_book.ml
facilitates high level task registration, used ininstaller.ml
- remainders are helper code largely
-
-
TL;DR
I wrote a Arch installer in OCaml, thought it’s pretty neat.
EDIT: Added missing Travis CI item in TODO