#!/bin/bash
set -e

# Post-removal script for adastra-storage

INSTALL_DIR="/opt/adastra-storage"
SERVICE_USER="adastra"

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

# Remove service user (optional - comment out if you want to keep the user)
# if id "$SERVICE_USER" &>/dev/null; then
#     echo "Removing service user: $SERVICE_USER"
#     userdel "$SERVICE_USER" || true
# fi

# Note: We don't remove /opt/adastra-storage by default
# to preserve data. Use the uninstaller script for complete removal.

echo "Adastra Storage removal complete!"
echo "Note: Data directory at $INSTALL_DIR/data has been preserved."
echo "To completely remove, run: $INSTALL_DIR/uninstall.sh"

exit 0

