37 lines
779 B
Bash
Executable File
37 lines
779 B
Bash
Executable File
#!/bin/bash
|
|
# run_once_00-prereqs.sh
|
|
# Verifies that the tools required by later run_once scripts are installed.
|
|
|
|
set -euo pipefail
|
|
|
|
missing=()
|
|
|
|
need_cmd() {
|
|
command -v "$1" >/dev/null 2>&1 || missing+=("$1")
|
|
}
|
|
|
|
need_cmd sudo
|
|
need_cmd git
|
|
need_cmd curl
|
|
need_cmd age
|
|
need_cmd jq
|
|
need_cmd pacman || need_cmd apt-get
|
|
need_cmd chezmoi
|
|
|
|
if (( ${#missing[@]} > 0 )); then
|
|
cat <<EOF
|
|
>>> Missing prerequisites: ${missing[*]}
|
|
|
|
Install them for your distro, then re-run \`chezmoi apply\`:
|
|
|
|
Arch: sudo pacman -S --needed git curl sudo age jq
|
|
Ubuntu: sudo apt-get install -y git curl sudo age jq
|
|
|
|
\`age\` is also available at https://github.com/FiloSottile/age as a static
|
|
binary if your distro does not package it.
|
|
EOF
|
|
exit 1
|
|
fi
|
|
|
|
echo ">>> prereqs OK"
|