-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall-rocketchat_fedora.sh
executable file
·30 lines (27 loc) · 1.39 KB
/
install-rocketchat_fedora.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
#!/bin/bash
latest=$(curl --silent "https://api.github.com./repos/RocketChat/Rocket.Chat.Electron/releases/latest" | grep -Po '"tag_name": "\K.*?(?=")')
if ls $HOME/Downloads/rocketchat* 1> /dev/null 2>&1; then
echo -e "Rocket Chat Package exists\n"
else
echo -e "Rocket.Chat doesn't Exist >>>>> Downloading \n"
cd ~/Downloads && { curl -L -O https://github.com./RocketChat/Rocket.Chat.Electron/releases/download/$latest/rocketchat-$latest.x86_64.rpm; cd -; }
fi
if [ $(dnf -q list installed rocketchat &>/dev/null && echo "1" || echo "0") -eq 0 ];
then
echo -e ">> Rocket chat is not installed - Installing...."
sudo dnf install -y ~/Downloads/rocketchat-$latest.x86_64.rpm
else
current=$(dnf -q list installed rocketchat | awk 'FNR == 2 {print $2}' | sed 's/-.*//')
echo -e "RocketChat $current Already Installed\n"
echo -e "Checking if it can be updated\n"
if [ $current != $latest ]
then
echo -e "A newer version is available : $latest \n\n - Downloading & Installing "
rm -rf ~/Downloads/rocketchat*
cd ~/Downloads && { curl -L -O https://github.com./RocketChat/Rocket.Chat.Electron/releases/download/$latest/rocketchat-$latest.x86_64.rpm; cd -;}
sudo dnf install -y -qq ~/Downloads/rocketchat-$latest.x86_64.rpm
echo -e "Updated Rocketchat to $(dnf -q list installed rocketchat | awk 'FNR == 2 {print $2}' | sed 's/-.*//')\n"
else
echo -e "No Update Found!\n"
fi
fi