Skip to content

Commit 4e288e9

Browse files
committed
Update setup.sh
1 parent cb9fc55 commit 4e288e9

1 file changed

Lines changed: 30 additions & 1 deletion

File tree

setup.sh

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -523,6 +523,11 @@ setup_novnc_service() {
523523
return
524524
fi
525525

526+
if ! command -v systemctl &> /dev/null; then
527+
print_error "systemctl command not found. Cannot set up noVNC systemd service."
528+
return 1
529+
fi
530+
526531
print_status "Non-WSL environment detected - Proceeding with noVNC service setup"
527532

528533
# Create systemd directory if it doesn't exist
@@ -548,6 +553,9 @@ setup_novnc_service() {
548553
NOVNC_PATH="$SCRIPT_DIR/novnc"
549554
fi
550555

556+
print_warning "The noVNC systemd service will be configured to proxy VNC display :0 (port 5900) by default."
557+
print_warning "If your VNC sessions use other displays/ports, you may need to adjust the noVNC client URL or start websockify manually for those specific sessions."
558+
551559
# Create noVNC systemd service
552560
cat > "$SYSTEMD_DIR/novnc.service" << EOF
553561
[Unit]
@@ -642,11 +650,32 @@ install_local() {
642650

643651
# Function to setup systemd service
644652
setup_systemd_service() {
653+
# Detect if we are in WSL
654+
if grep -qiE "(microsoft|wsl)" /proc/sys/kernel/osrelease 2>/dev/null; then
655+
print_warning "Detected WSL environment. Systemd services might not work as expected unless systemd is explicitly enabled in your WSL2 distribution."
656+
local attempt_wsl_service_core # Use local to avoid conflicts
657+
read -p "Still attempt to set up CoreSecFrame as a systemd service? (y/N): " attempt_wsl_service_core
658+
if [[ ! $attempt_wsl_service_core =~ ^[Yy]$ ]]; then
659+
print_status "Skipping systemd service setup for CoreSecFrame in WSL."
660+
return
661+
fi
662+
fi
663+
645664
print_header "=== System Service Setup ==="
646665

647666
read -p "Would you like to set up CoreSecFrame to start automatically on system boot? (y/N): " auto_start
648667

649668
if [[ $auto_start =~ ^[Yy]$ ]]; then
669+
if ! command -v systemctl &> /dev/null; then
670+
print_error "systemctl command not found. Cannot set up systemd service."
671+
return 1
672+
fi
673+
674+
if [ ! -f "$SCRIPT_DIR/run.py" ]; then
675+
print_error "$SCRIPT_DIR/run.py not found. Cannot set up service."
676+
return 1
677+
fi
678+
650679
print_status "Creating systemd service..."
651680

652681
# Create systemd directory
@@ -663,7 +692,7 @@ Type=simple
663692
User=$USER
664693
Group=$USER
665694
WorkingDirectory=$SCRIPT_DIR
666-
Environment=PATH=$VENV_PATH/bin
695+
Environment="PATH=\$VENV_PATH/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
667696
ExecStart=$VENV_PATH/bin/python run.py
668697
Restart=always
669698
RestartSec=3

0 commit comments

Comments
 (0)