dotfiles/.config/yadm/bootstrap##template

88 lines
1.9 KiB
Plaintext
Raw Normal View History

2024-10-18 01:46:03 -05:00
#!/bin/bash
2024-10-31 15:36:55 -05:00
2024-10-18 01:46:03 -05:00
set -eu
2024-12-04 12:17:38 -06:00
echo "Setting the yadm repo origin URL to SSH..."
yadm remote set-url origin "git@github.com:fwonkas/dotfiles.git"
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
2024-12-04 11:44:03 -06:00
echo "Installing homebrew"
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
2024-10-31 16:26:48 -05:00
fi
if [ -f "$HOME/.Brewfile" ]; then
2024-12-04 11:44:03 -06:00
echo "Updating homebrew bundle"
brew bundle --global
2024-10-31 16:26:48 -05:00
fi
{% endif %}
2024-12-02 20:28:36 +00:00
{% if yadm.os == "Linux" %}
echo "installing git"
sudo apt-get install -y git
packages=()
packages+=(
"bat"
"boxes"
"catimg"
"duf"
"editorconfig"
"fdfind"
"figlet"
"fzf"
"gh"
#"git-delta" # this is a special case that will be handled seperately
"gnupg"
"gron"
#"gum" # this is a special case that will be handled seperately
"highlight"
# "hr" # may not be available
"htop"
"jq"
"lolcat"
"lsd"
"neovim"
#"nodejs" Using alternate install method
#"nvm" # will use install script
#"ots" # not available for debian?
"peco"
#"pngpaste" # no deb package
"pwgen"
"shellcheck"
#"slackcat" # no deb package
#"slackdump" # no deb package
#"tag" # no deb package
"thefuck"
"tldr"
"tmux"
"vim"
#"watch" # standard in debian
"wget"
"yadm"
"zoxide"
"zsh-autosuggestions"
2024-12-04 11:44:03 -06:00
# "zsh-syntax-highlighting"
2024-12-02 20:28:36 +00:00
)
{% 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
2024-12-04 11:44:03 -06:00
echo "Error: bootstrap directory '$BOOTSTRAP_D' not found" >&2
exit 1
2024-10-18 01:46:03 -05:00
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
2024-12-04 11:44:03 -06:00
if [[ -x "$bootstrap" && ! "$bootstrap" =~ "##" && ! "$bootstrap" =~ "~$" ]]; then
if ! "$bootstrap"; then
echo "Error: bootstrap '$bootstrap' failed" >&2
exit 1
fi
fi
2024-10-18 01:46:03 -05:00
done