Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 55 additions & 5 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,35 @@ progress_spinner() {
return $exit_status
}

finish_ok() {
local version="$1"
ok "Engine online ($version verified)"
[[ -n "$AGY_BAK" && -f "$AGY_BAK" ]] && rm -f "$AGY_BAK"
[[ -n "$AGY_VA39_BAK" && -f "$AGY_VA39_BAK" ]] && rm -f "$AGY_VA39_BAK"
}

run_pkg_with_spinner() {
local msg="$1"
shift
GLIBC_PCT="${TMP}.pct"
echo "0" > "$GLIBC_PCT"
{
"$@" -o APT::Status-Fd=1 2>&1 | awk -v pct_file="$GLIBC_PCT" '
/^dlstatus:[0-9]+:([0-9.]+):/ || /^pmstatus:[^:]+:([0-9.]+):/ {
split($0, a, ":")
pct = int(a[3])
if (pct < 0) pct = 0
if (pct > 100) pct = 100
print pct > pct_file
close(pct_file)
fflush()
}'
} &
progress_spinner $! "$msg" "$GLIBC_PCT" || true
rm -f "$GLIBC_PCT"
GLIBC_PCT=""
}
Comment thread
wallentx marked this conversation as resolved.

download_with_progress() {
local url=$1
local dest=$2
Expand Down Expand Up @@ -358,12 +387,33 @@ ok "Binary found"
# ── Test & Extract Version ────────────────────────────────────────────────────
VERSION=""
if VERSION=$("$INSTALL_BIN_DIR/agy" --version 2>/dev/null); then
ok "Engine online ($VERSION verified)"
[[ -n "$AGY_BAK" && -f "$AGY_BAK" ]] && rm -f "$AGY_BAK"
[[ -n "$AGY_VA39_BAK" && -f "$AGY_VA39_BAK" ]] && rm -f "$AGY_VA39_BAK"
finish_ok "$VERSION"
else
rm -f "$INSTALL_BIN_DIR/agy" "$INSTALL_BIN_DIR/agy.va39"
die "Binaries failed to execute locally. Check dependencies."
if [[ "$ENV_TYPE" == "termux" ]]; then
info "Binary failed. Attempting dependency repair..."
run_pkg_with_spinner "Repairing Termux dependencies..." pkg reinstall -y proot glibc ca-certificates
rm -f "$HOME/.local/bin/agy" "$HOME/.local/bin/agy.va39"
Comment thread
wallentx marked this conversation as resolved.
rm -rf "$HOME/.local/agy"
Comment thread
wallentx marked this conversation as resolved.
hash -r

if VERSION=$("$INSTALL_BIN_DIR/agy" --version 2>/dev/null); then
Comment thread
wallentx marked this conversation as resolved.
Comment thread
wallentx marked this conversation as resolved.
finish_ok "$VERSION"
else
info "Repair failed. Attempting full package update..."
run_pkg_with_spinner "Updating package definitions..." apt update
run_pkg_with_spinner "Deep reinstalling dependencies..." pkg reinstall -y proot glibc ca-certificates

if VERSION=$("$INSTALL_BIN_DIR/agy" --version 2>/dev/null); then
finish_ok "$VERSION"
else
rm -f "$INSTALL_BIN_DIR/agy" "$INSTALL_BIN_DIR/agy.va39"
die "Binaries failed to execute locally. Check dependencies."
fi
fi
else
rm -f "$INSTALL_BIN_DIR/agy" "$INSTALL_BIN_DIR/agy.va39"
die "Binaries failed to execute locally. Check dependencies."
fi
fi

# ── Done ──────────────────────────────────────────────────────────────────────
Expand Down
Loading