-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup
executable file
·301 lines (298 loc) · 13 KB
/
setup
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
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
#!/bin/bash
# Thunder Installation Script
# This script may look clunky and complicated, but if you want to modify it read the comments first!
if uname -m | grep -q 'x86' ;then # Make sure the user isn't trying to run Thunder on x86, or that ruins the point of it
echo "Sorry, but Thunder is not for x86 devices. It is only available for ARM Linux PCs. A similar app on x86 is Lutris, but if you still want to use Thunder consider purchasing a Raspberry Pi 4 or 3."
exit
fi
if uname -m | grep -q 'amd64' ;then
echo "Sorry, but Thunder is not for x86 devices. It is only available for ARM Linux PCs. A similar app on x86 is Lutris, but if you still want to use Thunder consider purchasing a Raspberry Pi 4 or 3."
exit
fi
if uname -m | grep -q 'i386' ;then
echo "Sorry, but Thunder is not for x86 devices. It is only available for ARM Linux PCs. A similar app on x86 is Lutris, but if you still want to use Thunder consider purchasing a Raspberry Pi 4 or 3."
exit
fi
if uname -m | grep -q 'i686' ;then
echo "Sorry, but Thunder is not for x86 devices. It is only available for ARM Linux PCs. A similar app on x86 is Lutris, but if you still want to use Thunder consider purchasing a Raspberry Pi 4 or 3."
exit
fi
if uname -m | grep -q 'armel' ;then
echo "Sorry, but Thunder is not compatible with ARMEL devices. You need at least an ARMHF or ARM64 processor. Please consider purchasing a board with the ARM64 or ARMHF architecture, or upgrade your current device to a new architecture."
exit
fi
echo Welcome to Thunder setup! In a few steps your ARM SBC will be a gaming machine. We need to ask you some questions first.
read -p "To play most games you'll need Box86 to be installed. Install it? [Y/n] " response
if [[ $response =~ [Nn] ]]; then
echo OK, skipping. # The main reason there's the skip option is if someone already has the things installed
fi
# Compile Box86 for the selected Pi
if [[ $response =~ [Yy] ]]; then
echo Time to compile! "(This might take a while.)"
read -p "Wait, one last thing. What to SBC to compile for?: 464/432/3/RK3399/SD845 " whattocompilefor
# RK3399
if [[ $whattocompilefor == "RK3399" ]]; then
echo Got it, an RK3399. # Not everything works with this, but pretty much everything
function check-armhf() {
ARMHF="$(dpkg --print-foreign-architectures | grep "armhf")"
}
check-armhf
if [[ "$ARMHF" == *"armhf"* ]]; then
echo "ARMHF architecture is already added..."
else
sudo dpkg --add-architecture armhf
check-armhf
if [[ "$ARMHF" != *"armhf"* ]]; then
echo "The ARMHF architecture should be added by now, but it isn't!"
echo "Sorry, run this script again but skip compiling for an RK3399..."
exit
fi
fi
echo Working on it...
cd ~
git clone https://github.com/ptitSeb/box86
cd box86
sudo apt install gcc-arm-linux-gnueabihf
#if you encounter errors, run 'sudo apt install libc6-dev-armhf-cross'
mkdir build; cd build; cmake .. -DRK3399=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo; make -j3
echo Finished!
fi
# SD845
if [[ $whattocompilefor == "SD845" ]]; then
echo Got it, an SD845. # Not everything works with this, but pretty much everything
function check-armhf() {
ARMHF="$(dpkg --print-foreign-architectures | grep "armhf")"
}
check-armhf
if [[ "$ARMHF" == *"armhf"* ]]; then
echo "ARMHF architecture is already added..."
else
sudo dpkg --add-architecture armhf
check-armhf
if [[ "$ARMHF" != *"armhf"* ]]; then
echo "The ARMHF architecture should be added by now, but it isn't!"
echo "Sorry, run this script again but skip compiling for an SD845..."
exit
fi
fi
echo Working on it...
cd ~
git clone https://github.com/ptitSeb/box86
cd box86
sudo apt install gcc-arm-linux-gnueabihf
mkdir build; cd build; cmake .. -DSD845=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo; make -j4
echo Finished!
fi
# 64-bit Pi4
if [[ $whattocompilefor == "464" ]]; then
echo Got it, a Pi4 64-BIT. # This is the best option of the three.
function check-armhf() {
ARMHF="$(dpkg --print-foreign-architectures | grep "armhf")"
}
# This part right here is from the 64-bit install script on pi-apps. It checks if armhf is an arch on the system.
check-armhf
if [[ "$ARMHF" == *"armhf"* ]]; then
echo "ARMHF architecture is already added..."
else
sudo dpkg --add-architecture armhf
check-armhf
if [[ "$ARMHF" != *"armhf"* ]]; then
echo "The ARMHF architecture should be added by now, but it isn't!"
echo "Sorry, run this script again but skip compiling for a 64-bit Pi4..."
exit
fi
fi
echo Working on it...
cd ~ # This isn't necessary, but it's preferred.
sudo apt install gcc-arm-linux-gnueabihf
git clone https://github.com/ptitSeb/box86
cd box86
mkdir build; cd build; cmake .. -DRPI4ARM64=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo
make -j2
sudo make install # This technically is optional, but it will make a lot easier.
sudo systemctl restart systemd-binfmt
echo "Please ensure you have all needed dependencies before using Box86."
echo Finished!
#cp ~/Thunder/emulators/box86 /usr/local/bin/box86
#/usr/local/bin/box86
#sudo systemctl restart systemd-binfmt
echo "Finished!"
fi
# 32-bit Pi4
if [[ $whattocompilefor == "432" ]]; then
echo Got it, a Pi4 32-BIT. # I prefer 64-bit though.
echo Working on it...
cd ~
git clone https://github.com/ptitSeb/box86
cd box86
mkdir build; cd build; cmake .. -DRPI4=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo
make
sudo make install
sudo systemctl restart systemd-binfmt
echo Finished!
fi
# 32-bit Pi3
if [[ $whattocompilefor == "3" ]]; then
echo Got it, a Pi3. # But seriously who would use a Pi3 as a Gaming PC when there's Pi4 XD?!
echo Working on it...
cd ~
git clone https://github.com/ptitSeb/box86
cd box86
mkdir build; cd build; cmake .. -DRPI3=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo # I hope this works, this part was modified and not just copied and pasted!
make
sudo make install
sudo systemctl restart systemd-binfmt
echo Finished!
fi
echo If you need help with Box86, view box86.org
echo OK, now for the next thing.
fi
read -p "To run 64-BIT games you will need Box64. Install it (answer N or n to skip)? [4/RK3399/SD845/N] " boxycompile
if [[ $boxycompile =~ [Nn] ]]; then
echo OK, skipping.
fi
# Compile Box64 for the Pi4 64-bit
if [[ $boxycompile == "4" ]]; then
echo OK, working on it, a 64-bit Pi4.
cd ~ # We want to make Box86 and Box64 accessible for advanced users, so it's going in the home directory.
git clone -b steam_chrome https://github.com/ptitSeb/box64
cd box64
mkdir build; cd build; cmake .. -DRPI4ARM64=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo # The ARM64 part of it is what makes it 64-bit
make -j4
sudo make install
sudo systemctl restart systemd-binfmt # We don't know if this is the first time someone installed Box64, so that's why it's here.
echo If you need help with Box64, view box86.org
echo Finished!
#cp ~/Thunder/emulators/box64 /usr/local/bin/box64
#/usr/local/bin/box64
#sudo systemctl restart systemd-binfmt
#echo "Finished!"
fi
# Compile Box64 for the RK3399
if [[ $boxycompile == "RK3399" ]] ;then
git clone -b steam_chrome https://github.com/ptitSeb/box64
cd box64
mkdir build; cd build; cmake .. -DRK3399=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo
make -j4
sudo make install
sudo systemctl restart systemd-binfmt
fi
# Compile Box64 for the SD845
if [[ $boxycompile == "SD845" ]] ;then
git clone -b steam_chrome https://github.com/ptitSeb/box64
cd box64
mkdir build; cd build; cmake .. -DSD845=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo
make -j4
sudo make install
sudo systemctl restart systemd-binfmt
fi
read -p "To run most PC games you will need Steam installed. Box86 AND Box64 will need to be installed or else it won't work. Install? [Y/n] " steamy
if [[ $steamy =~ [Nn] ]]; then
echo OK, skipping.
fi
# Install Steam, Box86 required for this, otherwise Steam won't launch besides error messages about missing dependencies and libc6
if [[ $steamy =~ [Yy] ]]; then
cd ~/box86
echo "Running Box86's Steam install script..."
bash install_steam.sh
fi
read -p "To run retro games Mednafen will need to be installed. It doesn't need Box86 or Box64 to run. Install Mednafen? [Y/n] " medd
if [[ $medd =~ [Nn] ]]; then
echo OK, skipping.
fi
if [[ $medd =~ [Yy] ]]; then
echo OK, installing.
sudo apt install mednafen # Not everything works with Mednafen, but most should if they're 16-bit or 8-bit. 32-bit might differ by game.
mednafen # Then start mednafen to create a config folder
rm ~/.mednafen/mednafen.cfg # Remove the default config file
cp ~/Thunder/mednafen.cfg ~/.mednafen/mednafen.cfg # And finally copy Thunder's Mednafen Config file, which has some gamepads preconfigured
sudo chmod +x ~/Thunder/emulators/mednagui/mednagui.py
sudo chmod +x ~/Thunder/emulators/mednagui/settings
echo If you need help with Mednafen, view mednafen.github.io
echo Finished!
fi
echo Just a little bit left!
echo Now initializing the Thunder client and configuring emulators...
cd ~
cd Thunder
sudo chmod +x main.py # Make main.py executable
sudo rm -f /usr/local/bin/thunder-cli
sudo cp ~/Thunder/thunder-cli /usr/local/bin/thunder-cli # Allow Thunder to be used from the command line
cd ~
echo "Configuring Dolphin..."
Thunder/emulators/dolphin/dolphin-emu-nogui
rm ~/.config/dolphin-emu/GFX.ini
cp Thunder/emulators/dolphin/GFX.ini ~/.config/dolphin-emu/GFX.ini
echo "Dolphin configuration complete!"
echo "Configuring melonDS_Pi..."
sudo chmod +x ~/Thunder/emulators/melonDS_Pi/melonDS
sudo chmod +x ~/Thunder/emulators/melonDS_Pi/launcher
echo "melonDS_Pi configuration complete!"
echo "Preparing PPSSPP..."
# unzip ~/Thunder/emulators/ppsspp/PPSSPP.zip
sudo chmod +x ~/Thunder/emulators/ppsspp/PPSSPPSDL
echo "Finished preparing PPSSPP!"
mkdir .thunder
cd .thunder
mkdir configs
cd ~
cd Thunder
read -p "Reset configuration (needed on first-time setup)? [Y/n]: " firsttimes
if [[ $firsttimes =~ [Yy] ]]; then
rm -f ~/.thunder/library.cfg
cp library.cfg ~/.thunder/library.cfg
rm -f ~/.thunder/config.cfg
cp config.cfg ~/.thunder/config.cfg
rm -f ~/.thunder/page.cfg
cp page.cfg ~/.thunder/page.cfg
rm -f ~/.thunder/size.cfg
cp size.cfg ~/.thunder/size.cfg
rm -f ~/.thunder/news.cfg
cp news.cfg ~/.thunder/news.cfg
rm -f ~/.thunder/browser.cfg
cp browser.cfg ~/.thunder/browser.cfg
rm -f ~/.thunder/mesa.cfg
cp mesa.cfg ~/.thunder/mesa.cfg
rm -f ~/.thunder/gallium.cfg
cp gallium.cfg ~/.thunder/gallium.cfg
fi
if [[ $firsttimes =~ [Nn] ]]; then
echo "Got it."
fi
cd runtime
sudo chmod +x startup
# cp startup ~/.config/autostart/thunder_startup In the future
cp default.txt ~/.thunder/default.txt
cd ..
echo Initialized the Thunder client!
echo Creating menu shortcut...
sudo python3 c_desktop.py $USER # Run the Python script to make the shortcut
sudo chmod +x /usr/share/applications/thunder.desktop # Then make it executable
sudo chmod +x ~/Thunder/start # Also make the launcher executable
echo Created menu shortcut!
echo Installing dependencies...
sudo apt update # Make sure everything is up to date
echo "Installing gamemode..."
cd ~ # ensure that gamemode isn't installed into Thunder's directory, which causes bugs with updates
git clone https://github.com/FeralInteractive/gamemode
read -p "Install gamemode depenendencies (only say no if you've installed gamemode before)? [Y/n]" gmcomp
if [[ $gmcomp =~ [Yy] ]]; then
sudo apt install meson libsystemd-dev pkg-config ninja-build git libdbus-1-dev libinih-dev build-essential
fi
cd gamemode
./bootstrap.sh
echo "Gamemode install complete!"
sudo apt install --no-install-recommends python3-pip # Make sure pip is installed
sudo pip3 install guizero # Then install guizero. I chose guizero so new programmers can easily contribute to it. Also it's really quick to develop with
sudo pip3 install pillow # This is for more image types
sudo apt install python3-tk # Tkinter library
sudo apt install --no-install-recommends pcmanfm # This is Thunder's preferred file manager
sudo apt install python3-pil.imagetk # Most distros have this preinstalled, but RPiOS Lite doesn`t, so it`s still here
sudo apt install neofetch # For system info in thunder-cli
sudo apt install mesa-utils # For system info in thunder-cli
sudo apt install vulkan-tools # For system info in thunder-cli
sudo apt install --no-install-recommends python3-webview # For viewing Steam, GOG, and Itch
sudo apt install --no-install-recommends zenity # For various functions of the GUI
sudo apt install --no-install-recommends libsdl2-dev # For many emulators
echo Thunder is now installed. Go on and start playing!
sleep 1s