1#!/bin/sh
2#fist version March 2002, Herb  Lewis
3
4DESTDIR=$1
5DATDIR=`echo $2 | sed 's/\/\//\//g'`
6SRCDIR=$3/
7shift
8shift
9shift
10
11case $0 in
12	*uninstall*)
13		if test ! -d "$DESTDIR/$DATDIR"; then
14			echo "Directory $DESTDIR/$DATDIR does not exist! "
15			echo "Do a "make installmsg" or "make install" first. "
16			exit 1
17		fi
18		mode='uninstall'
19		;;
20	*) mode='install' ;;    
21esac
22
23for f in $SRCDIR/codepages/*.dat; do
24	FNAME="$DESTDIR/$DATDIR/`basename $f`"
25	if test "$mode" = 'install'; then
26		echo "Installing $f as $FNAME "
27		cp "$f" "$FNAME"
28		if test ! -f "$FNAME"; then
29			echo "Cannot install $FNAME.  Does $USER have privileges? "
30			exit 1
31		fi
32		chmod 0644 "$FNAME"
33	elif test "$mode" = 'uninstall'; then
34		echo "Removing $FNAME "
35		rm -f "$FNAME"
36		if test -f "$FNAME"; then
37			echo "Cannot remove $FNAME.  Does $USER have privileges? "
38			exit 1
39		fi
40	else
41		echo "Unknown mode, $mode.  Script called as $0 "
42		exit 1
43	fi
44done
45
46if test "$mode" = 'install'; then
47	cat << EOF
48======================================================================
49The dat files have been installed.  You may uninstall the dat files
50using the command "make uninstalldat" or "make uninstall" to uninstall
51binaries, man pages, dat files, and shell scripts.
52======================================================================
53EOF
54else
55	cat << EOF
56======================================================================
57The dat files have been removed.  You may restore these files using
58the command "make installdat" or "make install" to install binaries, 
59man pages, modules, dat files, and shell scripts.
60======================================================================
61EOF
62fi
63
64exit 0
65
66