# Check if afs is running.  If so turn off xntpd as afs does its own time sync
/sbin/chkconfig --list afs | grep on
if [ $? -eq 0 ] ; then
	/sbin/chkconfig --level 345 xntpd off
	echo "Turned off xntpd because afs is running" >>/etc/$WORKGROUP/after.rpms.log
fi
# Added to enable nfs
/sbin/chkconfig --level 345 nfs on
/sbin/chkconfig --level 345 autofs on
/sbin/chkconfig --level 345 nfslock on


# Set up Theory YP stuff.

NISDOMAIN=theory.fnal.gov
NISSERVER=fnth32.fnal.gov
NISIPADDR=131.225.55.129

if [ `grep NISDOMAIN=$NISDOMAIN /etc/sysconfig/network | wc -l` -eq 0 ]
then
  echo "NISDOMAIN=$NISDOMAIN" >> /etc/sysconfig/network
fi

if [ `grep $NISDOMAIN /etc/yp.conf | wc -l` -eq 0 ]
then
  if [ -z $NISSERVER ] ; then
     echo "domain $NISDOMAIN" >> /etc/yp.conf
     echo "broadcast" >> /etc/yp.conf
  else
     echo "domain $NISDOMAIN server $NISSERVER" >> /etc/yp.conf
  fi
fi

if [ -z $NISSERVER ] ; then
        ecbo "no NISSERVER defined,  using broadcast"
else
  if [ `grep $NISSERVER /etc/hosts | wc -l` -eq 0 ]
  then
  	echo "$NISIPADDR          $NISSERVER" >> /etc/hosts
  fi
fi

/sbin/chkconfig --level 35 ypbind on
/sbin/chkconfig --level 35 portmap on

# Edit the config.ps for the latex
#   so that it uses standard 8.5 x 11 size as the default
cd /usr/share/texmf/dvips/config/

csplit -f dvips config.ps /"@ A4size 210mm 297mm"/
csplit -f dvipsagain dvips01 /"@ letterSize 8.5in 11in"/
csplit -f dvipsyetagain dvipsagain01 2

cat dvipsyetagain00 >> dvips00
cat dvipsagain00 >> dvips00
cat dvipsyetagain01 >> dvips00

mv -f dvips00 config.ps
rm -f dvipsyetagain00 dvipsyetagain01 dvipsagain00 dvipsagain01
rm -f dvips01

# Add some ups products locally
. /usr/local/etc/setups.sh
setup upd
upd install sendmail v8_11_0_a -G -c
ups opt1 sendmail v8_11_0_a
upd install latex2html -G -c

# This will remove/disable the password for the products account

STAMP=`/bin/date +%Y%m%d`
export STAMP
/bin/cp /etc/passwd /etc/passwd.$STAMP
/bin/cp /etc/passwd /etc/passwd.temp

FIELD2=`grep products /etc/passwd | cut -f2 -d":"`
export FIELD2

/bin/sed  -e "s/$FIELD2/*/" /etc/passwd.temp  > /etc/passwd
/bin/rm /etc/passwd.temp
