mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-09-22 19:23:31 +00:00
fix: stop service before updating binary to avoid 'Text file busy' error
Move service stop to happen before attempting to copy the binary file. This prevents the error when the binary is still in use by the running service. Added 2-second delay to ensure process fully releases the file.
This commit is contained in:
+8
-9
@@ -224,21 +224,20 @@ download_pulse() {
|
||||
DOWNLOAD_URL="https://github.com/$GITHUB_REPO/releases/download/$LATEST_RELEASE/pulse-${LATEST_RELEASE}-linux-${PULSE_ARCH}.tar.gz"
|
||||
print_info "Downloading from: $DOWNLOAD_URL"
|
||||
|
||||
# Detect and stop existing service BEFORE downloading (to free the binary)
|
||||
EXISTING_SERVICE=$(detect_service_name)
|
||||
if systemctl is-active --quiet $EXISTING_SERVICE; then
|
||||
print_info "Stopping existing Pulse service ($EXISTING_SERVICE)..."
|
||||
systemctl stop $EXISTING_SERVICE
|
||||
sleep 2 # Give the process time to fully stop and release the binary
|
||||
fi
|
||||
|
||||
cd /tmp
|
||||
if ! wget -q -O pulse.tar.gz "$DOWNLOAD_URL"; then
|
||||
print_error "Failed to download Pulse release"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Detect existing service name
|
||||
EXISTING_SERVICE=$(detect_service_name)
|
||||
|
||||
# Stop service if running (for updates)
|
||||
if systemctl is-active --quiet $EXISTING_SERVICE; then
|
||||
print_info "Stopping existing Pulse service ($EXISTING_SERVICE)..."
|
||||
systemctl stop $EXISTING_SERVICE
|
||||
fi
|
||||
|
||||
# Extract to temporary directory first
|
||||
TEMP_EXTRACT="/tmp/pulse-extract-$$"
|
||||
mkdir -p "$TEMP_EXTRACT"
|
||||
|
||||
Reference in New Issue
Block a user