cmd/update.sh: fix style inconsistencies
This commit is contained in:
parent
79c49b3638
commit
1e9328c6e1
@ -284,19 +284,19 @@ homebrew-update() {
|
|||||||
for option in "$@"
|
for option in "$@"
|
||||||
do
|
do
|
||||||
case "$option" in
|
case "$option" in
|
||||||
-\?|-h|--help|--usage) brew help update; exit $? ;;
|
-\?|-h|--help|--usage) brew help update; exit $? ;;
|
||||||
--verbose) HOMEBREW_VERBOSE=1 ;;
|
--verbose) HOMEBREW_VERBOSE=1 ;;
|
||||||
--debug) HOMEBREW_DEBUG=1;;
|
--debug) HOMEBREW_DEBUG=1 ;;
|
||||||
--merge) HOMEBREW_MERGE=1 ;;
|
--merge) HOMEBREW_MERGE=1 ;;
|
||||||
--simulate-from-current-branch) HOMEBREW_SIMULATE_FROM_CURRENT_BRANCH=1 ;;
|
--simulate-from-current-branch) HOMEBREW_SIMULATE_FROM_CURRENT_BRANCH=1 ;;
|
||||||
--preinstall) export HOMEBREW_UPDATE_PREINSTALL=1 ;;
|
--preinstall) export HOMEBREW_UPDATE_PREINSTALL=1 ;;
|
||||||
--*) ;;
|
--*) ;;
|
||||||
-*)
|
-*)
|
||||||
[[ "$option" = *v* ]] && HOMEBREW_VERBOSE=1;
|
[[ "$option" = *v* ]] && HOMEBREW_VERBOSE=1
|
||||||
[[ "$option" = *d* ]] && HOMEBREW_DEBUG=1;
|
[[ "$option" = *d* ]] && HOMEBREW_DEBUG=1
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
odie <<-EOS
|
odie <<EOS
|
||||||
This command updates brew itself, and does not take formula names.
|
This command updates brew itself, and does not take formula names.
|
||||||
Use 'brew upgrade <formula>'.
|
Use 'brew upgrade <formula>'.
|
||||||
EOS
|
EOS
|
||||||
@ -312,7 +312,7 @@ EOS
|
|||||||
# check permissions
|
# check permissions
|
||||||
if [[ "$HOMEBREW_PREFIX" = "/usr/local" && ! -w /usr/local ]]
|
if [[ "$HOMEBREW_PREFIX" = "/usr/local" && ! -w /usr/local ]]
|
||||||
then
|
then
|
||||||
odie <<-EOS
|
odie <<EOS
|
||||||
/usr/local is not writable. You should change the ownership
|
/usr/local is not writable. You should change the ownership
|
||||||
and permissions of /usr/local back to your user account:
|
and permissions of /usr/local back to your user account:
|
||||||
sudo chown -R \$(whoami) /usr/local
|
sudo chown -R \$(whoami) /usr/local
|
||||||
@ -321,7 +321,7 @@ EOS
|
|||||||
|
|
||||||
if [[ ! -w "$HOMEBREW_REPOSITORY" ]]
|
if [[ ! -w "$HOMEBREW_REPOSITORY" ]]
|
||||||
then
|
then
|
||||||
odie <<-EOS
|
odie <<EOS
|
||||||
$HOMEBREW_REPOSITORY is not writable. You should change the
|
$HOMEBREW_REPOSITORY is not writable. You should change the
|
||||||
ownership and permissions of $HOMEBREW_REPOSITORY back to your
|
ownership and permissions of $HOMEBREW_REPOSITORY back to your
|
||||||
user account:
|
user account:
|
||||||
@ -387,7 +387,7 @@ EOS
|
|||||||
if [[ -n "$HOMEBREW_UPDATE_PREINSTALL" ]]
|
if [[ -n "$HOMEBREW_UPDATE_PREINSTALL" ]]
|
||||||
then
|
then
|
||||||
# Skip taps without formulae.
|
# Skip taps without formulae.
|
||||||
FORMULAE="$(find "$DIR" -maxdepth 1 \( -name '*.rb' -or -name 'Formula' -or -name 'HomebrewFormula' \) -print -quit)"
|
FORMULAE="$(find "$DIR" -maxdepth 1 \( -name "*.rb" -or -name Formula -or -name HomebrewFormula \) -print -quit)"
|
||||||
[[ -z "$FORMULAE" ]] && exit
|
[[ -z "$FORMULAE" ]] && exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -399,7 +399,7 @@ EOS
|
|||||||
UPSTREAM_BRANCH_LOCAL_SHA="$(git rev-parse "refs/remotes/origin/$UPSTREAM_BRANCH")"
|
UPSTREAM_BRANCH_LOCAL_SHA="$(git rev-parse "refs/remotes/origin/$UPSTREAM_BRANCH")"
|
||||||
# Only try to `git fetch` when the upstream branch is at a different SHA
|
# Only try to `git fetch` when the upstream branch is at a different SHA
|
||||||
# (so the API does not return 304: unmodified).
|
# (so the API does not return 304: unmodified).
|
||||||
UPSTREAM_SHA_HTTP_CODE="$("$HOMEBREW_CURL" --silent '--max-time' 3 \
|
UPSTREAM_SHA_HTTP_CODE="$("$HOMEBREW_CURL" --silent --max-time 3 \
|
||||||
--output /dev/null --write-out "%{http_code}" \
|
--output /dev/null --write-out "%{http_code}" \
|
||||||
--user-agent "$HOMEBREW_USER_AGENT_CURL" \
|
--user-agent "$HOMEBREW_USER_AGENT_CURL" \
|
||||||
--header "Accept: application/vnd.github.v3.sha" \
|
--header "Accept: application/vnd.github.v3.sha" \
|
||||||
@ -425,7 +425,7 @@ EOS
|
|||||||
if ! git fetch --force "${QUIET_ARGS[@]}" origin \
|
if ! git fetch --force "${QUIET_ARGS[@]}" origin \
|
||||||
"refs/heads/$UPSTREAM_BRANCH:refs/remotes/origin/$UPSTREAM_BRANCH"
|
"refs/heads/$UPSTREAM_BRANCH:refs/remotes/origin/$UPSTREAM_BRANCH"
|
||||||
then
|
then
|
||||||
echo "Fetching $DIR failed!" >> "$update_failed_file"
|
echo "Fetching $DIR failed!" >>"$update_failed_file"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
) &
|
) &
|
||||||
@ -436,7 +436,7 @@ EOS
|
|||||||
|
|
||||||
if [[ -f "$update_failed_file" ]]
|
if [[ -f "$update_failed_file" ]]
|
||||||
then
|
then
|
||||||
onoe < "$update_failed_file"
|
onoe <"$update_failed_file"
|
||||||
rm -f "$update_failed_file"
|
rm -f "$update_failed_file"
|
||||||
export HOMEBREW_UPDATE_FAILED="1"
|
export HOMEBREW_UPDATE_FAILED="1"
|
||||||
fi
|
fi
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user