34 lines
637 B
Bash
Executable File
34 lines
637 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 chezmoi
|
|
|
|
if (( ${#missing[@]} > 0 )); then
|
|
RED=$'\e[31m'
|
|
RESET=$'\e[0m'
|
|
|
|
printf ">>> Missing prerequisites:\n"
|
|
for cmd in "${missing[@]}"; do
|
|
printf "\t%s%s%s\n" "$RED" "$cmd" "$RESET"
|
|
done
|
|
printf "\n"
|
|
echo "Install them, then re-run \`chezmoi apply\`"
|
|
exit 1
|
|
fi
|
|
|
|
echo ">>> prereqs OK"
|