Fix kiwix-tools rebuilds, failed-build handling, and config expansion
- compile.conf: kiwix-tools never installs kiwix-lib, so it was rebuilt on every update; detect it by kiwix-serve instead - install-compiled.sh: stop at the first failing build step, report the app as failed, and don't record its version so the next update retries - install-binaries.sh, install-compiled.sh: expand only $HOME, $HAMPACK_DIR and $USER in config values instead of `eval echo`, which dropped semicolons (e.g. categories=HamRadio;) and mangled quotes and spacing Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
52f043d0b5
commit
ebda32d567
+1
-1
@@ -38,7 +38,7 @@ steps=/usr/lib/qt6/bin/qmake PREFIX=$HOME/.local "QMAKE_CXXFLAGS+=-Wno-error=sfi
|
||||
[kiwix-tools]
|
||||
version=3.8.2
|
||||
git=https://github.com/kiwix/kiwix-tools.git
|
||||
install=$HOME/.local/bin/kiwix-lib
|
||||
install=$HOME/.local/bin/kiwix-serve
|
||||
steps=sudo chown -R $USER:$USER $HOME/.local/share/man, meson setup build --prefix=$HOME/.local, ninja -C build, ninja -C build install
|
||||
|
||||
[Dump1090]
|
||||
|
||||
+11
-1
@@ -9,6 +9,16 @@ TMP_DIR="/tmp/hampack-build"
|
||||
VERSION_FILE="$HOME/.local/state/HamPack/.installed_versions"
|
||||
FAILED=()
|
||||
|
||||
# Expand $HOME, $HAMPACK_DIR and $USER in a config value. Unlike `eval echo`,
|
||||
# this leaves everything else (semicolons, quotes, spacing) untouched.
|
||||
expand_vars() {
|
||||
local v="$1"
|
||||
v="${v//\$HAMPACK_DIR/"$HAMPACK_DIR"}"
|
||||
v="${v//\$HOME/"$HOME"}"
|
||||
v="${v//\$USER/"$USER"}"
|
||||
printf '%s\n' "$v"
|
||||
}
|
||||
|
||||
# Get the installed version of an app
|
||||
get_installed_version() {
|
||||
local app="$1"
|
||||
@@ -197,7 +207,7 @@ process_conf() {
|
||||
|
||||
local key="${line%%=*}"
|
||||
local value="${line#*=}"
|
||||
value=$(eval echo "$value")
|
||||
value=$(expand_vars "$value")
|
||||
|
||||
case "$key" in
|
||||
url) url="$value" ;;
|
||||
|
||||
+29
-11
@@ -9,6 +9,16 @@ TMP_DIR="/tmp/hampack-build"
|
||||
VERSION_FILE="$HOME/.local/state/HamPack/.installed_versions"
|
||||
FAILED=()
|
||||
|
||||
# Expand $HOME, $HAMPACK_DIR and $USER in a config value. Unlike `eval echo`,
|
||||
# this leaves everything else (semicolons, quotes, spacing) untouched.
|
||||
expand_vars() {
|
||||
local v="$1"
|
||||
v="${v//\$HAMPACK_DIR/"$HAMPACK_DIR"}"
|
||||
v="${v//\$HOME/"$HOME"}"
|
||||
v="${v//\$USER/"$USER"}"
|
||||
printf '%s\n' "$v"
|
||||
}
|
||||
|
||||
# Get the installed version of an app
|
||||
get_installed_version() {
|
||||
local app="$1"
|
||||
@@ -239,11 +249,11 @@ run_steps() {
|
||||
|
||||
if [ ! -d "$src_dir" ]; then
|
||||
echo " Error: source directory $src_dir not found."
|
||||
exit 1
|
||||
return 1
|
||||
fi
|
||||
|
||||
echo " Changing into $src_dir..."
|
||||
cd "$src_dir"
|
||||
cd "$src_dir" || return 1
|
||||
|
||||
echo " Building $app..."
|
||||
IFS=',' read -ra step_list <<< "$steps"
|
||||
@@ -251,7 +261,10 @@ run_steps() {
|
||||
step="${step#"${step%%[![:space:]]*}"}"
|
||||
step="${step%"${step##*[![:space:]]}"}"
|
||||
echo " Running: $step"
|
||||
eval "$step"
|
||||
if ! eval "$step"; then
|
||||
echo " Error: step failed: $step"
|
||||
return 1
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
@@ -294,13 +307,18 @@ process_app() {
|
||||
FAILED+=("$app")
|
||||
return
|
||||
fi
|
||||
run_steps "$app" "$steps"
|
||||
# Steps run in this shell (they may `cd`), so return to a safe directory afterwards
|
||||
if ! run_steps "$app" "$steps"; then
|
||||
cd "$HOME" || true
|
||||
echo " Error: build of $app failed; version not recorded, will retry next update."
|
||||
FAILED+=("$app")
|
||||
return
|
||||
fi
|
||||
cd "$HOME" || true
|
||||
|
||||
install_desktop "$desktop"
|
||||
save_installed_version "$app" "$version"
|
||||
|
||||
# Return to a safe directory after build
|
||||
cd "$HOME"
|
||||
|
||||
echo " $app $version installed successfully."
|
||||
}
|
||||
|
||||
@@ -324,13 +342,13 @@ process_conf() {
|
||||
local value="${line#*=}"
|
||||
|
||||
case "$key" in
|
||||
git) git_url="$(eval echo "$value")" ;;
|
||||
git) git_url="$(expand_vars "$value")" ;;
|
||||
ref) ref="$value" ;;
|
||||
wget) wget_url="$(eval echo "$value")" ;;
|
||||
install) install_path="$(eval echo "$value")" ;;
|
||||
wget) wget_url="$(expand_vars "$value")" ;;
|
||||
install) install_path="$(expand_vars "$value")" ;;
|
||||
steps) steps="$value" ;;
|
||||
version) version="$value" ;;
|
||||
desktop) desktop="$(eval echo "$value")" ;;
|
||||
desktop) desktop="$(expand_vars "$value")" ;;
|
||||
gui) gui="$value" ;;
|
||||
esac
|
||||
|
||||
|
||||
Reference in New Issue
Block a user