particle-os-tools/src/composefs/scriptlets/01-dependencies.sh
robojerk 74c7bede5f Initial commit: Particle-OS tools repository
- Complete Particle-OS rebranding from uBlue-OS
- Professional installation system with standardized paths
- Self-initialization system with --init and --reset commands
- Enhanced error messages and dependency checking
- Comprehensive testing infrastructure
- All source scriptlets updated with runtime improvements
- Clean codebase with redundant files moved to archive
- Complete documentation suite
2025-07-11 21:14:33 -07:00

55 lines
No EOL
1.8 KiB
Bash

# Check dependencies for Ubuntu uBlue ComposeFS Alternative
check_dependencies() {
local deps=(
"mount" # Filesystem mounting
"umount" # Filesystem unmounting
"findmnt" # Mount point detection
"losetup" # Loop device management
"sha256sum" # Hash generation
"jq" # JSON processing
"tar" # Archive operations
"mksquashfs" # SquashFS creation
"unsquashfs" # SquashFS extraction
"nproc" # CPU core detection
"du" # Disk usage
"stat" # File status
"modprobe" # Kernel module loading
"mountpoint" # Mount point checking
)
local missing=()
for dep in "${deps[@]}"; do
if ! command -v "$dep" &> /dev/null; then
missing+=("$dep")
fi
done
if [[ ${#missing[@]} -gt 0 ]]; then
log_error "Missing required dependencies: ${missing[*]}" "composefs-alternative"
log_error "Please install the missing packages (squashfs-tools, jq, coreutils, util-linux)" "composefs-alternative"
exit 1
fi
log_info "All dependencies are available" "composefs-alternative"
}
# Check kernel modules
check_kernel_modules() {
local modules=("squashfs" "overlay")
local missing_modules=()
for module in "${modules[@]}"; do
if ! modprobe -n "$module" >/dev/null 2>&1; then
missing_modules+=("$module")
fi
done
if [[ ${#missing_modules[@]} -gt 0 ]]; then
log_warning "Missing kernel modules: ${missing_modules[*]}" "composefs-alternative"
log_warning "Some features may not work correctly" "composefs-alternative"
return 1
fi
log_info "All required kernel modules are available" "composefs-alternative"
return 0
}