-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathinstall_feed
208 lines (201 loc) · 5.3 KB
/
install_feed
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
#!/bin/bash
#kiran.vkvr@gmail.com
#https://github.com/Kiran-Bose/supreme
#--------------------------------------------------------------------------------------------------
function getos ()
{
if [ -f /etc/os-release ]; then
# freedesktop.org and systemd
. /etc/os-release
OS=$NAME
VER=$VERSION_ID
elif type lsb_release >/dev/null 2>&1; then
# linuxbase.org
OS=$(lsb_release -si)
VER=$(lsb_release -sr)
elif [ -f /etc/lsb-release ]; then
# For some versions of Debian/Ubuntu without lsb_release command
. /etc/lsb-release
OS=$DISTRIB_ID
VER=$DISTRIB_RELEASE
elif [ -f /etc/debian_version ]; then
# Older Debian/Ubuntu/etc.
OS=Debian
VER=$(cat /etc/debian_version)
elif [ -f /etc/SuSe-release ]; then
# Older SuSE/etc.
OS=SUSE
elif [ -f /etc/redhat-release ]; then
# Older Red Hat, CentOS, etc.
OS=Redhat
else
OS="ND"
fi
}
#------------------------------------------------------------------------------------------------
function dependency_check ()
{
deprc=1
depjq=1
depcl=1
if command -v rclone &>/dev/null; then
deprc=0
fi
if command -v jq &>/dev/null; then
depjq=0
fi
if command -v curl &>/dev/null; then
depcl=0
fi
}
#------------------------------------------------------------------------------------------------
function install_binaries ()
{
instlist=()
instsrch=$(pwd)
instdirchk=("$instsrch"/*)
for check in "${instdirchk[@]}"
do
Q=$( echo "$check" | rev | cut -d '/' -f 1 | rev )
if [[ -d "$check" ]] && [[ "$Q" == "supreme-"* ]]
then
instlist+=( "$check" )
fi
done
if [[ "${#instlist[@]}" != 0 ]]
then
echo -e "Installing..."
i=0
for item in "${instlist[0]}"/*
do
case "$item" in
"${instlist[0]}"/kbfunctions_basic) sudo cp -f "$item" /usr/local/bin && sudo chmod +x /usr/local/bin/kbfunctions_basic &&
i=$(($i+1));;
"${instlist[0]}"/kbcm) sudo cp -f "$item" /usr/local/bin && sudo chmod +x /usr/local/bin/kbcm &&
i=$(($i+1));;
"${instlist[0]}"/progress_bar) sudo cp -f "$item" /usr/local/bin && sudo chmod +x /usr/local/bin/progress_bar &&
i=$(($i+1));;
"${instlist[0]}"/supreme) sudo cp -f "$item" /usr/local/bin && sudo chmod +x /usr/local/bin/supreme &&
i=$(($i+1));;
esac
done
case $i in
0)echo -e "No files installed";;
4)echo -e "Successfully installed binaries"
getos
echo -e "Resolving dependencies..."
dependency_check
if [[ $deprc == 1 ]] || [[ $depjq == 1 ]] || [[ $depcl == 1 ]]
then
case $OS in
*buntu*|*Mint*|*Debian*)case $deprc in
1)sudo apt-get install rclone
dependency_check;;
esac
case $deprc in
1)sudo apt install rclone
dependency_check;;
esac
case $depjq in
1)sudo apt-get install jq
dependency_check;;
esac
case $depjq in
1)sudo apt install jq
dependency_check;;
esac
case $depcl in
1)sudo apt-get install curl
dependency_check;;
esac
case $depcl in
1)sudo apt install curl
dependency_check;;
esac;;
*Fedora*)case $deprc in
1)sudo dnf install rclone
dependency_check;;
esac
case $deprc in
1)sudo yum install rclone
dependency_check;;
esac
case $depjq in
1)sudo dnf install jq
dependency_check;;
esac
case $depjq in
1)sudo yum install jq
dependency_check;;
esac
case $depcl in
1)sudo dnf install curl
dependency_check;;
esac
case $depcl in
1)sudo yum install curl
dependency_check;;
esac;;
*Red*|*Cent*)case $deprc in
1)sudo yum install rclone
dependency_check;;
esac
case $depjq in
1)sudo yum install jq
dependency_check;;
esac
case $depcl in
1)sudo yum install curl
dependency_check;;
esac;;
*SUSE*|*Open*|*SuSE*)case $deprc in
1)sudo zypper install rclone
dependency_check;;
esac
case $depjq in
1)sudo zypper install jq
dependency_check;;
esac
case $depcl in
1)sudo zypper install curl
dependency_check;;
esac;;
*Arch*)case $deprc in
1)sudo pacman -S rclone
dependency_check;;
esac
case $depjq in
1)sudo pacman -S jq
dependency_check;;
esac
case $depcl in
1)sudo pacman -S curl
dependency_check;;
esac;;
esac
case $deprc in
0)echo -e "Dependency 'rclone':resolved";;
1)echo -e "Failed to install rclone. Try manual install";;
esac
case $depjq in
0)echo -e "Dependency 'jq':resolved";;
1)echo -e "Failed to install jq. Try manual install";;
esac
case $depcl in
0)echo -e "Dependency 'curl':resolved";;
1)echo -e "Failed to install curl. Try manual install";;
esac
else
echo "Dependencies resolved"
fi;;
*)echo -e "Unknown error during installation";;
esac
else
echo -e "No installables found"
fi
}
#------------------------------------------------------------------------------------------------
checkInternet()
{
ping -c2 google.com > /dev/null 2>&1 || { echo -e "Error: no active internet connection" >&2; return 1; }
}