feat(just): move setup-sunshine to its own file

This commit is contained in:
HikariKnight 2024-02-15 19:52:28 +01:00
parent cda37e127d
commit af944b51b1
3 changed files with 50 additions and 48 deletions

View File

@ -494,6 +494,7 @@ RUN /tmp/image-info.sh && \
cp "/usr/share/ublue-os/firstboot/yafti.yml" "/etc/yafti.yml" && \
echo "import \"/usr/share/ublue-os/just/80-bazzite.just\"" >> /usr/share/ublue-os/justfile && \
echo "import \"/usr/share/ublue-os/just/81-bazzite-apps.just\"" >> /usr/share/ublue-os/justfile && \
echo "import \"/usr/share/ublue-os/just/81-bazzite-sunshine.just\"" >> /usr/share/ublue-os/justfile && \
echo "import \"/usr/share/ublue-os/just/84-bazzite-virt.just\"" >> /usr/share/ublue-os/justfile && \
echo "import \"/usr/share/ublue-os/just/85-bazzite-image.just\"" >> /usr/share/ublue-os/justfile && \
echo "import \"/usr/share/ublue-os/just/90-bazzite-de.just\"" >> /usr/share/ublue-os/justfile && \

View File

@ -48,54 +48,6 @@ configure-waydroid:
deactivate
sudo rm -rf /tmp/waydroid_script
# Setup and configure Sunshine Game Streaming host
setup-sunshine ACTION="":
#!/bin/bash
source /usr/lib/ujust/ujust.sh
SUNSHINE_STATE="$(rpm -qa sunshine)"
SERVICE_STATE="$(systemctl is-enabled --user sunshine.service)"
OPTION={{ ACTION }}
if [ "$SUNSHINE_STATE" == "" ]; then
SUNSHINE_STATE="${red}${b}Not Installed${n}"
else
SUNSHINE_STATE="${green}${b}Installed${n}"
fi
if [ "$SERVICE_STATE" == "enabled" ]; then
SERVICE_STATE="${green}${b}Enabled${n}"
else
SERVICE_STATE="${red}${b}Disabled${n}"
fi
if [ "$OPTION" == "help" ]; then
echo "Usage: ujust setup-sunshine <option>"
echo " <option>: Specify the quick option to skip the prompt"
echo " Use 'install' to select Install Sunshine"
echo " Use 'remove' to select Remove Sunshine"
echo " Use 'autostart' to select Toggle Autostart"
exit 0
elif [ "$OPTION" == "" ]; then
echo "${bold}Sunshine setup and configuration${normal}"
echo "Sunshine is $SUNSHINE_STATE"
echo "Service is $SERVICE_STATE"
OPTION=$(Choose "Install Sunshine" "Remove Sunshine" "Toggle Autostart")
fi
if [[ "${OPTION,,}" =~ ^install ]]; then
systemctl enable sunshine-workaround.service
ublue-update --wait
rpm-ostree install -y https://github.com/LizardByte/Sunshine/releases/download/nightly-dev/sunshine-fedora-$(rpm -E %fedora)-amd64.rpm
echo "Sunshine is installed!"
elif [[ "${OPTION,,}" =~ ^(remove|uninstall) ]]; then
systemctl disable sunshine-workaround.service
ublue-update --wait
rpm-ostree remove -y sunshine
echo "Sunshine has been uninstalled."
elif [[ "${OPTION,,}" =~ autostart ]]; then
if [[ "${SERVICE_STATE,,}" =~ disabled ]]; then
systemctl enable --user --now sunshine.service
else
systemctl disable --user --now sunshine.service
fi
fi
# Patch a bug in some 32-bit Source 1.x titles that causes them to crash at startup
patch-source1-tcmalloc:
#!/usr/bin/bash

View File

@ -0,0 +1,49 @@
# vim: set ft=make :
# Setup and configure Sunshine Game Streaming host
setup-sunshine ACTION="":
#!/bin/bash
source /usr/lib/ujust/ujust.sh
SUNSHINE_STATE="$(rpm -qa sunshine)"
SERVICE_STATE="$(systemctl is-enabled --user sunshine.service)"
OPTION={{ ACTION }}
if [ "$SUNSHINE_STATE" == "" ]; then
SUNSHINE_STATE="${red}${b}Not Installed${n}"
else
SUNSHINE_STATE="${green}${b}Installed${n}"
fi
if [ "$SERVICE_STATE" == "enabled" ]; then
SERVICE_STATE="${green}${b}Enabled${n}"
else
SERVICE_STATE="${red}${b}Disabled${n}"
fi
if [ "$OPTION" == "help" ]; then
echo "Usage: ujust setup-sunshine <option>"
echo " <option>: Specify the quick option to skip the prompt"
echo " Use 'install' to select Install Sunshine"
echo " Use 'remove' to select Remove Sunshine"
echo " Use 'autostart' to select Toggle Autostart"
exit 0
elif [ "$OPTION" == "" ]; then
echo "${bold}Sunshine setup and configuration${normal}"
echo "Sunshine is $SUNSHINE_STATE"
echo "Service is $SERVICE_STATE"
OPTION=$(Choose "Install Sunshine" "Remove Sunshine" "Toggle Autostart")
fi
if [[ "${OPTION,,}" =~ ^install ]]; then
systemctl enable sunshine-workaround.service
ublue-update --wait
rpm-ostree install -y https://github.com/LizardByte/Sunshine/releases/download/nightly-dev/sunshine-fedora-$(rpm -E %fedora)-amd64.rpm
echo "Sunshine is installed!"
elif [[ "${OPTION,,}" =~ ^(remove|uninstall) ]]; then
systemctl disable sunshine-workaround.service
ublue-update --wait
rpm-ostree remove -y sunshine
echo "Sunshine has been uninstalled."
elif [[ "${OPTION,,}" =~ autostart ]]; then
if [[ "${SERVICE_STATE,,}" =~ disabled ]]; then
systemctl enable --user --now sunshine.service
else
systemctl disable --user --now sunshine.service
fi
fi