#!/bin/bash # # Purpose : Keep HamPack current (run by CoreDesktop's `update`, and by install.sh) SELF="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" COREDESKTOP="$HOME/.local/share/coredesktop" source "$COREDESKTOP/utils.sh" # Config files and build steps refer to files in this repo through $HAMPACK_DIR export HAMPACK_DIR="$SELF" FAILED=() # Run one update step; a failure is reported but doesn't stop the later steps step() { local name="$1" shift echo "→ $name..." if ! "$@"; then echo "✗ $name failed." FAILED+=("$name") fi } remove_stale_files() { # The HamPack GUI app was removed rm -f "$HOME/.local/bin/hampack" rm -f "$HOME/.local/share/applications/hampack.desktop" # Replaced by CoreDesktop's `update` and `sibling add` rm -f "$HOME/.local/bin/hampackupdate" "$HOME/.local/bin/hampackrefresh" # Paracon is now installed without the version in its file name rm -f "$HOME"/.local/bin/paracon_*.pyz # Hooks from before HamPack was a sibling; 71-siblings.sh now runs this script rm -f "$COREDESKTOP"/updates.d/[0-9][0-9][0-9]-hampack-* } install_tools() { mkdir -p "$HOME/.local/bin" install_script "$SELF/hampackremove" "$HOME/.local/bin/hampackremove" } install_hampack_packages() { source "$SELF/packages.conf" install_packages "${UTILITIES[@]}" && install_packages "${APPLICATIONS[@]}" } install_not1mm() { if command -v uv &> /dev/null && uv tool list 2> /dev/null | grep -q '^not1mm '; then uv tool upgrade not1mm else curl -LsSf uvx.sh/not1mm/install.sh | sh fi } install_dxpy() { wget -q https://raw.githubusercontent.com/HB9VQQ/dx.py/main/dx.py -O "$HOME/.local/bin/dx.py" && chmod +x "$HOME/.local/bin/dx.py" } install_desktop_files() { mkdir -p "$HOME/.local/share/applications" sed "s|\$HAMPACK_DIR|$SELF|g; s|\$HOME|$HOME|g" "$SELF/desktop/js8call.desktop" \ > "$HOME/.local/share/applications/js8call.desktop" && update-desktop-database "$HOME/.local/share/applications/" } # --- Main --- echo "Updating HamPack..." step "Removing stale HamPack files" remove_stale_files step "Installing HamPack tools" install_tools step "Installing HamPack packages" install_hampack_packages step "Installing Flatpak applications" bash "$SELF/install-flatpaks.sh" step "Installing pre-built binaries" bash "$SELF/install-binaries.sh" step "Installing compiled applications" bash "$SELF/install-compiled.sh" step "Installing Windows applications" bash "$SELF/install-windows-apps.sh" step "Installing not1mm" install_not1mm step "Installing dx.py" install_dxpy step "Installing desktop files" install_desktop_files if (( ${#FAILED[@]} > 0 )); then echo "HamPack updated, with errors in: ${FAILED[*]}" exit 1 fi echo "✓ HamPack updated."