#!/bin/bash
set -e

# Pre-removal script for adastra-storage

echo "Adastra Storage: Pre-removal cleanup..."

# Stop and disable service
if systemctl is-active adastra-storage.service >/dev/null 2>&1; then
    echo "Stopping adastra-storage service..."
    systemctl stop adastra-storage.service
fi

if systemctl is-enabled adastra-storage.service >/dev/null 2>&1; then
    echo "Disabling adastra-storage service..."
    systemctl disable adastra-storage.service
fi

systemctl daemon-reload

exit 0

