#!/bin/sh
#
# Checks if the system is ready

set -e

# Java installed?
if ! command -v java >/dev/null 2>&1; then
    echo "Error: Java Runtime Environment (JRE) is not installed." >&2
    echo "Please install 'default-jre' or 'openjdk-25-jre' and try again." >&2
    exit 1
fi

# Installation directory exists?
mkdir -p /opt/CuttingBoard

# If upgrading, stop the service if it's running (assuming a systemd service exists)
#if [ "$1" = "upgrade" ]; then
#    if systemctl is-active --quiet CuttingBoard.service 2>/dev/null; then
#        systemctl stop CuttingBoard.service
#    fi
#fi

exit 0