1
0
forked from finn/tinyboard

add check_deps function and dependency checks to all scripts

This commit is contained in:
Justin Oros
2026-04-16 13:05:45 -07:00
parent 08799f0f7f
commit 58f6445c72
3 changed files with 45 additions and 0 deletions

View File

@@ -13,6 +13,8 @@ touch "$SSH_DIR/known_hosts"
chmod 700 "$SSH_DIR"
chmod 600 "$SSH_DIR/known_hosts"
check_deps ssh ssh-keygen ssh-keyscan ssh-copy-id rclone
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
@@ -39,6 +41,19 @@ retry_or_abort() {
}
info() { echo -e "${GREEN}[+]${NC} $*"; }
check_deps() {
local missing=()
for cmd in "$@"; do
if ! command -v "$cmd" >/dev/null 2>&1; then
missing+=("$cmd")
fi
done
if [ ${#missing[@]} -gt 0 ]; then
die "Missing required dependencies: ${missing[*]}"
fi
}
warn() { echo -e "${YELLOW}[!]${NC} $*"; }
die() { echo -e "${RED}[ERROR]${NC} $*" >&2; exit 1; }
header() { echo -e "\n${CYAN}══════════════════════════════════════════${NC}"; echo -e "${CYAN} $*${NC}"; echo -e "${CYAN}══════════════════════════════════════════${NC}"; }