From 7e43d2f97dd674736ae7ffc7277eb180c21b38fb Mon Sep 17 00:00:00 2001 From: "courtmanr@gmail.com" Date: Sat, 31 May 2025 15:31:19 +0100 Subject: [PATCH] feat: restore installer self-update check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Added back the self-update check for the installer script - Installer now checks for updates to itself before running - Skips update check when running from pipe (curl | bash) - User is prompted before updating the installer 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- scripts/install-pulse.sh | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/scripts/install-pulse.sh b/scripts/install-pulse.sh index 762148581..cebc6b6d4 100755 --- a/scripts/install-pulse.sh +++ b/scripts/install-pulse.sh @@ -57,6 +57,42 @@ check_root() { fi } +# Self-update check +self_update_check() { + # Skip if running from pipe or no curl available + if [ ! -t 0 ] || ! command -v curl &>/dev/null; then + return 0 + fi + + print_info "Checking for installer updates..." + + local current_script="$0" + local temp_script="/tmp/install-pulse-new.sh" + local script_url="https://raw.githubusercontent.com/rcourtman/Pulse/main/scripts/install-pulse.sh" + + # Download latest version + if curl -sL "$script_url" -o "$temp_script" 2>/dev/null; then + # Compare with current script + if ! diff -q "$current_script" "$temp_script" >/dev/null 2>&1; then + print_warning "A newer version of the installer is available" + read -p "Update installer and restart? [Y/n]: " update_confirm + + if [[ ! "$update_confirm" =~ ^[Nn]$ ]]; then + print_info "Updating installer..." + cp "$temp_script" "$current_script" + chmod +x "$current_script" + rm -f "$temp_script" + + print_success "Installer updated, restarting..." + exec "$current_script" "$@" + fi + else + print_success "Installer is up to date" + fi + rm -f "$temp_script" + fi +} + # Print welcome banner print_welcome() { echo "" @@ -492,6 +528,7 @@ show_final_instructions() { # Main execution main() { check_root + self_update_check print_welcome check_installation