修复在没有预装 `curl` 的系统上脚本会运行失败的问题
parent
c3ebd755b9
commit
8e5c2e067f
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue