Skip to content

Commit

Permalink
make install.sh use cli
Browse files Browse the repository at this point in the history
  • Loading branch information
Vendicated committed Jan 22, 2024
1 parent 73a4da7 commit 8bd9dfd
Showing 1 changed file with 9 additions and 31 deletions.
40 changes: 9 additions & 31 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,46 +7,24 @@ if [ "$(id -u)" -eq 0 ]; then
fi

outfile=$(mktemp)
trap 'rm -rf "$outfile"' EXIT
trap 'rm -f "$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/Vendicated/VencordInstaller/releases/latest/download/VencordInstaller-$kind \
curl -sS https://github.com/Vendicated/VencordInstaller/releases/latest/download/VencordInstallerCli-Linux \
--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
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 "Running unprivileged"
"$outfile"
echo "Neither sudo nor doas were found. Please install either of them to proceed."
fi

0 comments on commit 8bd9dfd

Please sign in to comment.