fix(script): only cd into scripts directory if scripts are defined (#335)
This commit is contained in:
parent
bd1ff5d0bc
commit
c80bbcfb01
1 changed files with 11 additions and 7 deletions
|
|
@ -6,14 +6,18 @@ set -euo pipefail
|
||||||
get_yaml_array SCRIPTS '.scripts[]' "$1"
|
get_yaml_array SCRIPTS '.scripts[]' "$1"
|
||||||
get_yaml_array SNIPPETS '.snippets[]' "$1"
|
get_yaml_array SNIPPETS '.snippets[]' "$1"
|
||||||
|
|
||||||
cd "$CONFIG_DIRECTORY/scripts"
|
# shellcheck disable=SC2153
|
||||||
# Make every script executable
|
if [[ ${#SCRIPTS[@]} -gt 0 ]]; then
|
||||||
find "$PWD" -type f -exec chmod +x {} \;
|
cd "$CONFIG_DIRECTORY/scripts"
|
||||||
for SCRIPT in "${SCRIPTS[@]}"; do
|
# Make every script executable
|
||||||
echo "Running script $SCRIPT"
|
find "$PWD" -type f -exec chmod +x {} \;
|
||||||
"$PWD/$SCRIPT"
|
for SCRIPT in "${SCRIPTS[@]}"; do
|
||||||
done
|
echo "Running script $SCRIPT"
|
||||||
|
"$PWD/$SCRIPT"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
# shellcheck disable=SC2153
|
||||||
for SNIPPET in "${SNIPPETS[@]}"; do
|
for SNIPPET in "${SNIPPETS[@]}"; do
|
||||||
echo "Running snippet $SNIPPET"
|
echo "Running snippet $SNIPPET"
|
||||||
bash -c "$SNIPPET"
|
bash -c "$SNIPPET"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue