forked from Vencord/Installer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·55 lines (45 loc) · 1.26 KB
/
install.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
#!/bin/sh
set -e
if [ "$(id -u)" -eq 0 ]; then
echo "Run me as normal user, not root!"
exit 1
fi
outfile=$(mktemp)
# shellcheck disable=SC2064
trap "rm -rf '$outfile'" EXIT
echo "Downloading Installer..."
rootenv=
kind=wayland
if [ -z "$WAYLAND_DISPLAY" ]; then
echo "X11 detected"
kind=x11
else
echo "Wayland detected"
rootenv="XDG_RUNTIME_DIR=$XDG_RUNTIME_DIR WAYLAND_DISPLAY=$XDG_RUNTIME_DIR/$WAYLAND_DISPLAY"
fi
curl -sS https://github.com/Vendicated/VencordInstaller/releases/latest/download/VencordInstaller-$kind \
--output "$outfile" \
--location
chmod +x "$outfile"
echo
echo "Now running VencordInstaller"
echo "Do you want to run as root? [Y|n]"
echo "This is necessary if Discord is in a root owned location like /usr/share or /opt"
printf "> "
read -r runAsRoot
opt="$(echo "$runAsRoot" | tr "[:upper:]" "[:lower:]")"
if [ -z "$opt" ] || [ "$opt" = y ] || [ "$opt" = yes ]; then
if command -v sudo >/dev/null; then
echo "Running with sudo"
sudo env $rootenv "$outfile"
elif command -v doas >/dev/null; then
echo "Running with doas"
doas env $rootenv "$outfile"
else
echo "Didn't find sudo or doas, falling back to su"
su -c "SUDO_USER=$(whoami) '$outfile'"
fi
else
echo "Running unprivileged"
"$outfile"
fi