#!/bin/sh -e

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

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

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

