107 lines
3.4 KiB
Bash
Executable File
107 lines
3.4 KiB
Bash
Executable File
#!/bin/sh
|
|
# The contents of this file are subject to the Netscape Public
|
|
# License Version 1.1 (the "License"); you may not use this file
|
|
# except in compliance with the License. You may obtain a copy of
|
|
# the License at http://www.mozilla.org/NPL/
|
|
#
|
|
# Software distributed under the License is distributed on an "AS
|
|
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
|
# implied. See the License for the specific language governing
|
|
# rights and limitations under the License.
|
|
#
|
|
# The Original Code is the Netscape Mailstone utility,
|
|
# released March 17, 2000.
|
|
#
|
|
# The Initial Developer of the Original Code is Netscape
|
|
# Communications Corporation. Portions created by Netscape are
|
|
# Copyright (C) 1999-2000 Netscape Communications Corporation. All
|
|
# Rights Reserved.
|
|
#
|
|
# Contributor(s): Dan Christian <robodan@netscape.com>
|
|
# Marcel DePaolis <marcel@netcape.com>
|
|
#
|
|
# Alternatively, the contents of this file may be used under the
|
|
# terms of the GNU Public License (the "GPL"), in which case the
|
|
# provisions of the GPL are applicable instead of those above.
|
|
# If you wish to allow use of your version of this file only
|
|
# under the terms of the GPL and not to allow others to use your
|
|
# version of this file under the NPL, indicate your decision by
|
|
# deleting the provisions above and replace them with the notice
|
|
# and other provisions required by the GPL. If you do not delete
|
|
# the provisions above, a recipient may use your version of this
|
|
# file under either the NPL or the GPL.
|
|
#####################################################
|
|
|
|
# push or clean up mailclient and message files to client hosts
|
|
# Usage: setup|cleanup|timesync|checktime|config [mode] [-w workload_file]
|
|
#
|
|
# Setup (or cleanup) OS specific versions of mailclient and utilities
|
|
|
|
have_nsarch() {
|
|
if [ ! -x bin/nsarch ] ; then
|
|
echo "Installation error! Cannot locate $1 or nsarch.\n"
|
|
exit 1
|
|
fi
|
|
}
|
|
|
|
do_setup() {
|
|
have_nsarch $1
|
|
OUROS=`bin/nsarch`
|
|
ln -s bin/$OUROS/$1 $1
|
|
}
|
|
|
|
do_setup_perl() {
|
|
have_nsarch perl/bin
|
|
OUROS=`bin/nsarch`;
|
|
export OUROS;
|
|
(cd perl; ln -s arch/${OUROS} bin)
|
|
}
|
|
|
|
[ -d perl/bin ] || do_setup_perl # need perl, even for cleanup mode
|
|
|
|
# Pick up mode as an argument
|
|
if [ $# -gt 0 -a \( "$1" = timesync -o "$1" = checktime \
|
|
-o "$1" = setup -o "$1" = cleanup -o "$1" = config \) ] ; then
|
|
mode=$1
|
|
shift
|
|
else
|
|
mode=$0
|
|
sm=`echo $mode | cut -f2 -d/` # strip ./ from name
|
|
if [ -n "$sm" ] ; then
|
|
mode=$sm
|
|
fi
|
|
|
|
fi
|
|
|
|
if [ "$mode" = setup ] ; then # setup mode
|
|
# check to see if our binaries are configured right
|
|
#echo "Checking links"
|
|
[ -d gd ] || do_setup gd
|
|
[ -d gnuplot ] || do_setup gnuplot
|
|
[ -x bin/mailclient ] || (cd bin; ln -s `./nsarch`/bin/mailclient .)
|
|
fi
|
|
|
|
extra=""
|
|
if [ `uname -s` = HP-UX ] ; then # HP uses remsh for remote exec
|
|
extra="RSH=/usr/bin/remsh $extra"
|
|
fi
|
|
|
|
gconf=conf/general.wld # default file for machines info
|
|
oldmach=conf/all.tbd
|
|
if [ -f $oldmach ] ; then # BACK COMPAT 4.0, 4.1
|
|
echo "Found old style machine configuration file $oldmach."
|
|
perl/bin/perl -Ibin -- bin/setup.pl $mode -w $gconf -m $oldmach $extra "$@"
|
|
else
|
|
perl/bin/perl -Ibin -- bin/setup.pl $mode -w $gconf $extra "$@"
|
|
fi
|
|
|
|
|
|
if [ "$mode" = cleanup ] ; then # cleanup mode
|
|
#echo "Check for old links"
|
|
# remove any configured links. if these are directories, it will fail
|
|
rm -f perl/bin gd gnuplot 2> /dev/null
|
|
|
|
# the built in [ on Solaris does not have -L
|
|
/usr/bin/test -L bin/mailclient && rm -f bin/mailclient
|
|
fi
|