head     1.7;
access   paws bayes jws quist dew jwh;
symbols  ;
locks    ; strict;
comment  @# @;


1.7
date     89.01.04.15.27.06;  author dew;  state Exp;
branches ;
next     1.6;

1.6
date     88.12.14.16.35.19;  author dew;  state Exp;
branches ;
next     1.5;

1.5
date     88.12.14.16.30.31;  author dew;  state Exp;
branches ;
next     1.4;

1.4
date     88.11.07.15.29.06;  author dew;  state Exp;
branches ;
next     1.3;

1.3
date     88.10.27.10.46.36;  author dew;  state Exp;
branches ;
next     1.2;

1.2
date     88.10.11.17.33.13;  author dew;  state Exp;
branches ;
next     1.1;

1.1
date     88.10.05.15.52.43;  author dew;  state tmp;
branches ;
next     ;


desc
@Base file for PWS 3.3 release.

@


1.7
log
@Added check for turn in progress and diff files before
checking in (/src/paws/src files only)
@
text
@#
#       Script to install paws source files into RCS.
#       Sets up strict locking and proper access lists.
#       Also makes sure the file has the proper owner
#       and group.
#
#       09/88 added version logging.  The log message is entered
#       with an editor and then passed to both ci during check in
#       and a version log file.
#
#       NOTE: newci never checked for proper owner and group.
#


versionfile=/src/paws/adm/newciupdates  # this should be identical to allnewrev
flagfile=/src/paws/src/turninprogress   # this should be identical to rcs2pws
					# and allnewrev.  

fixfile=/tmp/$0fix.$$
logfile=/tmp/$0log.$$
cioutfile=/tmp/$0out.$$

Usage="Usage: $0 file \n"

trap "echo trap encountered.;rm -f /tmp/$0*;exit 1" 1 2 3 6 7 8 10 12 13 15 19

