1
0
Files
dotfiles/scripts/00-check-dependencies.sh

58 lines
1.5 KiB
Bash

#!/bin/bash
# scripts/00-check-dependencies.sh - Check for required dependencies
set -euo pipefail
# Source utilities
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "$SCRIPT_DIR/utils.sh"
check_dependencies() {
log_info "Checking dependencies..."
local missing_deps=()
# Check for git
if ! command_exists git; then
missing_deps+=("git")
fi
# Check for stow
if ! command_exists stow; then
missing_deps+=("stow")
fi
if [ ${#missing_deps[@]} -gt 0 ]; then
log_error "Missing required dependencies: ${missing_deps[*]}"
echo ""
echo "Please install the missing dependencies:"
for dep in "${missing_deps[@]}"; do
case "$dep" in
"git")
echo " Git:"
echo " Ubuntu/Debian: sudo apt install git"
echo " macOS: brew install git"
echo " Or visit: https://git-scm.com/downloads"
;;
"stow")
echo " GNU Stow:"
echo " Ubuntu/Debian: sudo apt install stow"
echo " macOS: brew install stow"
echo " Or use the alias: install_stow"
;;
esac
echo ""
done
return 1
fi
log_success "All dependencies satisfied"
}
# Run if called directly
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
check_dependencies
fi