update shadowsocks-libev version

This commit is contained in:
Teddysun 2017-02-12 14:57:28 +09:00
parent c2b9e2333c
commit e358b64d36
3 changed files with 101 additions and 27 deletions

View File

@ -26,6 +26,10 @@ software=(Shadowsocks-Python ShadowsocksR Shadowsocks-Go Shadowsocks-libev)
libsodium_file="libsodium-1.0.11" libsodium_file="libsodium-1.0.11"
libsodium_url="https://github.com/jedisct1/libsodium/releases/download/1.0.11/libsodium-1.0.11.tar.gz" libsodium_url="https://github.com/jedisct1/libsodium/releases/download/1.0.11/libsodium-1.0.11.tar.gz"
mbedtls_file="mbedtls-2.4.0"
mbedtls_url="https://tls.mbed.org/download/mbedtls-2.4.0-gpl.tgz"
shadowsocks_python_file="shadowsocks-master" shadowsocks_python_file="shadowsocks-master"
shadowsocks_python_url="https://github.com/shadowsocks/shadowsocks/archive/master.zip" shadowsocks_python_url="https://github.com/shadowsocks/shadowsocks/archive/master.zip"
shadowsocks_python_init="/etc/init.d/shadowsocks-python" shadowsocks_python_init="/etc/init.d/shadowsocks-python"
@ -144,7 +148,7 @@ get_ipv6(){
get_libev_ver(){ get_libev_ver(){
#libev_ver=$(wget --no-check-certificate -qO- https://api.github.com/repos/shadowsocks/shadowsocks-libev/releases/latest | grep 'tag_name' | cut -d\" -f4) #libev_ver=$(wget --no-check-certificate -qO- https://api.github.com/repos/shadowsocks/shadowsocks-libev/releases/latest | grep 'tag_name' | cut -d\" -f4)
# The specified version # The specified version
libev_ver="v2.5.6" libev_ver="v3.0.1"
[ -z ${libev_ver} ] && echo "${red}Error:${plain} Get shadowsocks-libev latest version failed" && exit 1 [ -z ${libev_ver} ] && echo "${red}Error:${plain} Get shadowsocks-libev latest version failed" && exit 1
} }
@ -173,8 +177,9 @@ download() {
download_files() { download_files() {
cd ${cur_dir} cd ${cur_dir}
if [ "${selected}" == "1" ]; then
download "${libsodium_file}.tar.gz" "${libsodium_url}" download "${libsodium_file}.tar.gz" "${libsodium_url}"
if [ "${selected}" == "1" ]; then
download "${shadowsocks_python_file}.zip" "${shadowsocks_python_url}" download "${shadowsocks_python_file}.zip" "${shadowsocks_python_url}"
if check_sys packageManager yum; then if check_sys packageManager yum; then
download "${shadowsocks_python_init}" "${shadowsocks_python_centos}" download "${shadowsocks_python_init}" "${shadowsocks_python_centos}"
@ -182,7 +187,6 @@ download_files() {
download "${shadowsocks_python_init}" "${shadowsocks_python_debian}" download "${shadowsocks_python_init}" "${shadowsocks_python_debian}"
fi fi
elif [ "${selected}" == "2" ]; then elif [ "${selected}" == "2" ]; then
download "${libsodium_file}.tar.gz" "${libsodium_url}"
download "${shadowsocks_r_file}.zip" "${shadowsocks_r_url}" download "${shadowsocks_r_file}.zip" "${shadowsocks_r_url}"
if check_sys packageManager yum; then if check_sys packageManager yum; then
download "${shadowsocks_r_init}" "${shadowsocks_r_centos}" download "${shadowsocks_r_init}" "${shadowsocks_r_centos}"
@ -203,12 +207,13 @@ download_files() {
elif [ "${selected}" == "4" ]; then elif [ "${selected}" == "4" ]; then
get_libev_ver get_libev_ver
shadowsocks_libev_file="shadowsocks-libev-$(echo ${libev_ver} | sed -e 's/^[a-zA-Z]//g')" shadowsocks_libev_file="shadowsocks-libev-$(echo ${libev_ver} | sed -e 's/^[a-zA-Z]//g')"
shadowsocks_libev_url="https://github.com/shadowsocks/shadowsocks-libev/archive/${libev_ver}.tar.gz" shadowsocks_libev_url="https://github.com/shadowsocks/shadowsocks-libev/releases/download/${ver}/${shadowsocks_libev_file}.tar.gz"
download "${shadowsocks_libev_file}.tar.gz" "${shadowsocks_libev_url}" download "${shadowsocks_libev_file}.tar.gz" "${shadowsocks_libev_url}"
if check_sys packageManager yum; then if check_sys packageManager yum; then
download "${shadowsocks_libev_init}" "${shadowsocks_libev_centos}" download "${shadowsocks_libev_init}" "${shadowsocks_libev_centos}"
elif check_sys packageManager apt; then elif check_sys packageManager apt; then
download "${mbedtls_file}-gpl.tgz" "${mbedtls_url}"
download "${shadowsocks_libev_init}" "${shadowsocks_libev_debian}" download "${shadowsocks_libev_init}" "${shadowsocks_libev_debian}"
fi fi
fi fi
@ -353,16 +358,20 @@ fi
install_dependencies() { install_dependencies() {
if check_sys packageManager yum; then if check_sys packageManager yum; then
yum_depends=( yum_depends=(
epel-release
unzip gzip openssl openssl-devel gcc swig python python-devel python-setuptools pcre pcre-devel libtool libevent xmlto unzip gzip openssl openssl-devel gcc swig python python-devel python-setuptools pcre pcre-devel libtool libevent xmlto
autoconf automake make curl curl-devel zlib-devel perl perl-devel cpio expat-devel gettext-devel asciidoc autoconf automake make curl curl-devel zlib-devel perl perl-devel cpio expat-devel gettext-devel asciidoc
udns-devel libev-devel mbedtls-devel
) )
for depend in ${yum_depends[@]}; do for depend in ${yum_depends[@]}; do
error_detect_depends "yum -y install ${depend}" error_detect_depends "yum -y install ${depend}"
done done
[ -f /usr/include/libev/ev.h ] && ln -sf /usr/include/libev/ev.h /usr/include/ev.h
elif check_sys packageManager apt; then elif check_sys packageManager apt; then
apt_depends=( apt_depends=(
build-essential unzip gzip python python-dev python-pip python-m2crypto curl openssl libssl-dev gettext build-essential unzip gzip python python-dev python-pip python-m2crypto curl openssl libssl-dev
autoconf automake libtool gcc swig make perl cpio xmlto asciidoc libpcre3 libpcre3-dev zlib1g-dev autoconf automake libtool gcc swig make perl cpio xmlto asciidoc libpcre3 libpcre3-dev zlib1g-dev
libudns-dev libev-dev
) )
apt-get -y update apt-get -y update
for depend in ${apt_depends[@]}; do for depend in ${apt_depends[@]}; do
@ -456,6 +465,7 @@ install_prepare() {
} }
install_libsodium() { install_libsodium() {
if [ ! -f /usr/local/lib/libsodium.a ]; then
cd ${cur_dir} cd ${cur_dir}
tar zxf ${libsodium_file}.tar.gz tar zxf ${libsodium_file}.tar.gz
cd ${libsodium_file} cd ${libsodium_file}
@ -467,6 +477,17 @@ install_libsodium() {
fi fi
echo "/usr/local/lib" > /etc/ld.so.conf.d/local.conf echo "/usr/local/lib" > /etc/ld.so.conf.d/local.conf
ldconfig ldconfig
else
echo -e "${green}Info:${plain} ${libsodium_file} already installed."
fi
}
install_mbedtls() {
cd ${cur_dir}
tar xf ${mbedtls_file}-gpl.tgz
cd ${mbedtls_file}
make SHARED=1 CFLAGS=-fPIC
make install
} }
install_shadowsocks_python() { install_shadowsocks_python() {
@ -639,13 +660,13 @@ install_completed_libev() {
} }
install_main(){ install_main(){
if [ "${selected}" == "1" ]; then
install_libsodium install_libsodium
if [ "${selected}" == "1" ]; then
install_shadowsocks_python install_shadowsocks_python
install_completed_python install_completed_python
elif [ "${selected}" == "2" ]; then elif [ "${selected}" == "2" ]; then
if [ "${yes_no}" == "y" -o "${yes_no}" == "Y" ] || [ ! -f ${shadowsocks_python_init} ]; then if [ "${yes_no}" == "y" -o "${yes_no}" == "Y" ] || [ ! -f ${shadowsocks_python_init} ]; then
install_libsodium
install_shadowsocks_r install_shadowsocks_r
install_completed_r install_completed_r
fi fi
@ -653,6 +674,9 @@ install_main(){
install_shadowsocks_go install_shadowsocks_go
install_completed_go install_completed_go
elif [ "${selected}" == "4" ]; then elif [ "${selected}" == "4" ]; then
if check_sys packageManager apt; then
install_mbedtls
fi
install_shadowsocks_libev install_shadowsocks_libev
install_completed_libev install_completed_libev
fi fi
@ -666,6 +690,7 @@ install_main(){
install_cleanup(){ install_cleanup(){
cd ${cur_dir} cd ${cur_dir}
rm -rf ${libsodium_file} ${libsodium_file}.tar.gz rm -rf ${libsodium_file} ${libsodium_file}.tar.gz
rm -rf ${mbedtls_file} ${mbedtls_file}-gpl.tgz
rm -rf ${shadowsocks_python_file} ${shadowsocks_python_file}.zip rm -rf ${shadowsocks_python_file} ${shadowsocks_python_file}.zip
rm -rf ${shadowsocks_r_file} ${shadowsocks_r_file}.zip rm -rf ${shadowsocks_r_file} ${shadowsocks_r_file}.zip
rm -rf ${shadowsocks_go_file_64}.tar.gz ${shadowsocks_go_file_32}.gz rm -rf ${shadowsocks_go_file_64}.tar.gz ${shadowsocks_go_file_32}.gz

View File

@ -57,10 +57,10 @@ get_char(){
get_latest_version(){ get_latest_version(){
#ver=$(wget --no-check-certificate -qO- https://api.github.com/repos/shadowsocks/shadowsocks-libev/releases/latest | grep 'tag_name' | cut -d\" -f4) #ver=$(wget --no-check-certificate -qO- https://api.github.com/repos/shadowsocks/shadowsocks-libev/releases/latest | grep 'tag_name' | cut -d\" -f4)
# The specified version # The specified version
ver="v2.5.6" ver="v3.0.1"
[ -z ${ver} ] && echo "Error: Get shadowsocks-libev latest version failed" && exit 1 [ -z ${ver} ] && echo "Error: Get shadowsocks-libev latest version failed" && exit 1
shadowsocks_libev_ver="shadowsocks-libev-$(echo ${ver} | sed -e 's/^[a-zA-Z]//g')" shadowsocks_libev_ver="shadowsocks-libev-$(echo ${ver} | sed -e 's/^[a-zA-Z]//g')"
download_link="https://github.com/shadowsocks/shadowsocks-libev/archive/${ver}.tar.gz" download_link="https://github.com/shadowsocks/shadowsocks-libev/releases/download/${ver}/${shadowsocks_libev_ver}.tar.gz"
init_script_link="https://raw.githubusercontent.com/teddysun/shadowsocks_install/master/shadowsocks-libev-debian" init_script_link="https://raw.githubusercontent.com/teddysun/shadowsocks_install/master/shadowsocks-libev-debian"
} }
@ -214,13 +214,13 @@ pre_install(){
# Update System # Update System
apt-get -y update apt-get -y update
# Install necessary dependencies # Install necessary dependencies
apt-get -y --no-install-recommends install build-essential autoconf libtool openssl libssl-dev zlib1g-dev xmlto asciidoc libpcre3 libpcre3-dev apt-get -y --no-install-recommends install gettext build-essential autoconf automake libtool openssl libssl-dev zlib1g-dev xmlto asciidoc libpcre3-dev libudns-dev libev-dev
echo
cd ${cur_dir}
} }
# Download latest shadowsocks-libev # Download latest shadowsocks-libev
download_files(){ download_files(){
cd ${cur_dir}
if [ -f ${shadowsocks_libev_ver}.tar.gz ]; then if [ -f ${shadowsocks_libev_ver}.tar.gz ]; then
echo "${shadowsocks_libev_ver}.tar.gz [found]" echo "${shadowsocks_libev_ver}.tar.gz [found]"
else else
@ -230,6 +230,16 @@ download_files(){
fi fi
fi fi
if ! wget --no-check-certificate -O libsodium-1.0.11.tar.gz https://github.com/jedisct1/libsodium/releases/download/1.0.11/libsodium-1.0.11.tar.gz; then
echo "Failed to download libsodium-1.0.11.tar.gz"
exit 1
fi
if ! wget --no-check-certificate -O mbedtls-2.4.0-gpl.tgz https://tls.mbed.org/download/mbedtls-2.4.0-gpl.tgz; then
echo "Failed to download mbedtls-2.4.0-gpl.tgz"
exit 1
fi
# Download init script # Download init script
if ! wget --no-check-certificate -O /etc/init.d/shadowsocks ${init_script_link}; then if ! wget --no-check-certificate -O /etc/init.d/shadowsocks ${init_script_link}; then
echo "Failed to download shadowsocks-libev init script!" echo "Failed to download shadowsocks-libev init script!"
@ -262,6 +272,23 @@ EOF
# Install Shadowsocks-libev # Install Shadowsocks-libev
install_shadowsocks(){ install_shadowsocks(){
tar zxf libsodium-1.0.11.tar.gz
cd libsodium-1.0.11
./configure && make && make install
if [ $? -ne 0 ]; then
echo "libsodium install failed!"
exit 1
fi
echo "/usr/local/lib" > /etc/ld.so.conf.d/local.conf
ldconfig
cd ${cur_dir}
tar xf mbedtls-2.4.0-gpl.tgz
cd mbedtls-2.4.0
make SHARED=1 CFLAGS=-fPIC
make install
cd ${cur_dir}
tar zxf ${shadowsocks_libev_ver}.tar.gz tar zxf ${shadowsocks_libev_ver}.tar.gz
cd ${shadowsocks_libev_ver} cd ${shadowsocks_libev_ver}
./configure ./configure
@ -284,6 +311,8 @@ install_shadowsocks(){
cd ${cur_dir} cd ${cur_dir}
rm -rf ${shadowsocks_libev_ver} ${shadowsocks_libev_ver}.tar.gz rm -rf ${shadowsocks_libev_ver} ${shadowsocks_libev_ver}.tar.gz
rm -rf libsodium-1.0.11 libsodium-1.0.11.tar.gz
rm -rf mbedtls-2.4.0 mbedtls-2.4.0-gpl.tgz
clear clear
echo echo

View File

@ -57,10 +57,10 @@ get_char(){
get_latest_version(){ get_latest_version(){
#ver=$(wget --no-check-certificate -qO- https://api.github.com/repos/shadowsocks/shadowsocks-libev/releases/latest | grep 'tag_name' | cut -d\" -f4) #ver=$(wget --no-check-certificate -qO- https://api.github.com/repos/shadowsocks/shadowsocks-libev/releases/latest | grep 'tag_name' | cut -d\" -f4)
# The specified version # The specified version
ver="v2.5.6" ver="v3.0.1"
[ -z ${ver} ] && echo "Error: Get shadowsocks-libev latest version failed" && exit 1 [ -z ${ver} ] && echo "Error: Get shadowsocks-libev latest version failed" && exit 1
shadowsocks_libev_ver="shadowsocks-libev-$(echo ${ver} | sed -e 's/^[a-zA-Z]//g')" shadowsocks_libev_ver="shadowsocks-libev-$(echo ${ver} | sed -e 's/^[a-zA-Z]//g')"
download_link="https://github.com/shadowsocks/shadowsocks-libev/archive/${ver}.tar.gz" download_link="https://github.com/shadowsocks/shadowsocks-libev/releases/download/${ver}/${shadowsocks_libev_ver}.tar.gz"
init_script_link="https://raw.githubusercontent.com/teddysun/shadowsocks_install/master/shadowsocks-libev" init_script_link="https://raw.githubusercontent.com/teddysun/shadowsocks_install/master/shadowsocks-libev"
} }
@ -243,13 +243,16 @@ pre_install(){
echo "Press any key to start...or press Ctrl+C to cancel" echo "Press any key to start...or press Ctrl+C to cancel"
char=`get_char` char=`get_char`
#Install necessary dependencies #Install necessary dependencies
yum install -y unzip autoconf automake make zlib-devel libtool libevent xmlto asciidoc pcre pcre-devel openssl-devel gcc perl perl-devel cpio expat-devel gettext-devel yum install -y epel-release
echo yum install -y gcc gettext-devel unzip autoconf automake make zlib-devel libtool xmlto asciidoc udns-devel libev-devel
cd ${cur_dir} yum install -y pcre pcre-devel perl perl-devel cpio expat-devel openssl-devel mbedtls-devel
[ -f /usr/include/libev/ev.h ] && ln -sf /usr/include/libev/ev.h /usr/include/ev.h
} }
# Download latest shadowsocks-libev # Download latest shadowsocks-libev
download_files(){ download_files(){
cd ${cur_dir}
if [ -f ${shadowsocks_libev_ver}.tar.gz ]; then if [ -f ${shadowsocks_libev_ver}.tar.gz ]; then
echo "${shadowsocks_libev_ver}.tar.gz [found]" echo "${shadowsocks_libev_ver}.tar.gz [found]"
else else
@ -259,6 +262,11 @@ download_files(){
fi fi
fi fi
if ! wget --no-check-certificate -O libsodium-1.0.11.tar.gz https://github.com/jedisct1/libsodium/releases/download/1.0.11/libsodium-1.0.11.tar.gz; then
echo "Failed to download libsodium-1.0.11.tar.gz"
exit 1
fi
# Download init script # Download init script
if ! wget --no-check-certificate -O /etc/init.d/shadowsocks ${init_script_link}; then if ! wget --no-check-certificate -O /etc/init.d/shadowsocks ${init_script_link}; then
echo "Failed to download shadowsocks-libev init script!" echo "Failed to download shadowsocks-libev init script!"
@ -330,6 +338,17 @@ firewall_set(){
# Install Shadowsocks-libev # Install Shadowsocks-libev
install_shadowsocks(){ install_shadowsocks(){
tar zxf libsodium-1.0.11.tar.gz
cd libsodium-1.0.11
./configure && make && make install
if [ $? -ne 0 ]; then
echo "libsodium install failed!"
exit 1
fi
echo "/usr/local/lib" > /etc/ld.so.conf.d/local.conf
ldconfig
cd ${cur_dir}
tar zxf ${shadowsocks_libev_ver}.tar.gz tar zxf ${shadowsocks_libev_ver}.tar.gz
cd ${shadowsocks_libev_ver} cd ${shadowsocks_libev_ver}
./configure ./configure
@ -354,6 +373,7 @@ install_shadowsocks(){
cd ${cur_dir} cd ${cur_dir}
rm -rf ${shadowsocks_libev_ver} ${shadowsocks_libev_ver}.tar.gz rm -rf ${shadowsocks_libev_ver} ${shadowsocks_libev_ver}.tar.gz
rm -rf libsodium-1.0.11 libsodium-1.0.11.tar.gz
clear clear
echo echo