-
Notifications
You must be signed in to change notification settings - Fork 9
/
install.sh
75 lines (63 loc) · 1.84 KB
/
install.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
#!/bin/sh
clear
prgm='netnoob'
Yellow="\033[1;33m";
End="\033[0m"
printf $Yellow
printf " _| _| _|_|_|_| _|_|_|_|_| _| _| _|_| _|_| _|_|_| \n"
printf " _|_| _| _| _| _|_| _| _| _| _| _| _| _|\n"
printf " _| _| _| _|_|_| _| _| _| _| _| _| _| _| _|_|_| \n"
printf " _| _|_| _| _| _| _|_| _| _| _| _| _| _|\n"
printf " _| _| _|_|_|_| _| _| _| _|_| _|_| _|_|_| \n"
printf "\n"
printf "============================== NETNOOB--2018 ==============================\n"
printf "============================= GITHUB/NARCOTIC =============================\n"
printf $End
printf "\n"
error()
{
printf "ERROR: %s\n" "$2" 1>&2
[ $1 -gt 0 ] && exit $1
}
if ! [ ${UID:-`id -u`} -eq 0 ]; then
error 1 'RUN AS ROOT!'
fi
exe()
{
Red='\033[1;31m'
Green='\033[1;32m'
Reset='\033[0m'
MSG=$1
shift
printf "%s... " "$MSG"
$@ 1> /dev/null 2>&1
if [ $? -gt 0 ]; then
printf " $Red[ERROR]$Reset\n"
else
printf " $Green[OK]$Reset\n"
fi
unset Red Green Reset MSG
}
if [ -f $prgm -a -r $prgm ]; then
if [ -f "/usr/bin/$prgm" ]; then
printf "File '/usr/bin/$prgm' Already Exists.\n"
printf "Overwrite? [Y/N] "
read YNAnswer
case $YNAnswer in
[Yy]|[Yy][Ee][Ss])
;;
[Nn]|[Nn][Oo])
printf "Nothing Done! Quitting!"
exit 0 ;;
*)
error 1 'Invalid Eesponse! Quitting!' ;;
esac
fi
exe "[1/3] Installing to '/usr/bin/netnoob'" cp "$prgm" /usr/bin/
exe "[2/3] Setting correct file modes" chmod 755 "/usr/bin/$prgm"
exe "[3/3] Correcting ownership" chown 0:0 "/usr/bin/$prgm"
printf "Done!\n"
else
error 1 'File '$prgm' Missing or Inaccessible.'
fi
# END OF THE PROGRAM