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 version=0.1
wget=http://www.cantab.net/users/john.wiseman/Downloads/QtTermSource.zip wget=http://www.cantab.net/users/john.wiseman/Downloads/QtTermSource.zip
install=$HOME/.local/bin/QtTermTCP install=$HOME/.local/bin/QtTermTCP
gui=true
steps=qmake, make, mv QtTermTCP $HOME/.local/bin/ steps=qmake, make, mv QtTermTCP $HOME/.local/bin/
[Kiwix-Desktop] [Kiwix-Desktop]

View File

@@ -9,14 +9,17 @@ VERSION_FILE="$HOME/.local/state/HamPack/.installed_versions"
# Get the installed version of an app # Get the installed version of an app
get_installed_version() { get_installed_version() {
local app="$1" local app="$1"
local gui="$2"
# Try --version flag first # Skip --version check for GUI apps as it would launch them
if command -v "$app" &> /dev/null; then if [ "$gui" != "true" ]; then
local ver if command -v "$app" &> /dev/null; then
ver=$("$app" --version 2>&1 | grep -oP '\d+\.\d+[\.\d]*' | head -n1) local ver
if [ -n "$ver" ]; then ver=$("$app" --version 2>&1 | grep -oP '\d+\.\d+[\.\d]*' | head -n1)
echo "$ver" if [ -n "$ver" ]; then
return echo "$ver"
return
fi
fi fi
fi fi
@@ -63,6 +66,7 @@ needs_update() {
local app="$1" local app="$1"
local install_path="$2" local install_path="$2"
local latest="$3" local latest="$3"
local gui="$4"
# Not installed at all # Not installed at all
if ! command -v "$app" &> /dev/null && [ ! -f "$install_path" ]; then if ! command -v "$app" &> /dev/null && [ ! -f "$install_path" ]; then
@@ -71,7 +75,7 @@ needs_update() {
fi fi
local installed local installed
installed=$(get_installed_version "$app") installed=$(get_installed_version "$app" "$gui")
if [ "$installed" = "unknown" ]; then if [ "$installed" = "unknown" ]; then
if ask_user_proceed "$app" "$latest"; then if ask_user_proceed "$app" "$latest"; then
@@ -216,6 +220,7 @@ process_app() {
local steps="$5" local steps="$5"
local version="$6" local version="$6"
local desktop="$7" local desktop="$7"
local gui="$8"
echo "" echo ""
echo "=== $app ===" echo "=== $app ==="
@@ -235,7 +240,7 @@ process_app() {
echo " Skipping $app." echo " Skipping $app."
return return
fi fi
elif ! needs_update "$app" "$install_path" "$version"; then elif ! needs_update "$app" "$install_path" "$version" "$gui"; then
return return
fi fi
@@ -248,17 +253,17 @@ process_app() {
# Parse compile.conf and process each app # Parse compile.conf and process each app
process_conf() { 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 while IFS= read -r line || [ -n "$line" ]; do
[[ -z "$line" || "$line" == \#* ]] && continue [[ -z "$line" || "$line" == \#* ]] && continue
if [[ "$line" =~ ^\[(.+)\]$ ]]; then if [[ "$line" =~ ^\[(.+)\]$ ]]; then
if [ -n "$app" ]; 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 fi
app="${BASH_REMATCH[1]}" app="${BASH_REMATCH[1]}"
git_url="" wget_url="" install_path="" steps="" version="" desktop="" git_url="" wget_url="" install_path="" steps="" version="" desktop="" gui=""
continue continue
fi fi
@@ -273,13 +278,14 @@ process_conf() {
steps) steps="$value" ;; steps) steps="$value" ;;
version) version="$value" ;; version) version="$value" ;;
desktop) desktop="$value" ;; desktop) desktop="$value" ;;
gui) gui="$value" ;;
esac esac
done < "$CONF_FILE" done < "$CONF_FILE"
# Process the last app in the file # Process the last app in the file
if [ -n "$app" ]; 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 fi
} }