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:
35
b.sh
35
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
|
||||
|
||||
Reference in New Issue
Block a user