Files
David YoungandClaude Opus 5.5 6c76f94ac6
check / lint-and-test (push) Successful in 2m2s
check / packages (push) Successful in 23s
Add radio, which finds radios on USB, and put you in the uucp group
`radio` lists each radio plugged into USB: its serial ports, the sound
card that came with it (the same USB device, or behind the radio's own
hub), and its model and Hamlib model number. Icoms are recognised by
their USB serial number. `radio detect --probe` asks the others with the
CAT ID; command or Icom's CI-V transceiver ID, at the usual baud rates,
on ports no other program has open; `radio probe PORT` asks one port.
It drops DTR and RTS as soon as a port opens. The radios it knows are
in radios.conf.

update.sh links ~/.local/bin/radio to the clone, unless a different
radio is already there, and adds you to uucp, which owns serial ports on
Arch. hampackremove removes the link, and takes you out of uucp only if
HamPack put you in.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 12:12:31 -07:00

85 lines
3.1 KiB
Bash
Executable File

#!/bin/bash
#
# Purpose : HamPack's smoketest health checks. Run in a test VM with HamPack
# installed; prints what it checked, and exits 1 if anything's wrong.
# The Windows applications aren't checked: the smoketest skips them.
HAMPACK_DIR="${HAMPACK_DIR:-$HOME/.local/share/siblings/HamPack}"
APPLICATIONS_DIR="$HOME/.local/share/applications"
# shellcheck source=../lib.sh
source "$HAMPACK_DIR/lib.sh"
problems=()
problem() {
echo "PROBLEM: $*"
problems+=("$*")
}
# Arch packages (or the packages providing them) and groups
packages_installed() {
local p
while read -r p; do
pacman -T "$p" > /dev/null 2>&1 || pacman -Qg "$p" > /dev/null 2>&1 || problem "package $p isn't installed"
done < <(source "$HAMPACK_DIR/packages.conf"; printf '%s\n' "${UTILITIES[@]}" "${APPLICATIONS[@]}")
echo "checked packages.conf's packages"
}
flatpaks_installed() {
local id
while read -r id; do
flatpak info "$id" > /dev/null 2>&1 || problem "Flatpak $id isn't installed"
done < <(source "$HAMPACK_DIR/packages.conf"; printf '%s\n' "${FLATPAKS[@]}")
echo "checked packages.conf's Flatpaks"
}
# True if FILE is an ELF binary
is_elf() {
[ "$(head -c 4 "$1" 2> /dev/null | tail -c 3)" = ELF ]
}
# parse_conf callback for binaries.conf and compile.conf: the app is where it
# should be, at the version in the conf, with every library it links to, and
# with its desktop file
check_app() {
local app="${CONF[_name]}" path recorded missing desktop=""
path="$(expand_vars "${CONF[install]}")"
if [ ! -e "$path" ]; then
problem "$app isn't installed at $path"
return
fi
recorded="$(get_recorded_version "$app")"
[ "$recorded" = "${CONF[version]}" ] \
|| problem "$app is recorded at version ${recorded:-(none)}, not ${CONF[version]}"
if is_elf "$path"; then
missing="$(ldd "$path" 2> /dev/null | grep 'not found')"
[ -z "$missing" ] || problem "$app can't find libraries: $(echo "$missing" | awk '{print $1}' | tr '\n' ' ')"
fi
if [ -n "${CONF[desktop]}" ]; then
desktop="$APPLICATIONS_DIR/$(basename "$(expand_vars "${CONF[desktop]}")")"
elif [ "$1" = binary ] && [ "${CONF[gui]}" = true ]; then
desktop="$APPLICATIONS_DIR/$app.desktop"
fi
[ -z "$desktop" ] || [ -f "$desktop" ] || problem "$app has no desktop file at $desktop"
echo "checked $app"
}
check_binary() { check_app binary; }
check_compiled() { check_app compiled; }
packages_installed
flatpaks_installed
parse_conf "$HAMPACK_DIR/binaries.conf" check_binary
parse_conf "$HAMPACK_DIR/compile.conf" check_compiled
systemctl is-enabled --quiet graywolf 2> /dev/null || problem "graywolf's service isn't enabled"
uv tool list 2> /dev/null | grep -q '^not1mm ' || problem "not1mm isn't installed"
[ -f "$APPLICATIONS_DIR/k6gte-not1mm.desktop" ] || problem "not1mm has no desktop file"
[ -x "$HOME/.local/bin/hampackremove" ] || problem "hampackremove isn't installed"
"$HOME/.local/bin/radio" help > /dev/null 2>&1 || problem "radio isn't installed"
echo "checked graywolf's service, not1mm, hampackremove and radio"
if (( ${#problems[@]} > 0 )); then
echo "${#problems[@]} problem(s)"
exit 1
fi
echo "HamPack is healthy"