From 8e5c2e067f246800d90ab909b57c79798a432f5a Mon Sep 17 00:00:00 2001 From: IceCodeNew <32576256+IceCodeNew@users.noreply.github.com> Date: Fri, 25 Sep 2020 15:16:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=9C=A8=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E9=A2=84=E8=A3=85=20`curl`=20=E7=9A=84=E7=B3=BB=E7=BB=9F?= =?UTF-8?q?=E4=B8=8A=E8=84=9A=E6=9C=AC=E4=BC=9A=E8=BF=90=E8=A1=8C=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- install-release.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/install-release.sh b/install-release.sh index 96597c7..7bdbee4 100644 --- a/install-release.sh +++ b/install-release.sh @@ -28,7 +28,7 @@ green=$(tput setaf 2) reset=$(tput sgr0) curl() { - $(type -P curl) -L -q --retry 5 --retry-delay 10 --retry-max-time 60 "$@" + $(type -P curl) -L -q --retry 5 --retry-delay 10 --retry-max-time 60 "$@" } check_if_running_as_root() { @@ -108,8 +108,8 @@ identify_the_operating_system_and_architecture() { PACKAGE_MANAGEMENT_INSTALL='apt install -y --no-install-recommends' PACKAGE_MANAGEMENT_REMOVE='apt purge' elif [[ "$(type -P dnf)" ]]; then - PACKAGE_MANAGEMENT_INSTALL='dnf install -y' - PACKAGE_MANAGEMENT_REMOVE='dnf remove' + PACKAGE_MANAGEMENT_INSTALL='dnf install -y' + PACKAGE_MANAGEMENT_REMOVE='dnf remove' elif [[ "$(type -P yum)" ]]; then PACKAGE_MANAGEMENT_INSTALL='yum install -y' PACKAGE_MANAGEMENT_REMOVE='yum remove' @@ -180,7 +180,7 @@ judgment_parameters() { install_software() { COMPONENT="$1" - command -v "$COMPONENT" > /dev/null 2>&1 && return + type -P "$COMPONENT" > /dev/null 2>&1 && return if ${PACKAGE_MANAGEMENT_INSTALL} "$COMPONENT"; then echo "info: $COMPONENT is installed." else @@ -219,7 +219,6 @@ get_version() { fi # Get V2Ray release version number TMP_FILE="$(mktemp)" - install_software curl # DO NOT QUOTE THESE `${PROXY}` VARIABLES! if ! curl ${PROXY} -sS -H "Accept: application/vnd.github.v3+json" -o "$TMP_FILE" 'https://api.github.com/repos/v2fly/v2ray-core/releases/latest'; then "rm" "$TMP_FILE" @@ -502,6 +501,7 @@ main() { decompression "$LOCAL_FILE" else # Normal way + install_software curl get_version NUMBER="$?" if [[ "$NUMBER" -eq '0' ]] || [[ "$FORCE" -eq '1' ]] || [[ "$NUMBER" -eq 2 ]]; then