68 lines
2 KiB
Bash
68 lines
2 KiB
Bash
#!/bin/bash
|
|
|
|
# This script configures the machines to auto-launch Moonlight streaming on startup.
|
|
|
|
|
|
function configureMachine() {
|
|
|
|
# Update everything.
|
|
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys D5AFC5E2A4987676 241FE6973B765FAE
|
|
apt-get -y update
|
|
apt-get -y upgrade
|
|
apt-get -y dist-upgrade
|
|
apt-get -y autoremove
|
|
|
|
# Tools for us.
|
|
apt-get -y install mc joe openssh-server
|
|
|
|
# Disable screensaver.
|
|
sed -i 's/mode:[[:space:]]*blank/mode: off/' /home/${SUDO_USER}/.xscreensaver
|
|
|
|
# Install Moonlight.
|
|
apt-get -y install flatpak
|
|
flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
|
|
flatpak install -y flathub com.moonlight_stream.Moonlight
|
|
|
|
# Configure Moonlight.
|
|
sudo -i -u ${SUDO_USER} flatpak run com.moonlight_stream.Moonlight quit # This generates the ~/.var/ structure for the config.
|
|
wget https://forge.duensing.digital/Duensing_Digital/chromebook-linux/raw/branch/master/Moonlight.conf
|
|
chown ${SUDO_USER}:${SUDO_USER} Moonlight.conf
|
|
mv Moonlight.conf "/home/${SUDO_USER}/.var/app/com.moonlight_stream.Moonlight/config/Moonlight Game Streaming Project/."
|
|
|
|
# Add icon to desktop
|
|
cat <<- ICON > /home/${SUDO_USER/Desktop/Moonlight.desktop
|
|
[Desktop Entry]
|
|
Version 1.0
|
|
Type Application
|
|
Name Moonlight
|
|
Comment Game Streaming Client
|
|
Exec /home/${SUDO_USER}/moonlight.sh
|
|
icon palemoon
|
|
Path /home/${SUDO_USER}
|
|
Terminal false
|
|
StartupNotify false
|
|
ICON
|
|
|
|
# Make Moonlight run on startup.
|
|
cat <<- MOON > /home/${SUDO_USER}/moonlight.sh
|
|
#!/bin/bash
|
|
flatpak run com.moonlight_stream.Moonlight &
|
|
MOON
|
|
chown ${SUDO_USER}:${SUDO_USER} /home/${SUDO_USER}/moonlight.sh
|
|
chmod +x /home/${SUDO_USER}/moonlight.sh
|
|
cat <<- 'STARTUP' >> /home/${SUDO_USER}/.profile
|
|
if [ -z "$SSH_CLIENT" ] ; then
|
|
xset -dpms
|
|
xset s off
|
|
xset s noblank
|
|
$HOME/moonlight.sh
|
|
fi
|
|
STARTUP
|
|
|
|
# Reboot!
|
|
reboot
|
|
}
|
|
|
|
|
|
# All the config is in a function so we can stream this script from forge.duensing.digital.
|
|
sudo configureMachine
|