IGconf_nm_cmds accepts a path to a file containing nmcli commands to run inside the chroot at build time, with each line passed to the shell via eval with nmcli prepended. Refer to nmcli for the upstream documentation reference.
For example, a WPA2 profile for a network named Guest Only:
nm.cmds
--offline connection add type wifi ifname wlan0 con-name "Guest Only" ssid "Guest Only" wifi-sec.auth-alg open wifi-sec.key-mgmt wpa-psk wifi-sec.psk <passphrase> connection.autoconnect-retries 0 > /etc/NetworkManager/system-connections/Guest_Only.nmconnection
|
Note
|
It’s possible to incorporate a | grep -v '^Warning' filter before the redirection to work around a known NetworkManager bug where nmcli --offline emits spurious warnings on stdout that would corrupt the keyfile.
|
Connection keyfiles are installed under /etc/NetworkManager/system-connections/. NetworkManager requires these files to be owned by root and mode 0600. The layer enforces this automatically after all commands have run.
The commands file can be supplied via different mechanisms.
Config YAML (absolute path)
nm:
cmds: /path/to/nm.cmds
Config YAML (source-relative path)
Use the ${@SRCROOT} anchor to express the path relative to the source root (the directory passed via rpi-image-gen -S):
nm:
cmds: ${@SRCROOT}/nm.cmds
Command line
$ rpi-image-gen build -S ./examples/myimage/ -c myimage.yaml -- IGconf_nm_cmds=/path/to/nm.cmds