first commit

This commit is contained in:
David Young
2026-03-24 08:56:25 -06:00
commit e7fb83438c
8 changed files with 614 additions and 0 deletions

5
README.md Normal file
View File

@@ -0,0 +1,5 @@
A collection of Ham Radio server utilities to transform CoreServer machines in to Ham Radio servers.
```
wget -qO- https://gitea.young.computer/david/hampackserver/raw/branch/main/install.sh | bash
```

40
compile.conf Normal file
View File

@@ -0,0 +1,40 @@
[QtTermTCP]
version=0.1
wget=http://www.cantab.net/users/john.wiseman/Downloads/QtTermSource.zip
install=$HOME/.local/bin/QtTermTCP
gui=true
steps=qmake, make, mv QtTermTCP $HOME/.local/bin/
[Kiwix-Desktop]
version=2.75.1
git=https://github.com/kiwix/kiwix-desktop.git
install=/usr/local/bin/kiwix-desktop
steps=/usr/lib/qt6/bin/qmake, make, sudo make install
[Kiwix-Tools]
version=3.8.2
git=https://github.com/kiwix/kiwix-tools.git
install=/usr/local/bin/
steps=meson setup build, ninja -C build, sudo ninja -C build install
[Dump1090]
version=1.0.0
git=https://github.com/antirez/dump1090.git
install=$HOME/.local/bin/dump1090
steps=make, mv dump1090 $HOME/.local/bin/dump1090
[yaac]
version=1.0.0
wget=https://www.ka2ddo.org/ka2ddo/YAAC.zip
install=$HOME/.local/bin/yaac/YAAC.jar
desktop=$HOME/.local/share/HamPack/desktop/yaac.desktop
gui=true
steps=rm -rf $HOME/.local/bin/yaac, mkdir -p $HOME/.local/bin/yaac, mv /tmp/hampack-build/yaac $HOME/.local/bin/yaac
[potacat]
version=1.1.1
git=https://github.com/Waffleslop/POTACAT.git
install=$HOME/.local/bin/POTACAT.AppImage
desktop=$HOME/.local/share/HamPack/desktop/potacat.desktop
gui=true
steps=bash $HOME/.local/share/HamPack/patch-potacat.sh, npm install, npm run dist:linux, mv dist/*.AppImage $HOME/.local/bin/POTACAT.AppImage

316
install-compiled.sh Executable file
View File

@@ -0,0 +1,316 @@
#!/bin/bash
#
# Purpose : Compile and install applications from compile.conf
CONF_FILE="$HOME/.local/share/HamPack/compile.conf"
TMP_DIR="/tmp/hampack-build"
VERSION_FILE="$HOME/.local/state/HamPack/.installed_versions"
# Get the installed version of an app
get_installed_version() {
local app="$1"
local gui="$2"
# Skip --version check for GUI apps as it would launch them
if [ "$gui" != "true" ]; then
if command -v "$app" &> /dev/null; then
local ver
ver=$("$app" --version 2>&1 | grep -oP '\d+\.\d+[\.\d]*' | head -n1)
if [ -n "$ver" ]; then
echo "$ver"
return
fi
fi
fi
# Fall back to version file
if [ -f "$VERSION_FILE" ]; then
local stored
stored=$(grep "^$app=" "$VERSION_FILE" | cut -d'=' -f2)
if [ -n "$stored" ]; then
echo "$stored"
return
fi
fi
echo "unknown"
}
# Save installed version to version file
save_installed_version() {
local app="$1"
local version="$2"
touch "$VERSION_FILE"
if grep -q "^$app=" "$VERSION_FILE"; then
sed -i "s/^$app=.*/$app=$version/" "$VERSION_FILE"
else
echo "$app=$version" >> "$VERSION_FILE"
fi
}
# Ask the user whether to proceed when version can't be determined
ask_user_proceed() {
local app="$1"
local latest="$2"
echo "Warning: could not determine installed version of $app."
echo "compile.conf specifies version $latest."
read -rp "Compile and install $app anyway? [y/N] " response
[[ "$response" =~ ^[yY] ]]
}
# Check if an update is needed
needs_update() {
local app="$1"
local install_path="$2"
local latest="$3"
local gui="$4"
# Not installed at all
if ! command -v "$app" &> /dev/null && [ ! -f "$install_path" ]; then
echo " $app is not installed."
return 0
fi
local installed
installed=$(get_installed_version "$app" "$gui")
if [ "$installed" = "unknown" ]; then
if ask_user_proceed "$app" "$latest"; then
return 0
else
return 1
fi
fi
echo " Installed version : $installed"
echo " Latest version : $latest"
if [ "$installed" = "$latest" ]; then
echo " $app is up to date, skipping."
return 1
fi
echo " Update available for $app."
return 0
}
# Generate desktop file with absolute paths
generate_desktop() {
local desktop="$1"
local tmp_desktop="/tmp/$(basename "$desktop")"
sed "s|\$HOME|$HOME|g" "$desktop" > "$tmp_desktop"
echo "$tmp_desktop"
}
# Install desktop file if specified
install_desktop() {
local desktop="$1"
if [ -z "$desktop" ]; then
return
fi
if [ ! -f "$desktop" ]; then
echo " Warning: desktop file $desktop not found, skipping."
return
fi
echo " Installing desktop file..."
mkdir -p "$HOME/.local/share/applications"
local resolved
resolved=$(generate_desktop "$desktop")
cp "$resolved" "$HOME/.local/share/applications/$(basename "$desktop")"
chmod +x "$HOME/.local/share/applications/$(basename "$desktop")"
rm -f "$resolved"
echo " Desktop file installed."
}
# Fetch source via git or wget
fetch_source() {
local app="$1"
local git_url="$2"
local wget_url="$3"
local src_dir="$TMP_DIR/$app"
rm -rf "$src_dir"
mkdir -p "$src_dir"
if [ -n "$git_url" ]; then
echo " Cloning $git_url..."
git clone "$git_url" "$src_dir"
elif [ -n "$wget_url" ]; then
echo " Downloading $wget_url..."
local filename="${wget_url##*/}"
local filepath="$TMP_DIR/$filename"
wget -q "$wget_url" -O "$filepath"
echo " Extracting $filename..."
case "$filename" in
*.zip)
unzip -q "$filepath" -d "$src_dir"
# If the zip extracted into a single subdirectory, flatten it
local contents
contents=$(ls -1 "$src_dir")
local count
count=$(echo "$contents" | wc -l)
if [ "$count" -eq 1 ] && [ -d "$src_dir/$contents" ]; then
echo " Descending into $contents..."
local inner="$src_dir/$contents"
mv "$inner"/* "$src_dir/"
rmdir "$inner"
fi
;;
*.tar.gz|*.tgz)
tar -xzf "$filepath" -C "$src_dir" --strip-components=1
;;
*.tar.bz2)
tar -xjf "$filepath" -C "$src_dir" --strip-components=1
;;
*.tar.xz)
tar -xJf "$filepath" -C "$src_dir" --strip-components=1
;;
*)
echo " Error: unknown file type for $filename"
exit 1
;;
esac
rm -f "$filepath"
else
echo " Error: no git or wget URL specified for $app"
exit 1
fi
}
# cd into source directory and run steps
run_steps() {
local app="$1"
local steps="$2"
local src_dir="$TMP_DIR/$app"
if [ ! -d "$src_dir" ]; then
echo " Error: source directory $src_dir not found."
exit 1
fi
echo " Changing into $src_dir..."
cd "$src_dir"
echo " Building $app..."
IFS=',' read -ra step_list <<< "$steps"
for step in "${step_list[@]}"; do
step=$(echo "$step" | xargs)
echo " Running: $step"
eval "$step"
done
}
# Process a single app
process_app() {
local app="$1"
local git_url="$2"
local wget_url="$3"
local install_path="$4"
local steps="$5"
local version="$6"
local desktop="$7"
local gui="$8"
echo ""
echo "=== $app ==="
# Check if already installed
if command -v "$app" &> /dev/null || [ -f "$install_path" ]; then
if [ -z "$version" ]; then
echo " $app is already installed, skipping."
return
fi
fi
if [ -z "$version" ]; then
echo " Warning: no version specified in compile.conf for $app."
read -rp " Compile and install $app anyway? [y/N] " response
if [[ ! "$response" =~ ^[yY] ]]; then
echo " Skipping $app."
return
fi
elif ! needs_update "$app" "$install_path" "$version" "$gui"; then
return
fi
fetch_source "$app" "$git_url" "$wget_url"
run_steps "$app" "$steps"
install_desktop "$desktop"
save_installed_version "$app" "$version"
# Return to a safe directory after build
cd "$HOME"
echo " $app $version installed successfully."
}
# Parse compile.conf and process each app
process_conf() {
local app="" git_url="" wget_url="" install_path="" steps="" version="" desktop="" gui=""
while IFS= read -r line || [ -n "$line" ]; do
[[ -z "$line" || "$line" == \#* ]] && continue
if [[ "$line" =~ ^\[(.+)\]$ ]]; then
if [ -n "$app" ]; then
process_app "$app" "$git_url" "$wget_url" "$install_path" "$steps" "$version" "$desktop" "$gui"
fi
app="${BASH_REMATCH[1]}"
git_url="" wget_url="" install_path="" steps="" version="" desktop="" gui=""
continue
fi
local key="${line%%=*}"
local value="${line#*=}"
value=$(eval echo "$value")
case "$key" in
git) git_url="$value" ;;
wget) wget_url="$value" ;;
install) install_path="$value" ;;
steps) steps="$value" ;;
version) version="$value" ;;
desktop) desktop="$value" ;;
gui) gui="$value" ;;
esac
done < "$CONF_FILE"
# Process the last app in the file
if [ -n "$app" ]; then
process_app "$app" "$git_url" "$wget_url" "$install_path" "$steps" "$version" "$desktop" "$gui"
fi
}
# --- Main ---
if [ ! -f "$CONF_FILE" ]; then
echo "Error: $CONF_FILE not found."
exit 1
fi
mkdir -p "$TMP_DIR"
mkdir -p "$HOME/.local/state/HamPack"
echo "Starting HamPack source builds..."
process_conf
echo "Updating desktop database..."
update-desktop-database "$HOME/.local/share/applications/"
echo ""
echo "Cleaning up..."
rm -rf "$TMP_DIR"
echo "All done."

106
install.sh Executable file
View File

@@ -0,0 +1,106 @@
#!/bin/bash -i
#
# Purpose : HamPack installer
# Print the logo
print_logo() {
cat << "EOF"
██╗ ██╗ █████╗ ███╗ ███╗██████╗ █████╗ ██████╗██╗ ██╗
██║ ██║██╔══██╗████╗ ████║██╔══██╗██╔══██╗██╔════╝██║ ██╔╝
███████║███████║██╔████╔██║██████╔╝███████║██║ █████╔╝
██╔══██║██╔══██║██║╚██╔╝██║██╔═══╝ ██╔══██║██║ ██╔═██╗
██║ ██║██║ ██║██║ ╚═╝ ██║██║ ██║ ██║╚██████╗██║ ██╗
╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝
EOF
}
# --- Main ---
set -e
clear
print_logo
cd ~
sudo -v
echo "Getting the latest version of HamPack..."
rm -rf ~/.local/share/HamPack
git clone https://gitea.young.computer/david/HamPack.git ~/.local/share/HamPack > /dev/null
sudo cp ~/.local/share/HamPack/hampackrefresh ~/.local/bin/hampackrefresh
sudo cp ~/.local/share/HamPack/hampackupdate ~/.local/bin/hampackupdate
cd ~/.local/share/HamPack
# Source utility functions
source utils.sh
# Source package list
if [ ! -f "packages.conf" ]; then
echo "Error: packages.conf not found!"
exit 1
fi
source packages.conf
# echo "Updating system..."
# sudo pacman -Syu --noconfirm
cd ~/
# Install yay AUR helper if not present
#if ! command -v yay &> /dev/null; then
# echo "Installing yay AUR helper..."
# sudo pacman -S --needed git base-devel --noconfirm
# if [[ -d "yay" ]]; then
# echo "yay directory already exists, removing it..."
# rm -rf yay
# fi
# echo "Cloning yay repository..."
# git clone https://aur.archlinux.org/yay.git
# cd yay
# echo "Building yay..."
# makepkg -si --noconfirm
# cd ..
# rm -rf yay
#else
# echo "yay is already installed."
#fi
echo "Installing system utilities..."
install_packages "${UTILITIES[@]}"
echo "Installing applications..."
install_packages "${APPLICATIONS[@]}"
cd ~/.local/share/HamPack
echo "Installing Flatpak applications..."
. install-flatpaks.sh
echo "Installing stand-alone compiled applications..."
. install-compiled.sh
curl -LsSf uvx.sh/not1mm/install.sh | sh
if ! ls /usr/lib/modules/$(uname -r) > /dev/null 2>&1; then
echo "HamPack is installed. A newer kernel has been installed, a reboot is recommended."
read -rp "Reboot now? [y/N] " response
case "$response" in
[yY][eE][sS]|[yY])
echo "Rebooting..."
sudo reboot
;;
*)
echo "Reboot skipped. Please remember to reboot when convenient."
exit 0
;;
esac
else
echo "Ham Pack is installed. Reboot when convenient."
fi

48
packages.conf Normal file
View File

@@ -0,0 +1,48 @@
# Ham utilities
UTILITIES=(
alsa-utils
aria2
at-spi2-core
base-devel
cmake
docopt
fldigi
flrig
gpds
gpsbabel
gtk4
hamlib
jdk-openjdk
libappindicator-gtk3
libkiwix
libnotify
libsecret
libxcrypt-compat
libxtst
libzim
meson
ninja
nss
pat-bin
python-yattag # must come before chirp-next
qgis
qt6-base
qt6-tools
qt6-webengine
splat
util-linux-libs
voacapl
wine
winetricks
xdg-utils
zim-tools
zimwriterfs
)
# Ham applications
APPLICATIONS=(
gridtracker2
chattervox-bin
chirp-next
)

25
serverrefresh Executable file
View File

@@ -0,0 +1,25 @@
#!/bin/bash
# Print the logo
print_logo() {
cat << "EOF"
██╗ ██╗ █████╗ ███╗ ███╗██████╗ █████╗ ██████╗██╗ ██╗
██║ ██║██╔══██╗████╗ ████║██╔══██╗██╔══██╗██╔════╝██║ ██╔╝
███████║███████║██╔████╔██║██████╔╝███████║██║ █████╔╝
██╔══██║██╔══██║██║╚██╔╝██║██╔═══╝ ██╔══██║██║ ██╔═██╗
██║ ██║██║ ██║██║ ╚═╝ ██║██║ ██║ ██║╚██████╗██║ ██╗
╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝
EOF
}
# Clear screen and show logo
clear
print_logo
echo "Let's get the lastest changes to HamPack..."
wget -qO- https://gitea.young.computer/david/hampack/raw/branch/main/install.sh | bash

46
serverupdate Executable file
View File

@@ -0,0 +1,46 @@
#!/bin/bash
# Print the logo
print_logo() {
cat << "EOF"
██╗ ██╗ █████╗ ███╗ ███╗██████╗ █████╗ ██████╗██╗ ██╗
██║ ██║██╔══██╗████╗ ████║██╔══██╗██╔══██╗██╔════╝██║ ██╔╝
███████║███████║██╔████╔██║██████╔╝███████║██║ █████╔╝
██╔══██║██╔══██║██║╚██╔╝██║██╔═══╝ ██╔══██║██║ ██╔═██╗
██║ ██║██║ ██║██║ ╚═╝ ██║██║ ██║ ██║╚██████╗██║ ██╗
╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝
EOF
}
# Clear screen and show logo
clear
print_logo
echo "Updating Arch..."
sudo pacman -Syu
echo "Updating AUR..."
if ! yay -Sua 2>/dev/null; then
echo "yay -Sua returned an error. Let's rebuild YAY."
sudo pacman -R yay
cd /tmp
git clone https://aur.archlinux.org/yay.git
cd yay
makepkg -si
cd ..
rm -rf yay
cd
yay -Sua --noconfirm
else
yay -Sua --noconfirm
fi
# Will need to update the downloaded binaries and the compiled apps
# In the area below...
echo "Done. You probably want to reboot your system..."

28
utils.sh Executable file
View File

@@ -0,0 +1,28 @@
#!/bin/bash
# Function to check if a package is installed
is_installed() {
pacman -Qi "$1" &> /dev/null
}
# Function to check if a package is installed
is_group_installed() {
pacman -Qg "$1" &> /dev/null
}
# Function to install packages if not already installed
install_packages() {
local packages=("$@")
local to_install=()
for pkg in "${packages[@]}"; do
if ! is_installed "$pkg" && ! is_group_installed "$pkg"; then
to_install+=("$pkg")
fi
done
if [ ${#to_install[@]} -ne 0 ]; then
echo "Installing: ${to_install[*]}"
yay -S --noconfirm "${to_install[@]}"
fi
}