From 9d6f39d7aca99bb1d9b36ed87c37c156e18fc985 Mon Sep 17 00:00:00 2001 From: Mathieu Broillet Date: Mon, 1 Jan 2024 18:57:37 +0100 Subject: [PATCH] improved install script to allow for launching GUI apps from SSH --- .github/wiki/script-auto-config-linux.sh | 32 +++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/.github/wiki/script-auto-config-linux.sh b/.github/wiki/script-auto-config-linux.sh index fa9879e..d4af9ad 100644 --- a/.github/wiki/script-auto-config-linux.sh +++ b/.github/wiki/script-auto-config-linux.sh @@ -1,6 +1,11 @@ #!/bin/bash +# Ask for HomeAssistant IP +echo "Please enter your HomeAssistant IP address:" +read -r HOMEASSISTANT_IP + # Enable SSH Server +echo "Enabling SSH Server..." if command -v systemctl &> /dev/null; then sudo systemctl enable --now sshd else @@ -9,15 +14,36 @@ fi # Configure sudoers echo "Configuring sudoers..." -echo -e "\n# Allow your user to execute specific commands without a password" | sudo tee -a /etc/sudoers +echo -e "\n# Allow your user to execute specific commands without a password (for EasyComputerManager/HA)" | sudo tee -a /etc/sudoers echo "$(whoami) ALL=(ALL) NOPASSWD: /sbin/shutdown, /sbin/init, /usr/bin/systemctl, /usr/sbin/pm-suspend, /usr/bin/awk, /usr/sbin/grub-reboot, /usr/sbin/grub2-reboot" | sudo tee -a /etc/sudoers # Firewall Configuration +echo "Configuring firewall..." if command -v ufw &> /dev/null; then - echo "Configuring firewall..." sudo ufw allow 22 else - echo "UFW not found. Please configure the firewall manually." + echo "UFW not found. Please configure the firewall manually (if needed)." fi +# Setup xhost for GUI apps +echo "Configuring persistent xhost for starting GUI apps (like Steam)..." +COMMANDS="xhost +$HOMEASSISTANT_IP; xhost +localhost" +DESKTOP_ENTRY_NAME="EasyComputerManager-AutoStart" +DESKTOP_ENTRY_PATH="$HOME/.config/autostart/$DESKTOP_ENTRY_NAME.desktop" + +# Create the desktop entry file for the Desktop Environment to autostart at login every reboot +cat > "$DESKTOP_ENTRY_PATH" <