Skip to content

Commit

Permalink
install: fix the check for rosetta on darwin-arm64
Browse files Browse the repository at this point in the history
  • Loading branch information
romkatv committed Nov 26, 2020
1 parent 4211e33 commit e2276e7
Showing 1 changed file with 14 additions and 29 deletions.
43 changes: 14 additions & 29 deletions install
Original file line number Diff line number Diff line change
Expand Up @@ -7,38 +7,23 @@ _gitstatus_install_daemon_found() {
shift

case "$daemon" in
*-darwin-x86_64);;
*)
[ $# = 0 ] || "$@" "$daemon" "$version" "$installed"
return
;;
esac

local cpu
if [ "$uname_s" != darwin ] || [ "$uname_m" != arm64 ] ||
[ -e /Library/Apple/System/Library/LaunchDaemons/com.apple.oahd.plist ] ||
[ ! -x /usr/sbin/softwareupdate ] ||
! cpu="$(/usr/sbin/sysctl -n machdep.cpu.brand_string)"; then
[ $# = 0 ] || "$@" "$daemon" "$version" "$installed"
return
fi

case "$cpu" in
*Intel*);;
*)
[ $# = 0 ] || "$@" "$daemon" "$version" "$installed"
return
*-darwin-x86_64)
if [ "$uname_m" = arm64 ] &&
[ ! -e /Library/Apple/System/Library/LaunchDaemons/com.apple.oahd.plist ] &&
[ -x /usr/sbin/softwareupdate ]; then
>&"$e" printf 'Please run the following command to install Rosetta:\n'
>&"$e" printf '\n'
>&"$e" printf ' \033[32m/usr/sbin/softwareupdate\033[0m --install-rosetta\n'
>&"$e" printf '\n'
>&"$e" printf 'See for details: \033[4mhttps://support.apple.com/en-us/HT211861\033[0m\n'
>&"$e" printf '\n'
>&"$e" printf 'Once Rosetta is installed, restart your shell.\n'
return 1
fi
;;
esac

>&"$e" printf 'Please run the following command to install Rosetta:\n'
>&"$e" printf '\n'
>&"$e" printf ' \033[32m/usr/sbin/softwareupdate\033[0m --install-rosetta\n'
>&"$e" printf '\n'
>&"$e" printf 'See for details: \033[4mhttps://support.apple.com/en-us/HT211861\033[0m\n'
>&"$e" printf '\n'
>&"$e" printf 'Once Rosetta is installed, restart your shell.\n'
return 1
[ $# = 0 ] || "$@" "$daemon" "$version" "$installed"
}

_gitstatus_install_main() {
Expand Down

0 comments on commit e2276e7

Please sign in to comment.