From ef1e02b51c5ad19902572500d0b00c158c838ce9 Mon Sep 17 00:00:00 2001 From: neo Date: Wed, 13 Dec 2023 20:01:22 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=20=E6=9B=B4=E6=96=B0=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- install-origin.sh | 14 +++++--------- install.sh | 31 +++++++++++++++++++++---------- 2 files changed, 26 insertions(+), 19 deletions(-) diff --git a/install-origin.sh b/install-origin.sh index 5533894..bf72797 100755 --- a/install-origin.sh +++ b/install-origin.sh @@ -262,7 +262,7 @@ execute() { execute_sudo() { local -a args=("$@") - if have_sudo_access + if [[ "${EUID:-${UID}}" != "0" ]] && have_sudo_access then if [[ -n "${SUDO_ASKPASS-}" ]] then @@ -484,7 +484,7 @@ ohai 'Checking for `sudo` access (which may request your password)...' if [[ -n "${HOMEBREW_ON_MACOS-}" ]] then - have_sudo_access + [[ "${EUID:-${UID}}" == "0" ]] || have_sudo_access elif ! [[ -w "${HOMEBREW_PREFIX}" ]] && ! [[ -w "/home/linuxbrew" ]] && ! [[ -w "/home" ]] && @@ -910,13 +910,6 @@ EOABORT fi fi -# Set HOMEBREW_DEVELOPER on Linux systems where usable Git/cURL is not in /usr/bin -if [[ -n "${HOMEBREW_ON_LINUX-}" && (-n "${HOMEBREW_CURL_PATH-}" || -n "${HOMEBREW_GIT_PATH-}") ]] -then - ohai "Setting HOMEBREW_DEVELOPER to use Git/cURL not in /usr/bin" - export HOMEBREW_DEVELOPER=1 -fi - ohai "Downloading and installing Homebrew..." ( cd "${HOMEBREW_REPOSITORY}" >/dev/null || return @@ -1029,6 +1022,9 @@ case "${SHELL}" in shell_rcfile="${ZDOTDIR:-"${HOME}"}/.zprofile" fi ;; + */fish*) + shell_rcfile="${HOME}/.config/fish/config.fish" + ;; *) shell_rcfile="${ENV:-"${HOME}/.profile"}" ;; diff --git a/install.sh b/install.sh index dbf4f33..49ff2b8 100755 --- a/install.sh +++ b/install.sh @@ -115,6 +115,21 @@ checkExecute() { fi } +checkGitProxy() { + git_https_proxy=$(git config --global https.proxy) + git_http_proxy=$(git config --global http.proxy) + if [[ -z "$git_https_proxy" && -z "$git_http_proxy" ]]; then + echo "" + else + warn " + 发现git代理!如果后面出现git相关报错,尝试在终端执行下面命令: + + git config --global --unset https.proxy + git config --global --unset http.proxy + " + fi +} + # Check if script is run non-interactively (e.g. CI) # If it is run non-interactively we should not prompt for passwords. # Always use single-quoted strings with `exp` expressions @@ -970,6 +985,8 @@ EOABORT fi fi +checkGitProxy + if ! command -v curl >/dev/null then abort "$( @@ -1143,14 +1160,6 @@ ohai "Downloading and installing Homebrew..." ring_bell -ohai "Homebrew是由志愿者义务维护的,如果可以请考虑捐赠:" -echo "$( - cat </dev/null || return execute "${USABLE_GIT}" "config" "--replace-all" "homebrew.analyticsmessage" "true" @@ -1202,11 +1211,13 @@ then eval \$(${HOMEBREW_PREFIX}/bin/brew shellenv) #brew.idayer.com export HOMEBREW_API_DOMAIN=${HOMEBREW_API_DOMAIN} #brew.idayer.com export HOMEBREW_BOTTLE_DOMAIN=${HOMEBREW_BOTTLE_DOMAIN} #brew.idayer.com +export HOMEBREW_PIP_INDEX_URL=https://mirrors.aliyun.com/pypi/simple/ #brew.idayer.com EOS else cat >> ${shell_rcfile} <