Fix brew style shellcheck warnings.
				
					
				
			This commit is contained in:
		
							parent
							
								
									96504ec9dc
								
							
						
					
					
						commit
						4feb851279
					
				@ -26,7 +26,7 @@ export HOMEBREW_COMMAND_DEPTH=$((HOMEBREW_COMMAND_DEPTH + 1))
 | 
			
		||||
onoe() {
 | 
			
		||||
  if [[ -t 2 ]] # check whether stderr is a tty.
 | 
			
		||||
  then
 | 
			
		||||
    echo -ne "\033[4;31mError\033[0m: " >&2 # highlight Error with underline and red color
 | 
			
		||||
    echo -ne "\\033[4;31mError\\033[0m: " >&2 # highlight Error with underline and red color
 | 
			
		||||
  else
 | 
			
		||||
    echo -n "Error: " >&2
 | 
			
		||||
  fi
 | 
			
		||||
@ -90,6 +90,9 @@ then
 | 
			
		||||
 | 
			
		||||
  # The system Curl is too old for some modern HTTPS certificates on
 | 
			
		||||
  # older macOS versions.
 | 
			
		||||
  #
 | 
			
		||||
  # Intentionally set this variable by exploding another.
 | 
			
		||||
  # shellcheck disable=SC2086,SC2183
 | 
			
		||||
  printf -v HOMEBREW_MACOS_VERSION_NUMERIC "%02d%02d%02d" ${HOMEBREW_MACOS_VERSION//./ }
 | 
			
		||||
  if [[ "$HOMEBREW_MACOS_VERSION_NUMERIC" -lt "101000" ]]
 | 
			
		||||
  then
 | 
			
		||||
@ -162,6 +165,7 @@ export HOMEBREW_CACHE
 | 
			
		||||
export HOMEBREW_CELLAR
 | 
			
		||||
export HOMEBREW_SYSTEM
 | 
			
		||||
export HOMEBREW_CURL
 | 
			
		||||
export HOMEBREW_SYSTEM_CURL_TOO_OLD
 | 
			
		||||
export HOMEBREW_GIT
 | 
			
		||||
export HOMEBREW_PROCESSOR
 | 
			
		||||
export HOMEBREW_PRODUCT
 | 
			
		||||
@ -340,8 +344,8 @@ access to all bottles."
 | 
			
		||||
EOS
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
# Hide shellcheck complaint:
 | 
			
		||||
# shellcheck source=/dev/null
 | 
			
		||||
# Don't need shellcheck to follow this `source`.
 | 
			
		||||
# shellcheck disable=SC1090
 | 
			
		||||
source "$HOMEBREW_LIBRARY/Homebrew/utils/analytics.sh"
 | 
			
		||||
setup-analytics
 | 
			
		||||
 | 
			
		||||
@ -401,13 +405,13 @@ then
 | 
			
		||||
  # a Ruby script and avoids hard-to-debug issues if the Bash script is updated
 | 
			
		||||
  # at the same time as being run.
 | 
			
		||||
  #
 | 
			
		||||
  # Hide shellcheck complaint:
 | 
			
		||||
  # shellcheck source=/dev/null
 | 
			
		||||
  # Don't need shellcheck to follow this `source`.
 | 
			
		||||
  # shellcheck disable=SC1090
 | 
			
		||||
  source "$HOMEBREW_BASH_COMMAND"
 | 
			
		||||
  { update-preinstall; "homebrew-$HOMEBREW_COMMAND" "$@"; exit $?; }
 | 
			
		||||
else
 | 
			
		||||
  # Hide shellcheck complaint:
 | 
			
		||||
  # shellcheck source=/dev/null
 | 
			
		||||
  # Don't need shellcheck to follow this `source`.
 | 
			
		||||
  # shellcheck disable=SC1090
 | 
			
		||||
  source "$HOMEBREW_LIBRARY/Homebrew/utils/ruby.sh"
 | 
			
		||||
  setup-ruby-path
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -26,12 +26,12 @@ homebrew-update-reset() {
 | 
			
		||||
    set -x
 | 
			
		||||
  fi
 | 
			
		||||
 | 
			
		||||
  if [[ -z "$REPOS" ]]
 | 
			
		||||
  if [[ -z "${REPOS[]}" ]]
 | 
			
		||||
  then
 | 
			
		||||
    REPOS+=("$HOMEBREW_REPOSITORY" "$HOMEBREW_LIBRARY"/Taps/*/*)
 | 
			
		||||
  fi
 | 
			
		||||
 | 
			
		||||
  for DIR in ${REPOS[@]}
 | 
			
		||||
  for DIR in "${REPOS[@]}"
 | 
			
		||||
  do
 | 
			
		||||
    [[ -d "$DIR/.git" ]] || continue
 | 
			
		||||
    cd "$DIR" || continue
 | 
			
		||||
 | 
			
		||||
@ -8,8 +8,8 @@
 | 
			
		||||
#:    If `--force` (or `-f`) is specified then always do a slower, full update check even
 | 
			
		||||
#:    if unnecessary.
 | 
			
		||||
 | 
			
		||||
# Hide shellcheck complaint:
 | 
			
		||||
# shellcheck source=/dev/null
 | 
			
		||||
# Don't need shellcheck to follow this `source`.
 | 
			
		||||
# shellcheck disable=SC1090
 | 
			
		||||
source "$HOMEBREW_LIBRARY/Homebrew/utils/lock.sh"
 | 
			
		||||
 | 
			
		||||
# Replaces the function in Library/Homebrew/brew.sh to cache the Git executable to
 | 
			
		||||
 | 
			
		||||
@ -2,13 +2,16 @@
 | 
			
		||||
#:  * `vendor-install` [<target>]:
 | 
			
		||||
#:     Install vendor version of Homebrew dependencies.
 | 
			
		||||
 | 
			
		||||
# Hide shellcheck complaint:
 | 
			
		||||
# shellcheck source=/dev/null
 | 
			
		||||
# Don't need shellcheck to follow this `source`.
 | 
			
		||||
# shellcheck disable=SC1090
 | 
			
		||||
source "$HOMEBREW_LIBRARY/Homebrew/utils/lock.sh"
 | 
			
		||||
 | 
			
		||||
VENDOR_DIR="$HOMEBREW_LIBRARY/Homebrew/vendor"
 | 
			
		||||
 | 
			
		||||
# Built from https://github.com/Homebrew/homebrew-portable-ruby.
 | 
			
		||||
#
 | 
			
		||||
# Dynamic variables can't be detected by shellcheck
 | 
			
		||||
# shellcheck disable=SC2034
 | 
			
		||||
if [[ -n "$HOMEBREW_MACOS" ]]
 | 
			
		||||
then
 | 
			
		||||
  if [[ "$HOMEBREW_PROCESSOR" = "Intel" ]]
 | 
			
		||||
@ -152,7 +155,6 @@ EOS
 | 
			
		||||
 | 
			
		||||
install() {
 | 
			
		||||
  local tar_args
 | 
			
		||||
  local verb
 | 
			
		||||
 | 
			
		||||
  if [[ -n "$HOMEBREW_VERBOSE" ]]
 | 
			
		||||
  then
 | 
			
		||||
@ -168,13 +170,7 @@ install() {
 | 
			
		||||
 | 
			
		||||
  if [[ -d "$VENDOR_VERSION" ]]
 | 
			
		||||
  then
 | 
			
		||||
    verb="reinstall"
 | 
			
		||||
    mv "$VENDOR_VERSION" "$VENDOR_VERSION.reinstall"
 | 
			
		||||
  elif [[ -n "$(ls -A .)" ]]
 | 
			
		||||
  then
 | 
			
		||||
    verb="upgrade"
 | 
			
		||||
  else
 | 
			
		||||
    verb="install"
 | 
			
		||||
  fi
 | 
			
		||||
 | 
			
		||||
  safe_cd "$VENDOR_DIR"
 | 
			
		||||
@ -185,8 +181,6 @@ install() {
 | 
			
		||||
  if quiet_stderr "./$VENDOR_VERSION/bin/$VENDOR_NAME" --version >/dev/null
 | 
			
		||||
  then
 | 
			
		||||
    ln -sfn "$VENDOR_VERSION" current
 | 
			
		||||
    # remove old vendor installations by sorting files with modified time.
 | 
			
		||||
    ls -t | grep -Ev "^(current|$VENDOR_VERSION)" | tail -n +4 | xargs rm -rf
 | 
			
		||||
    if [[ -d "$VENDOR_VERSION.reinstall" ]]
 | 
			
		||||
    then
 | 
			
		||||
      rm -rf "$VENDOR_VERSION.reinstall"
 | 
			
		||||
@ -197,7 +191,7 @@ install() {
 | 
			
		||||
    then
 | 
			
		||||
      mv "$VENDOR_VERSION.reinstall" "$VENDOR_VERSION"
 | 
			
		||||
    fi
 | 
			
		||||
    odie "Failed to $verb vendor $VENDOR_NAME."
 | 
			
		||||
    odie "Failed to vendor $VENDOR_NAME $VENDOR_VERSION."
 | 
			
		||||
  fi
 | 
			
		||||
 | 
			
		||||
  trap - SIGINT
 | 
			
		||||
 | 
			
		||||
@ -1,10 +1,13 @@
 | 
			
		||||
# Migrate analytics UUID to its new home in Homebrew repo's git config and
 | 
			
		||||
# remove the legacy UUID file if detected.
 | 
			
		||||
migrate-legacy-uuid-file() {
 | 
			
		||||
  local legacy_uuid_file="$HOME/.homebrew_analytics_user_uuid"
 | 
			
		||||
  local legacy_uuid_file analytics_uuid
 | 
			
		||||
 | 
			
		||||
  legacy_uuid_file="$HOME/.homebrew_analytics_user_uuid"
 | 
			
		||||
 | 
			
		||||
  if [[ -f "$legacy_uuid_file" ]]
 | 
			
		||||
  then
 | 
			
		||||
    local analytics_uuid="$(<"$legacy_uuid_file")"
 | 
			
		||||
    analytics_uuid="$(<"$legacy_uuid_file")"
 | 
			
		||||
    if [[ -n "$analytics_uuid" ]]
 | 
			
		||||
    then
 | 
			
		||||
      git config --file="$HOMEBREW_REPOSITORY/.git/config" --replace-all homebrew.analyticsuuid "$analytics_uuid" 2>/dev/null
 | 
			
		||||
@ -23,8 +26,9 @@ setup-analytics() {
 | 
			
		||||
    return
 | 
			
		||||
  fi
 | 
			
		||||
 | 
			
		||||
  local message_seen="$(git config --file="$git_config_file" --get homebrew.analyticsmessage 2>/dev/null)"
 | 
			
		||||
  local analytics_disabled="$(git config --file="$git_config_file" --get homebrew.analyticsdisabled 2>/dev/null)"
 | 
			
		||||
  local message_seen analytics_disabled
 | 
			
		||||
  message_seen="$(git config --file="$git_config_file" --get homebrew.analyticsmessage 2>/dev/null)"
 | 
			
		||||
  analytics_disabled="$(git config --file="$git_config_file" --get homebrew.analyticsdisabled 2>/dev/null)"
 | 
			
		||||
  if [[ "$message_seen" != "true" || "$analytics_disabled" = "true" ]]
 | 
			
		||||
  then
 | 
			
		||||
    # Internal variable for brew's use, to differentiate from user-supplied setting
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										9
									
								
								bin/brew
									
									
									
									
									
								
							
							
						
						
									
										9
									
								
								bin/brew
									
									
									
									
									
								
							@ -8,12 +8,13 @@ if ! [[ -d "$PWD" ]]; then
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
quiet_cd() {
 | 
			
		||||
  cd "$@" >/dev/null
 | 
			
		||||
  cd "$@" >/dev/null || return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
symlink_target_directory() {
 | 
			
		||||
  local target="$(readlink "$1")"
 | 
			
		||||
  local target_dirname="$(dirname "$target")"
 | 
			
		||||
  local target target_dirname
 | 
			
		||||
  target="$(readlink "$1")"
 | 
			
		||||
  target_dirname="$(dirname "$target")"
 | 
			
		||||
  local directory="$2"
 | 
			
		||||
  quiet_cd "$directory" && quiet_cd "$target_dirname" && pwd -P
 | 
			
		||||
}
 | 
			
		||||
@ -83,5 +84,7 @@ then
 | 
			
		||||
 | 
			
		||||
  exec /usr/bin/env -i "${FILTERED_ENV[@]}" /bin/bash "$HOMEBREW_LIBRARY/Homebrew/brew.sh" "$@"
 | 
			
		||||
else
 | 
			
		||||
  # Don't need shellcheck to follow this `source`.
 | 
			
		||||
  # shellcheck disable=SC1090
 | 
			
		||||
  source "$HOMEBREW_LIBRARY/Homebrew/brew.sh"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user