From f9b8037486babbc77e511d28ea2e6e090f1d96df Mon Sep 17 00:00:00 2001 From: rcourtman Date: Tue, 30 Sep 2025 16:16:10 +0000 Subject: [PATCH] fix: resolve install script unbound variables and add update command Addresses #450, #451, #406 - Initialize all variables at top of script to prevent "unbound variable" errors with set -u - BUILD_FROM_SOURCE, SKIP_DOWNLOAD, IN_CONTAINER, IN_DOCKER now set at line 20-27 - ENABLE_AUTO_UPDATES, FORCE_VERSION, FORCE_CHANNEL, SOURCE_BRANCH also moved to top - Removed duplicate assignments from argument parsing section - Restore /bin/update command creation for ProxmoxVE LXC installations - Creates update script that re-runs install.sh for easy updates - Allows backend to properly detect ProxmoxVE deployment type - Users can now run "update" in LXC console as documented - Update deployment detection to recognize install.sh in update command - Previously only looked for legacy "pulse.sh" reference - Now checks for both pulse.sh and install.sh --- install.sh | 37 +++++++++++++++++++++++++------------ internal/updates/version.go | 2 +- 2 files changed, 26 insertions(+), 13 deletions(-) diff --git a/install.sh b/install.sh index 018694aa1..ded31fe4b 100755 --- a/install.sh +++ b/install.sh @@ -19,6 +19,12 @@ SERVICE_NAME="pulse" GITHUB_REPO="rcourtman/Pulse" BUILD_FROM_SOURCE=false SKIP_DOWNLOAD=false +IN_CONTAINER=false +IN_DOCKER=false +ENABLE_AUTO_UPDATES=false +FORCE_VERSION="" +FORCE_CHANNEL="" +SOURCE_BRANCH="main" # Wrapper for systemctl commands that might hang in unprivileged containers safe_systemctl() { @@ -1453,15 +1459,29 @@ setup_directories() { } setup_update_command() { - # Function kept for compatibility but no longer creates update command - # Community Scripts installations have their own update mechanism at /bin/update - # Native installations should update using: curl -fsSL ... | bash - + # Create update command at /bin/update for ProxmoxVE LXC detection + # This allows the backend to detect ProxmoxVE installations + cat > /bin/update <<'EOF' +#!/usr/bin/env bash +# Pulse update command +# This script re-runs the Pulse installer to update to the latest version + +set -e + +echo "Updating Pulse..." +curl -fsSL https://raw.githubusercontent.com/rcourtman/Pulse/main/install.sh | bash + +echo "" +echo "Update complete! Pulse will restart automatically." +EOF + + chmod +x /bin/update + # Ensure /usr/local/bin is in PATH for all users if ! grep -q '/usr/local/bin' /etc/profile 2>/dev/null; then echo 'export PATH="/usr/local/bin:$PATH"' >> /etc/profile fi - + # Also add to bash profile if it exists if [[ -f /etc/bash.bashrc ]] && ! grep -q '/usr/local/bin' /etc/bash.bashrc 2>/dev/null; then echo 'export PATH="/usr/local/bin:$PATH"' >> /etc/bash.bashrc @@ -2372,13 +2392,6 @@ reset_pulse() { } # Parse command line arguments -FORCE_VERSION="" -FORCE_CHANNEL="" -SOURCE_BRANCH="main" -IN_CONTAINER=false -IN_DOCKER=false -ENABLE_AUTO_UPDATES=false - while [[ $# -gt 0 ]]; do case $1 in --uninstall) diff --git a/internal/updates/version.go b/internal/updates/version.go index 6cd2034cc..761b8eeb9 100644 --- a/internal/updates/version.go +++ b/internal/updates/version.go @@ -238,7 +238,7 @@ func GetDeploymentType() string { if fileExists("/bin/update") { // Read file directly instead of using exec.Command data, err := os.ReadFile("/bin/update") - if err == nil && strings.Contains(string(data), "pulse.sh") { + if err == nil && (strings.Contains(string(data), "pulse.sh") || strings.Contains(string(data), "install.sh")) { return "proxmoxve" } }