Enhance first-boot script and documentation with config file support
Introduce a configuration file (`first-boot.conf`) to allow users to override default script variables without modifying the script directly. Update the first-boot script to load this config file from multiple locations, enhancing flexibility in customization. Revise documentation to guide users on how to utilize the config file for setting variables like FILE_SERVER, HOSTNAME, and PACKAGES, improving the overall user experience during first boot operations.
This commit is contained in:
@@ -4,9 +4,21 @@ This script runs once on first boot via cloud-init (see `user-data-remote-gnss.e
|
||||
|
||||
---
|
||||
|
||||
## Config file (first-boot.conf)
|
||||
|
||||
You can override script behaviour without editing `first-boot.sh` by using a **config file**. Copy `first-boot.conf.example` to `first-boot.conf`, edit the variables you need, and ensure the script can load it. The script looks for a config file in this order:
|
||||
|
||||
1. **Same directory as the script** — e.g. if you host both at `.../first-boot/first-boot.sh` and `.../first-boot/first-boot.conf`.
|
||||
2. **`/tmp/first-boot.conf`** — when run via cloud-init, add a runcmd line to download your config to `/tmp/first-boot.conf` before running the script.
|
||||
3. **`/etc/cm4-provisioning/first-boot.conf`** — for host-side or pre-written config.
|
||||
|
||||
Only set variables you want to change; the rest use built-in defaults. See `first-boot.conf.example` for all options (FILE_SERVER, HOSTNAME, PI_USER, PACKAGES, LIGHTDM_SESSION, GTK_THEME_NAME, WALLPAPER_MODE, DSI_ROTATE, SWIOTLB_SIZE, RETERMINAL_DEVICE, RETERMINAL_REPO_URL, ONESHOT_SCRIPTS, etc.).
|
||||
|
||||
---
|
||||
|
||||
## Structure (sections)
|
||||
|
||||
1. **Constants** — `FILE_SERVER`, `PI_USER`, paths, log file.
|
||||
1. **Config & constants** — Load optional `first-boot.conf`; then `FILE_SERVER`, `PI_USER`, paths, log file (defaults or from config).
|
||||
2. **Logging** — All output tee’d to `/var/log/first-boot.log`.
|
||||
3. **Helpers** — `install_oneshot(name)` downloads `${name}.sh` from the file server and installs it as a one-shot autostart (runs once at pi’s first login, then deletes itself).
|
||||
4. **Packages** — git, Chromium, wmctrl, SSH, swaybg, wlr-randr, maliit, xinput-calibrator.
|
||||
|
||||
Reference in New Issue
Block a user