# Network provisioning client When a reTerminal (or any Pi) has **network boot** enabled and boots over the network, it can register with the provisioning dashboard and then perform **Deploy** (pull golden image and write to eMMC) or **Backup** (read eMMC and upload to the server) when you choose the action in the dashboard. ## Flow 1. Device boots (e.g. from NFS or a minimal netboot root). 2. Run **provisioning-client.sh** with `PROVISIONING_SERVER` set to the dashboard URL (e.g. `http://:5000`). 3. The script registers (MAC + IP) and polls `GET /api/device-action-poll?mac=...`. 4. In the dashboard, the device appears under "Device detected (Network)". You click **Backup** or **Deploy**. 5. The device gets the action from the next poll: **Deploy** → it downloads `GET /api/golden-image` and runs `dd of=/dev/mmcblk0`. **Backup** → it runs `dd if=/dev/mmcblk0` and POSTs to `POST /api/backup-upload?mac=...`. ## Usage on the device ```bash export PROVISIONING_SERVER=http://192.168.1.10:5000 # dashboard URL ./provisioning-client.sh ``` - **EMMC_DEV**: override eMMC block device (default `/dev/mmcblk0`). The device must have network access to the dashboard and (for deploy) the dashboard must have `golden.img` in its provisioning directory. ## Integrating into a netboot environment - Add this script to your netboot root (e.g. NFS-mounted filesystem or initramfs). - Run it from a first-boot or default login script so that when the device boots from the network it registers and waits for an action. Optionally run it as a systemd service that starts after network is up.