#!/bin/bash

for GAME in hipnotic rogue ; do

    if [ "$1" = "${GAME}" ]; then

	if [ ! -f /usr/share/games/quakeforge/${GAME}/pak0.pak ]; then

	    if [ -n "${DISPLAY}" ]; then

		xmessage -center "Error: \"/usr/share/games/quakeforge/${GAME}/pak0.pak not found...\" 
       You should first install the Quake PAK file in 
       \"/usr/share/games/quakeforge/${GAME}\""

	    else

		echo -e "Error: \"/usr/share/games/quakeforge/${GAME}/pak0.pak not found...\""
		echo -e "You should first install the Quake PAK file in"
		echo -e "\"/usr/share/games/quakeforge/${GAME}\""

	    fi

	    exit 1

	fi

    elif [ -z "$1" ]; then

	for PAK in pak0.pak pak1.pak ; do

	    if [ ! -f /usr/share/games/quakeforge/id1/${PAK} ]; then

		if [ -n "${DISPLAY}" ]; then

		    xmessage -center "Error: \"/usr/share/games/quakeforge/id1/${PAK} not found...\" 
       You should first install the Quake PAK files in 
       \"/usr/share/games/quakeforge/id1\""

		else

		    echo -e "Error: \"/usr/share/games/quakeforge/id1/${PAK} not found...\""
		    echo -e "You should first install the Quake PAK files in"
		    echo -e "\"/usr/share/games/quakeforge/id1\""

		fi

		exit 1

	    fi

	done

    fi

done

exit 0
