# HG changeset patch # User darius # Date 881383019 0 # Node ID 4d6502ffaa5e5b724eba8429dd91b08634700709 # Parent 52b8d91ecc32bc0b0f8b07f498648b89f59574d4 Initial revision diff -r 52b8d91ecc32 -r 4d6502ffaa5e README --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/README Sat Dec 06 04:36:59 1997 +0000 @@ -0,0 +1,9 @@ +All documentary files are located in /docs, including help files on how +to install. Even if you are familiar with the server read the file +README.Changes as it explains how I have restructured the files, as well +as explaining the setup script and Makefile.in. + +If you are new and wish to know how to install the server, read the file +README.Admin. + +-Brandon (9/19/94) - diff -r 52b8d91ecc32 -r 4d6502ffaa5e bin/daemonII Binary file bin/daemonII has changed diff -r 52b8d91ecc32 -r 4d6502ffaa5e bin/dbbackup --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/dbbackup Sat Dec 06 04:36:59 1997 +0000 @@ -0,0 +1,45 @@ +#!/bin/sh +# +# backup the database. +# +# first argument is the old playerfile, if a second argument exists it is +# assumed to be NETREKDIR +# + +if [ X$1 != X ]; then + NETREKDIR=$1 +elif [ X${NETREKDIR} = X ]; then + if [ -f "../etc/conf.netrekdir" ]; then + NETREKDIR=`cat "../etc/conf.netrekdir"` + else + echo "$0: No NETREKDIR variable found, exiting." + exit 1 + fi +fi + +ND=$NETREKDIR +DATE=`date +"%m-%d-%y"` + +if [ ! -f ${ND}/etc/db.players -o ! ${ND}/etc/db.global ]; then + echo "$0: Database not found, exiting." + echo "$0: (expecting: ${ND}/etc/db.players and ${ND}/db.global)" + exit 1 +fi + +if [ ! -d ${ND}/backups ]; then + echo "$0: ${ND}/backups directory not found, exiting." + exit 1 +fi + +echo "$0: creating ${ND}/backups/db.players-${DATE}" +cp ${ND}/etc/db.players ${ND}/backups/db.players-${DATE} + +echo "$0: gzipping ${ND}/backups/db.players-${DATE}" +gzip -9 ${ND}/backups/db.players-${DATE} + +echo "$0: creating ${ND}/backups/db.global-${DATE}" +cp ${ND}/etc/db.global ${ND}/backups/db.global-${DATE} + +# don't bother zipping the globals, they are piddly + +echo "$0: Done." diff -r 52b8d91ecc32 -r 4d6502ffaa5e bin/init.shutdown --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/init.shutdown Sat Dec 06 04:36:59 1997 +0000 @@ -0,0 +1,8 @@ +#!/bin/sh +# +# Called upon reboot, change this to whatever your NETREKDIR should be +# if the system is starting the server on reboot. +# +NETREKDIR=/export/home/netrek/server/ +cd ${NETREKDIR}/bin +./ntstop diff -r 52b8d91ecc32 -r 4d6502ffaa5e bin/init.startup --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/init.startup Sat Dec 06 04:36:59 1997 +0000 @@ -0,0 +1,8 @@ +#!/bin/sh +# +# Called upon reboot, change this to whatever your NETREKDIR should be +# if the system is starting the server on reboot. +# +NETREKDIR=/export/home/netrek/server/ +cd ${NETREKDIR}/bin +./ntstart ${NETREKDIR} diff -r 52b8d91ecc32 -r 4d6502ffaa5e bin/listen Binary file bin/listen has changed diff -r 52b8d91ecc32 -r 4d6502ffaa5e bin/mailcluecheck --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/mailcluecheck Sat Dec 06 04:36:59 1997 +0000 @@ -0,0 +1,10 @@ +#!/bin/sh +# +# Called when a player is ejected. (If the MAIL_CLUELETTER option is set +# in config.h) +# + +EJECTLETTER="lib/eject.letter" +HOST=`hostname` +echo $1@$2 >> ${NETREKDIR}/logs/eject.log +mailx -s'You were ejected from Netrek at ${HOST}' $1@$2 < ${NETREKDIR}/${EJECTLETTER} diff -r 52b8d91ecc32 -r 4d6502ffaa5e bin/makemotd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/makemotd Sat Dec 06 04:36:59 1997 +0000 @@ -0,0 +1,67 @@ +#!/bin/sh +# +# generates a motd with highscores +# +# first argument is the old playerfile, if a second argument exists it is +# assumed to be NETREKDIR. +# +# NOTE: the Old playerfile is assumed to be a gzipped file! This is because +# the dbbackup script gzips it. +# + +if [ $# -eq 0 ]; then + echo "Syntax: '$0 [NETREKDIR]'" + exit 1 +else + OLDPLAYERS=$1 +fi + +if [ X$2 != X ]; then + NETREKDIR=$2 +elif [ X${NETREKDIR} = X ]; then + if [ -f "../etc/conf.netrekdir" ]; then + NETREKDIR=`cat "../etc/conf.netrekdir"` + else + echo "No NETREKDIR variable found, exiting." + exit 1 + fi +fi + +if [ ! -f ${NETREKDIR}/bin/hs ]; then + echo "$0: Highscores program not found, exiting." + echo "$0: (expecting: ${NETREKDIR}/bin/hs)" + exit 1 +fi + +if [ ! -f ${NETREKDIR}/bin/hr ]; then + echo "$0: Honorroll program not found, exiting." + echo "$0: (expecting: ${NETREKDIR}/bin/hr)" + exit 1 +fi + +if [ ! -f ${NETREKDIR}/${OLDPLAYERS} ]; then + echo "$0: Old player db not found, exiting." + echo "$0: (expecting: ${NETREKDIR}/${OLDPLAYERS})" + exit 1 +else + echo -n "$0: Unzipping ${NETREKDIR}/${OLDPLAYERS}..." + gzip -d ${NETREKDIR}/${OLDPLAYERS} + echo "Done." +fi + +if [ ! -f ${NETREKDIR}/etc/motd.body ]; then + echo "$0: \"motd.body\" file not found, exiting." + echo "$0: (expecting: ${NETREKDIR}/etc/motd.body)" + exit 1 +fi + +exit + +cat ${NETREKDIR}/etc/motd.body > ${NETREKDIR}/etc/motd +echo "Scores last updated: `date`" >> motd +${NETREKDIR}/bin/hs -n 35 -c 0 ${NETREKDIR}/${OLDPLAYERS} ${NETREKDIR}/etc/db.players >> ${NETREKDIR}/etc/motd +${NETREKDIR}/bin/hr 120 -m -f ${NETREKDIR}/etc/db.players >> ${NETREKDIR/etc/motd + +echo -n "$0: gzipping ${NETREKDIR}/${OLDPLAYERS}..." +gzip -9 ${NETREKDIR}/${OLDPLAYERS} +echo "Done." diff -r 52b8d91ecc32 -r 4d6502ffaa5e bin/ntserv Binary file bin/ntserv has changed diff -r 52b8d91ecc32 -r 4d6502ffaa5e bin/ntstart --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/ntstart Sat Dec 06 04:36:59 1997 +0000 @@ -0,0 +1,53 @@ +#!/bin/sh +# +# Server startup script for NetrekII (Paradise) +# +# If args1 exists it is assumed it is NETREKDIR, and will be used +# in place of whatever NETREKDIR was before. If NETREKDIR is not +# found it will attempt to find it in ../etc/conf.netrekdir +# + +if [ X$1 != X ]; then + NETREKDIR=$1 +elif [ X${NETREKDIR} = X ]; then + if [ -f "../etc/conf.netrekdir" ]; then + NETREKDIR=`cat "../etc/conf.netrekdir"` + else + echo "No NETREKDIR variable found, exiting." + exit 1 + fi +fi + +PORT=2592 +PLPORT=2591 +LOGS="${NETREKDIR}/logs" + +if [ ! -f "${NETREKDIR}/bin/listen" ]; then + echo "$0: ${NETREKDIR}/bin/listen not found, exiting." + exit 1 +fi + +if [ -f "${LOGS}/server.log" ]; then + echo "$0: Moving server logfile to server.log.old" + mv ${LOGS}/server.log ${LOGS}/server.log.old +fi + +if [ -f ${LOGS}/startup.log ]; then + echo "$0: Moving startup.log to startup.log.old" + mv ${LOGS}/startup.log ${LOGS}/startup.log.old +fi + +echo "Netrek Server Startup at `date` by ${USER}" >> "${LOGS}/startup.log" +echo "NETREKDIR=${NETREKDIR}" >> "${LOGS}/startup.log" +echo "PORT=${PORT}" >> "${LOGS}/startup.log" +echo "PLPORT=${PLPORT}" >> "${LOGS}/startup.log" + +# Startup listen +${NETREKDIR}/bin/listen -p ${PLPORT} +${NETREKDIR}/bin/listen -p ${PORT} + +# Startup the connected players port +if [ -f ${NETREKDIR}/faucet -a -f ${NETREKDIR}/pl ]; then + echo "$0: Starting player listing on port ${PLPORT}" >> ${LOGS}/startup.log + ${NETREKDIR}/faucet ${PLPORT} -out pl & +fi diff -r 52b8d91ecc32 -r 4d6502ffaa5e bin/ntstop --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/ntstop Sat Dec 06 04:36:59 1997 +0000 @@ -0,0 +1,35 @@ +#!/bin/sh +# +# shut down the server +# +# since we don't know who may execute this (if it is called from the system +# upon a machine shutdown, for instance), use ../directory notation +# rather than ${NETREKDIR}, assuming it is executed in ${NETREKDIR}/bin +# +# This will blast the daemon and listen process, it will NOT blast any +# ntserv processes (wait for them to disconnect or do these by hand) +# +# if an argument exists it is taken as the NETREKDIR +# + +if [ X$1 != X ]; then + NETREKDIR=$1 +elif [ X${NETREKDIR} = X ]; then + if [ -f "../etc/conf.netrekdir" ]; then + NETREKDIR=`cat "../etc/conf.netrekdir"` + else + echo "No NETREKDIR variable found, exiting." + exit 1 + fi +fi + +SYSTEM=`hostname` + +echo "" > /tmp/$$.ntstop +echo "${USER}@${SYSTEM}: ******* IMMINENT SYSTEM SHUTDOWN! *******" >> /tmp/$$.ntstop +echo "${USER}@${SYSTEM}: ******* IMMINENT SYSTEM SHUTDOWN! *******" >> /tmp/$$.ntstop +echo "" >> /tmp/$$.ntstop +${NETREKDIR}/bin/mes A -w < /tmp/$$.ntstop +rm /tmp/$$.ntstop +/bin/kill `cat ${NETREKDIR}/logs/listen.pid` 2> /dev/null +/bin/kill `cat ${NETREKDIR}/logs/daemonII.pid` 2> /dev/null diff -r 52b8d91ecc32 -r 4d6502ffaa5e bin/robotII Binary file bin/robotII has changed diff -r 52b8d91ecc32 -r 4d6502ffaa5e setup --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/setup Sat Dec 06 04:36:59 1997 +0000 @@ -0,0 +1,316 @@ +#!/bin/sh +# +# NETREK II -- Paradise server setup script +# +# Permission to use, copy, modify, and distribute this software and its +# documentation for any NON-COMMERCIAL purpose +# (read the files 'src/copyright*.h')) and without +# fee is hereby granted, provided that this copyright notice appear in all +# copies. No representations are made about the suitability of this +# software for any purpose. This software is provided "as is" without +# express or implied warranty. +# +# Xtrek Copyright 1986 Chris Guthrie +# Netrek (Xtrek II) Copyright 1989 Kevin P. Smith +# Scott Silvey +# Paradise (Netrek II) Copyright 1993 Larry Denys +# Kurt Olsen +# Brandon Gillespie +# Rob Forsman +# +# Comprehensive Credits available in the file docs/CREDITS +# +# Note: this is just a quick hack I made, we can probably improve it later +# -Brandon + +trap "rm -f test.c a.out core $0.tmp; exit" 2 3 + +t=" " +i="- " + +echo "-- Netrek II (Paradise) -- + +${t}Setup script for the Netrek II (Paradise) Server. + +${t}To rebuild the Makefile using previous options (in the instance that +${t}Makefile.in was changed), use the \"-p\" (previous) flag, \"make +${t}makefile\" will also execute \"setup -p\". +" + +# figure out what to do with echo -- from perl's Configure +# This blows chunks on Linux; fixed line from echotmp to $0.tmp. + +(echo "hi there \c" ; echo " ") > $0.tmp +if grep c $0.tmp >/dev/null 2>&1 ; then + echo "${i}Supressing newlines with -n..." + n='-n' + c='' +else + echo "${i}Supressing newlines with \\\c..." + n='' + c='\c' +fi + +echo '' +echo $n "${i}The asterisk should be here => $c" +echo '*' +echo '' + +if [ X$1 != X -a X$1 = X"-p" ]; then + echo "${i}Reading previous setup configuration..." + if [ ! -f etc/$0.conf ]; then + echo + echo "${t}previous configuration file (etc/$0.conf) not found!" + exit 1 + fi +else + +########################################################################### +# Global vars +LIBS="-lm" + +########################################################################### +SYS=`(/bin/uname || /usr/bin/uname) 2>/dev/null` + +case $SYS in +SunOS) + # check for Solaris the hard way + if [ "`/bin/uname -rs | cut -c0-9`" != "SunOS 4.1" ]; then + SYS="SOLARIS" + CCOPTIONS="-DSYSV -DSVR4 ${CCOPTIONS}" + LIBS="-lnsl -lsocket ${LIBS}" + fi + ;; +HP-UX) + CCOPTIONS="-Ae -DSYSV ${CCOPTIONS}" + ;; +IRIX) + CCOPTIONS="-mips2 -DSYSV -DSVR4 -DBAD_SVR4_HACKS ${CCOPTIONS}" + LIBS="-lsun ${LIBS}" + ;; +OSF1) + CCOPTIONS="-DSYSV ${CCOPTIONS}" + ;; +*) + # this is a hack because Unixware returns odd things with /bin/uname + echo $n "Are you running Unixware? [yn] (default: n) $c" + read ANSWER + if [ X$ANSWER = X"y" ]; then + SYS="UNIXWARE" + CCOPTIONS="-DSYSV -DSVR4 -DBAD_SVR4_HACKS ${CCOPTIONS}" + LIBS="-lnsl -lsocket -lresolv ${LIBS}" + fi + ;; +esac + +echo "" +echo "${i}Looks like you are running ${SYS}..." +# Should probably check for RAND48, will add later if anybody complains +CCOPTIONS="-D${SYS} -DHAVE_RAND48 ${CCOPTIONS}" + + +############################################################################ +## compiler +echo "" +echo $n "${i}Checking for cc or gcc...$c" + +cat > test.c </dev/null) 2>&1"` +rm -f test.c a.out + +if [ X"$err" != X ]; then + echo "using cc" + CC=cc +else + echo "using gcc" + CC=gcc +fi + +echo $n " + 1 -- Basic optimization (-O -s) + 2 -- Full optimization (-O2 -s) + 3 -- Debug, no optimization (-g) + +Specify optimization/debug state. [123] (default: 1) $c" + +read DEBUG + +if [ X${DEBUG} = X ]; then + DEBUG="1" +fi + +if [ ${DEBUG} = "1" ]; then + DEBUG="Basic optimization." + CDEBUGFLAGS="-O -s" +elif [ ${DEBUG} = "2" ]; then + DEBUG="Full optimization." + CDEBUGFLAGS="-O2 -s" +elif [ ${DEBUG} = "3" ]; then + while [ "${DEBUG}" = "3" ]; do + echo $n " + gdb -- GNU Debugger + dbx -- source level debugger + none -- no debugger + -- other debugger + +Use which debugger? (default: none) $c" + read DEBUGGER + if [ X${DEBUGGER} = X ]; then + DEBUGGER="none" + fi + + if [ ${DEBUGGER} = "none" ]; then + DEBUG="Debug (No debugger), no optimization" + CDEBUGFLAGS="-g" + elif [ ${DEBUGGER} = "gdb" ]; then + DEBUG="Debug (GNU debugger), no optimization" + CDEBUGFLAGS="-ggdb" + elif [ ${DEBUGGER} = "dbx" ]; then + DEBUG="Debug, no optimization" + CDEBUGFLAGS="-gdbx" + else + echo $n "${t}\"${DEBUGGER}\" is an unknown debugger, use anyway? [yn] (default: y) $c" + read ANSWER + if [ X${ANSWER} = X"y" ]; then + DEBUG="Debug (Other: ${DEBUGGER}), no optimization" + CDEBUGFLAGS="-g${DEBUGGER}" + fi + fi + done +else + echo "$0: unknown option \"${DEBUG}\", exiting." + exit 1 +fi + +######################################################################### + +if [ -f "rsa/Makefile" ]; then + echo $n " + You seem to have the RSA files. RSA verification is NOT required + for the server to function, and is usually enabled only on high + profile public servers. + +Do you wish to enable RSA verification? [yn] (default: n) $c" + + read ANSWER + if [ X${ANSWER} = X"y" ]; then + RSA="-DAUTHORIZE" + AUTHOBJS="rsa-server.o rsa_util.o reserved.o" + else + RSA="" + AUTHOBJS="" + fi +else + echo " + RSA files do not exist, RSA verification is not enabled (RSA + verification is not required for the server to run, and is + usually only enabled on high profile public servers)." +fi + +########################################################################### +echo "" +echo $n "${i}Does the mp library exist...$c" + +cat > test.c </dev/null) 2>&1"` +rm -f test.c a.out + +if [ -z "$err" ]; then + echo "yes." + LIBS="-lmp ${LIBS}" + if [ ! -z "$RSA" ]; then + echo "" + echo "${i}Using appropriate mp RSA files." + echo "" + AUTHOBJS="rsa-server.o rsa_utilmp.o reserved.o" + fi +else + echo "no." +fi + +########################################################################### +# strdup() + +echo $n "${i}Does strdup() exist...$c" + +cat > test.c < +main () { char *str, *str2 = "test\n"; str = strdup(str2); } +EOF + +err=`eval "($CC test.c >/dev/null) 2>&1"` +if [ ! -z "$err" ]; then + CCOPTIONS="${CCOPTIONS} -DNO_STRDUP " + echo "no." +else + echo "yes." +fi + +rm -f test.c a.out + +########################################################################## +# qsort() + +echo $n "${i}Does qsort() exist...$c" + +cat > test.c < +main () { qsort(); } +EOF + +err=`eval "($CC test.c >/dev/null) 2>&1"` +rm -f test.c a.out + +if [ ! -z "$err" ]; then + CCOPTIONS="${CCOPTIONS} -DNO_QSORT" + echo "no." +else + echo "yes." +fi + +########################################################################## + +# This is inefficient to do it seperately for each option, but it is +# the cleanest way. + +echo "sed \"s:^#@@LIBS@:LIBS=${LIBS}:g\" src/Makefile.in > /tmp/a\$\$.setup" > etc/$0.conf +echo "sed \"s:^#@@CC@:CC=${CC}:g\" /tmp/a\$\$.setup > /tmp/\$\$.setup" >> etc/$0.conf +echo "sed \"s:^#@@CDEBUGFLAGS@:CDEBUGFLAGS=${CDEBUGFLAGS}:g\" /tmp/\$\$.setup > /tmp/a\$\$.setup" >> etc/$0.conf +echo "sed \"s:^#@@RSA@:RSA=${RSA}:g\" /tmp/a\$\$.setup > /tmp/\$\$.setup" >> etc/$0.conf +echo "sed \"s:^#@@AUTHOBJS@:AUTHOBJS=${AUTHOBJS}:g\" /tmp/\$\$.setup > /tmp/a\$\$.setup" >> etc/$0.conf +echo "sed \"s:^#@@CCOPTIONS@:CCOPTIONS=${CCOPTIONS}:g\" /tmp/a\$\$.setup > /tmp/\$\$.setup" >> etc/$0.conf +echo "echo \$\$" >> etc/$0.conf + +# This 'fi' is from the first if (checking "-d") +fi + +echo "" +echo $n "${i}Generating \"src/Makefile\" from \"src/Makefile.in\"...$c" + +SPID=`sh etc/$0.conf` + +echo "# This file generated by \"$0\" on `date`." > /tmp/${SPID}.Makefile +echo "# Make changes to \"Makefile.in\" and run the setup script" >> /tmp/${SPID}.Makefile +echo "#" >> /tmp/${SPID}.Makefile + +cat /tmp/${SPID}.Makefile > src/Makefile +cat /tmp/${SPID}.setup >> src/Makefile + +rm -f /tmp/${SPID}.setup +rm -f /tmp/a${SPID}.setup +rm -f /tmp/${SPID}.Makefile + +echo "Done." +echo "" +echo " use 'make