#! /bin/sh

# Installing a Geomorph user, part 1:  the directory with default POV scenes

VERSION=0.31
SOURCE_DIR=/usr/local/share/geomorph/$VERSION/scenes

if [ -d $HOME/geomorph ]
then
# Directory exists, rename old scenes before copying

	# If one of the files was renamed "old", we exit (won't install twice)
	for SCN in sunseta sunsetb sea_n_moon iced_satellite sea_and_fog simple_terrain moon
	do

		if [ -f $HOME/geomorph/$SCN'.pov' ]
		then
			echo $SCN'.pov'
			if [ ! -f $HOME/geomorph/$SCN'_old.pov' ]
			then
				echo $SCN'.pov -> '$SCN'_old.pov'
				mv $HOME/geomorph/$SCN'.pov' $HOME/geomorph/$SCN'_old.pov'
			else
				exit
			fi

		fi
		cp $SOURCE_DIR/$SCN'.pov' $HOME/geomorph/$SCN'.pov'

	done
	exit
fi

mkdir -v $HOME/geomorph
cp -fv /usr/local/share/geomorph/$VERSION/scenes/* $HOME/geomorph


