#!/bin/sh
set -e

if [ "$1" = "configure" ]; then
    # Install desktop-file-utils if missing
    if ! command -v update-desktop-database >/dev/null 2>&1; then
        apt-get update && apt-get install -y desktop-file-utils || true
    fi

    # Update desktop database
    update-desktop-database /usr/share/applications/ || true

    # Refresh MATE or Cinnamon menus
  #  if command -v mate-panel >/dev/null 2>&1; then
  #      mate-panel --replace & || true
  #  elif command -v cinnamon >/dev/null 2>&1; then
  #      cinnamon --replace & || true
  #  fi

    # Placeholder for Free Trial/STD/PRO logic
    # Example: Set up config file
    # if [ ! -f /etc/bvideoconverter/config ]; then
    #     echo "trial_mode=true" > /etc/bvideoconverter/config
    # fi
fi

exit 0
