From 14890629436f98ef9c44e1fc4706b4d9674cde7f Mon Sep 17 00:00:00 2001 From: Jose Henrique Date: Sun, 24 Aug 2025 20:59:49 -0300 Subject: [PATCH] removing auto update --- clean.sh | 81 ----------------------------------------------- docker-updater.sh | 3 -- 2 files changed, 84 deletions(-) diff --git a/clean.sh b/clean.sh index c2e5b7b..23a2509 100644 --- a/clean.sh +++ b/clean.sh @@ -4,7 +4,6 @@ # # Description: Comprehensive system cleanup for Docker containers and Linux systems # Features: -# - Self-updating capability # - Docker resource cleanup (images, containers, volumes, networks) # - Package manager cache cleanup (APK/APT) # - System cache and temporary file cleanup @@ -30,10 +29,6 @@ readonly LIGHT_BLUE='\033[1;34m' readonly LIGHT_GREY='\033[0;37m' readonly YELLOW='\033[1;33m' -# Script configuration -readonly SCRIPT_NAME="clean.sh" -readonly SERVER_BASE_URL="https://git.ivanch.me/ivanch/server-scripts/raw/branch/main" - # Cleanup configuration readonly LOG_RETENTION_DAYS=30 readonly JOURNAL_RETENTION_DAYS=7 @@ -133,79 +128,6 @@ get_system_info() { echo "$info" } -#============================================================================== -# AUTO-UPDATE FUNCTIONALITY -#============================================================================== - -# Check server connectivity -check_server_connectivity() { - local url="$1" - curl -s --head "$url" | head -n 1 | grep -E "HTTP/[12] [23].." >/dev/null 2>&1 -} - -# Get SHA256 hash of a file -get_file_hash() { - local file="$1" - sha256sum "$file" 2>/dev/null | awk '{print $1}' || echo "" -} - -# Get SHA256 hash from URL content -get_url_hash() { - local url="$1" - curl -s "$url" 2>/dev/null | sha256sum | awk '{print $1}' || echo "" -} - -# Perform self-update if newer version is available -perform_self_update() { - if [[ "$AUTO_UPDATE_ENABLED" != "true" ]]; then - log_info "Auto-update is disabled" - return 0 - fi - - local server_url="$SERVER_BASE_URL/$SCRIPT_NAME" - - log_step "Checking for script updates..." - - # Check if server file is accessible - if ! check_server_connectivity "$server_url"; then - log_warning "Cannot connect to update server, continuing with current version" - return 0 - fi - - # Compare local and server file hashes - local local_hash server_hash - local_hash=$(get_file_hash "$SCRIPT_NAME") - server_hash=$(get_url_hash "$server_url") - - if [[ -z "$local_hash" || -z "$server_hash" ]]; then - log_warning "Cannot determine file hashes, skipping update" - return 0 - fi - - if [[ "$local_hash" != "$server_hash" ]]; then - log_info "Update available, downloading new version..." - - # Create backup of current script - local backup_file="${SCRIPT_NAME}.backup.$(date +%s)" - cp "$SCRIPT_NAME" "$backup_file" || die "Failed to create backup" - - # Download updated script - if curl -s -o "$SCRIPT_NAME" "$server_url"; then - chmod +x "$SCRIPT_NAME" || die "Failed to set executable permissions" - log_success "Script updated successfully" - - log_step "Running updated script..." - exec ./"$SCRIPT_NAME" "$@" - else - # Restore backup on failure - mv "$backup_file" "$SCRIPT_NAME" - die "Failed to download updated script" - fi - else - log_success "Script is already up to date" - fi -} - #============================================================================== # DOCKER CLEANUP FUNCTIONS #============================================================================== @@ -526,9 +448,6 @@ main() { echo fi - # Perform self-update if enabled - perform_self_update "$@" - # Docker cleanup cleanup_docker diff --git a/docker-updater.sh b/docker-updater.sh index c2e5a26..564dd28 100644 --- a/docker-updater.sh +++ b/docker-updater.sh @@ -281,9 +281,6 @@ main() { # Check requirements check_docker_requirements - # Perform self-update if enabled - perform_self_update "$@" - # Update all Docker projects update_all_docker_projects