sibling requirements
This commit is contained in:
+19
-10
@@ -7,6 +7,7 @@ export HAMPACK_DIR
|
||||
CONF_FILE="${HAMPACK_BINARIES_CONF:-$HAMPACK_DIR/binaries.conf}"
|
||||
TMP_DIR="/tmp/hampack-build"
|
||||
VERSION_FILE="$HOME/.local/state/HamPack/.installed_versions"
|
||||
FAILED=()
|
||||
|
||||
# Get the installed version of an app
|
||||
get_installed_version() {
|
||||
@@ -53,14 +54,8 @@ needs_update() {
|
||||
installed=$(get_installed_version "$app")
|
||||
|
||||
if [ "$installed" = "unknown" ]; then
|
||||
echo " Warning: could not determine installed version of $app."
|
||||
echo " binaries.conf specifies version $latest."
|
||||
read -rp " Download and install $app anyway? [y/N] " response
|
||||
if [[ "$response" =~ ^[yY] ]]; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
echo " Installed version of $app is unknown, reinstalling version $latest."
|
||||
return 0
|
||||
fi
|
||||
|
||||
echo " Installed version : $installed"
|
||||
@@ -85,7 +80,11 @@ download_binary() {
|
||||
local tmp_file="$TMP_DIR/$filename"
|
||||
|
||||
echo " Downloading $url..."
|
||||
wget -q "$url" -O "$tmp_file"
|
||||
if ! wget -q "$url" -O "$tmp_file"; then
|
||||
echo " Error: download of $url failed."
|
||||
rm -f "$tmp_file"
|
||||
return 1
|
||||
fi
|
||||
|
||||
mkdir -p "$(dirname "$install_path")"
|
||||
mv "$tmp_file" "$install_path"
|
||||
@@ -142,11 +141,13 @@ process_app() {
|
||||
|
||||
if [ -z "$url" ]; then
|
||||
echo " Error: no url specified for $app, skipping."
|
||||
FAILED+=("$app")
|
||||
return
|
||||
fi
|
||||
|
||||
if [ -z "$install_path" ]; then
|
||||
echo " Error: no install path specified for $app, skipping."
|
||||
FAILED+=("$app")
|
||||
return
|
||||
fi
|
||||
|
||||
@@ -162,7 +163,10 @@ process_app() {
|
||||
echo " $app is not installed."
|
||||
fi
|
||||
|
||||
download_binary "$app" "$url" "$install_path"
|
||||
if ! download_binary "$app" "$url" "$install_path"; then
|
||||
FAILED+=("$app")
|
||||
return
|
||||
fi
|
||||
|
||||
if [ "$gui" = "true" ]; then
|
||||
install_desktop "$app" "$install_path" "$exec_cmd" "$comment" "$icon" "$categories"
|
||||
@@ -236,4 +240,9 @@ echo ""
|
||||
echo "Cleaning up..."
|
||||
rm -rf "$TMP_DIR"
|
||||
|
||||
if (( ${#FAILED[@]} > 0 )); then
|
||||
echo "Failed to install: ${FAILED[*]}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "All done."
|
||||
|
||||
Reference in New Issue
Block a user