#!/bin/sh
# Slackware wrapper for the dwarffortress executable.
# A copy of the game is in /opt/dwarffortress
# When a user runs the game these files are copied to
# their home directory, and the game runs from there.
runme(){
    if [ ! -d ~/.dwarffortress ]; then
	cp -a /opt/dwarffortress ~/.dwarffortress
	cd ~/.dwarffortress
	find {data,raw,sdl} -type d -exec chmod 700 {} \;
    fi
    cd ~/.dwarffortress
    ~/.dwarffortress/df
}

if [ $UID == 0 ]; then
    read -p "You are currently running as root...\
 Are you sure you want to proceed? (N/y): " resp
    case "$resp" in
	y|yes)
	    runme
	    ;;
	*)
	    echo Exiting
	    exit 0
	    ;;
    esac
else
    runme
fi
