#!/bin/bash set -e # Colors RED='\033[0;31m' GREEN='\033[0;32m' YELLOW='\033[1;33m' NC='\033[0m' echo -e "${GREEN}>>> Lutris Git Installer for SteamOS${NC}" echo -e "${YELLOW}>>> This script will auto-install missing system dependencies via pacman.${NC}" echo -e "${YELLOW}>>> Lutris itself will be installed from Git via pip --user.${NC}" echo -e "${YELLOW}>>> NO icons, NO desktop files, NO extra crap.${NC}" echo "" # Require sudo if [[ ${EUID} -ne 0 ]]; then echo -e "${RED}>>> This script requires sudo to install system packages.${NC}" echo -e "${YELLOW}>>> Re-executing with sudo...${NC}" exec sudo bash "$0" "$@" exit ${?} fi # 1. Install system dependencies via pacman (if missing) echo -e "${GREEN}>>> Checking and installing system dependencies...${NC}" DEPS=( git python3 python-pip python-yaml python-requests python-pillow python-gobject gtk3 libnotify webkit2gtk gstreamer gstreamer-plugins-base gstreamer-plugins-good gstreamer-plugins-bad gstreamer-plugins-ugly cabextract unzip p7zip curl xorg-xrandr python-evdev libgirepository python-setproctitle python-distro pkgconf gcc make ) # Filter out already installed packages TO_INSTALL=() for pkg in "${DEPS[@]}"; do if ! pacman -Q "$pkg" &>/dev/null; then TO_INSTALL+=("$pkg") fi done if [ ${#TO_INSTALL[@]} -gt 0 ]; then echo -e "${YELLOW}>>> Installing missing packages: ${TO_INSTALL[*]}${NC}" pacman -Sy --noconfirm "${TO_INSTALL[@]}" if [ ${?} -ne 0 ]; then echo -e "${RED}>>> Warning: Failed to install some system packages. Trying to continue...${NC}" fi else echo -e "${GREEN}>>> All system dependencies are already installed.${NC}" fi # 2. Switch to non-root user for pip/user install if [ -z "$SUDO_USER" ]; then REAL_USER="root" else REAL_USER="$SUDO_USER" fi HOME_DIR=$(eval echo ~$REAL_USER) echo -e "${GREEN}>>> Cloning Lutris from Git...${NC}" LUTRIS_SRC="$HOME_DIR/lutris-source" rm -rf "$LUTRIS_SRC" su - "$REAL_USER" -c "git clone --depth 1 https://github.com/lutris/lutris.git '$LUTRIS_SRC'" cd "$LUTRIS_SRC" || exit 1 # 3. Install Python deps via pip --user (as the real user) echo -e "${GREEN}>>> Installing Python dependencies via pip --user...${NC}" su - "$REAL_USER" -c "pip3 install --user -r '$LUTRIS_SRC/requirements.txt'" || { echo -e "${RED}>>> Warning: Some pip dependencies may have failed.${NC}" } # 4. Install Lutris itself via setup.py --user echo -e "${GREEN}>>> Installing Lutris via setup.py --user...${NC}" su - "$REAL_USER" -c "python3 '$LUTRIS_SRC/setup.py' install --user" || { echo -e "${RED}>>> Error installing Lutris.${NC}" exit 1 } # 5. Ensure ~/.local/bin is in PATH for the user echo -e "${GREEN}>>> Ensuring ~/.local/bin is in user PATH...${NC}" su - "$REAL_USER" -c 'grep -q ".local/bin" ~/.bashrc || echo "export PATH=\"\$HOME/.local/bin:\$PATH\"" >> ~/.bashrc' su - "$REAL_USER" -c 'grep -q ".local/bin" ~/.profile || echo "export PATH=\"\$HOME/.local/bin:\$PATH\"" >> ~/.profile' echo -e "${GREEN}=========================================${NC}" echo -e "${GREEN}>>> DONE.${NC}" echo -e "${GREEN}=========================================${NC}" echo "" echo -e "${YELLOW}>>> To run Lutris:${NC}" echo -e "1. Exit sudo (if you are root) and run: ${GREEN}lutris${NC}" echo -e "2. Or re-login and launch from terminal/menu." echo "" echo -e "${RED}>>> NOTE:${NC} If 'lutris' command is not found, run:" echo -e " ${GREEN}export PATH=\"\$HOME/.local/bin:\$PATH\"${NC}" echo -e " Then try again: ${GREEN}lutris${NC}" echo "" echo -e "${YELLOW}>>> No icons, no shortcuts, no desktop files created. As requested.${NC}"