Run script on macOS only
This commit is contained in:
parent
b883ffa0a6
commit
66f00729a6
1 changed files with 19 additions and 18 deletions
|
@ -1,4 +1,3 @@
|
||||||
{{- if (ne .host.distro.family "darwin") -}}
|
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# @file macOS Common Dependencies
|
# @file macOS Common Dependencies
|
||||||
# @brief Ensures common system dependencies are installed via Homebrew on macOS
|
# @brief Ensures common system dependencies are installed via Homebrew on macOS
|
||||||
|
@ -14,25 +13,27 @@
|
||||||
export VOLTA_HOME="${XDG_DATA_HOME:-$HOME/.local/share}/volta"
|
export VOLTA_HOME="${XDG_DATA_HOME:-$HOME/.local/share}/volta"
|
||||||
export PATH="$VOLTA_HOME/bin:$PATH"
|
export PATH="$VOLTA_HOME/bin:$PATH"
|
||||||
|
|
||||||
if command -v brew > /dev/null; then
|
### Ensure system is macOS
|
||||||
logg 'Installing base dependencies for macOS using `brew bundle`'
|
if [ -d /Applications ] && [ -d /System ]; then
|
||||||
logg info 'Dependencies: age asdf jq node glow go go-task/tap/go-task gnupg gum m-cli progress volta yq m-cli yq zx'
|
if command -v brew > /dev/null; then
|
||||||
logg info 'GNU compatibility dependencies: coreutils findutils'
|
logg 'Installing base dependencies for macOS using `brew bundle`'
|
||||||
|
logg info 'Dependencies: age asdf jq node glow go go-task/tap/go-task gnupg gum m-cli progress volta yq m-cli yq zx'
|
||||||
|
logg info 'GNU compatibility dependencies: coreutils findutils'
|
||||||
|
|
||||||
brew bundle --verbose --no-lock --file=/dev/stdin <<EOF
|
brew bundle --verbose --no-lock --file=/dev/stdin <<EOF
|
||||||
{{ includeTemplate "darwin/Brewfile" . -}}
|
{{ includeTemplate "darwin/Brewfile" . -}}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
### Ensure Python version is 3.11 or higher
|
### Ensure Python version is 3.11 or higher
|
||||||
PYTHON_VERSION="$(python3 --version | sed 's/Python //')"
|
PYTHON_VERSION="$(python3 --version | sed 's/Python //')"
|
||||||
MIN_PYTHON_VERSION="3.11.0"
|
MIN_PYTHON_VERSION="3.11.0"
|
||||||
if [ "$(printf '%s\n' "$MIN_PYTHON_VERSION" "$PYTHON_VERSION" | sort -V | head -n1)" = "$MIN_PYTHON_VERSION" ]; then
|
if [ "$(printf '%s\n' "$MIN_PYTHON_VERSION" "$PYTHON_VERSION" | sort -V | head -n1)" = "$MIN_PYTHON_VERSION" ]; then
|
||||||
logg info "Minimum Python version satisfied (minimum: $MIN_PYTHON_VERSION, current: $PYTHON_VERSION)"
|
logg info "Minimum Python version satisfied (minimum: $MIN_PYTHON_VERSION, current: $PYTHON_VERSION)"
|
||||||
|
else
|
||||||
|
logg info 'Updating Python 3 version with `brew link --overwrite python@3.11`'
|
||||||
|
brew link --overwrite python@3.11
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
logg info 'Updating Python 3 version with `brew link --overwrite python@3.11`'
|
logg error '`brew` was not found in the PATH'
|
||||||
brew link --overwrite python@3.11
|
|
||||||
fi
|
fi
|
||||||
else
|
|
||||||
logg error '`brew` was not found in the PATH'
|
|
||||||
fi
|
fi
|
||||||
{{ end -}}
|
|
||||||
|
|
Loading…
Reference in a new issue