From 2bf11060cbc6606bbf1e08bb0d63932e742f2fc6 Mon Sep 17 00:00:00 2001 From: Correl Roush Date: Thu, 22 Feb 2018 10:43:19 -0500 Subject: [PATCH] Add option to install all recipes --- provision.sh | 34 +++++++++++++++++++++++++++++++++- recipes/{apt => _apt} | 0 recipes/{path => _path} | 0 recipes/bin | 2 +- recipes/brew | 2 +- 5 files changed, 35 insertions(+), 3 deletions(-) rename recipes/{apt => _apt} (100%) rename recipes/{path => _path} (100%) diff --git a/provision.sh b/provision.sh index 080dd54..06dd984 100755 --- a/provision.sh +++ b/provision.sh @@ -1,6 +1,38 @@ #!/bin/bash set +e +RECIPE_PATH=${HOME}/dotfiles/recipes +RECIPES=$(ls $RECIPE_PATH|grep -v '^_') +INSTALL=(base) + +POSITIONAL=() +while [[ $# -gt 0 ]]; do + case $1 in + -D|--debug) + DEBUG=1 + shift + ;; + -l|--list) + echo Available recipes: + for recipe in $RECIPES; do + echo " $recipe" + done + exit + ;; + -A|--all) + INSTALL=($RECIPES) + shift + ;; + *) + INSTALL+=("$1") + shift + esac +done + +INSTALL=($(for recipe in "${INSTALL[@]}"; do + echo $recipe + done |sort | uniq)) + function _run { local msg=$1 shift @@ -21,7 +53,7 @@ function _recipe { USER=${USER:-$(whoami)} _PLATFORM=$(uname -s | awk '{print tolower($1)}') -for recipe in base $@; do +for recipe in "${INSTALL[@]}"; do _recipe $recipe done diff --git a/recipes/apt b/recipes/_apt similarity index 100% rename from recipes/apt rename to recipes/_apt diff --git a/recipes/path b/recipes/_path similarity index 100% rename from recipes/path rename to recipes/_path diff --git a/recipes/bin b/recipes/bin index 2d1f327..bcf03e9 100644 --- a/recipes/bin +++ b/recipes/bin @@ -1,5 +1,5 @@ #!/bin/bash set +e -_recipe path +_recipe _path _run "Add dotfiles/bin to PATH" _path_high ${HOME}/dotfiles/bin diff --git a/recipes/brew b/recipes/brew index 66d4eae..a3d1836 100644 --- a/recipes/brew +++ b/recipes/brew @@ -7,7 +7,7 @@ function __install_brew { /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" ;; *) - _recipe apt + _recipe _apt for pkg in build-essential curl file git python-setuptools; do _apt $pkg