-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·407 lines (356 loc) · 13.2 KB
/
install.sh
File metadata and controls
executable file
·407 lines (356 loc) · 13.2 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
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
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
#!/bin/bash
set -e
project_root="$HOME/SLStools"
repo_url="https://github.com/aglairdev/SLStools.git"
conquistas_dir="$project_root/conquistas"
scripts_dir="$project_root/scripts"
color_green=$(tput setaf 2)
color_red=$(tput setaf 1)
color_yellow=$(tput setaf 3)
color_reset=$(tput sgr0)
symbol_check="✓"
symbol_cross="𐄂"
divider="⚒"
spinner() {
local pid=$!
local delay=0.1
local spinstr='|/-\'
while kill -0 $pid 2>/dev/null; do
local temp=${spinstr#?}
printf " [%c] " "$spinstr"
spinstr=$temp${spinstr%"$temp"}
sleep $delay
printf "\b\b\b\b\b\b"
done
}
echo
echo "|------------------------------------|"
echo " INSTALAÇÃO SLStools ${divider} "
echo "|------------------------------------|"
echo "[sudo] Será solicitada a senha para continuar..."
sudo -v
dependencies=(
git make unzip g++ pkg-config figlet whiptail libssl-dev
g++-multilib gcc-multilib libc6-dev-i386 libssl-dev:i386
python3.13 python3.13-venv python3.12-venv python3.10-venv
libxcb-cursor0 libxcb-xinerama0 libxcb-icccm4 libxcb-image0
libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-shape0
libxcb-xfixes0 libxkbcommon-x11-0 libglu1-mesa
qt6-base-dev qt6-base-dev-tools libglib2.0-bin
)
echo "Instalando dependências..."
for package in "${dependencies[@]}"; do
echo "Instalando: $package"
if ! dpkg -s "$package" >/dev/null 2>&1 && ! command -v "$package" >/dev/null 2>&1; then
if command -v apt >/dev/null 2>&1; then
(sudo apt install -y "$package" >/dev/null 2>&1) & spinner
elif command -v dnf >/dev/null 2>&1; then
(sudo dnf install -y "$package" >/dev/null 2>&1) & spinner
elif command -v pacman >/dev/null 2>&1; then
(sudo pacman -S --noconfirm "$package" >/dev/null 2>&1) & spinner
else
echo "${color_red}$symbol_cross Nenhum gerenciador de pacotes compatível encontrado${color_reset}"
exit 1
fi
fi
done
echo "${color_green}$symbol_check Dependências instaladas${color_reset}"
export PKG_CONFIG_PATH="/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/lib/i386-linux-gnu/pkgconfig"
echo
echo "Identificando instalação da Steam..."
steam_binary=""
if command -v steam >/dev/null 2>&1; then
steam_binary="$(command -v steam)"
elif [ -x "/usr/games/steam" ]; then
steam_binary="/usr/games/steam"
elif which steam >/dev/null 2>&1; then
steam_binary="$(which steam)"
else
candidate="$(whereis -b steam | awk '{print $2}')"
if [ -n "$candidate" ] && [ -x "$candidate" ]; then
steam_binary="$candidate"
fi
fi
if [ -z "$steam_binary" ]; then
echo "${color_red}$symbol_cross Steam não encontrada${color_reset}"
exit 1
else
echo "${color_green}$symbol_check Steam encontrada: $steam_binary${color_reset}"
fi
echo
echo "Atualizando/clonando repositório principal..."
if [ -d "$project_root/.git" ]; then
cd "$project_root"
echo "Atualizando SLStools..."
git reset --hard HEAD >/dev/null 2>&1
git pull --progress
echo "${color_green}$symbol_check SLStools atualizado${color_reset}"
else
echo "Clonando SLStools..."
git clone --progress --branch main "$repo_url" "$project_root"
echo "${color_green}$symbol_check SLStools clonado${color_reset}"
fi
echo
echo "Atualizando/clonando SLSsteam..."
slssteam_dir="$scripts_dir/SLSsteam"
if [ -d "$slssteam_dir/.git" ]; then
cd "$slssteam_dir"
echo "Atualizando SLSsteam..."
git reset --hard HEAD >/dev/null 2>&1
git pull --quiet
echo "${color_green}$symbol_check SLSsteam atualizado${color_reset}"
else
echo "Clonando SLSsteam..."
mkdir -p "$scripts_dir"
git clone "https://github.com/AceSLS/SLSsteam.git" "$slssteam_dir" --quiet
echo "${color_green}$symbol_check SLSsteam clonado${color_reset}"
fi
echo
echo "Compilando e instalando SLSsteam..."
cd "$slssteam_dir"
make >/dev/null 2>&1 || true
chmod +x setup.sh
set +e
./setup.sh install >/dev/null 2>&1
set -e
echo "${color_green}$symbol_check SLSsteam instalado${color_reset}"
echo
echo "Atualizando/clonando SLScheevo..."
slscheevo_dir="$conquistas_dir/SLScheevo"
if [ -d "$slscheevo_dir/.git" ]; then
cd "$slscheevo_dir"
echo "Atualizando SLScheevo..."
git reset --hard HEAD >/dev/null 2>&1
git pull --quiet
echo "${color_green}$symbol_check SLScheevo atualizado${color_reset}"
else
echo "Clonando SLScheevo..."
mkdir -p "$conquistas_dir"
git clone "https://github.com/xamionex/SLScheevo.git" "$slscheevo_dir" --quiet
echo "${color_green}$symbol_check SLScheevo clonado${color_reset}"
fi
echo
echo "Baixando Ludusavi..."
ludusavi_dir="$scripts_dir/ludusavi"
ludusavi_url="https://github.com/mtkennerly/ludusavi/releases/latest/download/ludusavi-v0.30.0-linux.tar.gz"
mkdir -p "$ludusavi_dir"
cd "$ludusavi_dir"
if [ ! -f "ludusavi-v0.30.0-linux.tar.gz" ]; then
echo "Baixando Ludusavi v0.30.0..."
(wget -q "$ludusavi_url" -O "ludusavi-v0.30.0-linux.tar.gz") & spinner
echo "${color_green}$symbol_check Ludusavi baixado${color_reset}"
else
echo "${color_green}$symbol_check Ludusavi já está atualizado${color_reset}"
fi
desktop_app_dir="$HOME/.local/share/applications"
mkdir -p "$desktop_app_dir"
desktop_file="$desktop_app_dir/steam.desktop"
slssteam_so="$HOME/.local/share/SLSsteam/SLSsteam.so"
ld_audit_exec="env LD_AUDIT=\"$slssteam_so\""
cat > "$desktop_file" <<EOF
[Desktop Entry]
Name=Steam
Comment=Application for managing and playing games on Steam
Exec=$ld_audit_exec $steam_binary %U
Icon=steam
Terminal=false
Type=Application
Categories=Network;FileTransfer;Game;
MimeType=x-scheme-handler/steam;x-scheme-handler/steamlink;
Actions=Store;Community;Library;Servers;Screenshots;News;Settings;BigPicture;Friends;
PrefersNonDefaultGPU=true
X-KDE-RunOnDiscreteGpu=true
EOF
chmod 644 "$desktop_file"
if command -v gio >/dev/null 2>&1; then
gio set "$desktop_file" "metadata::trusted" true >/dev/null 2>&1 || true
fi
echo "${color_green}$symbol_check Atalho criado/atualizado em $desktop_app_dir${color_reset}"
find_desktop_dir() {
local d
if command -v xdg-user-dir >/dev/null 2>&1; then
d="$(xdg-user-dir DESKTOP 2>/dev/null || true)"
if [ -n "$d" ] && [ -d "$d" ]; then
echo "$d"
return
fi
fi
local candidates=("Desktop" "desktop" "Área de trabalho" "Área de Trabalho")
for name in "${candidates[@]}"; do
if [ -d "$HOME/$name" ]; then
echo "$HOME/$name"
return
fi
done
for d in "$HOME"/*; do
if [ -d "$d" ]; then
local base="$(basename "$d")"
local lower="$(echo "$base" | tr '[:upper:]' '[:lower:]' | iconv -f utf8 -t ascii//TRANSLIT 2>/dev/null || true)"
if [[ "$lower" == *desktop* ]] || ([[ "$lower" == *area* ]] && [[ "$lower" == *trabalho* ]]); then
echo "$d"
return
fi
fi
done
echo "$HOME/Desktop"
}
DESKTOP_DIR="$(find_desktop_dir)"
mkdir -p "$DESKTOP_DIR"
desktop_shortcut="$DESKTOP_DIR/steam.desktop"
cp "$desktop_file" "$desktop_shortcut"
chmod 644 "$desktop_shortcut"
echo "${color_green}$symbol_check Atalho na área de trabalho criado/atualizado${color_reset}"
if command -v gio >/dev/null 2>&1; then
gio set "$desktop_shortcut" "metadata::trusted" true >/dev/null 2>&1 || true
chmod a+x "$desktop_shortcut" >/dev/null 2>&1 || true
echo "${color_green}$symbol_check Atalho marcado como confiável e permissões ajustadas${color_reset}"
elif command -v gvfs-set-attribute >/dev/null 2>&1; then
gvfs-set-attribute -t boolean "$desktop_shortcut" metadata::trusted true >/dev/null 2>&1 || true
chmod a+x "$desktop_shortcut" >/dev/null 2>&1 || true
echo "${color_green}$symbol_check Atalho marcado como confiável (gvfs) e permissões ajustadas${color_reset}"
else
chmod a+x "$desktop_shortcut" >/dev/null 2>&1 || true
echo "${color_red}$symbol_cross 'gio' não encontrado; marque o atalho como confiável manualmente se necessário${color_reset}"
fi
echo
echo "# Início do processo de descompactação #"
slstools_dir="$scripts_dir/SLStools"
if ls "$slstools_dir"/SLStools.zip.* >/dev/null 2>&1; then
echo "Unindo arquivos zip..."
cd "$slstools_dir"
cat SLStools.zip.* > SLStools.zip
echo "Extraindo SLStools..."
unzip -o SLStools.zip -d "$slstools_dir"
if [ -d "$slstools_dir/SLStools" ]; then
rm -rf "$slstools_dir/bin" "$slstools_dir/setup.sh" "$slstools_dir/utils" 2>/dev/null || true
shopt -s dotglob nullglob
mv "$slstools_dir/SLStools/"* "$slstools_dir/"
shopt -u dotglob nullglob
rm -rf "$slstools_dir/SLStools"
fi
rm -f SLStools.zip SLStools.zip.*
else
echo "Atualizando SLStools via git..."
rm -rf "$slstools_dir"
mkdir -p "$slstools_dir"
cd "$project_root"
git reset --hard HEAD >/dev/null 2>&1
git pull --quiet
echo "${color_green}$symbol_check SLStools atualizado${color_reset}"
fi
echo
echo "# Fim do processo de descompactação #"
echo
echo "Instalando SLStools..."
cd "$slstools_dir"
chmod +x setup.sh
set +e
./setup.sh install >/dev/null 2>&1
set -e
echo "${color_green}$symbol_check SLStools instalado${color_reset}"
echo
echo "Criando atalhos do SLStools..."
"$slstools_dir/bin/shortcut.sh" >/dev/null 2>&1 || true
echo "${color_green}$symbol_check Atalho SLStools criado com sucesso${color_reset}"
echo
echo "Baixando Steamless..."
steamless_dir="$scripts_dir/Steamless"
steamless_url="https://github.com/atom0s/Steamless/releases/download/v3.1.0.5/Steamless.v3.1.0.5.-.by.atom0s.zip"
mkdir -p "$steamless_dir"
cd "$steamless_dir"
if [ ! -f "Steamless.v3.1.0.5.-.by.atom0s.zip" ]; then
echo "Baixando Steamless v3.1.0.5..."
(wget -q "$steamless_url" -O "Steamless.v3.1.0.5.-.by.atom0s.zip") & spinner
echo "${color_green}$symbol_check Steamless baixado${color_reset}"
else
echo "${color_green}$symbol_check Steamless já está atualizado${color_reset}"
fi
if command -v update-desktop-database &>/dev/null; then
update-desktop-database "$HOME/.local/share/applications" >/dev/null 2>&1 || true
fi
if command -v gtk-update-icon-cache &>/dev/null; then
gtk-update-icon-cache -f "$HOME/.local/share/icons/hicolor" >/dev/null 2>&1 || true
fi
echo
echo "${color_green}$symbol_check Todas as ferramentas necessárias foram adicionadas${color_reset}"
echo
echo "${color_yellow}Iniciando a Steam para gerar ~/.config/SLSsteam${color_reset}"
steam_log="/tmp/steam_start.log.$$"
set +e
desktop_id="$(basename "$desktop_file" .desktop)"
if command -v gtk-launch >/dev/null 2>&1; then
gtk-launch "$desktop_id" >/dev/null 2>&1 &
elif command -v gio >/dev/null 2>&1; then
gio open "$desktop_file" >/dev/null 2>&1 &
elif command -v xdg-open >/dev/null 2>&1; then
xdg-open "$desktop_file" >/dev/null 2>&1 &
else
env LD_AUDIT="$slssteam_so" nohup "$steam_binary" >"$steam_log" 2>&1 &
fi
sleep 1
max_wait=60
elapsed=0
success=0
while [ $elapsed -lt $max_wait ]; do
if [ -d "$HOME/.config/SLSsteam" ]; then
success=1
break
fi
sleep 1
elapsed=$((elapsed+1))
done
if [ $success -eq 1 ]; then
echo "${color_green}$symbol_check Steam iniciada e arquivos ~/.config/SLSsteam detectados${color_reset}"
else
echo "${color_red}$symbol_cross Não foi possível detectar ~/.config/SLSsteam após ${max_wait}s${color_reset}"
if [ -f "$steam_log" ]; then
echo "Últimas linhas do log:"
tail -n 30 "$steam_log" 2>/dev/null || true
fi
echo "${color_red}Verifique se a sessão gráfica está ativa e se o desktop entry $desktop_file está sendo usado para iniciar a Steam.${color_reset}"
exit 1
fi
set -e
echo
echo "${color_yellow}Fechando Steam...${color_reset}"
if command -v steam >/dev/null 2>&1; then
steam -shutdown >/dev/null 2>&1 || true
fi
shutdown_wait=30
sw=0
while pgrep -u "$USER" -f "[s]team" >/dev/null 2>&1 && [ $sw -lt $shutdown_wait ]; do
sleep 1
sw=$((sw+1))
done
if pgrep -u "$USER" -f "[s]team" >/dev/null 2>&1; then
pkill -15 -u "$USER" -f steam >/dev/null 2>&1 || true
sleep 2
fi
if pgrep -u "$USER" -f "[s]team" >/dev/null 2>&1; then
pkill -9 -u "$USER" -f steam >/dev/null 2>&1 || true
fi
if pgrep -u "$USER" -f "[s]team" >/dev/null 2>&1; then
echo "${color_red}$symbol_cross Não foi possível encerrar todos os processos do Steam${color_reset}"
exit 1
else
echo "${color_green}$symbol_check Steam encerrada com sucesso${color_reset}"
fi
slssteam_config_dir="$HOME/.config/SLSsteam"
config_file="$slssteam_config_dir/config.yaml"
echo
echo "${color_yellow}Editando $config_file ${color_reset}"
if [ -f "$config_file" ]; then
cp "$config_file" "$config_file.bak.$(date +%s)" 2>/dev/null || true
if grep -qE '^[[:space:]]*PlayNotOwnedGames:' "$config_file"; then
sed -i -E 's/^[[:space:]]*PlayNotOwnedGames:[[:space:]]*(no|false|0)/PlayNotOwnedGames: yes/I' "$config_file"
sed -i -E 's/^[[:space:]]*PlayNotOwnedGames:[[:space:]]*(yes|true|1)/PlayNotOwnedGames: yes/I' "$config_file"
else
echo "PlayNotOwnedGames: yes" >> "$config_file"
fi
echo "${color_green}$symbol_check $config_file editado com sucesso${color_reset}"
else
echo "${color_red}$symbol_cross $config_file não encontrado${color_reset}"
exit 1
fi
echo
echo "${color_green}$symbol_check Instalação completa!${color_reset}"