#!/bin/csh -f

#
#

echo This script will install nview/nconvert/xnview in the /usr/local/bin directory

if ( ! -e /usr/local ) then
	mkdir /usr/local
endif

if ( ! -e /usr/local ) then
	exit 0
endif

if ( ! -e /usr/local/bin ) then
	mkdir -p /usr/local/bin
	chmod 777 /usr/local/bin
endif

if ( ! -e /usr/local/lib ) then
	mkdir /usr/local/lib
	chmod 777 /usr/local/lib
endif

rm -f /usr/local/bin/nviewgl /usr/local/bin/nview /usr/local/bin/nconvert /usr/local/bin/xnview

cp bin/nview bin/nconvert bin/nviewgl bin/xnview /usr/local/bin
chmod a+x /usr/local/bin/nview /usr/local/bin/nconvert /usr/local/bin/xnview

cp lib/libformat.so.2.70 /usr/local/lib
cd /usr/local/lib
rm -f libformat.so
chmod a+x libformat.so.2.70
ln -s libformat.so.2.70 libformat.so

echo You must add to the PATH environment variable /usr/local/bin
echo 
echo Done!
