#!/bin/bash

# discovered distro; Debian by default
DISTRO='Debian'

# distro names
DEBIAN='Debian'
SUSE='SuSe'
REDHAT='RedHat'
MANDRAKE='Mandrake'

#######################################################################
# DISTRIBUTION DETECTION
########################################################################
if [ -f /etc/redhat-release ] ; then
    DISTRO=$REDHAT
elif [ -f /etc/SuSE-release ] ; then
    DISTRO=$SUSE
elif [ -f /etc/mandrake-release ] ; then
    DISTRO=$MANDRAKE
elif [ -f /etc/debian_version ] ; then
    DISTRO=$DEBIAN
fi
########################################################################

# start the application

if [ "${DISTRO}" = "${SUSE}" ];
then
    gnomesu --command "java -jar /opt/lxmed/LXMenuEditor.jar"
elif [ "${DISTRO}" = "${REDHAT}" ];
then
    beesu -c "java -jar /opt/lxmed/LXMenuEditor.jar"
else
    gksu --message "Please enter password to run lxmed in fully operational mode:" 'java -jar /opt/lxmed/LXMenuEditor.jar'
fi
