forked from finn/tinyboard
add check_deps function and dependency checks to all scripts
This commit is contained in:
@@ -33,12 +33,27 @@ check_permissions() {
|
||||
}
|
||||
|
||||
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}"; }
|
||||
|
||||
[ "$(id -u)" -eq 0 ] || die "Run as root"
|
||||
|
||||
check_deps ssh ssh-keygen systemctl useradd groupadd crontab
|
||||
|
||||
header "TinyBoard Hub Setup"
|
||||
|
||||
read -rp "Hub username [armbian]: " HUB_USER
|
||||
|
||||
Reference in New Issue
Block a user