#!/bin/bash
# Info: Radicle preparation script
# Author: Provisioning System
# Release: 1.0

echo "Preparing Radicle installation..."

# Load environment variables
[ -r "env-radicle" ] && . ./env-radicle

# Check if required tools are available
command -v curl >/dev/null 2>&1 || { echo "curl is required but not installed." >&2; exit 1; }
command -v tar >/dev/null 2>&1 || { echo "tar is required but not installed." >&2; exit 1; }
command -v systemctl >/dev/null 2>&1 || { echo "systemctl is required but not installed." >&2; exit 1; }

# Validate configuration
if [ -z "$RADICLE_VERSION" ]; then
    echo "RADICLE_VERSION must be set" >&2
    exit 1
fi

echo "Preparation completed successfully."