#!/bin/sh

# The theme to install
THEME=sometheme.tar.gz

# tar & gzip seperate for thoe systems that don't have GNU tar and its -z flag
TAR=/bin/tar
GUNZIP=/bin/gunzip

case "$1" in
	local)
		echo "Installing theme in local GNUstep domain..."
		mkdir -p ~/GNUstep/Library/WindowMaker/
		$(GUNZIP) $(THEME) | $(TAR) xf - -C ~/GNUstep/Library/WindowMaker/
		echo "Done."
	global)
		echo "Installing theme in global GNUstep domain..."
		if [`id -u` != 0]; then
			echo "Please contact the superuser"
			exit 42
		fi
		mkdir -p /usr/local/share/WindowMaker/
		$(GUNZIP) $(THEME) | $(TAR) xf - -C /usr/local/share/WindowMaker/
		echo "Done."
	*)
		echo "Bite me"
		exit 69
esac

exit 0
