#!/bin/sh

#Script by Ross Farinella
#http://findross.com

if [ ! $1 ]
then
	echo "Nothing to do .. quiting"
	exit
fi

if [ $1 == "h" ] #connect to home network
then 
	echo "Connecting to private network & leasing IP . . ."
	sudo ifconfig eth1 up
	sudo iwconfig eth1 essid NetworkSSID key my_big_long_key_here
	sudo dhcpcd eth1	
	echo "Setting up dual head configuration . . ."
	sudo cp /etc/X11/xorg.conf.BasicBackup.Dual /etc/X11/xorg.conf 			# copy the dual head xorg
	sudo cp /home/fatalerr/.kickerrc_dual /home/fatalerr/.kde3.5/share/config/kickerrc	# copy the dual head kde config
	sudo /etc/init.d/sshd restart		
	echo "done."
else
	if [ $1 == "um" ]
	then
		echo "Connecting to school network & leasing IP . . ."
		sudo ifconfig eth1 up
		sudo iwconfig eth1 essid UMASS
		sudo dhcpcd eth1
		sudo vpnc
		echo "Setting up single head configuration . . ."
		sudo cp /etc/X11/xorg.conf.BasicBackup /etc/X11/xorg.conf
	else
		if [ $1 == "a" ]
		then
			echo "Connecting to friend's network & leasing IP . . ."
			sudo ifconfig eth1 up
			sudo iwconfig eth1 essid MyNetwork key my_friends_big_long_key
			sudo dhcpcd eth1
			echo "Setting up single head configuration . . ."
			sudo cp /etc/X11/xorg.conf.BasicBackup /etc/X11/xorg.conf
		else
			if [ $1 == "hs" ]
			then
				echo "Connecting to private network & leasing IP . . ."
				sudo ifconfig eth1 up
				sudo iwconfig eth1 essid MyNetwork key big_long_key
				sudo dhcpcd eth1	
				echo "Setting up SINGLE head configuration . . ."
				sudo cp /etc/X11/xorg.conf.BasicBackup /etc/X11/xorg.conf
			else
				echo "Nothing to do .. quiting."	
			fi
		fi
	fi
	cp /home/fatalerr/.kickerrc_single /home/fatalerr/.kde3.5/share/config/kickerrc
fi
