1997-02-02 04:11:35 +00:00
|
|
|
#! /bin/sh
|
|
|
|
|
|
|
|
if ! export PREFIX=$(expr $0 : "\(/.*\)/etc/cvsup/update\.sh\$"); then
|
|
|
|
echo "$0: Cannot determine the PREFIX" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
export PATH=/bin:/usr/bin:${PREFIX}/bin
|
|
|
|
|
|
|
|
lock=/var/spool/lock/cvsup.lock
|
|
|
|
log=/var/log/cvsup.log
|
|
|
|
|
|
|
|
# Rotate the log files
|
|
|
|
|
|
|
|
umask 22
|
|
|
|
test -f ${log}.7 && mv -f ${log}.7 ${log}.8
|
|
|
|
test -f ${log}.6 && mv -f ${log}.6 ${log}.7
|
|
|
|
test -f ${log}.5 && mv -f ${log}.5 ${log}.6
|
|
|
|
test -f ${log}.4 && mv -f ${log}.4 ${log}.5
|
|
|
|
test -f ${log}.3 && mv -f ${log}.3 ${log}.4
|
|
|
|
test -f ${log}.2 && mv -f ${log}.2 ${log}.3
|
|
|
|
test -f ${log}.1 && mv -f ${log}.1 ${log}.2
|
|
|
|
test -f ${log}.0 && mv -f ${log}.0 ${log}.1
|
|
|
|
test -f ${log} && mv -f ${log} ${log}.0
|
|
|
|
exec >${log} 2>&1
|
|
|
|
|
|
|
|
# Do the update
|
|
|
|
|
2000-02-06 00:13:52 +00:00
|
|
|
date "+CVSup update begins at %Y-%m-%d %T"
|
1997-02-02 04:11:35 +00:00
|
|
|
|
|
|
|
# The rest of this is executed while holding the lock file, to ensure that
|
|
|
|
# multiple instances won't collide with one another.
|
|
|
|
|
|
|
|
lockf -t 0 ${lock} /bin/sh << 'E*O*F'
|
|
|
|
|
|
|
|
base=${PREFIX}/etc/cvsup
|
2000-01-28 06:42:37 +00:00
|
|
|
rundir=/var/tmp
|
|
|
|
cd ${rundir} || exit
|
|
|
|
. ${base}/config.sh || exit
|
1997-02-02 04:11:35 +00:00
|
|
|
|
|
|
|
colldir=sup.client
|
|
|
|
startup=${PREFIX}/etc/rc.d
|
2000-02-11 04:23:24 +00:00
|
|
|
eval chome=~${cuser}
|
|
|
|
cmd="env HOME=${chome} cvsup"
|
2000-01-14 04:53:10 +00:00
|
|
|
options="-1gL 1 -b ${base} -c ${colldir}"
|
1997-02-02 04:11:35 +00:00
|
|
|
|
|
|
|
umask 2
|
2000-01-14 04:53:10 +00:00
|
|
|
ok=yes
|
1997-02-02 04:11:35 +00:00
|
|
|
if [ ${host_crypto} = ${host} ]; then
|
|
|
|
echo "Updating from ${host}"
|
2000-01-28 06:42:37 +00:00
|
|
|
su -m ${cuser} -c \
|
2000-02-11 04:23:24 +00:00
|
|
|
"${cmd} ${options} -h ${host} ${base}/supfile" || ok=no
|
1997-02-02 04:11:35 +00:00
|
|
|
else
|
2000-02-06 00:15:15 +00:00
|
|
|
if [ -d ${base}/prefixes/FreeBSD-crypto.cvs ]; then
|
1997-02-02 04:11:35 +00:00
|
|
|
echo "Updating from ${host_crypto}"
|
2000-01-28 06:42:37 +00:00
|
|
|
su -m ${cuser} -c \
|
2000-02-11 04:23:24 +00:00
|
|
|
"${cmd} ${options} -h ${host_crypto} ${base}/supfile.crypto" ||\
|
|
|
|
ok=no
|
1997-02-02 04:11:35 +00:00
|
|
|
fi
|
|
|
|
echo "Updating from ${host}"
|
2000-01-28 06:42:37 +00:00
|
|
|
su -m ${cuser} -c \
|
2000-02-11 04:23:24 +00:00
|
|
|
"${cmd} ${options} -h ${host} ${base}/supfile.non-crypto" || ok=no
|
1997-02-02 04:11:35 +00:00
|
|
|
fi
|
|
|
|
|
2000-01-14 04:53:10 +00:00
|
|
|
if [ ${ok} = yes ]; then
|
2000-01-28 06:42:37 +00:00
|
|
|
if [ -f ${base}/.start_server ]; then
|
2000-01-14 04:53:10 +00:00
|
|
|
if [ -x ${startup}/cvsupd.sh ]; then
|
|
|
|
echo -n "Starting the server:"
|
2000-01-28 06:42:37 +00:00
|
|
|
/bin/sh ${startup}/cvsupd.sh start
|
2000-01-14 04:53:10 +00:00
|
|
|
echo "."
|
|
|
|
fi
|
2000-01-28 06:42:37 +00:00
|
|
|
rm -f ${base}/.start_server
|
1997-02-02 04:11:35 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
E*O*F
|
|
|
|
|
2000-02-06 00:13:52 +00:00
|
|
|
date "+CVSup update ends at %Y-%m-%d %T"
|