#!/bin/sh
# Nethack launcher for SuSE
# Copyright (c) 2002 SuSE Linux AG, Nuernberg, Germany.
# All rights reserved.
#
# Author: Michal Cihar <mcihar@suse.cz>
#

HACKBINDIR=/usr/games
HACKORDER="tty qt x11 gnome tty.qt tty.x11 tty.gnome"

if [ -z "$HACKSTYLE" ]; then
    echo No HACKSTYLE set so trying to detect...
    for HACKSTYLE in $HACKORDER ; do
        if [ -x $HACKBINDIR/nethack.$HACKSTYLE ] ; then
            echo nethack.$HACKSTYLE found, it will be executed
        else
            echo nethack.$HACKSTYLE not found
        fi
        if [ ! -x $HACKBINDIR/nethack.$HACKSTYLE ] ; then
            echo NO nethack executable found, aborting
            exit 1
        else
            exec $HACKBINDIR/nethack.$HACKSTYLE
        fi
    done
else
    if [ ! -x $HACKBINDIR/nethack.$HACKSTYLE ] ; then
        echo NO nethack with defined HACKSTYLE=$HACKSTYLE executable found, aborting
        exit 1
    else
        exec $HACKBINDIR/nethack.$HACKSTYLE
    fi
fi
