-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
216 lines (181 loc) Β· 6.62 KB
/
install.sh
File metadata and controls
216 lines (181 loc) Β· 6.62 KB
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
#!/bin/bash
# RootStream - Installation and Setup Script
set -e
BLUE='\033[0;34m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
NC='\033[0m' # No Color
echo -e "${BLUE}"
echo "βββββββββββββββββββββββββββββββββββββββββββββββββ"
echo "β RootStream Installation β"
echo "β Native Linux Game Streaming β"
echo "βββββββββββββββββββββββββββββββββββββββββββββββββ"
echo -e "${NC}"
# Check if running on Arch-based system
if [ -f /etc/arch-release ]; then
echo -e "${GREEN}β Arch Linux detected${NC}"
DISTRO="arch"
elif [ -f /etc/debian_version ]; then
echo -e "${YELLOW}β Debian/Ubuntu detected (untested)${NC}"
DISTRO="debian"
elif [ -f /etc/redhat-release ]; then
echo -e "${YELLOW}β Fedora/RHEL detected (untested)${NC}"
DISTRO="fedora"
else
echo -e "${YELLOW}β Unknown distribution${NC}"
DISTRO="unknown"
fi
# Function to install dependencies
install_deps() {
echo -e "\n${BLUE}π¦ Installing dependencies...${NC}"
case $DISTRO in
arch)
sudo pacman -S --needed base-devel libdrm libva mesa
;;
debian)
sudo apt-get update
sudo apt-get install -y build-essential libdrm-dev libva-dev mesa-va-drivers
;;
fedora)
sudo dnf install -y gcc make libdrm-devel libva-devel mesa-va-drivers
;;
*)
echo -e "${RED}β Unknown distro - please install: gcc, make, libdrm, libva${NC}"
exit 1
;;
esac
echo -e "${GREEN}β Dependencies installed${NC}"
}
# Check for dependencies
check_deps() {
echo -e "\n${BLUE}π Checking dependencies...${NC}"
local missing=()
if ! command -v gcc &> /dev/null; then
missing+=("gcc")
fi
if ! command -v make &> /dev/null; then
missing+=("make")
fi
if ! pkg-config --exists libdrm 2>/dev/null; then
missing+=("libdrm")
fi
if ! pkg-config --exists libva 2>/dev/null; then
missing+=("libva")
fi
if [ ${#missing[@]} -eq 0 ]; then
echo -e "${GREEN}β All dependencies found${NC}"
return 0
else
echo -e "${YELLOW}β Missing dependencies: ${missing[*]}${NC}"
read -p "Install missing dependencies? (y/n) " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
install_deps
else
echo -e "${RED}β Cannot continue without dependencies${NC}"
exit 1
fi
fi
}
# Build the project
build() {
echo -e "\n${BLUE}π¨ Building RootStream...${NC}"
if [ ! -f Makefile ]; then
echo -e "${RED}β Makefile not found - are you in the right directory?${NC}"
exit 1
fi
make clean 2>/dev/null || true
if make; then
echo -e "${GREEN}β Build successful${NC}"
else
echo -e "${RED}β Build failed${NC}"
exit 1
fi
}
# Install the binary
install_binary() {
echo -e "\n${BLUE}π¦ Installing RootStream...${NC}"
if [ ! -f rootstream ]; then
echo -e "${RED}β Binary not found - build first${NC}"
exit 1
fi
sudo install -m 755 rootstream /usr/local/bin/
echo -e "${GREEN}β Installed to /usr/local/bin/rootstream${NC}"
if [ -f assets/rootstream.desktop ]; then
sudo install -m 644 assets/rootstream.desktop /usr/local/share/applications/rootstream.desktop
fi
if [ -f assets/rootstream.png ]; then
sudo install -m 644 assets/rootstream.png /usr/local/share/icons/hicolor/256x256/apps/rootstream.png
fi
}
# Setup permissions
setup_permissions() {
echo -e "\n${BLUE}π Setting up permissions...${NC}"
# Add user to video group
if ! groups $USER | grep -q '\bvideo\b'; then
sudo usermod -a -G video $USER
echo -e "${YELLOW}β Added to 'video' group - you must log out and back in${NC}"
else
echo -e "${GREEN}β Already in 'video' group${NC}"
fi
# Check uinput permissions
if [ ! -c /dev/uinput ]; then
echo -e "${YELLOW}β /dev/uinput not found${NC}"
echo " Loading uinput module..."
sudo modprobe uinput
echo "uinput" | sudo tee /etc/modules-load.d/rootstream.conf > /dev/null
fi
# Check for DRM devices
if [ -e /dev/dri/card0 ]; then
echo -e "${GREEN}β DRM device found: /dev/dri/card0${NC}"
else
echo -e "${RED}β No DRM device found${NC}"
echo " This is probably a problem."
fi
}
# Test VA-API
test_vaapi() {
echo -e "\n${BLUE}π§ͺ Testing VA-API...${NC}"
if command -v vainfo &> /dev/null; then
if vainfo &> /dev/null; then
echo -e "${GREEN}β VA-API working${NC}"
else
echo -e "${YELLOW}β VA-API not working - encoder may fail${NC}"
echo " For NVIDIA, try: sudo pacman -S libva-vdpau-driver"
fi
else
echo -e "${YELLOW}β vainfo not found - install libva-utils to test${NC}"
fi
}
# Main installation
main() {
check_deps
build
read -p "Install to /usr/local/bin? (y/n) " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
install_binary
setup_permissions
test_vaapi
if [ -f rootstream.service ]; then
echo -e "\n${BLUE}π§© Installing systemd service template...${NC}"
sudo install -m 644 rootstream.service /etc/systemd/system/rootstream@.service
echo -e "${GREEN}β Installed /etc/systemd/system/rootstream@.service${NC}"
fi
echo -e "\n${GREEN}βββββββββββββββββββββββββββββββββββββββββββββββββ${NC}"
echo -e "${GREEN}β π Installation Complete! β${NC}"
echo -e "${GREEN}βββββββββββββββββββββββββββββββββββββββββββββββββ${NC}"
echo -e "\nQuick start:"
echo -e " ${BLUE}rootstream host${NC} # Start streaming"
echo -e " ${BLUE}rootstream client HOST${NC} # Connect to host"
if ! groups $USER | grep -q '\bvideo\b'; then
echo -e "\n${YELLOW}β IMPORTANT: Log out and back in for permissions to take effect${NC}"
fi
else
echo -e "\n${YELLOW}Build complete. To install manually:${NC}"
echo " sudo make install"
fi
}
# Run
main