From ca7b04185762fe5e77d43061e04b93525e850a72 Mon Sep 17 00:00:00 2001 From: lvsi <15239928381@163.com> Date: Sun, 12 Feb 2023 01:29:59 +0800 Subject: [PATCH] fix: fix the bug of system check --- scripts/adjust_system_param.sh | 3 +++ scripts/common.sh | 15 ++++++++------- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/scripts/adjust_system_param.sh b/scripts/adjust_system_param.sh index 17044ee..85cf433 100644 --- a/scripts/adjust_system_param.sh +++ b/scripts/adjust_system_param.sh @@ -5,6 +5,9 @@ cd $ngxwayPath # Require the common shell scripts. . $ngxwayPath/scripts/common.sh +# Check the system, only available for Linux and Unix series. +whichSystem=$(printWhichSystem) + # Adjust system parameters to improve the performance of ngxway. if [ "${whichSystem}" == "Linux" ] ; then echo $systemParamTemplate1 >> ~/.bashrc diff --git a/scripts/common.sh b/scripts/common.sh index 2e4df5c..08b3ca3 100644 --- a/scripts/common.sh +++ b/scripts/common.sh @@ -50,14 +50,15 @@ function printSignedRequest() { function printWhichSystem(){ uNames=`uname -s` osName=${uNames: 0: 4} - if [ "$osName" == "Darwin" ] ; then # Darwin - echo "MacOS" - elif [ "$osName" == "Linux" ] ; then # Linux - echo "Linux" - elif [ "$osName" == "MINGW" ] ; then # MINGW - echo "Windows" + if [ "$osName" == "Darw" ] ; then # Darwin + whichSystem="MacOS" + elif [ "$osName" == "Linu" ] ; then # Linux + whichSystem="Linux" + elif [ "$osName" == "MING" ] ; then # MINGW + whichSystem="Windows" else - echo "Unknown" + whichSystem="Unknown" fi + echo $whichSystem } # ================================