This commit is contained in:
David Young
2026-03-20 20:59:23 -06:00
parent 850413a39d
commit 73fe1ef6f7
2 changed files with 20 additions and 13 deletions

View File

@@ -2,6 +2,7 @@
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]

View File

@@ -9,14 +9,17 @@ VERSION_FILE="$HOME/.local/state/HamPack/.installed_versions"
# Get the installed version of an app
get_installed_version() {
local app="$1"
local gui="$2"
# Try --version flag first
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
# 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
@@ -63,6 +66,7 @@ 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
@@ -71,7 +75,7 @@ needs_update() {
fi
local installed
installed=$(get_installed_version "$app")
installed=$(get_installed_version "$app" "$gui")
if [ "$installed" = "unknown" ]; then
if ask_user_proceed "$app" "$latest"; then
@@ -216,6 +220,7 @@ process_app() {
local steps="$5"
local version="$6"
local desktop="$7"
local gui="$8"
echo ""
echo "=== $app ==="
@@ -235,7 +240,7 @@ process_app() {
echo " Skipping $app."
return
fi
elif ! needs_update "$app" "$install_path" "$version"; then
elif ! needs_update "$app" "$install_path" "$version" "$gui"; then
return
fi
@@ -248,17 +253,17 @@ process_app() {
# Parse compile.conf and process each app
process_conf() {
local app="" git_url="" wget_url="" install_path="" steps="" version="" desktop=""
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"
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=""
git_url="" wget_url="" install_path="" steps="" version="" desktop="" gui=""
continue
fi
@@ -273,13 +278,14 @@ process_conf() {
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"
process_app "$app" "$git_url" "$wget_url" "$install_path" "$steps" "$version" "$desktop" "$gui"
fi
}