Add WebSocket support and fix Makefile installation

This commit is contained in:
Jose Luis Montañes Ojados
2026-01-27 02:52:52 +01:00
parent 0865aba041
commit 481f8c431d
3 changed files with 45 additions and 96 deletions

View File

@@ -22,10 +22,18 @@ clean:
@echo "Cleaning..."
rm -f $(BINARY_NAME)
install: build
install:
@if [ ! -f $(BINARY_NAME) ]; then \
echo "Error: '$(BINARY_NAME)' binary not found."; \
echo "Please run 'make build' first as a regular user."; \
exit 1; \
fi
@echo "Installing $(BINARY_NAME) to $(INSTALL_DIR)..."
# Create user if not exists
id -u grokway &>/dev/null || useradd -r -s /bin/false grokway
if ! id -u grokway >/dev/null 2>&1; then \
echo "Creating grokway user..."; \
useradd -r -s /bin/false grokway; \
fi
# Create directory
mkdir -p $(INSTALL_DIR)
# Copy binary
@@ -41,7 +49,9 @@ install: build
cp $(SERVICE_NAME) $(SYSTEMD_DIR)/
# Update paths in service file just in case they were modified
sed -i 's|WorkingDirectory=.*|WorkingDirectory=$(INSTALL_DIR)|g' $(SYSTEMD_DIR)/$(SERVICE_NAME)
sed -i 's|ExecStart=.*|ExecStart=$(INSTALL_DIR)/$(BINARY_NAME)|g' $(SYSTEMD_DIR)/$(SERVICE_NAME)
# execStart sed commented out to preserve arguments like --ssh :2223
# sed -i 's|ExecStart=.*|ExecStart=$(INSTALL_DIR)/$(BINARY_NAME)|g' $(SYSTEMD_DIR)/$(SERVICE_NAME)
# Instead, ensure the binary path is correct but keep args (this is tricky with sed, simpler to rely on repo file)
systemctl daemon-reload
systemctl enable $(SERVICE_NAME)