fix: Prevent auto update on [INFO] Removing bootstrap CLI completely...

[INFO] Removing block 'bootstrap-cli setup' from /home/sortedcord/.bashrc
[SUCCESS] Bootstrap CLI removed successfully. (Note: Run 'unset -f b' to clear it from the current session)
This commit is contained in:
2026-06-20 18:16:35 +05:30
parent 64d4c5c5af
commit dd1b0b8146
2 changed files with 20 additions and 17 deletions

View File

@@ -1 +1 @@
1.0.10
1.0.11

35
b.sh
View File

@@ -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