fix(install): stop existing daemons before binary replacement (#945)
Stop existing daemons before binary replacement during install Prevents file lock race condition by gracefully stopping bd daemons before replacing the binary. Safe for fresh installs (skips if bd not found).
This commit is contained in:
committed by
GitHub
parent
88f106fe17
commit
bec44d85a1
@@ -109,6 +109,25 @@ detect_platform() {
|
||||
echo "${os}_${arch}"
|
||||
}
|
||||
|
||||
# Stop existing daemons before upgrade (safe for fresh installs)
|
||||
stop_existing_daemons() {
|
||||
# Skip if bd isn't installed (fresh install)
|
||||
if ! command -v bd &> /dev/null; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
log_info "Stopping existing bd daemons before upgrade..."
|
||||
|
||||
# Try graceful shutdown via bd daemons killall
|
||||
if bd daemons killall 2>/dev/null; then
|
||||
log_success "Stopped existing daemons"
|
||||
else
|
||||
log_warning "No daemons running or failed to stop (continuing anyway)"
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
# Download and install from GitHub releases
|
||||
install_from_release() {
|
||||
log_info "Installing bd from GitHub releases..."
|
||||
@@ -449,6 +468,9 @@ main() {
|
||||
platform=$(detect_platform)
|
||||
log_info "Platform: $platform"
|
||||
|
||||
# Stop any running daemons before replacing binary
|
||||
stop_existing_daemons
|
||||
|
||||
# Try downloading from GitHub releases first
|
||||
if install_from_release "$platform"; then
|
||||
verify_installation
|
||||
|
||||
Reference in New Issue
Block a user