2023-07-07 01:29:58 -07:00
|
|
|
{{- if (ne .host.distro.family "windows") -}}
|
2023-06-26 23:21:36 -07:00
|
|
|
#!/usr/bin/env bash
|
2023-04-11 20:26:25 -07:00
|
|
|
# @file ASDF Plugins / Install
|
|
|
|
# @brief Configures ASDF plugins and ensures they are pre-installed.
|
|
|
|
# @description
|
|
|
|
# This script ensures ASDF is setup and then adds the plugins specified in the `~/.tool-versions` file. After that,
|
|
|
|
# it ensures the ASDF plugins are pre-installed.
|
Update dotfiles/.local/share/chezmoi/home/.chezmoiexternal.toml, dotfiles/.local/share/chezmoi/home/.chezmoiremove, dotfiles/.local/share/chezmoi/home/private_dot_config/shell/functions, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/darwin/run_onchange_before_10_install-darwin-packages.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/darwin/run_onchange_after_20-configure-darwin-shell.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/darwin/run_onchange_after_10_configure-darwin.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoidata.yaml, dotfiles/.local/share/chezmoi/home/private_dot_config/shell/exports, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/universal/run_onchange_after_15_install-asdf-packages.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/universal/run_onchange_after_20_install-helm-plugins.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/universal/run_onchange_after_10_install-aqua-packages.sh.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/universal/run_onchange_after_30_install-krew-plugins.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/universal/run_onchange_after_40_install-rust-toolchain.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/universal/run_onchange_after_99_bootstrap-z4h.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/archlinux/run_onchange_before_10_install-archlinux-packages.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/ubuntu/run_onchange_before_10_install-ubuntu-packages.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoitemplates/universal/essential-packages, dotfiles/.local/share/chezmoi/home/dot_local/bin/symlink_bat.tmpl, dotfiles/.local/share/chezmoi/home/dot_local/bin/symlink_fd.tmpl, dotfiles/.local/share/chezmoi/home/dot_local/bin/symlink_readlink.tmpl
2022-11-24 02:42:17 -08:00
|
|
|
|
|
|
|
# dot_tool-versions.tmpl hash: {{ include "dot_tool-versions.tmpl" | sha256sum }}
|
|
|
|
|
Update dotfiles/.local/share/chezmoi/home/.chezmoiscripts/_universal/run_onchange_before_8-install-zx.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/_universal/run_onchange_before_5-install-homebrew.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/darwin/run_onchange_before_10_install-darwin-dependencies.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoitemplates/universal/profile, dotfiles/.local/share/chezmoi/home/private_dot_config/shell/exports.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/_universal/run_onchange_after_99_bootstrap-z4h.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/_universal/run_onchange_after_80-bash-completions.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/_universal/run_onchange_after_60-cleanup.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/_universal/run_onchange_after_50-crontab.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/_universal/run_onchange_after_15_install-asdf-packages.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/_universal/run_onchange_after_10_install-aqua-packages.sh.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/archlinux/run_onchange_before_10_install-archlinux-dependencies.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/centos/run_onchange_before_10-install-centos-dependencies.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/darwin/run_onchange_after_10_configure-macos.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/darwin/run_onchange_after_20-ensure-zsh-macos.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/debian/run_onchange_before_10-install-debian-dependencies.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/fedora/run_onchange_before_10-install-fedora-dependencies.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/freebsd/run_onchange_before_11-install-freebsd-packages.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/opensuse/run_onchange_before_11-install-opensuse-software.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/ubuntu/run_onchange_before_10_install-ubuntu-dependencies.tmpl, dotfiles/.local/share/chezmoi/home/private_dot_config/tabby/config.yaml.tmpl
Deleted dotfiles/.local/share/chezmoi/home/.chezmoiscripts/_universal/run_onchange_before_1-logging-deps
2022-11-26 19:55:43 -08:00
|
|
|
{{- includeTemplate "universal/profile" }}
|
|
|
|
{{- includeTemplate "universal/logg" }}
|
Update dotfiles/.local/share/chezmoi/home/.chezmoiexternal.toml, dotfiles/.local/share/chezmoi/home/.chezmoiremove, dotfiles/.local/share/chezmoi/home/private_dot_config/shell/functions, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/darwin/run_onchange_before_10_install-darwin-packages.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/darwin/run_onchange_after_20-configure-darwin-shell.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/darwin/run_onchange_after_10_configure-darwin.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoidata.yaml, dotfiles/.local/share/chezmoi/home/private_dot_config/shell/exports, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/universal/run_onchange_after_15_install-asdf-packages.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/universal/run_onchange_after_20_install-helm-plugins.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/universal/run_onchange_after_10_install-aqua-packages.sh.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/universal/run_onchange_after_30_install-krew-plugins.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/universal/run_onchange_after_40_install-rust-toolchain.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/universal/run_onchange_after_99_bootstrap-z4h.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/archlinux/run_onchange_before_10_install-archlinux-packages.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/ubuntu/run_onchange_before_10_install-ubuntu-packages.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoitemplates/universal/essential-packages, dotfiles/.local/share/chezmoi/home/dot_local/bin/symlink_bat.tmpl, dotfiles/.local/share/chezmoi/home/dot_local/bin/symlink_fd.tmpl, dotfiles/.local/share/chezmoi/home/dot_local/bin/symlink_readlink.tmpl
2022-11-24 02:42:17 -08:00
|
|
|
|
2023-11-27 02:12:13 -08:00
|
|
|
### Re-source ~/.bashrc if necessary
|
|
|
|
if [ -z "$ASDF_DIR" ]; then
|
|
|
|
logg info 'ASDF_DIR is not defined so ~/.bashrc will be sourced' && source ~/.bashrc
|
|
|
|
fi
|
|
|
|
|
Update dotfiles/.local/share/chezmoi/home/.chezmoiexternal.toml, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/universal/run_onchange_after_80-bash-completions, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/universal/run_onchange_after_15_install-asdf-packages.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/ubuntu/run_onchange_before_10_install-ubuntu-dependencies.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/darwin/run_onchange_before_10_install-darwin-packages.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/darwin/run_onchange_after_20-ensure-zsh-macos.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/darwin/run_onchange_after_10_configure-macos.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/archlinux/run_onchange_before_10_install-archlinux-dependencies.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/universal/run_onchange_after_10_install-aqua-packages.sh.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/universal/run_onchange_after_99_bootstrap-z4h.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoitemplates/universal/logg
Deleted dotfiles/.local/share/chezmoi/home/run_onchange_after_bash-completions, dotfiles/.local/share/chezmoi/home/run_once_before_install-software.sh.tmpl
2022-11-24 06:18:43 -08:00
|
|
|
if [ -f "$ASDF_DIR/asdf.sh" ] && [ -f ~/.tool-versions ]; then
|
2022-12-04 22:45:53 -08:00
|
|
|
logg info 'Sourcing asdf.sh'
|
Update dotfiles/.local/share/chezmoi/home/.chezmoiexternal.toml, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/universal/run_onchange_after_80-bash-completions, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/universal/run_onchange_after_15_install-asdf-packages.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/ubuntu/run_onchange_before_10_install-ubuntu-dependencies.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/darwin/run_onchange_before_10_install-darwin-packages.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/darwin/run_onchange_after_20-ensure-zsh-macos.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/darwin/run_onchange_after_10_configure-macos.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/archlinux/run_onchange_before_10_install-archlinux-dependencies.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/universal/run_onchange_after_10_install-aqua-packages.sh.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/universal/run_onchange_after_99_bootstrap-z4h.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoitemplates/universal/logg
Deleted dotfiles/.local/share/chezmoi/home/run_onchange_after_bash-completions, dotfiles/.local/share/chezmoi/home/run_once_before_install-software.sh.tmpl
2022-11-24 06:18:43 -08:00
|
|
|
. ${ASDF_DIR}/asdf.sh
|
2022-12-04 22:45:53 -08:00
|
|
|
cat .tool-versions | while read TOOL; do
|
2023-11-04 18:46:18 -07:00
|
|
|
logg info 'Installing ASDF plugin '"$(echo "$TOOL" | sed 's/ .*//')"''
|
2022-12-04 22:45:53 -08:00
|
|
|
asdf plugin add "$(echo "$TOOL" | sed 's/ .*//')"
|
|
|
|
done
|
2023-01-24 08:55:50 -08:00
|
|
|
# Only proceed with installation if either DEBUG_MODE is enabled or ~/.cache/megabyte-labs/asdf-install is missing
|
2023-01-24 08:56:29 -08:00
|
|
|
# Added to save time between tests because PHP takes awhile to install
|
2023-01-24 08:55:50 -08:00
|
|
|
if [ "$DEBUG_MODE" == 'true' ] || [ ! -f "${XDG_CACHE_HOME:-$HOME/.cache}/megabyte-labs/asdf-install" ]; then
|
2023-11-04 18:46:18 -07:00
|
|
|
logg info 'Installing ASDF dependencies derived from ~/.tool-versions via asdf install'
|
2023-01-24 08:55:50 -08:00
|
|
|
asdf install || EXIT_CODE=$?
|
|
|
|
if [ -n "$EXIT_CODE" ]; then
|
2023-11-04 18:46:18 -07:00
|
|
|
logg error 'Error installing the ASDF plugins specified in ~/.tool-versions'
|
2023-01-24 08:55:50 -08:00
|
|
|
fi
|
|
|
|
mkdir -p "${XDG_CACHE_HOME:-$HOME/.cache}/megabyte-labs"
|
|
|
|
touch "${XDG_CACHE_HOME:-$HOME/.cache}/megabyte-labs/asdf-install"
|
2022-12-04 23:24:57 -08:00
|
|
|
fi
|
Update dotfiles/.local/share/chezmoi/home/.chezmoiexternal.toml, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/universal/run_onchange_after_80-bash-completions, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/universal/run_onchange_after_15_install-asdf-packages.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/ubuntu/run_onchange_before_10_install-ubuntu-dependencies.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/darwin/run_onchange_before_10_install-darwin-packages.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/darwin/run_onchange_after_20-ensure-zsh-macos.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/darwin/run_onchange_after_10_configure-macos.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/archlinux/run_onchange_before_10_install-archlinux-dependencies.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/universal/run_onchange_after_10_install-aqua-packages.sh.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/universal/run_onchange_after_99_bootstrap-z4h.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoitemplates/universal/logg
Deleted dotfiles/.local/share/chezmoi/home/run_onchange_after_bash-completions, dotfiles/.local/share/chezmoi/home/run_once_before_install-software.sh.tmpl
2022-11-24 06:18:43 -08:00
|
|
|
else
|
2023-11-04 18:46:18 -07:00
|
|
|
logg warn 'The $ASDF_DIR/asdf.sh or ~/.tool-versions file is not present'
|
Update dotfiles/.local/share/chezmoi/home/.chezmoiexternal.toml, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/universal/run_onchange_after_80-bash-completions, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/universal/run_onchange_after_15_install-asdf-packages.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/ubuntu/run_onchange_before_10_install-ubuntu-dependencies.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/darwin/run_onchange_before_10_install-darwin-packages.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/darwin/run_onchange_after_20-ensure-zsh-macos.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/darwin/run_onchange_after_10_configure-macos.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/archlinux/run_onchange_before_10_install-archlinux-dependencies.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/universal/run_onchange_after_10_install-aqua-packages.sh.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/universal/run_onchange_after_99_bootstrap-z4h.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoitemplates/universal/logg
Deleted dotfiles/.local/share/chezmoi/home/run_onchange_after_bash-completions, dotfiles/.local/share/chezmoi/home/run_once_before_install-software.sh.tmpl
2022-11-24 06:18:43 -08:00
|
|
|
fi
|
Update .local/share/chezmoi/home/.chezmoiscripts/windows/run_onchange_before_11-install-windows-packages.tmpl, .local/share/chezmoi/home/.chezmoiscripts/windows/run_onchange_before_10-install-windows-dependencies.tmpl, .local/share/chezmoi/home/.chezmoiscripts/universal/run_onchange_before_8-install-zx.tmpl, .local/share/chezmoi/home/.chezmoiscripts/universal/run_onchange_before_5-install-homebrew.tmpl, .local/share/chezmoi/home/.chezmoiscripts/universal/run_onchange_after_99_bootstrap-zsh-plugins.tmpl, .local/share/chezmoi/home/.chezmoiscripts/darwin/run_onchange_before_10_install-darwin-dependencies.tmpl, .local/share/chezmoi/home/.chezmoiscripts/darwin/run_onchange_after_set-wallpaper.tmpl, .local/share/chezmoi/home/.chezmoiscripts/darwin/run_onchange_after_20-ensure-zsh-macos.tmpl, .local/share/chezmoi/home/.chezmoiscripts/darwin/run_onchange_after_10_configure-macos.tmpl, .local/share/chezmoi/home/.chezmoiscripts/centos/run_onchange_before_10-install-centos-dependencies.tmpl, .local/share/chezmoi/home/.chezmoiscripts/archlinux/run_onchange_before_10_install-archlinux-dependencies.tmpl, .local/share/chezmoi/home/.chezmoiscripts/debian/run_onchange_before_10-install-debian-dependencies.tmpl, .local/share/chezmoi/home/.chezmoiscripts/fedora/run_onchange_before_10-install-fedora-dependencies.tmpl, .local/share/chezmoi/home/.chezmoiscripts/freebsd/run_onchange_before_11-install-freebsd-packages.tmpl, .local/share/chezmoi/home/.chezmoiscripts/opensuse/run_onchange_before_11-install-opensuse-software.tmpl, .local/share/chezmoi/home/.chezmoiscripts/ubuntu/run_onchange_before_10_install-ubuntu-dependencies.tmpl, .local/share/chezmoi/home/.chezmoiscripts/universal/run_onchange_after_15_install-asdf-packages.tmpl
2022-12-01 23:35:35 -08:00
|
|
|
|
|
|
|
{{ end -}}
|