-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall_curl.sh
executable file
·61 lines (51 loc) · 1.84 KB
/
install_curl.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
# Detect package manager
if command -v apt-get &>/dev/null; then
PACKAGE_MANAGER="apt-get"
elif command -v dnf &>/dev/null; then
PACKAGE_MANAGER="dnf"
elif command -v yum &>/dev/null; then
PACKAGE_MANAGER="yum"
elif command -v pacman &>/dev/null; then
PACKAGE_MANAGER="pacman"
elif command -v zypper &>/dev/null; then
PACKAGE_MANAGER="zypper"
else
echo "Unsupported package manager"
exit 1
fi
# Install required packages
case $PACKAGE_MANAGER in
"apt-get")
sudo $PACKAGE_MANAGER update;
sudo $PACKAGE_MANAGER install -y curl wget unzip autoconf libtool libssl-dev;
;;
"dnf"|"yum")
sudo $PACKAGE_MANAGER install -y curl wget unzip autoconf libtool openssl-devel;
;;
"pacman")
sudo $PACKAGE_MANAGER -Sy --noconfirm curl wget unzip autoconf libtool openssl;
;;
"zypper")
sudo $PACKAGE_MANAGER install -y curl wget unzip autoconf libtool libopenssl-devel;
;;
esac
# get latest version tag
VERSION_CURL_LATEST=$(curl -s "https://api.github.com/repos/curl/curl/releases/latest" | grep -o '"tag_name": "[^"]*' | cut -d'"' -f4) && \
# make url
LOCATION_CURL_LATEST="https://github.com/curl/curl/archive/${VERSION_CURL_LATEST}.zip" && \
# fetch the zip file using wget
wget $LOCATION_CURL_LATEST -O "curl_latest.zip" && \
# unzip the fetched file and remove the zip
unzip curl_latest.zip && rm curl_latest.zip && \
# configure curl
cd "curl-${VERSION_CURL_LATEST}" && ./buildconf && ./configure --enable-websockets --with-openssl && \
# make
PROCCESSOR_COUNT=$(nproc) && make -j$PROCCESSOR_COUNT && \
# install curl
sudo make install && \
echo "export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH" >> ~/.bashrc && \
source ~/.bashrc
# clean
make clean && \
echo "libcurl with wss has been installed successfully :)" && \
echo "Use -lcurl while linking for this build."