From c00549d2be563087adda5c48474725b70e530822 Mon Sep 17 00:00:00 2001 From: Yuk1n0 <39364985+Yuk1n0@users.noreply.github.com> Date: Sat, 10 Jul 2021 17:31:57 +0800 Subject: [PATCH] Adjust judgment method --- shadowsocks.sh | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/shadowsocks.sh b/shadowsocks.sh index 4b20e84..bc1204f 100644 --- a/shadowsocks.sh +++ b/shadowsocks.sh @@ -604,10 +604,12 @@ install_prepare() { } install_libsodium() { - if [ ! -f /usr/lib/libsodium.a ] || [ ! -f /usr/lib64/libsodium.a ]; then + if [ -f /usr/lib/libsodium.a ] || [ -f /usr/lib64/libsodium.a ]; then + echo + echo -e "[${green}Info${plain}] ${libsodium_file} already installed." + else echo echo -e "[${green}Info${plain}] ${libsodium_file} start installing." - echo cd ${cur_dir} || exit download "${libsodium_file}.tar.gz" "${libsodium_url}" tar zxf ${libsodium_file}.tar.gz @@ -619,17 +621,16 @@ install_libsodium() { exit 1 fi echo -e "[${green}Info${plain}] ${libsodium_file} install success!" - else - echo - echo -e "[${green}Info${plain}] ${libsodium_file} already installed." fi } install_mbedtls() { - if [ ! -f /usr/lib/libmbedtls.a ] || [ ! -f /usr/lib64/libmbedtls.a ]; then + if [ -f /usr/lib/libmbedtls.a ] || [ -f /usr/lib64/libmbedtls.a ]; then + echo + echo -e "[${green}Info${plain}] ${mbedtls_file} already installed." + else echo echo -e "[${green}Info${plain}] ${mbedtls_file} start installing." - echo cd ${cur_dir} || exit download "mbedtls-${mbedtls_file}.tar.gz" "${mbedtls_url}" tar zxf mbedtls-${mbedtls_file}.tar.gz @@ -642,16 +643,12 @@ install_mbedtls() { exit 1 fi echo -e "[${green}Info${plain}] ${mbedtls_file} install success!" - else - echo - echo -e "[${green}Info${plain}] ${mbedtls_file} already installed." fi } install_shadowsocks_libev() { echo echo -e "[${green}Info${plain}] ${software[0]} start installing." - echo cd ${cur_dir} || exit tar zxf ${shadowsocks_libev_file}.tar.gz cd ${shadowsocks_libev_file} || exit @@ -676,7 +673,6 @@ install_shadowsocks_libev() { install_shadowsocks_r() { echo echo -e "[${green}Info${plain}] ${software[1]} start installing." - echo cd ${cur_dir} || exit tar zxf ${shadowsocks_r_file}.tar.gz mv ${shadowsocks_r_file}/shadowsocks /usr/local/