forked from bilelmoussaoui/Hardcode-Tray
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·49 lines (49 loc) · 1.68 KB
/
install.sh
File metadata and controls
executable file
·49 lines (49 loc) · 1.68 KB
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
#!/bin/bash
cd /tmp || exit
if [ -d "/tmp/Hardcode-Tray/" ]; then
sudo rm -rf /tmp/Hardcode-Tray
fi
echo "Downloading Hardcode-Tray ..."
if [ "$1" == "--g" ]; then
echo "Cloning the repository..."
if [ -d "./Hardcode-Tray" ]; then
rm -rf /tmp/Hardcode-Tray
fi
git clone https://github.com/bil-elmoussaoui/Hardcode-Tray
cd ./Hardcode-Tray
else
echo "Downloading the latest version..."
version=$(git ls-remote -t https://github.com/bil-elmoussaoui/Hardcode-Tray.git | awk '{print $2}' | cut -d '/' -f 3 | cut -d '^' -f 1 | sort -b -t . -k 1,1nr -k 2,2nr -k 3,3r -k 4,4r -k 5,5r | uniq)
IFS=' ' read -r -a versions <<< "$version"
version=${versions[0]}
wget -q https://github.com/bil-elmoussaoui/Hardcode-Tray/archive/"$version".zip
unzip -oq "$version".zip
rm -f "$version".zip
versionnb=${version//[a-zA-Z]/}
cd ./Hardcode-Tray-"$versionnb" || exit
fi
rm -rf .git ./screenshots
rm -f .gitignore README.md install.sh uninstall.sh
cd ../ || exit
if [ -d "/opt/Hardcode-Tray" ]; then
sudo rm -rf /opt/Hardcode-Tray
fi
if [ "$1" == "--g" ]; then
sudo mv Hardcode-Tray/ /opt/Hardcode-Tray
else
sudo mv Hardcode-Tray-"$versionnb"/ /opt/Hardcode-Tray
fi
echo "Creating symbolic link.."
if [ -L "/usr/bin/hardcode-tray" ] || [ -f "/usr/bin/hardcode-tray" ];
then
sudo rm -f /usr/bin/hardcode-tray
fi
sudo ln -s /opt/Hardcode-Tray/hardcode-tray /usr/bin/hardcode-tray
if [ "$1" == "--u" ]; then
echo "The update has completed successfully."
elif [ "$1" == "--g" ]; then
echo "Hardcode-Tray was updated to git version successfully."
else
echo "Installation completed successfully."
fi
echo "You can run the script using 'hardcode-tray'"