diff --git a/bootstrap.sh b/bootstrap.sh index dca6e40c..c2e97a8c 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -3,6 +3,25 @@ # This script is intended to be run with curl, i.e. # # bash <(curl -s https://raw.githubusercontent.com/eliasnorrby/dotfiles/develop/bootstrap.sh) +# +# +# # Configuration +# There are a number of environment variables you can set prior to +# running this script in order to customize its behaviour. +# +# DOTFILES_VERSION: (master|develop|...) +# Select which branch to download a snapshot of +# DO_MAS: (true) +# Enable to install Mac App Store apps. Make sure you log into the +# App Store app with your Apple ID first. +# ASK_PASS: (true) +# Add the -K (--ask-become-pass) flag to ansible-playbook. This may +# or may not be needed to properly install homebrew. +# +# # Extended example: +# +# DO_MAS=true ASK_PASS=true bash <(curl -s https://raw.githubusercontent.com/eliasnorrby/dotfiles/develop/bootstrap.sh) +# SECONDS=0 @@ -10,6 +29,18 @@ if [ -z "$DOTFILES_VERSION" ] ; then DOTFILES_VERSION=${1:-master} fi +ANSIBLE_TAGS='all,setup_homebrew,do_homebrew,do_packages,do_defaults,do_post_provision' +ANSIBLE_FLAGS='' + +if [ "$DO_MAS" == true ]; then + ANSIBLE_TAGS="${ANSIBLE_TAGS},do_mas" +fi + +if [ "$ASK_PASS" == true ]; then + # Ask for sudo password (possibly required for homebrew role) + ANSIBLE_FLAGS="-K" +fi + set -exo pipefail export DOTFILES_REPO="https://github.com/eliasnorrby/dotfiles" @@ -38,7 +69,7 @@ cd _provision ansible-galaxy install -r requirements.yml _msg "Running the playbook..." -ansible-playbook playbook.yml --tags 'all,setup_homebrew,do_homebrew,do_packages,do_defaults,do_post_provision' -v +ansible-playbook playbook.yml --tags "$ANSIBLE_TAGS" "$ANSIBLE_FLAGS" -v _msg "Run post-install script..." cd $DOTFILES