nginx_build_script: add: os detection/no longer install golang in /usr/local

This commit is contained in:
minoplhy 2024-09-22 13:42:55 +07:00
parent 0d322d34e7
commit 4b873606f2
Signed by: minoplhy
GPG Key ID: 41D406044E2434BF

View File

@ -66,8 +66,45 @@ BUILD_TYPE=${BUILD_TYPE:-"nginx"}
#################################
# Get Dependencies
sudo apt-get install mercurial libunwind-dev libpcre3 libpcre3-dev zlib1g-dev cmake make libxslt1-dev libgd-dev libssl-dev libperl-dev libpam0g-dev libgeoip-dev git g++ -y
sudo apt-get install apt-utils autoconf automake build-essential libcurl4-openssl-dev liblmdb-dev libtool libxml2-dev libyajl-dev pkgconf wget ninja-build -y
# Detect OS
os=$(cat /etc/os-release | grep -oP "^ID=\K[^ ]+")
case $os in
"debian" | "ubuntu" )
sudo apt update
sudo apt install -y \
mercurial \
libunwind-dev \
libpcre3 \
libpcre3-dev \
zlib1g-dev \
cmake \
make \
libxslt1-dev \
libgd-dev \
libssl-dev \
libperl-dev \
libpam0g-dev \
libgeoip-dev \
git \
g++ \
apt-utils \
autoconf \
automake \
build-essential \
libcurl4-openssl-dev \
liblmdb-dev \
libtool \
libxml2-dev \
libyajl-dev \
pkgconf \
wget \
ninja-build
;;
* )
echo "ERROR: the os detected is not supported. The script will run as is."
;;
esac
HOMEDIRECTORY=~/nginx_scriptbox
@ -130,13 +167,11 @@ case $SSL_LIB in
;;
"boringssl")
# Golang
GO_VERSION=1.22.1
GO_VERSION=1.23.1
sudo unlink /usr/bin/go
wget https://go.dev/dl/go$GO_VERSION.linux-amd64.tar.gz
sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go$GO_VERSION.linux-amd64.tar.gz
export PATH=$PATH:/usr/local/go/bin
sudo ln -s /usr/local/go/bin /usr/bin/go
tar -C $HOMEDIRECTORY -xzf go$GO_VERSION.linux-amd64.tar.gz
export PATH=$PATH:$HOMEDIRECTORY/go/bin
git clone --depth=1 https://github.com/google/boringssl $HOMEDIRECTORY/boringssl
cd $HOMEDIRECTORY/boringssl