62 lines
2.2 KiB
Bash
62 lines
2.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
|
|
xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/dpms-enabled -t bool -s false
|
|
|
|
# Change clock format.
|
|
plugin_name="$( xfconf-query -c xfce4-panel -p /plugins -lv | grep -E '/plugins/plugin-[0-9]+.*clock' | cut -d" " -f '1-1' )"
|
|
xfconf-query -c xfce4-panel -p ${plugin_name}/digital-format -t "string" -s '<span font="18">%T</span>%n<span font="12">%Y-%m-%d</span>' -n
|
|
|
|
# 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.
|
|
mkdir -p /home/${SUDO_USER}/.config/autostart
|
|
ln -s /home/${SUDO_USER}/Desktop/Moonlight.desktop /home/${SUDO_USER}/.config/autostart/.
|
|
chown -R ${SUDO_USER}:${SUDO_USER} /home/${SUDO_USER}/.config
|
|
|
|
# Reboot!
|
|
reboot
|
|
}
|
|
|
|
|
|
# All the config is in a function so we can stream this script from forge.duensing.digital.
|
|
sudo configureMachine
|