forked from bilelmoussaoui/Hardcode-Tray
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhardcode-tray
executable file
·30 lines (30 loc) · 1.12 KB
/
hardcode-tray
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
version=v3.7
if [[ $EUID -ne 0 ]]; then
case $1 in
-u|--update)
upversion=$(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 <<< "$upversion"
upversion=${versions[0]}
echo $upversion
if [ ! "$version" == "v$upversion" ]; then
cd /tmp
wget -q https://raw.githubusercontent.com/bil-elmoussaoui/Hardcode-Tray/master/install.sh && bash install.sh --u
else
echo "Hardcode-Tray is up to date"
fi
exit 0 ;;
-ug | --update-git)
cd /tmp
wget -q https://raw.githubusercontent.com/bil-elmoussaoui/Hardcode-Tray/master/install.sh && bash install.sh --g
exit 0 ;;
-v|--version)
echo $version
exit 0 ;;
*)
cd /opt/Hardcode-Tray/
sudo -E python3 script.py "$@"
esac
else
echo "Script shouldn't be run as root"
fi