mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-05-08 18:21:55 +00:00
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
This commit is contained in:
parent
413ef73953
commit
f9b8037486
2 changed files with 26 additions and 13 deletions
37
install.sh
37
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)
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue