1#!/bin/sh
2# $LynxId: install-lss.sh,v 1.1 2007/05/13 22:15:29 tom Exp $
3# install lynx.lss, ensuring the old config-file is saved to a backup file.
4#
5# $1 = install program
6# $2 = file to install
7# $3 = where to install it
8PRG="$1"
9SRC=$2
10DST=$3
11
12if test -f "$DST" ; then
13	# See if we have saved this information before
14	if cmp -s $SRC $DST
15	then
16		echo "... installed $DST would not be changed"
17	else
18		NUM=1
19		while test -f ${DST}-${NUM}
20		do
21			if cmp -s $SRC ${DST}-${NUM}
22			then
23				break
24			fi
25			NUM=`expr $NUM + 1`
26		done
27		if test ! -f ${DST}-${NUM}
28		then
29			echo "... saving old config as ${DST}-${NUM}"
30			mv $DST ${DST}-${NUM} || exit 1
31		fi
32		echo "** installing $SRC as $DST"
33		eval $PRG $SRC $DST || exit 1
34	fi
35else
36	echo "** installing $SRC as $DST"
37	eval $PRG $SRC $DST || exit 1
38fi
39