Update dotfiles/.local/share/chezmoi/home/.chezmoiscripts/_universal/run_onchange_after_60-cleanup.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/_universal/run_onchange_before_5-install-homebrew, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/_universal/run_onchange_before_8-install-zx, dotfiles/.local/share/chezmoi/home/dot_local/bin/executable_install-software
This commit is contained in:
parent
34853c1fc0
commit
a3abf7190f
4 changed files with 61 additions and 8 deletions
|
@ -1,5 +1,4 @@
|
|||
#!/usr/bin/env bash
|
||||
{{ if or (eq .chezmoi.os "linux") (eq .chezmoi.os "darwin") }}
|
||||
|
||||
source "$HOME/.config/shell/exports"
|
||||
|
||||
|
@ -17,9 +16,3 @@ else
|
|||
logg warn 'Unable to fix `~/.local/Taskfile.yml` because gsed GNU compatibility tool is not installed.'
|
||||
fi
|
||||
{{- end }}
|
||||
|
||||
{{ else if chezmoi.os "windows" }}
|
||||
|
||||
Remove-Item -LiteralPath "$env:HOMEPATH\Library" -Force -Recurse
|
||||
|
||||
{{- end }}
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
ensurePackageManagerHomebrew() {
|
||||
if ! command -v brew > /dev/null; then
|
||||
if command -v sudo > /dev/null && sudo -n true; then
|
||||
echo | bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
||||
else
|
||||
logg info 'Homebrew is not installed. Password may be required.'
|
||||
bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" || BREW_EXIT_CODE="$?"
|
||||
if [ -n "$BREW_EXIT_CODE" ]; then
|
||||
if command -v brew > /dev/null; then
|
||||
logg warn 'Homebrew was installed but part of the installation failed. Attempting to fix..'
|
||||
BREW_DIRS="share/man share/doc share/zsh/site-functions etc/bash_completion.d"
|
||||
for BREW_DIR in $BREW_DIRS; do
|
||||
if [ -d "$(brew --prefix)/$BREW_DIR" ]; then
|
||||
sudo chown -R "$(whoami)" "$(brew --prefix)/$BREW_DIR"
|
||||
fi
|
||||
done
|
||||
brew update --force --quiet
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
ensurePackageManagerHomebrew
|
|
@ -0,0 +1,34 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
if ! command -v zx > /dev/null; then
|
||||
if command -v volta > /dev/null; then
|
||||
logg 'Installing `zx` via `volta`'
|
||||
volta install zx
|
||||
else
|
||||
if command -v brew > /dev/null; then
|
||||
if ! command -v volta > /dev/null; then
|
||||
logg 'Installing `volta` via `brew`'
|
||||
brew install volta
|
||||
fi
|
||||
if [ -z "$VOLTA_HOME" ]; then
|
||||
volta setup
|
||||
if [ -f "$HOME/.bashrc" ]; then
|
||||
. "$HOME/.bashrc"
|
||||
elif [ -f "$HOME/.zshrc" ]; then
|
||||
. "$HOME/.zshrc"
|
||||
else
|
||||
logg warn 'Could not find `.bashrc` or `.zshrc` to source the results of `volta setup` from'
|
||||
fi
|
||||
fi
|
||||
export PATH="$VOLTA_HOME/bin:$PATH"
|
||||
logg 'Installing `node` via `volta`'
|
||||
volta install node
|
||||
logg 'Installing `zx` via `volta`'
|
||||
volta install zx
|
||||
else
|
||||
logg '`brew` is unavailable to use to install `node` and `zx`'
|
||||
fi
|
||||
fi
|
||||
else
|
||||
logg '`zx` is already installed'
|
||||
fi
|
|
@ -1926,7 +1926,7 @@ async function ensurePackageManager(packageManager) {
|
|||
### Ensures Homebrew is installed
|
||||
ensurePackageManagerHomebrew() {
|
||||
if ! command -v brew > /dev/null; then
|
||||
if type sudo &> /dev/null && sudo -n true; then
|
||||
if command -v sudo > /dev/null && sudo -n true; then
|
||||
echo | bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
||||
else
|
||||
logg info 'Homebrew is not installed. Password may be required.'
|
||||
|
|
Loading…
Reference in a new issue