Merge branch 'vendor/LIBARCHIVE'
[dragonfly.git] / usr.sbin / rpc.yppasswdd / yppwupdate
1 #!/bin/sh
2 #
3 # This script is invoked by rpc.yppasswdd to update the password
4 # maps after the master password file has been modified. It expects
5 # to be passed two arguments: the name of the master.passwd template
6 # file that was modified by the server, and the name of the domain to
7 # update. These are passed to /var/yp/Makefile.
8 #
9 # Comment out the LOG=yes line to disable logging.
10 #
11 # $FreeBSD: src/usr.sbin/rpc.yppasswdd/yppwupdate,v 1.7 1999/08/28 01:19:42 peter Exp $
12 # $DragonFly: src/usr.sbin/rpc.yppasswdd/yppwupdate,v 1.2 2003/06/17 04:30:02 dillon Exp $
13 #
14
15 PATH=/bin:/usr/bin; export PATH
16 LOG=yes
17 LOGFILE=/var/yp/ypupdate.log
18
19 umask 077
20
21 if [ ! -f $LOGFILE ];
22 then
23         touch $LOGFILE
24         echo "# Edit /usr/libexec/yppwupdate to disable" >> $LOGFILE
25         echo "# logging to this file from yppasswdd." >> $LOGFILE
26         echo -n "# Log started on: " >> $LOGFILE
27         date >> $LOGFILE
28 fi
29
30 if [ ! $LOG ];
31 then
32         cd /var/yp && make MASTER_PASSWD=$1 UPDATE_DOMAIN=$2 $3 2>&1
33 else
34         cd /var/yp && make MASTER_PASSWD=$1 UPDATE_DOMAIN=$2 $3 >> $LOGFILE 2>&1
35 fi