-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathupdate
More file actions
101 lines (96 loc) · 2.29 KB
/
update
File metadata and controls
101 lines (96 loc) · 2.29 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
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#!/bin/bash
#Colors_BEGIN
clear
red='\e[0;31m'
green='\e[1;32m'
orange='\e[1;33m'
lightblue='\e[0;34m'
purple='\e[0;35m'
cyan='\e[0;36m'
lightgray='\e[0;37m'
darkgray='\e[1;30em'
lightred='\e[1;31m'
lightgreen='\e[0;32m'
yellow='\e[0;49;93m'
blue='\e[1;34m'
lightpurple='\e[1;35m'
lightcyan='\e[1;36m'
white='\e[1;37m'
nc="\e[0m"
#Colors_END
#checking for internet
while true; do
echo -e "$yellow""Checking for internet connection$nc"
sleep 0.1
clear
echo -e "$yellow""Checking for internet connection.$nc"
sleep 0.1
clear
echo -e "$yellow""Checking for internet connection..$nc"
sleep 0.1
clear
echo -e "$yellow""Checking for internet connection...$nc"
sleep 0.1
clear
done &
trap 'kill $!' SIGTERM SIGKILL
sleep 2
wget -q --spider https://www.google.com
if [ $? -eq 0 ]; then
echo -e "$green""Connected to internet$nc [$green✓$nc]"
kill $!
sleep 3
clear
sleep 0.5
# Updating netTool
while true; do
echo -e $blue"Updating NetTool from Github"
sleep 0.1
clear
echo -e $blue"Updating NetTool from Github."
sleep 0.1
clear
echo -e $blue"Updating NetTool from Github.."
sleep 0.1
clear
echo -e $blue"Updating NetTool from Github..."
sleep 0.1
clear
done &
trap 'kill $!' SIGTERM SIGKILL
sleep 1
netTool_path=$(find $HOME/ -name "netTool" | grep /NetTool/netTool)
NetTool_path=$(find $HOME/ -name "NetTool" | grep /NetTool)
cd >/dev/null 2>&1
cd $NetTool_path >/dev/null 2>&1
git reset HEAD --hard >/dev/null 2>&1
git pull origin master >/dev/null 2>&1
rm /usr/bin/netTool
cp $netTool_path /usr/bin
sleep 1
echo -e $green"Update success!"
kill $!
sleep 0.5
echo -e $yellow"Applying Execution Permissions to netTool..."
sleep 0.5
chmod a+x $netTool_path >/dev/null 2>&1
chmod a+x /usr/bin/netTool 2>&1
chmod a+x update >/dev/null 2>&1
chmod a+x install >/dev/null 2>&1
sleep 0.5
echo -e $blue"DONE"
sleep 1
read -p "Rerun netTool? [Y/n] " anssw
if [ "$anssw" = "y" ] || [ "$anssw" = "Y" ]; then
sleep 0.5
netTool
else
echo "Aboarding..."
exit 1
fi
else
echo -e "$lightred""No internet connection$nc [$ligthred✗$nc]$nc"
echo -e "$yellow""Please make sure you are connected to internet!" "$nc"
kill $!
exit 1
fi