From 3b6d69887e5dde9183fc8f84e2b818cdc0a271ed Mon Sep 17 00:00:00 2001 From: David Young Date: Tue, 17 Mar 2026 15:24:19 -0600 Subject: [PATCH] improve compiled --- compile.conf | 2 +- install-compiled.sh | 42 +++++++++++++++++++++++++++++++++++++----- 2 files changed, 38 insertions(+), 6 deletions(-) diff --git a/compile.conf b/compile.conf index 3ff9ea2..0eb9d71 100644 --- a/compile.conf +++ b/compile.conf @@ -2,7 +2,7 @@ version=1.7 wget=http://www.cantab.net/users/john.wiseman/Downloads/QtTermSource.zip install=$HOME/.local/bin -steps=mkdir qttermtcp, cd qttermtcp, unzip, qmake, make +steps=qmake, make, mv QtTermTCP $HOME/.local/bin/ #[wsjtx] #version=2.7.0 diff --git a/install-compiled.sh b/install-compiled.sh index 510b395..b9624a4 100755 --- a/install-compiled.sh +++ b/install-compiled.sh @@ -106,27 +106,59 @@ fetch_source() { if [ -n "$git_url" ]; then echo " Cloning $git_url..." git clone "$git_url" "$src_dir" + elif [ -n "$wget_url" ]; then echo " Downloading $wget_url..." - wget -q "$wget_url" -P "$TMP_DIR" local filename="${wget_url##*/}" - tar -xf "$TMP_DIR/$filename" -C "$src_dir" --strip-components=1 - rm -f "$TMP_DIR/$filename" + local filepath="$TMP_DIR/$filename" + + wget -q "$wget_url" -O "$filepath" + + echo " Extracting $filename..." + case "$filename" in + *.zip) + unzip -q "$filepath" -d "$TMP_DIR" + local extracted + extracted=$(unzip -qql "$filepath" | head -n1 | awk '{print $NF}' | cut -d/ -f1) + mv "$TMP_DIR/$extracted" "$src_dir" + ;; + *.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 } -# Parse and run steps for a given app +# cd into source directory and run steps run_steps() { local app="$1" local steps="$2" local src_dir="$TMP_DIR/$app" - echo " Building $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)