#!/bin/sh

# This file is: make_changes - update DIMACS info server files
# GEA 9/19/92

INFO_MASTER=root	# set this to whomever the maintainer is

if [ `pwd` != '/dimacs/u3/ftp/pub/dimacs' ]
then
	echo "You need to run this program from the dimacs directory."
	echo "Try typing \"cd; cd dimacs\" first."
	exit 1
fi

if [ $# = 0 -o "$1" != "remote" ]
then
	echo "update local: (will not send changes to remote INFO system.)"
	WHERE="local"
else
	echo "update remote: (will send changes to remote INFO system.)"
	WHERE="remote"
fi


echo  "running make..."
make -f /dimacs/u3/ftp/pub/dimacs/maint/Makefile   # execute any local fixes to files

echo  "checking file protections..."
chgrp -R infodim /dimacs/u3/ftp/pub/dimacs
chmod -R a+r /dimacs/u3/ftp/pub/dimacs

if [ $WHERE = "remote" ]
then
	echo  "propagating changed files to info.rutgers.edu..."
	rdist -f /dimacs/u3/ftp/pub/dimacs/maint/Distfile
fi


WHO=`who am i`    # can't use `whoami` because we're root
/usr/5bin/echo \($WHERE\) "INFO system has been updated by:\n\n"$WHO "\n\nCommand string was:\n\n"$0 $@ |  mail -s "INFO system has been updated."  $INFO_MASTER

echo "Done."
