2798e29d / scripts /install /persistence-install.sh
autoface's picture
first commit
9b205e1
#!/bin/bash
set -e
# Function for logging
log() {
echo "[$(date '+%Y-%m-%d %H:%M:%S')] [PERSISTENCE] $*"
}
# Function for cleanup
cleanup() {
log "Performing persistence installation cleanup..."
rm -rf \
/var/lib/apt/lists/* \
/var/tmp/* \
/var/log/*
}
# Trap to ensure cleanup on exit
trap cleanup EXIT
log "Starting persistence service dependencies installation..."
log "Updating package lists..."
apt-get update
log "Installing Python environment for persistence service..."
apt-get install -y --no-install-recommends \
python3 \
python3-pip \
python3-venv
log "Installing Python packages for Hugging Face integration..."
pip3 install --no-cache-dir --break-system-packages huggingface_hub
log "Verifying Python installation..."
if command -v python3 >/dev/null 2>&1; then
PYTHON_VERSION=$(python3 --version 2>&1 || echo "Version check failed")
log "Python installed successfully: ${PYTHON_VERSION}"
else
log "ERROR: Python installation failed"
exit 1
fi
log "Verifying huggingface_hub installation..."
if python3 -c "import huggingface_hub; print('huggingface_hub version:', huggingface_hub.__version__)" 2>/dev/null; then
log "huggingface_hub installed successfully"
else
log "ERROR: huggingface_hub installation failed"
exit 1
fi
log "Persistence service dependencies installation completed successfully"