agama/live/live-root/usr/lib/dracut/modules.d/99initrd-nmtui/initrd-nmtui-cmdline.sh
Ladislav Slezák f9da98ee9f
feat(live): Added new boot option "live.net_config_tui=1" (#2923)
## Problem

- Manual network configuration using the dracut boot options is not easy

## Solution

- Added new boot option `live.net_config_tui=1` to interactively
configure network settings using the `nmtui` tool.
- Additional features:
  - Allow configuring the HTTP proxy
  - Display the network configuration summary
- Added network test button which tries connecting to www.suse.com to
check that the network setup is correct.

## Testing

- Tested manually

## Notes

- It turned out that configuring the Wifi network is not possible
because the drivers are missing in the initrd. In theory after adding
the Wifi drivers (and firmware if required) it should be possible to
configure also the Wifi cards and use them for downloading the
self-updates.

## Screenshots

The initial summary screen:
<img width="1280" height="800" alt="agama-net-config-summary-devices"
src="https://github.com/user-attachments/assets/35ab0b0e-6907-4c9b-b60d-b3e2fc04ccde"
/>


After pressing "Edit" button the `nmtui` tool is started
<img width="1280" height="800" alt="agama-net-config-edit"
src="https://github.com/user-attachments/assets/5cbc7a82-8a7e-46b1-8e8e-0a43af2554c9"
/>

Then the user is asked to optionally configure the HTTP proxy:
<img width="1280" height="800" alt="agama-net-config-proxy"
src="https://github.com/user-attachments/assets/bd2fac93-a908-406f-87c9-7016e622b721"
/>

Then the summary dialog is displayed again. After pressing the "Test
connection" button a request to `https://www.suse.com` is sent and the
result is displayed on the screen:
<img width="1280" height="800" alt="agama-net-config-test"
src="https://github.com/user-attachments/assets/ba49d61e-295c-48f7-a421-d8a7241a0974"
/>

When the "Continue" button is pressed in the summary the boot process
continues as usually.

A proof that the configured network proxy is used in the self-update
step later:
<img width="1280" height="800" alt="nmtui7"
src="https://github.com/user-attachments/assets/476e54db-4f4d-480b-964c-b0b0009397af"
/>
2026-01-09 16:08:10 +01:00

20 lines
531 B
Bash
Executable file

#!/bin/bash
# automatically configure network and start NetworkManager when live.net_config_tui=1
. /lib/dracut-lib.sh
# generate Dracut command line options
FILE="/etc/cmdline.d/initrd-nmtui.conf"
# only if interactive network config requested
if getargbool 0 live.net_config_tui; then
# and network not disabled
if getargbool 1 rd.neednet; then
echo "rd.neednet=1" >"$FILE"
# use DHCP if there is no network configuration provided by user
if ! getarg "ip="; then
echo "ip=dhcp" >>"$FILE"
fi
fi
fi