✨ Actually install Homebrew whoops
This commit is contained in:
parent
a00571bcd6
commit
9b1196d7f7
2 changed files with 105 additions and 0 deletions
|
@ -0,0 +1,80 @@
|
|||
#!/usr/bin/env bash
|
||||
# vim:set ft=bash:
|
||||
|
||||
cd "$(dirname "${BASH_SOURCE[0]}")" \
|
||||
&& . "../script/utils.sh"
|
||||
|
||||
################################################################################
|
||||
# Install #
|
||||
################################################################################
|
||||
|
||||
install()
|
||||
{
|
||||
if test ! $(which brew); then
|
||||
NONINTERACTIVE=1 \
|
||||
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" \
|
||||
&> /dev/null
|
||||
|
||||
print_result $? "Install"
|
||||
fi
|
||||
}
|
||||
|
||||
################################################################################
|
||||
# Add to Path #
|
||||
################################################################################
|
||||
|
||||
add_to_path()
|
||||
{
|
||||
if command -v brew &> /dev/null; then
|
||||
return
|
||||
fi
|
||||
|
||||
HARDWARE="$(uname -m)"
|
||||
prefix=""
|
||||
|
||||
if [[ "$(uname)" == "Linux" ]]; then
|
||||
prefix="/home/linuxbrew/.linuxbrew"
|
||||
elif [[ "$HARDWARE" == "arm64" ]]; then
|
||||
prefix="/opt/homebrew"
|
||||
elif [[ "$HARDWARE" == "x86_64" ]]; then
|
||||
prefix="/usr/local"
|
||||
else
|
||||
print_error "Homebrew is only supported on macOS Intel/ARM or Linux!"
|
||||
fi
|
||||
|
||||
PATH="$prefix/bin:$PATH"
|
||||
|
||||
command -v brew &> /dev/null
|
||||
print_result $? "Add to PATH"
|
||||
}
|
||||
|
||||
################################################################################
|
||||
# Update & Upgrade #
|
||||
################################################################################
|
||||
|
||||
update()
|
||||
{
|
||||
execute "brew update" "Update"
|
||||
}
|
||||
|
||||
upgrade()
|
||||
{
|
||||
execute "brew upgrade" "Upgrade"
|
||||
}
|
||||
|
||||
################################################################################
|
||||
# Main #
|
||||
################################################################################
|
||||
|
||||
main()
|
||||
{
|
||||
print_title "Homebrew"
|
||||
|
||||
install
|
||||
add_to_path
|
||||
|
||||
update
|
||||
upgrade
|
||||
}
|
||||
|
||||
main
|
|
@ -122,6 +122,28 @@ download_dotfiles()
|
|||
|| return 1
|
||||
}
|
||||
|
||||
################################################################################
|
||||
# Xcode #
|
||||
################################################################################
|
||||
|
||||
are_xcode_cli_tools_installed()
|
||||
{
|
||||
xcode-select --print-path &> /dev/null
|
||||
}
|
||||
|
||||
install_xcode_cli_toools()
|
||||
{
|
||||
print_title "Xcode"
|
||||
|
||||
if [[ "$(uname)" == "Darwin" ]]; then
|
||||
xcode-select --install &> /dev/null
|
||||
|
||||
execute \
|
||||
"until are_xcode_cli_tools_installed; do sleep 5; done" \
|
||||
"Install Xcode Command Line Tools"
|
||||
fi
|
||||
}
|
||||
|
||||
################################################################################
|
||||
# Setup Gitconfig #
|
||||
################################################################################
|
||||
|
@ -317,10 +339,13 @@ main()
|
|||
|
||||
$dotfiles_dir/os/pref.sh
|
||||
|
||||
install_xcode_cli_toools
|
||||
|
||||
$dotfiles_dir/homebrew/brew.sh
|
||||
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
print_title "Installers"
|
||||
find . -name install.sh | while read installer ; do sh -c "${installer}" ; done
|
||||
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
|
Loading…
Reference in a new issue