#!/bin/bash

if [ "$#" = "1" ]; then
	username=$1
elif [ "$#" = "0" ]; then
		username=""
else 
	echo "Usage: xdsetup"
	echo "       xdsetup <username>"
	echo
	echo "Installs the basic .xdphysrc setup into"
	echo "a user's home directory."
fi


if [ -d ~${username}/.xdphysrc ]; then
	echo "${username}  already has a .xdphysrc directory!"
	echo "NOT overwriting existing files."
else
	eval mkdir ~${username}/.xdphysrc
	eval chmod 0755 ~${username}/.xdphysrc
	eval cd ~${username}/.xdphysrc;
	tar zxf /usr/local/lib/xdphys/xdphysrc.tar.gz
	if [ "$#" = 1 ]; then
		eval chown -R ${username} ~${username}/.xdphyrc
	fi
fi
