diff --git a/README.md b/README.md index a830db6..ae4c8e7 100644 --- a/README.md +++ b/README.md @@ -44,11 +44,41 @@ Applications are pinned to tested versions, which we try to keep up with. Pinned - POTACAT: POTA spot aggregator with CAT control and logging - JS8Call (JS8Call-improved): keyboard-to-keyboard HF messaging - Graywolf: APRS transceiver and gateway, run as a systemd service +- xara: VARA-compatible HF/FM modem that runs natively on Linux (see below) +- xara: VARA-compatible HF/FM modem that runs natively on Linux (see below) **Pre-built downloads** (`binaries.conf`, each checked against its SHA-256): ardopcf (ARDOP modem), Paracon (packet terminal) and dx.py (DX cluster client). **Others:** not1mm (contest logger, installed with `uv`), and VARA HF, VARA FM, VARA Terminal and Winlink Express under Wine. The Windows installers need you to click through them, so they run only when one of these is missing and you're at the desktop. +### xara: VARA without Wine + +[xara](https://github.com/x0rro/xara) is an open source (MIT) modem that is compatible with VARA HF and FM over the air, so it can connect to VARA RMS gateways and other VARA stations. It listens on VARA's ports (8300 and 8301), so Pat, which HamPack also installs, uses it like VARA. HamPack installs it alongside VARA under Wine so you can try it; both use port 8300, so run one at a time. + +xara is new (0.1.x), so keep VARA around until it has worked well for you. HamPack builds it without the "registered" feature, which would unlock the speeds of paid VARA without a VARA license. + +To set it up: + +1. Edit `~/.config/xara/xara.conf`: set `call`, `hf` (or `fm`), your sound card (`xara --list-devices` lists them), and `radio` and `ptt` to transmit. The comments in the file explain each setting. +2. Start it by hand with `xara`, or as a user service with `systemctl --user enable --now xara`. +3. In Pat, use the VARA HF transport, e.g. `pat connect varahf:///GATEWAYCALL`, or pick VARA HF in `pat http`. Pat's VARA transports point at localhost:8300 by default, so there's nothing to configure. + +`xara-monitor` is also installed: a passive VARA HF monitor with its own web UI. + +### xara: VARA without Wine + +[xara](https://github.com/x0rro/xara) is an open source (MIT) modem that is compatible with VARA HF and FM over the air, so it can connect to VARA RMS gateways and other VARA stations. It listens on VARA's ports (8300 and 8301), so Pat, which HamPack also installs, uses it like VARA. HamPack installs it alongside VARA under Wine so you can try it; both use port 8300, so run one at a time. + +xara is new (0.1.x), so keep VARA around until it has worked well for you. HamPack builds it without the "registered" feature, which would unlock the speeds of paid VARA without a VARA license. + +To set it up: + +1. Edit `~/.config/xara/xara.conf`: set `call`, `hf` (or `fm`), your sound card (`xara --list-devices` lists them), and `radio` and `ptt` to transmit. The comments in the file explain each setting. +2. Start it by hand with `xara`, or as a user service with `systemctl --user enable --now xara`. +3. In Pat, use the VARA HF transport, e.g. `pat connect varahf:///GATEWAYCALL`, or pick VARA HF in `pat http`. Pat's VARA transports point at localhost:8300 by default, so there's nothing to configure. + +`xara-monitor` is also installed: a passive VARA HF monitor with its own web UI. + ### Graywolf's web UI Graywolf's web UI is at http://localhost:8080 and, by default, can only be reached from the machine it runs on. To reach it from other machines, run `sudo systemctl edit graywolf` and override `ExecStart` with `-http 0.0.0.0:8080`. Changes made that way survive HamPack updates; edits to `/etc/systemd/system/graywolf.service` itself don't. diff --git a/compile.conf b/compile.conf index 8e9730a..ff64041 100644 --- a/compile.conf +++ b/compile.conf @@ -96,3 +96,14 @@ version=0.14.14 git=https://github.com/chrissnell/graywolf.git install=$HOME/.local/bin/graywolf steps=make all, install -m 755 bin/graywolf $HOME/.local/bin/graywolf, install -m 755 bin/graywolf-modem $HOME/.local/bin/graywolf-modem + +# VARA-compatible HF/FM modem, native on Linux; an alternative to VARA under +# Wine (both use port 8300, so run one at a time). Built without the +# "registered" feature, which unlocks paid-VARA speeds without a license. +# Installs the user service but doesn't enable it: set up +# ~/.config/xara/xara.conf first (see the README) +[xara] +version=0.1.3 +git=https://github.com/x0rro/xara.git +install=$HOME/.local/bin/xara +steps=cargo build --release --locked -p xara, mkdir -p stage$HOME/.local/bin stage$HOME/.local/share/man/man1 stage$HOME/.config/systemd/user stage/etc/udev/rules.d, install -m 755 target/release/xara target/release/xara-monitor stage$HOME/.local/bin/, install -m 644 dist/man/xara.1 dist/man/xara-monitor.1 stage$HOME/.local/share/man/man1/, sed "s|/usr/bin/xara|$HOME/.local/bin/xara|" dist/systemd/xara.service > stage$HOME/.config/systemd/user/xara.service, install -m 644 dist/udev/60-xara-ptt.rules stage/etc/udev/rules.d/, install_staged stage, sudo udevadm control --reload-rules, systemctl --user daemon-reload || true, mkdir -p $HOME/.config/xara, cp -n dist/xara.conf.example $HOME/.config/xara/xara.conf diff --git a/hampackremove b/hampackremove index e3fe02b..e8c2bca 100755 --- a/hampackremove +++ b/hampackremove @@ -215,12 +215,18 @@ start_sudo_keepalive || exit 1 echo "Removing graywolf systemd service..." remove_graywolf_service +if [ -f "$HOME/.config/systemd/user/xara.service" ]; then + echo "Stopping xara..." + systemctl --user disable --now xara 2> /dev/null +fi + echo "Removing installed applications..." remove_manifests parse_conf "$HAMPACK_DIR/binaries.conf" remove_binary_app parse_conf "$HAMPACK_DIR/compile.conf" remove_compiled_app remove_unrecorded_build_files sudo udevadm control --reload-rules +systemctl --user daemon-reload 2> /dev/null echo "Removing HamPack scripts..." rm -f "$BIN"/hampackrefresh "$BIN"/hampackupdate "$BIN"/hampackcheck "$BIN"/hampack @@ -259,3 +265,6 @@ rm -rf "$HAMPACK_DIR" echo "" echo "HamPack has been removed." +if [ -d "$HOME/.config/xara" ]; then + echo "Your xara settings are still in ~/.config/xara; delete them if you don't need them." +fi diff --git a/packages.conf b/packages.conf index 887a515..45dd0f2 100644 --- a/packages.conf +++ b/packages.conf @@ -3,6 +3,7 @@ # Ham utilities UTILITIES=( + alsa-lib # xara alsa-utils aria2 at-spi2-core @@ -23,6 +24,7 @@ UTILITIES=( libkiwix libtorrent-rasterbar libnotify + libpulse # xara libsecret libxcrypt-compat libxtst @@ -51,6 +53,12 @@ UTILITIES=( zimwriterfs ) +# Builds xara. Installed only if there's no cargo yet: rustup users already +# have one, and Arch's rust package conflicts with rustup +RUST_TOOLCHAIN=( + rust +) + # Ham applications APPLICATIONS=( chattervox-bin diff --git a/tests/hampackremove.bats b/tests/hampackremove.bats index e77b193..3eb133a 100644 --- a/tests/hampackremove.bats +++ b/tests/hampackremove.bats @@ -91,3 +91,13 @@ remove() { [ -e "$FAKE_PACMAN_DB/fldigi" ] [ -d "$SIBLING" ] } + +@test "stops xara's user service and keeps the user's xara settings" { + mkdir -p "$HOME/.config/systemd/user" "$HOME/.config/xara" + touch "$HOME/.config/systemd/user/xara.service" "$HOME/.config/xara/xara.conf" + remove + [ "$status" -eq 0 ] + grep -qx "systemctl --user disable --now xara" "$STUB_LOG" + [ -f "$HOME/.config/xara/xara.conf" ] + [[ "$output" == *"xara settings are still in ~/.config/xara"* ]] +} diff --git a/tests/update.bats b/tests/update.bats index 86ca2e2..30258f1 100644 --- a/tests/update.bats +++ b/tests/update.bats @@ -96,3 +96,22 @@ setup() { [[ "$output" == *"errors in: Installing Flatpak applications"* ]] grep -qx "uv tool install not1mm" "$STUB_LOG" } + +@test "rust is installed for xara only when there's no cargo" { + stub cargo 'exit 0' + run bash "$REPO/update.sh" + [ ! -e "$FAKE_PACMAN_DB/rust" ] + + # A PATH with everything but cargo + local nocargo="$BATS_TEST_TMPDIR/nocargo" dir f + mkdir -p "$nocargo" + rm "$STUB_DIR/cargo" + for dir in /usr/local/bin /usr/bin; do + for f in "$dir"/*; do + [ "$(basename "$f")" = cargo ] || ln -sf "$f" "$nocargo/" 2> /dev/null + done + done + PATH="$STUB_DIR:$nocargo" run bash "$REPO/update.sh" + [ -e "$FAKE_PACMAN_DB/rust" ] + grep -qx rust "$HAMPACK_STATE/installed-packages" +} diff --git a/tests/xara.bats b/tests/xara.bats new file mode 100644 index 0000000..cd34fa2 --- /dev/null +++ b/tests/xara.bats @@ -0,0 +1,68 @@ +#!/usr/bin/env bats +# +# The xara entry in compile.conf, built from a fake upstream with cargo stubbed + +load helpers + +setup() { + setup_fake_home + # A fake xara repo with the files the build steps use, tagged like upstream + UPSTREAM="$BATS_TEST_TMPDIR/xara" + mkdir -p "$UPSTREAM"/dist/{man,systemd,udev} + touch "$UPSTREAM"/dist/man/xara.1 "$UPSTREAM"/dist/man/xara-monitor.1 + printf '[Service]\nExecStart=/usr/bin/xara --config %%E/xara/xara.conf\n' > "$UPSTREAM/dist/systemd/xara.service" + echo '# udev' > "$UPSTREAM/dist/udev/60-xara-ptt.rules" + echo '#call = YOURCALL' > "$UPSTREAM/dist/xara.conf.example" + git -C "$UPSTREAM" init -q + git -C "$UPSTREAM" add -A + git -C "$UPSTREAM" -c user.email=t@t -c user.name=t commit -q -m init + git -C "$UPSTREAM" tag v0.1.3 + + # The real compile.conf entry, pointed at the fake repo + export HAMPACK_COMPILE_CONF="$BATS_TEST_TMPDIR/compile.conf" + sed -n '/^\[xara\]/,/^$/p' "$REPO/compile.conf" \ + | sed "s|^git=.*|git=file://$UPSTREAM|" > "$HAMPACK_COMPILE_CONF" + + stub cargo 'mkdir -p target/release && echo xara > target/release/xara && echo monitor > target/release/xara-monitor' +} + +@test "xara is built without the registered feature" { + ! sed -n '/^\[xara\]/,/^$/p' "$REPO/compile.conf" | grep '^steps=' | grep -q registered +} + +@test "first install builds xara and installs it, its service and its config" { + run bash "$REPO/install-compiled.sh" + [ "$status" -eq 0 ] + grep -qx "cargo build --release --locked -p xara" "$STUB_LOG" + [ -x "$HOME/.local/bin/xara" ] + [ -x "$HOME/.local/bin/xara-monitor" ] + [ -f "$HOME/.local/share/man/man1/xara.1" ] + grep -qx "ExecStart=$HOME/.local/bin/xara --config %E/xara/xara.conf" "$HOME/.config/systemd/user/xara.service" + grep -q "^sudo cp -P --remove-destination .*/etc/udev/rules.d/60-xara-ptt.rules /etc/udev/rules.d/60-xara-ptt.rules$" "$STUB_LOG" + [ "$(cat "$HOME/.config/xara/xara.conf")" = "#call = YOURCALL" ] + grep -qx "$HOME/.local/bin/xara" "$HAMPACK_STATE/manifests/xara" + grep -qx "/etc/udev/rules.d/60-xara-ptt.rules" "$HAMPACK_STATE/manifests/xara" + grep -qx "xara=0.1.3" "$HAMPACK_STATE/.installed_versions" + # The service is installed but not enabled: it needs a callsign first + ! grep -q "systemctl --user enable" "$STUB_LOG" +} + +@test "a rebuild keeps the user's xara.conf" { + bash "$REPO/install-compiled.sh" + echo "call = N0CALL" > "$HOME/.config/xara/xara.conf" + sed -i 's/^version=.*/version=0.1.4/' "$HAMPACK_COMPILE_CONF" + git -C "$UPSTREAM" tag v0.1.4 + run bash "$REPO/install-compiled.sh" + [ "$status" -eq 0 ] + grep -qx "xara=0.1.4" "$HAMPACK_STATE/.installed_versions" + [ "$(cat "$HOME/.config/xara/xara.conf")" = "call = N0CALL" ] +} + +@test "a later update with xara current doesn't rebuild it" { + bash "$REPO/install-compiled.sh" + : > "$STUB_LOG" + run bash "$REPO/install-compiled.sh" + [ "$status" -eq 0 ] + [[ "$output" == *"xara 0.1.3 is up to date"* ]] + ! grep -q "^cargo " "$STUB_LOG" +} diff --git a/update.sh b/update.sh index 0975645..d08c0d0 100644 --- a/update.sh +++ b/update.sh @@ -65,6 +65,9 @@ install_hampack_packages() { source "$SELF/packages.conf" local pkg missing=() added=() status=0 + command -v cargo &> /dev/null && RUST_TOOLCHAIN=() + UTILITIES+=("${RUST_TOOLCHAIN[@]}") + for pkg in "${UTILITIES[@]}" "${APPLICATIONS[@]}"; do is_installed "$pkg" || missing+=("$pkg") done