setup_pi.sh¶
File: scripts/setup_pi.sh.
Run on the Raspberry Pi, from the repository root. Idempotent: run it again
after a git pull or after swapping the mainboard.
scripts/setup_pi.sh [--service] [--udev [--vid XXXX --pid XXXX]] [--skip-apt] [--dry-run]
| Option | Meaning |
|---|---|
--service |
Also install the dashboard service (systemd, starts on boot) |
--udev |
Also install the udev rule for the optional console cable |
--vid, --pid |
USB id of the console bridge (4 hex digits each). Only with --udev. Default: detect |
--skip-apt |
Do not install apt packages |
--dry-run |
Print privileged commands instead of running them |
--skip-udev |
Accepted for old scripts; ignored, since no rule is written by default |
Steps¶
- Installs
python3 python3-venv python3-pip usbutils curlif any are missing (apt,--no-install-recommends). - Creates
.venv(or reuses it) and installsrequirements.txt(the package in editable mode, plus test tools). - With
--udevonly:-
Detects the console bridge behind the printer's USB-C port with
lsusb. Known ids, first match wins:VID:PID Device 1a86:7523CH340 10c4:ea60CP210x If neither is connected it stops and asks for
--vid/--pid. It never guesses. 2. Writes/etc/udev/rules.d/99-triaina.rulesonly if the content differs, then reloads udev. The console is then/dev/triaina(screen /dev/triaina 1500000). 3. Adds the user todialoutif needed (log out and in to apply).
-
The printer's USB-C port is a console to its Linux host, not a link to the MCU, so no rule is needed for normal use.
With --service¶
- Installs
poppler-utils ghostscript potrace prusa-slicerif missing (PDF/AI/EPS and image conversion, slicing). - Creates the system user
triaina(no login shell) if missing. - Builds the triaina wheel as the invoking user (so nothing root-owned is left
in the clone), then installs it into
/opt/triaina/.venvwith--force-reinstall, so agit pullwith an unchanged version still updates the code. - Writes
/etc/triaina/config.tomlfromdeploy/config.example.tomlonly if it does not exist; an edited config is never overwritten. - Installs
deploy/triaina.serviceto/etc/systemd/system/if it changed, enables and restarts the service. - Waits up to 30 s for
http://127.0.0.1:<port>/healthz(port read from the config the same way the service reads it).
Uses script-helpers for logging when the submodule is present, and falls back to local functions when it is not.