diff --git a/VERSION b/VERSION index 7ee7020..59e9e60 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.0.10 +1.0.11 diff --git a/b.sh b/b.sh index 2f4de1c..208d6f0 100755 --- a/b.sh +++ b/b.sh @@ -33,25 +33,28 @@ b() { } # Auto-update check: once every 24 hours, or if routes.sh or VERSION is missing - if [ $((current_time - last_update)) -gt 86400 ] || [ ! -f "$routes_file" ] || [ ! -f "$routes_dir/VERSION" ]; then - # Update the timestamp immediately to prevent spamming on connection errors - echo "$current_time" > "$last_update_file" + # Skip when uninstalling — no point updating bootstrap if we're about to remove it + if [ "${1:-}" != "bye" ]; then + if [ $((current_time - last_update)) -gt 86400 ] || [ ! -f "$routes_file" ] || [ ! -f "$routes_dir/VERSION" ]; then + # Update the timestamp immediately to prevent spamming on connection errors + echo "$current_time" > "$last_update_file" - local base_url="https://git.adityagupta.dev/sortedcord/bootstrap/raw/branch/master" - local local_ver="0.0.0" - [ -f "$routes_dir/VERSION" ] && local_ver=$(cat "$routes_dir/VERSION" 2>/dev/null | tr -d '[:space:]') + local base_url="https://git.adityagupta.dev/sortedcord/bootstrap/raw/branch/master" + local local_ver="0.0.0" + [ -f "$routes_dir/VERSION" ] && local_ver=$(cat "$routes_dir/VERSION" 2>/dev/null | tr -d '[:space:]') - local remote_ver - if remote_ver=$(curl -fsSL "$base_url/VERSION" 2>/dev/null || wget -qO- "$base_url/VERSION" 2>/dev/null); then - remote_ver=$(echo "$remote_ver" | tr -d '[:space:]') - if [ -n "$remote_ver" ] && _version_lt "$local_ver" "$remote_ver"; then - echo "New version $remote_ver available (local: $local_ver). Auto-updating..." >&2 - local tmp_bootstrap - tmp_bootstrap="$(mktemp)" - if curl -fsSL "$base_url/bootstrap.sh" -o "$tmp_bootstrap" 2>/dev/null || wget -qO "$tmp_bootstrap" "$base_url/bootstrap.sh" 2>/dev/null; then - bash "$tmp_bootstrap" >/dev/null 2>&1 + local remote_ver + if remote_ver=$(curl -fsSL "$base_url/VERSION" 2>/dev/null || wget -qO- "$base_url/VERSION" 2>/dev/null); then + remote_ver=$(echo "$remote_ver" | tr -d '[:space:]') + if [ -n "$remote_ver" ] && _version_lt "$local_ver" "$remote_ver"; then + echo "New version $remote_ver available (local: $local_ver). Auto-updating..." >&2 + local tmp_bootstrap + tmp_bootstrap="$(mktemp)" + if curl -fsSL "$base_url/bootstrap.sh" -o "$tmp_bootstrap" 2>/dev/null || wget -qO "$tmp_bootstrap" "$base_url/bootstrap.sh" 2>/dev/null; then + bash "$tmp_bootstrap" >/dev/null 2>&1 + fi + rm -f "$tmp_bootstrap" fi - rm -f "$tmp_bootstrap" fi fi fi