From 6d93fcd3919065e5f4a8e05ef7a709170fc2f8a7 Mon Sep 17 00:00:00 2001 From: Pulse Monitor Date: Fri, 29 Aug 2025 07:59:03 +0000 Subject: [PATCH] fix: ensure PATH and update command work for all installations - Created setup_update_command() function to handle PATH and update script setup - Adds /usr/local/bin to PATH in /etc/profile and /etc/bash.bashrc - Creates /usr/local/bin/update script if it doesn't exist - Called during all installation/update flows (fresh, update, reinstall) - Fixes issue where existing users couldn't run 'update' command without full path - Addresses #377 --- install.sh | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/install.sh b/install.sh index 3ad43ff5f..40b8e0d6b 100755 --- a/install.sh +++ b/install.sh @@ -895,6 +895,28 @@ setup_directories() { chmod 700 "$CONFIG_DIR" } +setup_update_command() { + # Create or update the convenient update script + if [[ ! -f /usr/local/bin/update ]]; then + cat > /usr/local/bin/update << 'EOF' +#!/bin/bash +echo 'Updating Pulse...' +curl -sSL https://raw.githubusercontent.com/rcourtman/Pulse/main/install.sh | bash +EOF + chmod +x /usr/local/bin/update + fi + + # 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 + fi +} + setup_auto_updates() { print_info "Setting up automatic updates..." @@ -1138,6 +1160,7 @@ main() { systemctl stop $SERVICE_NAME || true create_user download_pulse + setup_update_command start_pulse print_completion return 0 @@ -1305,6 +1328,7 @@ main() { systemctl stop $SERVICE_NAME || true create_user download_pulse + setup_update_command # Setup auto-updates if requested during update if [[ "$ENABLE_AUTO_UPDATES" == "true" ]]; then @@ -1337,6 +1361,7 @@ main() { create_user download_pulse setup_directories + setup_update_command install_systemd_service # Setup auto-updates if requested during reinstall @@ -1443,6 +1468,7 @@ main() { create_user setup_directories download_pulse + setup_update_command install_systemd_service # Setup auto-updates if requested @@ -1492,6 +1518,7 @@ uninstall_pulse() { rm -f /etc/systemd/system/pulse-update.timer rm -f /usr/local/bin/pulse rm -f /usr/local/bin/pulse-auto-update.sh + rm -f /usr/local/bin/update # Remove user (if it exists and isn't being used by other services) if id "pulse" &>/dev/null; then