mirror of
https://gitee.com/ineo6/homebrew-install.git
synced 2025-06-25 13:59:16 +08:00
feat: 更新脚本
This commit is contained in:
parent
ef1e02b51c
commit
3815fa48aa
15
install.sh
15
install.sh
@ -314,7 +314,7 @@ execute() {
|
|||||||
|
|
||||||
execute_sudo() {
|
execute_sudo() {
|
||||||
local -a args=("$@")
|
local -a args=("$@")
|
||||||
if have_sudo_access
|
if [[ "${EUID:-${UID}}" != "0" ]] && have_sudo_access
|
||||||
then
|
then
|
||||||
if [[ -n "${SUDO_ASKPASS-}" ]]
|
if [[ -n "${SUDO_ASKPASS-}" ]]
|
||||||
then
|
then
|
||||||
@ -536,7 +536,7 @@ ohai 'Checking for `sudo` access (which may request your password)...'
|
|||||||
|
|
||||||
if [[ -n "${HOMEBREW_ON_MACOS-}" ]]
|
if [[ -n "${HOMEBREW_ON_MACOS-}" ]]
|
||||||
then
|
then
|
||||||
have_sudo_access
|
[[ "${EUID:-${UID}}" == "0" ]] || have_sudo_access
|
||||||
elif ! [[ -w "${HOMEBREW_PREFIX}" ]] &&
|
elif ! [[ -w "${HOMEBREW_PREFIX}" ]] &&
|
||||||
! [[ -w "/home/linuxbrew" ]] &&
|
! [[ -w "/home/linuxbrew" ]] &&
|
||||||
! [[ -w "/home" ]] &&
|
! [[ -w "/home" ]] &&
|
||||||
@ -1077,8 +1077,14 @@ ohai "Downloading and installing Homebrew..."
|
|||||||
|
|
||||||
execute "${USABLE_GIT}" "fetch" "--force" "origin"
|
execute "${USABLE_GIT}" "fetch" "--force" "origin"
|
||||||
execute "${USABLE_GIT}" "fetch" "--force" "--tags" "origin"
|
execute "${USABLE_GIT}" "fetch" "--force" "--tags" "origin"
|
||||||
|
execute "${USABLE_GIT}" "remote" "set-head" "origin" "--auto" >/dev/null
|
||||||
|
|
||||||
execute "${USABLE_GIT}" "reset" "--hard" "origin/master"
|
LATEST_GIT_TAG="$("${USABLE_GIT}" tag --list --sort="-version:refname" | head -n1)"
|
||||||
|
if [[ -z "${LATEST_GIT_TAG}" ]]
|
||||||
|
then
|
||||||
|
abort "Failed to query latest Homebrew/brew Git tag."
|
||||||
|
fi
|
||||||
|
execute "${USABLE_GIT}" "checkout" "--force" "-B" "stable" "${LATEST_GIT_TAG}"
|
||||||
|
|
||||||
if [[ "${HOMEBREW_REPOSITORY}" != "${HOMEBREW_PREFIX}" ]]
|
if [[ "${HOMEBREW_REPOSITORY}" != "${HOMEBREW_PREFIX}" ]]
|
||||||
then
|
then
|
||||||
@ -1184,6 +1190,9 @@ case "${SHELL}" in
|
|||||||
shell_rcfile="${ZDOTDIR:-"${HOME}"}/.zprofile"
|
shell_rcfile="${ZDOTDIR:-"${HOME}"}/.zprofile"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
*/fish*)
|
||||||
|
shell_rcfile="${HOME}/.config/fish/config.fish"
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
shell_rcfile="${ENV:-"${HOME}/.profile"}"
|
shell_rcfile="${ENV:-"${HOME}/.profile"}"
|
||||||
;;
|
;;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user