# RadioRations

Headless Raspberry Pi 5 ham-radio station installer.

Built for a **Technician-class** operator using:

- Raspberry Pi 5 + Raspberry Pi OS Lite (64-bit Bookworm)
- One or two AIOC (All-In-One-Cable) + Quansheng UV-K5
- Generic USB GPS (u-blox)
- Packet / APRS / keyboard-to-keyboard / Winlink (Pat)

## What you get

| Component        | Role                                      |
|------------------|-------------------------------------------|
| Direwolf         | Software TNC (AGW + KISS); optional 2nd instance for Winlink |
| Graywolf         | Modern APRS modem + digi + iGate + web UI |
| LinBPQ           | Node + BBS + Chat over RF                 |
| Pat              | Winlink client (web UI)                   |
| gpsd + chrony    | GPS time + optional LAN NTP server        |
| udev rules       | Friendly names (`aioc-aprs`, `aioc-winlink`, `gps`) |
| rr-launcher     | APRS modem switch, Winlink TNC, logs & ports |

**APRS:** Direwolf and Graywolf share one radio — only one at a time.  
**Winlink:** A second AIOC/radio can run `direwolf-winlink` in parallel (ports 8002/8003).

## Layout

```text
RadioRations/
├── install.sh              # main entry
├── config.env.example
├── bin/
│   └── rr-launcher.sh     # end-user tool (installed to ~/)
├── configs/                # templates (udev, units, direwolf, bpq, chrony)
├── scripts/                # installer steps 01–08
└── docs/
    └── NOTES.md
```

## Quick start

```bash
git clone <your-repo-url> RadioRations
cd RadioRations
cp config.env.example config.env
nano config.env          # CALLSIGN, GRID, LAT/LON, HAM_USER, AIOC serials, …
./install.sh
```

### `config.env` — AIOC hardware (important)

Genuine **AIOC** cables all share the same USB vendor/product IDs:

| Setting | Typical value | Change it? |
|---------|---------------|------------|
| `AIOC_VID` | `1209` | **No** — leave as-is for real AIOCs |
| `AIOC_PID` | `7388` | **No** — leave as-is for real AIOCs |
| `AIOC_APRS_SERIAL` | *(your unit)* | **Yes** — unique per cable |
| `AIOC_WINLINK_SERIAL` | *(your unit)* | **Yes** — second cable (dual-radio) |

udev builds `/dev/aioc-aprs` and `/dev/aioc-winlink` from those **serials**. If serials are empty or wrong, GPS may still work but AIOC friendly names will not.

**Read serials** (AIOCs plugged in):

```bash
for d in /dev/ttyACM*; do
  echo "======== $d ========"
  udevadm info -a -n "$d" | egrep 'KERNEL==|idVendor|idProduct|serial|product' | head -12
  echo
done
```

Copy the `ATTRS{serial}=="..."` value for each AIOC (`1209` / `7388`) into `config.env`.  
To see which physical cable is which: unplug one, re-run the loop, note which serial disappeared.

GPS uses `GPS_VID` / `GPS_PID` (defaults assume a common u-blox `1546:01a7`). Change those only if `lsusb` shows a different GPS chipset.

More detail: [docs/NOTES.md](docs/NOTES.md) (*Identifying AIOC adapters*).

After install:

```bash
source ~/.bashrc         # or log out/in; reboot once for udev + groups
rr status
rr graywolf             # APRS + starts Winlink TNC if present
rr winlink              # Winlink TNC + Pat only
pat configure           # finish Winlink client identity (any callsign)
```

## Ports (default)

| Service                    | Port  |
|----------------------------|-------|
| APRS Direwolf / Graywolf AGW | 8000 |
| APRS Direwolf / Graywolf KISS | 8001 |
| Winlink Direwolf AGW       | 8002  |
| Winlink Direwolf KISS      | 8003  |
| Graywolf web               | 8080  |
| LinBPQ telnet              | 8010  |
| LinBPQ web                 | 8090  |
| Pat web                    | 8081  |
| gpsd                       | 2947  |

## Design notes

- Bash installer (no Ansible) — easy to read and share
- Personal data only in `config.env` (gitignored)
- `configs/` = system templates; `bin/` = tools you run; `scripts/` = installer phases

## Replacing or adding an AIOC

You do **not** need a new VID/PID for a replacement AIOC — only a new **serial**.

1. Read the new serial (`udevadm` loop above).
2. Update `AIOC_APRS_SERIAL` or `AIOC_WINLINK_SERIAL` in `config.env`.
3. Re-run the udev step or edit `/etc/udev/rules.d/99-ham-radio.rules`, then:
   ```bash
   sudo udevadm control --reload-rules && sudo udevadm trigger
   ls -l /dev/aioc*
   ```

Full walkthrough: **[docs/NOTES.md](docs/NOTES.md)** (*Identifying AIOC adapters*, *Updating udev after replacing an AIOC*).

## License

Use and adapt freely for amateur radio. No warranty — verify Part 97 compliance for your station and license class.

73
