-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathdiscord.sh
executable file
·84 lines (69 loc) · 2.78 KB
/
discord.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
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
#!/bin/bash
echo "Discord $(uname -m) script started!"
echo "CREDITS: https://github.com/SpacingBat3/WebCord"
sleep 2
cd /tmp
rm webcord*
if
command -v apt >/dev/null
then
if [[ $dpkg_architecture == "amd64" ]] || [[ $dpkg_architecture == "arm64" ]] || [[ $dpkg_architecture == "armhf" ]]; then
echo "Installing dependencies..."
sudo apt install git curl python3-pip -y || error "Couldn't install dependencies"
case "$__os_codename" in
bionic)
sudo apt install -y python3.8 python3.8-dev
#fix edge case with broken folder ownership that popped up in our GitHub Actions runs
mkdir -p ~/.cache/
mkdir -p ~/.cache/pip/
sudo chown -R $USER:$USER ~/.cache/
sudo chown -R $USER:$USER ~/.cache/pip/
yes | python3.6 -m pip uninstall lastversion
;;
*)
echo "Installing dependencies..."
;;
esac
pipx_install lastversion
echo "Removing previous legacy Discord installs and inconsistent apt repo..."
sudo dpkg -r electron-discord-webapp
sudo rm /etc/apt/sources.list.d/webcord.list*
echo "Downloading the most recent .deb from SpacingBat3's repository..."
lastversion --assets --filter $dpkg_architecture.deb download https://github.com/SpacingBat3/WebCord
echo "Done! Installing the package..."
sudo apt install -y /tmp/webcord*$dpkg_architecture.deb || error "Webcord install failed"
else
error_user "Your architecture ($dpkg_architecture) is not supported."
fi
elif
command -v dnf >/dev/null
then
# I'm not including 32-bit arm here despite Webcord (currently) providing downloads for it because
# 1. Fedora deprecated it https://arm.fedoraproject.org/
# 2. I'm too lazy to parse out armv7l and armv7hl
if [[ $architecture == "aarch64" ]] || [[ $architecture == "x86_64" ]]; then
echo "Installing dependencies..."
sudo yum -y install https://extras.getpagespeed.com/release-latest.rpm
sudo yum -y install lastversion
# bootleg $dpkg_architecture on Fedora for the only two use cases we expect
fedoraArch=""
if grep -q "x86_64" <<<$(uname -m); then
fedoraArch="x86_64" #yes, really.
elif grep -q "aarch64" <<<$(uname -m); then
fedoraArch="arm64"
else
error_user "Your architecture $(uname -m) is not supported by this script!"
fi
echo "Downloading and installing the most recent .rpm from SpacingBat3's repository..."
# this command unfortunately doesn't work on Debian-based systems
yes | sudo lastversion install webcord --filter $fedoraArch.rpm || error "Webcord install failed"
else
error_user "Your architecture ($architecture) is not supported."
fi
else
error_user "No available package manager found. Are you using a Ubuntu/Debian or Fedora based system?"
fi
cd ~
echo "Done!"
echo "Sending you back to the menu..."
sleep 1