2023-01-09 21:55:47 -08:00
|
|
|
{{- if (ne .host.distro.family "windows") -}}
|
2022-11-26 19:27:29 -08:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2023-01-24 20:36:59 -08:00
|
|
|
{{ includeTemplate "universal/profile-before" }}
|
|
|
|
{{ includeTemplate "universal/logg-before" }}
|
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
|
|
|
|
2022-11-27 18:11:28 -08:00
|
|
|
### Ensure node is installed
|
|
|
|
if ! command -v node > /dev/null; then
|
|
|
|
if command -v brew; then
|
|
|
|
logg 'Installing `node` via Homebrew'
|
2023-02-01 09:00:46 -08:00
|
|
|
brew install node || NODE_EXIT_CODE=$?
|
|
|
|
if [ -n "$NODE_EXIT_CODE" ]; then
|
|
|
|
logg warn 'Calling `brew link --overwrite node` because the Node.js installation seems to be misconfigured'
|
|
|
|
brew link --overwrite node
|
|
|
|
fi
|
2022-11-27 18:11:28 -08:00
|
|
|
else
|
|
|
|
logg '`brew` is unavailable. Cannot use it to perform a system installation of node.'
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
logg '`node` is available'
|
|
|
|
fi
|
|
|
|
|
2023-02-01 08:58:31 -08:00
|
|
|
### Ensure Volta is installed
|
2022-11-27 18:11:28 -08:00
|
|
|
if ! command -v volta > /dev/null; then
|
|
|
|
if command -v brew > /dev/null; then
|
|
|
|
logg 'Installing `volta` via `brew`'
|
|
|
|
brew install volta
|
2023-02-01 08:58:31 -08:00
|
|
|
else
|
|
|
|
logg warn '`brew` needs to be available to install Volta'
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
if ! node --version > /dev/null; then
|
|
|
|
volta install node@latest
|
2022-11-27 18:11:28 -08:00
|
|
|
fi
|
2023-02-01 08:58:31 -08:00
|
|
|
fi
|
|
|
|
|
|
|
|
### Setup Volta
|
|
|
|
if command -v volta > /dev/null; then
|
2022-11-27 18:11:28 -08:00
|
|
|
if [ -z "$VOLTA_HOME" ]; then
|
|
|
|
volta setup
|
2023-02-01 08:58:31 -08:00
|
|
|
else
|
|
|
|
logg warn 'VOLTA_HOME is not defined'
|
2022-11-27 18:11:28 -08:00
|
|
|
fi
|
|
|
|
if [ -f "$HOME/.bashrc" ]; then
|
|
|
|
. "$HOME/.bashrc"
|
|
|
|
else
|
|
|
|
logg warn 'Could not find `~/.bashrc` to source the results of `volta setup` from'
|
|
|
|
fi
|
|
|
|
export PATH="$VOLTA_HOME/bin:$PATH"
|
|
|
|
logg 'Installing `node` via `volta`'
|
2022-12-24 02:46:21 -08:00
|
|
|
volta install node@latest
|
2022-11-27 18:11:28 -08:00
|
|
|
else
|
2023-02-01 08:58:31 -08:00
|
|
|
logg warn '`volta` needs to be installed'
|
2022-11-27 18:11:28 -08:00
|
|
|
fi
|
|
|
|
|
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
|
|
|
### Ensure zx is installed
|
2022-11-26 19:27:29 -08:00
|
|
|
if ! command -v zx > /dev/null; then
|
|
|
|
if command -v volta > /dev/null; then
|
|
|
|
logg 'Installing `zx` via `volta`'
|
|
|
|
volta install zx
|
|
|
|
else
|
2022-11-27 18:11:28 -08:00
|
|
|
logg '`volta` is missing'
|
2022-11-26 19:27:29 -08:00
|
|
|
fi
|
|
|
|
else
|
|
|
|
logg '`zx` is already installed'
|
|
|
|
fi
|
2023-01-24 20:36:59 -08:00
|
|
|
{{ end -}}
|