This script automates the installation and configuration of Sunshine on Arch Linux, including setting necessary permissions, capabilities, and creating a systemd service for automatic startup at boot.
- Adds the LizardByte repository to
/etc/pacman.conf(optional, with a warning if it fails). - Updates package lists using
pacman. - Installs Sunshine if it's not already present.
- Dynamically detects the installed Sunshine version.
- Creates a wrapper script (
archSunshine.sh) in/usr/local/binto manage permissions and capabilities. - Sets appropriate permissions and the
cap_sys_admincapability for Sunshine. - Creates a systemd service (
archSunshine.service) to ensure Sunshine starts at boot. - Option to start the service immediately after installation using the
--startflag. - Comprehensive error handling for robust execution.
- Arch Linux installed and configured.
sudoprivileges.
-
Download the script: Download the
archSunshine.shscript. -
Make it executable:
chmod +x archSunshine.sh
-
Run the script with
sudo:sudo ./archSunshine.sh
To also start the service immediately after installation:
sudo ./archSunshine.sh --start
The script performs the following steps:
-
Add LizardByte Repository (Optional):
- Adds the LizardByte repository to
/etc/pacman.confto enable installation of Sunshine. - If the repository is already present or adding it fails, a warning is displayed, but the script continues.
- Adds the LizardByte repository to
-
Update Package Lists:
- Runs
pacman -Syu --noconfirmto update the local package database and synchronize with remote repositories.
- Runs
-
Install Sunshine:
- Checks if Sunshine is already installed.
- If not installed, attempts to install it using
pacman -S sunshine --noconfirm. - If the installation fails, the script aborts.
-
Configuration:
- Sets variables for the script destination, service name, and service file path.
- Dynamically retrieves the current user's username.
- Dynamically extracts the installed Sunshine version from the executable filename.
- Constructs the full path to the versioned Sunshine executable.
-
Create Wrapper Script (
archSunshine.sh):- Creates a wrapper script at
/usr/local/bin/archSunshine.sh. - This script sets the necessary permissions (
a+x) and thecap_sys_admincapability for the Sunshine executable. - Uses
sedto correctly insert the version into the script.
- Creates a wrapper script at
-
Create Systemd Service (
archSunshine.service):- Creates a systemd service file at
/etc/systemd/system/archSunshine.service. - This service ensures that the
archSunshine.shscript is executed at boot. - Configured to run as the current user.
- Creates a systemd service file at
-
Enable Systemd Service:
- Enables the systemd service to start automatically at boot.
-
Start Service (Optional):
- If the
--startflag is provided, the script starts the service immediately.
- If the
- Repository Issues: If you encounter issues adding the LizardByte repository, you can add it manually by editing
/etc/pacman.conf. - Sunshine Installation Issues: Check your internet connection and ensure the LizardByte repository is working correctly.
- Service Startup Issues: Check the systemd service status using
systemctl status archSunshine.servicefor any error messages. - Permissions Issues: Ensure the
archSunshine.shscript has execute permissions (chmod +x /usr/local/bin/archSunshine.sh).
To uninstall, you'll need to manually perform the following steps:
- Stop the service:
sudo systemctl stop archSunshine.service - Disable the service:
sudo systemctl disable archSunshine.service - Remove the service file:
sudo rm /etc/systemd/system/archSunshine.service - Remove the wrapper script:
sudo rm /usr/local/bin/archSunshine.sh - (Optional) Remove sunshine:
sudo pacman -R sunshine - (Optional) Remove the Lizardbyte repository from
/etc/pacman.conf
This script is licensed under the GNU General Public License v3.0.