if [ $# -lt 1 ]
then
	echo $Usage
	exit 1
fi

today=`date`

f=$1

#
# make sure the file $f exists and is not empty.
#
if [ ! -f $f -o ! -s $f ]
then
	echo $0 error: $f either does not exist or is empty.
	echo $0 aborting.
	exit 1
fi

#
# if this file exists under RCS,
# make sure the file is locked in RCS and this user can check it in!
#
if ls RCS | grep $f > /dev/null
then
	if rlog -L -l $f | grep "locked by:" | grep $LOGNAME > /dev/null
	then
		: #file is checked out locked by logging person.
	else
		echo $f is either not locked or not locked by $LOGNAME
		echo $0 aborting.
		exit 1
	fi
else
	echo RCS/$f,v does not exist.
	junk='a'
	while [ $junk != 'y' -a $junk != 'n' ]
	do
		echo "Is $f a new RCS file? (y/n). \c"
		read junk
	done
	if [ $junk = 'n' ]
	then
		echo $0 aborting.
		exit 1
	fi
fi



#
# DEW 12/14/88
#
# if this file is located in /src/paws/src/...
# then normalize, get a log message, and store.
# otherwise, just ci as normal.  This extension
# is added so that newci can be used all of the
# time.
#
if echo $PWD | grep "/src/paws/src" > /dev/null 2>&1 
then
	#
	# DEW 01/04/89
	#
	# if the flag file exists, then can not check files
	# in.
	#
	if [ -f $flagfile ]
	then
		echo "ERROR:  System Turn in progress."
		echo "Files under /src/paws/src can not be modified."
		echo "See the turn master."
		echo $0 aborting.
		exit 1
	fi

	#
	# update all tabs to spaces,
	# get rid of trailing tabs, spaces,
	# get rid of empty lines at then end of the file.
	#
	# this creates a standard format and makes diffs and srmcps alot
	# easier.
	#
	expand $f >$fixfile
	mv $fixfile $f
	normalize $f

	#
	# compare users file with RCS file, confirming
	# user wants to check in.
	#
	echo "Differences between $f and RCS/$f"
	echo "< indicates line out.\n> indicates line in."
	rcsdiff $f | more
	echo
	junk='a'
	while [ $junk != 'y' -a $junk != 'n' ]
	do
		echo "Do you want to check this file in? (y/n) \c"
		read junk
	done
	if [ $junk = 'n' ]
	then
		echo $0 aborting.
		exit 1
	fi


	#
	# get the log message and store in logfile.
	#
	echo Enter Log Message.
	echo "Editor: (return for vi) \c"
	read editname
	if [ "$editname" = "" ]
	then
		editname=vi
	fi
	done=0
	rm -f $logfile
	while [ $done -ne 1 ]
	do
		$editname $logfile
		if [ ! -s $logfile ]
		then
			echo You must make a log entry!
			echo Press return to continue.
			read junk
		else
			done=1
		fi
	done

	#
	# check the file in, using the data in $logfile.
	# if ci is o.k., log $logfile and other info to $versionfile
	#
	if cat $logfile | ci $f >$cioutfile 2>&1
	then
		if grep abort $cioutfile > /dev/null 2>&1
		then
			cihaserred=1
		else
			cihaserred=0
		fi
	else
		cihaserred=1
	fi
	if [ $cihaserred -eq 1 ]
	then
		#
		# display cioutput
		# generate internal error statement.
		#
		cat $cioutfile
		echo "$0 error: ci execution failed.  $versionfile NOT updated."
		echo $0 aborting.
		rm $cioutfile $logfile
		exit 1
	else
		#
		# display ci output.
		# it is saved for later use.
		#
		cat $cioutfile

		echo updating your log entry into $versionfile


		#
		# get the full file name.
		#
		fullname=`dirname $f`
		if [ $fullname = . ]
		then
			fullname=$PWD
		fi
		fullname=$fullname/`basename $f`

		#
		# get the revision.
		#
		rev=`cat $cioutfile | grep "new revision" | cut -d\  -f3 -s`

		#
		# update the log file.
		#
		echo "\n-------------------------\nFILE: $fullname; REV: $rev\nUSER: $LOGNAME;  DATE: $today;\n" >> $versionfile
		cat $logfile >> $versionfile
		rm $cioutfile $logfile
	fi
else
	ci $f
fi

@


1.6
log
@Fixed previous fix.
@
text
@d16 2
d23 1
a23 1
Usage="Usage: $0 file ... \n"
d35 1
a35 2
for f in $*
do
d37 52
d90 1
a90 1
	# make sure the file $f exists and is not empty.
d92 4
a95 1
	if [ ! -f $f -o ! -s $f ]
d97 3
a99 1
		echo $0 error: $f either does not exist or is empty.
d105 3
a107 2
	# if this file exists under RCS,
	# make sure the file is locked in RCS and this user can check it in!
d109 22
a130 1
	if ls RCS | grep $f > /dev/null
d132 21
a152 1
		if rlog -L -l $f | grep "locked by:" | grep $LOGNAME > /dev/null
d154 3
a156 1
			: #file is checked out locked by logging person.
d158 1
a158 3
			echo $f is either not locked or not locked by $LOGNAME
			echo $0 aborting.
			exit 1
d160 1
a160 14
	else
		echo RCS/$f,v does not exist.
		junk='a'
		while [ $junk != 'y' -a $junk != 'n' ]
		do
			echo "Is $f a new RCS file? (y/n). \c"
			read junk
		done
		if [ $junk = 'n' ]
		then
			echo $0 aborting.
			exit 1
		fi
	fi
a161 2


d163 2
a164 1
	# DEW 12/14/88
d166 1
a166 7
	# if this file is located in /src/paws/src/...
	# then normalize, get a log message, and store.
	# othewise, just ci as normal.  This extension
	# is added so that newci can be used all of the
	# time.
	#
	if echo $PWD | grep "/src/paws/src" 
d168 11
a178 1

d180 2
a181 3
		# update all tabs to spaces,
		# get rid of trailing tabs, spaces,
		# get rid of empty lines at then end of the file.
d183 6
a188 2
		# this creates a standard format and makes diffs and srmcps alot
		# easier.
d190 4
a193 3
		expand $f >$fixfile
		mv $fixfile $f
		normalize $f
d195 3
d199 1
a199 1
		# get the log message and store in logfile.
d201 2
a202 4
		echo Enter Log Message.
		echo "Editor: (return for vi) \c"
		read editname
		if [ "$editname" = "" ]
d204 1
a204 1
			editname=vi
d206 1
a206 14
		done=0
		rm -f $logfile
		while [ $done -ne 1 ]
		do
			$editname $logfile
			if [ ! -s $logfile ]
			then
				echo You must make a log entry!
				echo Press return to continue.
				read junk
			else
				done=1
			fi
		done
d209 1
a209 2
		# check the file in, using the data in $logfile.
		# if ci is o.k., log $logfile and other info to $versionfile
d211 1
a211 28
		if cat $logfile | ci $f >$cioutfile 2>&1
		then
			if grep abort $cioutfile > /dev/null 2>&1
			then
				cihaserred=1
			else
				cihaserred=0
			fi
		else
			cihaserred=1
		fi
		if [ $cihaserred -eq 1 ]
		then
			#
			# display cioutput
			# generate internal error statement.
			#
			cat $cioutfile
			echo "$0 error: ci execution failed.  $versionfile NOT updated."
			echo $0 aborting.
			rm $cioutfile $logfile
			exit 1
		else
			#
			# display ci output.
			# it is saved for later use.
			#
			cat $cioutfile
d213 6
a218 27
			echo updating your log entry into $versionfile


			#
			# get the full file name.
			#
			fullname=`dirname $f`
			if [ $fullname = . ]
			then
				fullname=$PWD
			fi
			fullname=$fullname/`basename $f`

			#
			# get the revision.
			#
			rev=`cat $cioutfile | grep "new revision" | cut -d\  -f3 -s`

			#
			# update the log file.
			#
			echo "\n-------------------------\nFILE: $fullname; REV: $rev\nUSER: $LOGNAME;  DATE: $today;\n" >> $versionfile
			cat $logfile >> $versionfile
			rm $cioutfile $logfile
		fi
	else
		ci $f
d220 3
a222 1
done
@


1.5
log
@updated so that newci can be used all of the time, and file
normalization will only occur on files under /src/paws/src
@
text
@d86 1
a86 1
	if cat $PWD | grep "/src/paws/src" 
@


1.4
log
@Don't use the same name for logging as is used under RCS.
This causes the log file to be wipped out when somebody does a co.
DEW 11/07/88
@
text
@d78 1
a78 3
	# update all tabs to spaces,
	# get rid of trailing tabs, spaces,
	# get rid of empty lines at then end of the file.
d80 5
a84 2
	# this creates a standard format and makes diffs and srmcps alot
	# easier.
d86 1
a86 11
	expand $f >$fixfile
	mv $fixfile $f
	normalize $f

	#
	# get the log message and store in logfile.
	#
	echo Enter Log Message.
	echo "Editor: (return for vi) \c"
	read editname
	if [ "$editname" = "" ]
a87 16
		editname=vi
	fi
	done=0
	rm -f $logfile
	while [ $done -ne 1 ]
	do
		$editname $logfile
		if [ ! -s $logfile ]
		then
			echo You must make a log entry!
			echo Press return to continue.
			read junk
		else
			done=1
		fi
	done
a88 17
	#
	# check the file in, using the data in $logfile.
	# if ci is o.k., log $logfile and other info to $versionfile
	#
	if cat $logfile | ci $f >$cioutfile 2>&1
	then
		if grep abort $cioutfile > /dev/null 2>&1
		then
			cihaserred=1
		else
			cihaserred=0
		fi
	else
		cihaserred=1
	fi
	if [ $cihaserred -eq 1 ]
	then
d90 3
a92 2
		# display cioutput
		# generate internal error statement.
d94 2
a95 6
		cat $cioutfile
		echo "$0 error: ci execution failed.  $versionfile NOT updated."
		echo $0 aborting.
		rm $cioutfile $logfile
		exit 1
	else
d97 3
a99 4
		# display ci output.
		# it is saved for later use.
		#
		cat $cioutfile
a100 3
		echo updating your log entry into $versionfile


d102 1
a102 1
		# get the full file name.
d104 4
a107 2
		fullname=`dirname $f`
		if [ $fullname = . ]
d109 1
a109 1
			fullname=$PWD
d111 14
a124 1
		fullname=$fullname/`basename $f`
d127 2
a128 1
		# get the revision.
d130 28
a157 1
		rev=`cat $cioutfile | grep "new revision" | cut -d\  -f3 -s`
d159 27
a185 6
		#
		# update the log file.
		#
		echo "\n-------------------------\nFILE: $fullname; REV: $rev\nUSER: $LOGNAME;  DATE: $today;\n" >> $versionfile
		cat $logfile >> $versionfile
		rm $cioutfile $logfile
@


1.3
log
@Added support for adding new files with newci.
@
text
@d15 1
a15 1
versionfile=/src/paws/adm/revlog3.3     # this should be identical to allnewrev
@


1.2
log
@newci updated to check if the file is locked and owned by the invoker
before it proceeds.  This prevents the frustration of having waited for
the file normalization and then entered the log message before finding out
that the file has not been locked or your not the owner.
@
text
@d47 1
d50 1
a50 1
	if rlog -L -l $f | grep "locked by:" | grep $LOGNAME > /dev/null
d52 8
a59 1
		: #file is checked out locked by logging person.
d61 12
a72 3
		echo $f is either not locked or not locked by $LOGNAME
		echo $0 aborting.
		exit 1
@


1.1
log
@Initial revision
@
text
@d46 13
@
