#!/bin/sh -e

INSTALL=/usr/games/armagetronad
VARDIR=$HOME/.armagetronad/var

if test ! -d $VARDIR ; then
    mkdir -p $VARDIR
        
    # Migrate old configuration
    files=$( find $HOME/.armagetronad -type f -maxdepth 1 )
 
    test "$files" != "" && echo "Porting old configuration..." && mv $files $VARDIR
fi

$INSTALL/bin/armagetronad --datadir $INSTALL --configdir /etc/armagetronad --userconfigdir $HOME/.armagetronad --vardir $VARDIR "$@"

