mirror of
https://github.com/correl/dotfiles.git
synced 2024-11-22 03:00:05 +00:00
[provisioning] Support running recipes from arbitrary locations
This commit is contained in:
parent
88cf84c5c4
commit
79d0fc0447
1 changed files with 15 additions and 2 deletions
17
provision.sh
17
provision.sh
|
@ -52,11 +52,24 @@ function _run {
|
||||||
}
|
}
|
||||||
|
|
||||||
function _recipe {
|
function _recipe {
|
||||||
|
local recipe
|
||||||
|
local path
|
||||||
|
if [ -f "$1" ]; then
|
||||||
|
recipe="$(basename $1)"
|
||||||
|
path=$(dirname "$1")
|
||||||
|
elif [ -f "${RECIPE_PATH}/$1" ]; then
|
||||||
|
recipe="$1"
|
||||||
|
path="${RECIPE_PATH}"
|
||||||
|
else
|
||||||
|
echo "Could not load recipe '$1'" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
STACK+=("$1")
|
STACK+=("$1")
|
||||||
|
pushd "$path"
|
||||||
echo "-- Recipe '${STACK[@]}' --"
|
echo "-- Recipe '${STACK[@]}' --"
|
||||||
source ${HOME}/dotfiles/recipes/$1
|
source "./${recipe}"
|
||||||
unset STACK[${#STACK[@]}-1]
|
|
||||||
echo "-- Recipe '${STACK[@]}' --"
|
echo "-- Recipe '${STACK[@]}' --"
|
||||||
|
popd
|
||||||
}
|
}
|
||||||
|
|
||||||
USER=${USER:-$(whoami)}
|
USER=${USER:-$(whoami)}
|
||||||
|
|
Loading…
Reference in a new issue