#! /bin/csh -f
#
# Install script for Perl library 'dtd' and associated programs.
#
# Look for lines with the string 'CONFIG' for customizing the installation
# script for your site.
#

# Set file mask
umask 022

# Array of files to install in bin directory
set binfiles = ( \
    dtd2html \
    dtdtree \
)
# Array of files to install in perl lib directory
set libfiles = ( \
    dtd.pl \
)

# CONFIG: $bindir is location of executable programs
set bindir = '/usr/local/hp/bin'

# CONFIG: $libdir is location of Perl library files
set libdir = '/usr/local/hp/lib/perl'

# Check if directories exist
if (! -d $bindir) then
    echo "$bindir not a directory or non-existent"
    exit 1
endif
if (! -d $libdir) then
    echo "$libdir not a directory or non-existent"
    exit 1
else
    if (! -e $libdir/dtd) then
	mkdir $libdir/dtd
	/bin/chmod 755 $libdir/dtd
    else if (! -d $libdir/dtd) then
	echo "$libdir/dtd not a directory"
	exit 1
    endif
endif

foreach x ($binfiles)
    echo "Installing $x into $bindir"
    /bin/cp $x $bindir
    /bin/chmod 755 $bindir/$x
end
foreach x ($libfiles)
    echo "Installing $x into $libdir/dtd"
    /bin/cp $x $libdir/dtd
    /bin/chmod 644 $libdir/dtd/$x
end
