-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathgaming.sh
executable file
·98 lines (76 loc) · 3.44 KB
/
gaming.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#!/usr/bin/bash
################################################
##### Utilities
################################################
if [ ${STEAM_NATIVE} = "yes" ]; then
# Install Gamescope
pacman -S --noconfirm gamescope
# Install MangoHud
pacman -S --noconfirm mangohud lib32-mangohud
# Configure MangoHud
mkdir -p /home/${NEW_USER}/.config/MangoHud
curl -sSL https://raw.githubusercontent.com/gjpin/arch-linux/main/configs/mangohud/MangoHud.conf -o /home/${NEW_USER}/.config/MangoHud/MangoHud.conf
fi
################################################
##### Steam
################################################
if [ ${STEAM_NATIVE} = "yes" ]; then
# Install Steam
pacman -S --noconfirm steam
# Make sure correct driver is installed
if pacman -Qs lib32-amdvlk > /dev/null; then
pacman -S --noconfirm lib32-vulkan-radeon
pacman -Rs --noconfirm lib32-amdvlk
fi
fi
# Create directory for Steam games
mkdir -p /home/${NEW_USER}/Games/Steam
################################################
##### Sunshine (native - prebuilt)
################################################
# References:
# https://github.com/LizardByte/Sunshine
# https://docs.lizardbyte.dev/projects/sunshine/en/latest/
# https://docs.lizardbyte.dev/projects/sunshine/en/latest/about/advanced_usage.html#port
# Install sunshine
sudo -u ${NEW_USER} paru -S --noconfirm sunshine-bin
# Enable sunshine service
chown -R ${NEW_USER}:${NEW_USER} /home/${NEW_USER}
sudo -u ${NEW_USER} systemctl --user enable sunshine
# Import sunshine configurations
mkdir -p /home/${NEW_USER}/.config/sunshine
curl https://raw.githubusercontent.com/gjpin/arch-linux/main/configs/sunshine/sunshine.conf -o /home/${NEW_USER}/.config/sunshine/sunshine.conf
if [ ${DESKTOP_ENVIRONMENT} = "gnome" ]; then
curl https://raw.githubusercontent.com/gjpin/arch-linux/main/configs/sunshine/apps-gnome.json -o /home/${NEW_USER}/.config/sunshine/apps.json
elif [ ${DESKTOP_ENVIRONMENT} = "plasma" ]; then
curl https://raw.githubusercontent.com/gjpin/arch-linux/main/configs/sunshine/apps-plasma.json -o /home/${NEW_USER}/.config/sunshine/apps.json
fi
# Enable KMS display capture
setcap cap_sys_admin+p $(readlink -f /usr/bin/sunshine)
# Allow Sunshine in firewall
firewall-offline-cmd --zone=home --add-port=47984/tcp
firewall-offline-cmd --zone=home --add-port=47989/tcp
firewall-offline-cmd --zone=home --add-port=48010/tcp
firewall-offline-cmd --zone=home --add-port=47998/udp
firewall-offline-cmd --zone=home --add-port=47999/udp
firewall-offline-cmd --zone=home --add-port=48000/udp
################################################
##### VR
################################################
# References:
# https://github.com/alvr-org/ALVR/blob/master/alvr/xtask/flatpak/com.valvesoftware.Steam.Utility.alvr.desktop
# https://github.com/alvr-org/ALVR/wiki/Installation-guide#portable-targz
# https://github.com/alvr-org/ALVR/tree/master/alvr/xtask/firewall
# https://github.com/alvr-org/ALVR/wiki/Flatpak
# https://github.com/alvr-org/ALVR/wiki/Installation-guide
if [ ${VR} = "yes" ]; then
# Install OpenXR and OpenVR
pacman -S --noconfirm openxr openvr
# Install ALVR
sudo -u ${NEW_USER} paru -S --noconfirm alvr-bin
# Allow ALVR in firewall
firewall-offline-cmd --zone=home --add-port=9943/tcp
firewall-offline-cmd --zone=home --add-port=9943/udp
firewall-offline-cmd --zone=home --add-port=9944/tcp
firewall-offline-cmd --zone=home --add-port=9944/udp
fi