2024-10-18 01:46:03 -05:00
|
|
|
#!/bin/bash
|
2024-10-31 15:36:55 -05:00
|
|
|
# WARNING: Do not edit this file.
|
|
|
|
# It was generated by processing {{ yadm.source }}
|
|
|
|
|
2024-10-18 01:46:03 -05:00
|
|
|
set -eu
|
|
|
|
|
2024-10-31 16:26:48 -05:00
|
|
|
{% if yadm.os == "Darwin" %}
|
|
|
|
# install homebrew if it's missing
|
|
|
|
if ! command -v brew >/dev/null 2>&1; then
|
|
|
|
echo "Installing homebrew"
|
|
|
|
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -f "$HOME/.Brewfile" ]; then
|
|
|
|
echo "Updating homebrew bundle"
|
|
|
|
brew bundle --global
|
|
|
|
fi
|
|
|
|
{% endif %}
|
|
|
|
|
2024-10-18 01:46:03 -05:00
|
|
|
# Directory to look for bootstrap executables in
|
|
|
|
BOOTSTRAP_D="${BASH_SOURCE[0]}.d"
|
|
|
|
|
|
|
|
if [[ ! -d "$BOOTSTRAP_D" ]]; then
|
|
|
|
echo "Error: bootstrap directory '$BOOTSTRAP_D' not found" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2024-10-31 15:36:55 -05:00
|
|
|
# This will execute all executable files (excluding templates and editor
|
2024-10-31 15:37:49 -05:00
|
|
|
# backups) in the $BOOTSTRAP_D directory when run.
|
2024-10-31 15:36:55 -05:00
|
|
|
|
2024-10-18 01:46:03 -05:00
|
|
|
find -L "$BOOTSTRAP_D" -type f | sort | while IFS= read -r bootstrap; do
|
|
|
|
if [[ -x "$bootstrap" && ! "$bootstrap" =~ "##" && ! "$bootstrap" =~ "~$" ]]; then
|
|
|
|
if ! "$bootstrap"; then
|
|
|
|
echo "Error: bootstrap '$bootstrap' failed" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|
2024-10-30 17:04:25 -05:00
|
|
|
|
|
|
|
hash -r
|
2024-10-31 15:36:55 -05:00
|
|
|
|
|
|
|
{% if yadm.class == "Work" %}
|
2024-10-30 17:04:25 -05:00
|
|
|
YARN=$(brew --prefix yarn)/bin/yarn
|
|
|
|
|
|
|
|
if (command -v "$YARN" >/dev/null 2>&1); then
|
|
|
|
# Install yalc. Needed for local-publish
|
|
|
|
echo "Installing yalc..."
|
|
|
|
if ! $YARN global add yalc; then
|
|
|
|
echo "Failed to install yalc" >&2
|
|
|
|
else
|
|
|
|
echo "Successfully installed yalc"
|
|
|
|
fi
|
2024-10-31 15:36:55 -05:00
|
|
|
fi
|
|
|
|
{% endif %}
|