1997-02-02 04:11:35 +00:00
|
|
|
#! /bin/sh
|
|
|
|
|
2004-08-05 23:37:47 +00:00
|
|
|
if ! PREFIX=$(expr $0 : "\(/.*\)/etc/cvsup/update\.sh\$"); then
|
1997-02-02 04:11:35 +00:00
|
|
|
echo "$0: Cannot determine the PREFIX" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2004-08-05 23:37:47 +00:00
|
|
|
export PREFIX
|
2000-04-24 14:01:58 +00:00
|
|
|
export CVSUP_ARGS="$*"
|
1997-02-02 04:11:35 +00:00
|
|
|
export PATH=/bin:/usr/bin:${PREFIX}/bin
|
|
|
|
|
|
|
|
lock=/var/spool/lock/cvsup.lock
|
|
|
|
log=/var/log/cvsup.log
|
|
|
|
|
|
|
|
umask 22
|
2004-03-16 17:35:06 +00:00
|
|
|
|
2006-01-02 10:05:11 +00:00
|
|
|
exec >>${log} 2>&1
|
1997-02-02 04:11:35 +00:00
|
|
|
|
|
|
|
# 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}
|
2000-06-21 05:00:15 +00:00
|
|
|
cmd="exec env HOME=${chome} cvsup"
|
2000-04-24 14:01:58 +00:00
|
|
|
options="-1gL 1 -b ${base} -c ${colldir} ${CVSUP_ARGS}"
|
1997-02-02 04:11:35 +00:00
|
|
|
|
|
|
|
umask 2
|
2000-01-14 04:53:10 +00:00
|
|
|
ok=yes
|
2000-07-09 17:57:33 +00:00
|
|
|
|
|
|
|
echo "Updating from ${host}"
|
|
|
|
su -f -m ${cuser} -c \
|
|
|
|
"${cmd} ${options} -h ${host} ${base}/supfile" || ok=no
|
1997-02-02 04:11:35 +00:00
|
|
|
|
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
|
2010-03-27 06:14:03 +00:00
|
|
|
if [ -x ${startup}/cvsupd ]; then
|
2000-01-14 04:53:10 +00:00
|
|
|
echo -n "Starting the server:"
|
2010-03-27 06:14:03 +00:00
|
|
|
/bin/sh ${startup}/cvsupd 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"
|