mirror of
https://gitee.com/ineo6/homebrew-install.git
synced 2025-04-06 03:58:05 +08:00
feat: 同步脚本
This commit is contained in:
parent
7539fa9e76
commit
f48e6e32cf
109
install.sh
109
install.sh
@ -776,10 +776,10 @@ then
|
|||||||
additional_shellenv_commands+=("export HOMEBREW_CASK_GIT_REMOTE=\"${HOMEBREW_CASK_GIT_REMOTE}\"")
|
additional_shellenv_commands+=("export HOMEBREW_CASK_GIT_REMOTE=\"${HOMEBREW_CASK_GIT_REMOTE}\"")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z "${HOMEBREW_NO_INSTALL_FROM_API-}" && -n "${HOMEBREW_INSTALL_FROM_API-}" ]]
|
if [[ -n "${HOMEBREW_NO_INSTALL_FROM_API-}" ]]
|
||||||
then
|
then
|
||||||
ohai "HOMEBREW_INSTALL_FROM_API is set."
|
ohai "HOMEBREW_NO_INSTALL_FROM_API is set."
|
||||||
echo "Homebrew/homebrew-core will not be tapped during this ${tty_bold}install${tty_reset} run."
|
echo "Homebrew/homebrew-core will be tapped during this ${tty_bold}install${tty_reset} run."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ohai "安装提示"
|
ohai "安装提示"
|
||||||
@ -972,25 +972,61 @@ ohai "Downloading and installing Homebrew..."
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z "${HOMEBREW_NO_INSTALL_FROM_API-}" && -n "${HOMEBREW_INSTALL_FROM_API-}" ]]
|
if [[ -n "${HOMEBREW_NO_INSTALL_FROM_API-}" && ! -d "${HOMEBREW_CORE}" ]]
|
||||||
then
|
then
|
||||||
|
# Always use single-quoted strings with `exp` expressions
|
||||||
# shellcheck disable=SC2016
|
# shellcheck disable=SC2016
|
||||||
ohai 'Skip tapping homebrew/core because `$HOMEBREW_INSTALL_FROM_API` is set.'
|
ohai 'Tapping homebrew/core because `$HOMEBREW_NO_INSTALL_FROM_API` is set.'
|
||||||
# Unset HOMEBREW_DEVELOPER since it is no longer needed and causes warnings during brew update below
|
(
|
||||||
if [[ -n "${HOMEBREW_ON_LINUX-}" && (-n "${HOMEBREW_CURL_PATH-}" || -n "${HOMEBREW_GIT_PATH-}") ]]
|
execute "${MKDIR[@]}" "${HOMEBREW_CORE}"
|
||||||
|
cd "${HOMEBREW_CORE}" >/dev/null || return
|
||||||
|
|
||||||
|
execute "git" "init" "-q"
|
||||||
|
execute "git" "config" "remote.origin.url" "${HOMEBREW_CORE_GIT_REMOTE}"
|
||||||
|
execute "git" "config" "remote.origin.fetch" "+refs/heads/*:refs/remotes/origin/*"
|
||||||
|
execute "git" "config" "--bool" "core.autocrlf" "false"
|
||||||
|
execute "git" "config" "--bool" "core.symlinks" "true"
|
||||||
|
execute "git" "fetch" "--force" "origin" "refs/heads/master:refs/remotes/origin/master"
|
||||||
|
execute "git" "remote" "set-head" "origin" "--auto" >/dev/null
|
||||||
|
execute "git" "reset" "--hard" "origin/master"
|
||||||
|
|
||||||
|
cd "${HOMEBREW_REPOSITORY}" >/dev/null || return
|
||||||
|
) || exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -n "${HOMEBREW_NO_INSTALL_FROM_API-}" && ! -d "${HOMEBREW_CASK}" ]]
|
||||||
|
then
|
||||||
|
# Always use single-quoted strings with `exp` expressions
|
||||||
|
# shellcheck disable=SC2016
|
||||||
|
ohai 'Tapping homebrew/cask because `$HOMEBREW_NO_INSTALL_FROM_API` is set.'
|
||||||
|
(
|
||||||
|
execute "${MKDIR[@]}" "${HOMEBREW_CASK}"
|
||||||
|
cd "${HOMEBREW_CASK}" >/dev/null || return
|
||||||
|
|
||||||
|
execute "git" "init" "-q"
|
||||||
|
execute "git" "config" "remote.origin.url" "${HOMEBREW_CASK_GIT_REMOTE}"
|
||||||
|
execute "git" "config" "remote.origin.fetch" "+refs/heads/*:refs/remotes/origin/*"
|
||||||
|
execute "git" "config" "--bool" "core.autocrlf" "false"
|
||||||
|
execute "git" "config" "--bool" "core.symlinks" "true"
|
||||||
|
execute "git" "fetch" "--force" "origin" "refs/heads/master:refs/remotes/origin/master"
|
||||||
|
execute "git" "remote" "set-head" "origin" "--auto" >/dev/null
|
||||||
|
execute "git" "reset" "--hard" "origin/master"
|
||||||
|
|
||||||
|
cd "${HOMEBREW_REPOSITORY}" >/dev/null || return
|
||||||
|
) || exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -n "${HOMEBREW_NO_INSTALL_FROM_API-}" && ! -d "${HOMEBREW_SERVICES}" ]]
|
||||||
then
|
then
|
||||||
export -n HOMEBREW_DEVELOPER
|
# Always use single-quoted strings with `exp` expressions
|
||||||
fi
|
# shellcheck disable=SC2016
|
||||||
else
|
ohai 'Tapping homebrew/services because `$HOMEBREW_NO_INSTALL_FROM_API` is set.'
|
||||||
if [[ ! -d "${HOMEBREW_CORE}" ]]
|
|
||||||
then
|
|
||||||
ohai "Tapping homebrew/core"
|
|
||||||
(
|
(
|
||||||
execute "${MKDIR[@]}" "${HOMEBREW_CORE}"
|
execute "${MKDIR[@]}" "${HOMEBREW_SERVICES}"
|
||||||
cd "${HOMEBREW_CORE}" >/dev/null || return
|
cd "${HOMEBREW_SERVICES}" >/dev/null || return
|
||||||
|
|
||||||
execute "git" "init" "-q"
|
execute "git" "init" "-q"
|
||||||
execute "git" "config" "remote.origin.url" "${HOMEBREW_CORE_GIT_REMOTE}"
|
execute "git" "config" "remote.origin.url" "${HOMEBREW_SERVICES_DEFAULT_GIT_REMOTE}"
|
||||||
execute "git" "config" "remote.origin.fetch" "+refs/heads/*:refs/remotes/origin/*"
|
execute "git" "config" "remote.origin.fetch" "+refs/heads/*:refs/remotes/origin/*"
|
||||||
execute "git" "config" "--bool" "core.autocrlf" "false"
|
execute "git" "config" "--bool" "core.autocrlf" "false"
|
||||||
execute "git" "config" "--bool" "core.symlinks" "true"
|
execute "git" "config" "--bool" "core.symlinks" "true"
|
||||||
@ -1000,47 +1036,6 @@ ohai "Downloading and installing Homebrew..."
|
|||||||
|
|
||||||
cd "${HOMEBREW_REPOSITORY}" >/dev/null || return
|
cd "${HOMEBREW_REPOSITORY}" >/dev/null || return
|
||||||
) || exit 1
|
) || exit 1
|
||||||
|
|
||||||
if [[ ! -d "${HOMEBREW_CASK}" ]]
|
|
||||||
then
|
|
||||||
ohai "Tapping homebrew/cask"
|
|
||||||
(
|
|
||||||
execute "${MKDIR[@]}" "${HOMEBREW_CASK}"
|
|
||||||
cd "${HOMEBREW_CASK}" >/dev/null || return
|
|
||||||
|
|
||||||
execute "git" "init" "-q"
|
|
||||||
execute "git" "config" "remote.origin.url" "${HOMEBREW_CASK_GIT_REMOTE}"
|
|
||||||
execute "git" "config" "remote.origin.fetch" "+refs/heads/*:refs/remotes/origin/*"
|
|
||||||
execute "git" "config" "--bool" "core.autocrlf" "false"
|
|
||||||
execute "git" "config" "--bool" "core.symlinks" "true"
|
|
||||||
execute "git" "fetch" "--force" "origin" "refs/heads/master:refs/remotes/origin/master"
|
|
||||||
execute "git" "remote" "set-head" "origin" "--auto" >/dev/null
|
|
||||||
execute "git" "reset" "--hard" "origin/master"
|
|
||||||
|
|
||||||
cd "${HOMEBREW_REPOSITORY}" >/dev/null || return
|
|
||||||
) || exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ ! -d "${HOMEBREW_SERVICES}" ]]
|
|
||||||
then
|
|
||||||
ohai "Tapping homebrew/services"
|
|
||||||
(
|
|
||||||
execute "${MKDIR[@]}" "${HOMEBREW_SERVICES}"
|
|
||||||
cd "${HOMEBREW_SERVICES}" >/dev/null || return
|
|
||||||
|
|
||||||
execute "git" "init" "-q"
|
|
||||||
execute "git" "config" "remote.origin.url" "${HOMEBREW_SERVICES_DEFAULT_GIT_REMOTE}"
|
|
||||||
execute "git" "config" "remote.origin.fetch" "+refs/heads/*:refs/remotes/origin/*"
|
|
||||||
execute "git" "config" "--bool" "core.autocrlf" "false"
|
|
||||||
execute "git" "config" "--bool" "core.symlinks" "true"
|
|
||||||
execute "git" "fetch" "--force" "origin" "refs/heads/master:refs/remotes/origin/master"
|
|
||||||
execute "git" "remote" "set-head" "origin" "--auto" >/dev/null
|
|
||||||
execute "git" "reset" "--hard" "origin/master"
|
|
||||||
|
|
||||||
cd "${HOMEBREW_REPOSITORY}" >/dev/null || return
|
|
||||||
) || exit 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
execute "${HOMEBREW_PREFIX}/bin/brew" "update" "--force" "--quiet"
|
execute "${HOMEBREW_PREFIX}/bin/brew" "update" "--force" "--quiet"
|
||||||
) || exit 1
|
) || exit 1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user