Stop running talkkonnect before binary replacement
Fixes "Text file busy" error and "Not installed" status: 1. **Stop service before install** (lines 535-547) - Check if talkkonnect service is running - Stop systemd service if active - Kill any stray processes - Sleep 1 second to ensure file is released - Then copy the new binary 2. **Fix status check** (line 72) - Changed from $HOME/go/bin/talkkonnect - To /home/$KIOSK_USER/go/bin/talkkonnect - Now correctly detects installed binary 3. **Separate build and install steps** - Build completes inside first sudo block - Installation happens in second sudo block after stopping service - Clean error handling for each step This matches the working talkkonnect_complete_install.sh approach.
This commit is contained in:
+28
-9
@@ -69,7 +69,7 @@ check_talkkonnect_status() {
|
||||
local installed=false
|
||||
local running=false
|
||||
|
||||
if command -v talkkonnect &>/dev/null || [[ -f "$HOME/go/bin/talkkonnect" ]]; then
|
||||
if command -v talkkonnect &>/dev/null || [[ -f "/home/$KIOSK_USER/go/bin/talkkonnect" ]]; then
|
||||
installed=true
|
||||
if systemctl is-active --quiet talkkonnect; then
|
||||
running=true
|
||||
@@ -517,14 +517,6 @@ EOFOPUS
|
||||
fi
|
||||
|
||||
echo 'Build successful'
|
||||
echo 'Installing binary...'
|
||||
|
||||
# Install to go/bin
|
||||
cp ~/talkkonnect-binary ~/go/bin/talkkonnect
|
||||
chmod +x ~/go/bin/talkkonnect
|
||||
rm ~/talkkonnect-binary
|
||||
|
||||
echo 'Installation complete'
|
||||
"
|
||||
|
||||
local build_result=$?
|
||||
@@ -540,6 +532,33 @@ EOFOPUS
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Stop any running talkkonnect before installing
|
||||
echo "Installing binary..."
|
||||
if systemctl is-active --quiet talkkonnect 2>/dev/null; then
|
||||
echo "Stopping existing talkkonnect service..."
|
||||
sudo systemctl stop talkkonnect
|
||||
fi
|
||||
|
||||
# Kill any stray processes
|
||||
if pgrep -x talkkonnect > /dev/null 2>&1; then
|
||||
echo "Killing running talkkonnect processes..."
|
||||
sudo pkill -9 talkkonnect
|
||||
sleep 1
|
||||
fi
|
||||
|
||||
# Now install as kiosk user
|
||||
sudo -u "$KIOSK_USER" bash -c "
|
||||
cp ~/talkkonnect-binary ~/go/bin/talkkonnect
|
||||
chmod +x ~/go/bin/talkkonnect
|
||||
rm ~/talkkonnect-binary
|
||||
"
|
||||
|
||||
if [[ $? -ne 0 ]]; then
|
||||
log_error "Failed to install binary"
|
||||
pause
|
||||
return 1
|
||||
fi
|
||||
|
||||
log_success "talkkonnect built successfully"
|
||||
|
||||
echo "[4/4] Creating configuration..."
|
||||
|
||||
Reference in New Issue
Block a user