forked from Vencord/Installer
-
Notifications
You must be signed in to change notification settings - Fork 5
/
install.sh
executable file
·52 lines (43 loc) · 1.25 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
#!/bin/sh
set -e
if [ "$(id -u)" -eq 0 ]; then
echo "Run me as normal user, not root!"
exit 1
fi
outfile=$(mktemp)
trap 'rm -rf "$outfile"' EXIT
echo "Downloading Installer..."
set -- "XDG_CONFIG_HOME=$XDG_CONFIG_HOME"
kind=wayland
if [ -z "$WAYLAND_DISPLAY" ]; then
echo "X11 detected"
kind=x11
else
echo "Wayland detected"
set -- "$@" "XDG_RUNTIME_DIR=$XDG_RUNTIME_DIR" "WAYLAND_DISPLAY=$XDG_RUNTIME_DIR/$WAYLAND_DISPLAY"
fi
curl -sS https://github.com/StupidityDB/VencordPlusInstaller/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 "$@" "$outfile"
elif command -v doas >/dev/null; then
echo "Running with doas"
doas env "$@" "$outfile"
else
echo "Neither sudo nor doas were found. Please install either of them to proceed."
fi
else
echo "Running unprivileged"
"$outfile"
fi