From 387cbec0994c0de777738f63a71683d16c85d8f3 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 23 Nov 2025 00:50:52 +0000 Subject: [PATCH] Move binary installation inside sudo block to fix permission check The build was succeeding but the post-build verification was failing because it tried to check /home/kiosk/talkkonnect-binary from outside the sudo -u kiosk block. Changes: - Move binary verification and installation inside the sudo -u block - Use ~ instead of /home/$KIOSK_USER (more reliable inside sudo) - Remove redundant chmod/chown after sudo block - Binary now installed while running as kiosk user This matches the approach from talkkonnect_complete_install.sh where all file operations happen inside the user context. --- setup_intercom.sh | 31 ++++++++++++------------------- 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/setup_intercom.sh b/setup_intercom.sh index 1b44b4e..e7821d8 100755 --- a/setup_intercom.sh +++ b/setup_intercom.sh @@ -509,16 +509,22 @@ EOFOPUS cd cmd/talkkonnect || exit 1 echo 'Compiling with vendored dependencies...' - go build -mod=vendor -v -o /home/$KIOSK_USER/talkkonnect-binary . 2>&1 | tail -20 + go build -mod=vendor -v -o ~/talkkonnect-binary . 2>&1 | tail -20 - if [[ -f /home/$KIOSK_USER/talkkonnect-binary ]]; then - chmod +x /home/$KIOSK_USER/talkkonnect-binary - echo 'Build successful' - exit 0 - else + if [[ ! -f ~/talkkonnect-binary ]]; then echo 'Build failed - binary not created' exit 1 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=$? @@ -534,19 +540,6 @@ EOFOPUS return 1 fi - # Verify and install binary - if [[ ! -x "/home/$KIOSK_USER/talkkonnect-binary" ]]; then - log_error "Binary not executable after build" - pause - return 1 - fi - - echo "Installing binary..." - sudo cp /home/$KIOSK_USER/talkkonnect-binary /home/$KIOSK_USER/go/bin/talkkonnect - sudo chmod +x /home/$KIOSK_USER/go/bin/talkkonnect - sudo chown "$KIOSK_USER:$KIOSK_USER" /home/$KIOSK_USER/go/bin/talkkonnect - rm -f /home/$KIOSK_USER/talkkonnect-binary - log_success "talkkonnect built successfully" echo "[4/4] Creating configuration..."