Blob Blame History Raw
#!/bin/bash

set -e

if [ ! -f $HOME/.q3a/wop/wop_006.pk3 ]; then
	set +e
	/usr/share/autodl/AutoDL.py /usr/share/quake3/worldofpadman.autodlrc
	STATUS=$?
	set -e

	# status 2 means download was ok, but the user choice not to start the game
	if [ "$STATUS" = "0" -o "$STATUS" = "2" ]; then
		mkdir -p $HOME/.q3a/wop/extras
		pushd $HOME/.q3a/wop > /dev/null
		
		# install wop 1.1
		sh ../worldofpadman.run --nox11 --noexec --target .
		tar xf readme.tar
		tar xf extras.tar -C extras wop_dvd_cover*
		tar xf wop-data.tar
		rm -r bin setup.sh setup.data *.tar ../worldofpadman.run

		# install 1.2 patch
		sh ../wop_patch_1_2.run --nox11 --noexec --target .
		tar xf extras.tar
		tar xf wop-data-1.2.tar
		rm -r bin setup.sh setup.data *.tar ../wop_patch_1_2.run
		
		popd > /dev/null
	fi
	if [ "$STATUS" != "0" ]; then
		exit $STATUS
	fi
fi

exec quake3 +set fs_game wop "$@"