#!/usr/local/bin/perl
##################################################################
# The Foundation II LPC Library Server and Library Configuration #
# copyright (c) 1995 George Reese #
# This script will automatically configure your server and your #
# LPC library for execution #
# Simply type ./Configure and answer the questions #
# If at any time you need to execute a command, preceed the #
# command with a ! #
##################################################################
$MAKE = "gmake";
print "This is the Foundation II Object Library's Server and Library\n";
print "Configuration Script. This script will ask you a few questions\n";
print "and then compile your driver, install it, configure your library,\n";
print "and install it. If at any time you need to execute a UNIX command\n";
print "In order to answer a question, preceed the command by a ! symbol\n";
print "and this program will execute it for you.\n\n";
print "The Foundation II Object Library is copyright (c)1992-1996 George Reese\n";
print "Use of the library signifies agreement to the terms of the agreement\n";
print "as specified in Agreement.Foundation.\n";
do {
print "Do you wish to read this file now? ";
} until ($Answer = &GetAnswer(""));
system("more Agreement.Foundation") if substr(lc($Answer), 0, 1) eq "y";
print "\n\nThe name MudOS is copyright 1991-1992 by Erik Kay, Adam Beeman,\n";
print "Stephan Iannce and John Garnett. The MudOS package is copyright\n";
print "1995 Tim Hollebeek. This copyright is included in Copyright.MudOS.\n";
do {
print "Do you wish to read this file now? ";
} until ($Answer = &GetAnswer(""));
system("more Copyright.MudOS") if substr(lc($Answer), 0, 1) eq "y";
do {
print "\nWhat is the name of your MUD?\n[] ";
} until ($MudName = GetAnswer(""));
do {
print "\nIn which directory should your LPC library be placed?\n";
print "[$ENV{'HOME'}] ";
} until ($Mudlib = GetAnswer($ENV{'HOME'}));
if( ! -d $Mudlib ) {
die "Failed to create library dir $Mudlib ...\n"
unless mkdir($Mudlib, 0770);
}
do {
print "\nIn which directory should the MudOS executables be placed?\n";
print "[$ENV{'HOME'}/bin] "
} until ($Bindir = GetAnswer($ENV{'HOME'}."/bin"));
if( ! -d $Bindir ) {
die "Failed to create bin directory $Bindir ...\n"
unless mkdir($Bindir, 0770);
}
print "\n\nGenerating Makefile...\n";
chdir("server") || die "Could not change dir.\n";
system("build.MudOS");
print "\n\nBuilding the MudOS driver, this will take a very long time.\n";
print "Do not panic if it takes especially long for interpret.c and\n";
print "object.c\n\nBuidling MudOS...\n\n";
die "Make clean failed, aborting...\n" if system("$MAKE clean");
die "Make failed, aborting Configure script...\n" if system("$MAKE");
print "\n\nInstalling the driver...\n";
die "Failed to install driver binaries, aborting...\n"
if system("cp driver addr_server $Bindir");
die "Failed to copy mudlib tar file, aborting...\n"
if system("cp ../lib.tar $Mudlib");
chdir("$Mudlib") || die "Could not change dir.\n";
die "Could not untar lib.tar, aborting...\n"
if system("tar -xf lib.tar");
print "\n\nCreating MudOS runtime config file...\n";
open(CFG, ">$Bindir/mudos.cfg");
print CFG <<"EOM";
###############################################################################
# Customizable runtime config file for MudOS v21 #
###############################################################################
# NOTE: All paths specified here are relative to the mudlib directory except #
# for mudlib directory, and binary directory. #
# Lines beginning with a # or a newline are ignored. #
###############################################################################
# name of this mud
EOM
print CFG "name : $MudName\n\n";
print CFG <<"EOM";
# the address server is an external program that lets the mud translate
# internet names to numbers (and vice versa). select an unused port.
address server ip : localhost
address server port : 9999
# absolute pathname of mudlib
EOM
print CFG "mudlib directory : $Mudlib/lib\n\n";
print CFG "# absolute pathname of driver/config dir\n";
print CFG "binary directory : $Bindir\n\n";
print CFG <<"EOM";
# debug.log and author/domain stats are stored here
log directory : /log
# the directories which are searched by #include <...>
# for multiple dirs, separate each path with a ':'
include directories : /secure/include:/include
# Directory to save binaries in. (if BINARIES is defined)
save binaries directory : /secure/save/bin
# the file which defines the master object
master file : /secure/daemon/master
# the file where all global simulated efuns are defined.
simulated efun file : /secure/sefun/sefun
# file to swap out objects; not used if time to swap is 0
swap file : /secure/tmp/swap
# alternate debug.log file name (assumed to be in specified 'log directory')
debug log file : runtime
# This is an include file which is automatically #include'd in all objects
global include file : <global.h>
# if an object is left alone for a certain time, then the
# function clean_up will be called. This function can do anything,
# like destructing the object. If the function isn't defined by the
# object, then nothing will happen.
# This time should be substantially longer than the swapping time.
time to clean up : 1200
# How long time until an unused object is swapped out.
# Machine with too many players and too little memory: 900 (15 minutes)
# Machine with few players and lot of memory: 10000
# Machine with infinite memory: 0 (never swap).
time to swap : 600
# How many seconds until an object is reset again.
time to reset : 1800
# Maximum number of bits in a bit field. They are stored in printable
# strings, 6 bits per byte.
maximum bits in a bitfield : 1200
# Max number of local variables in a function.
maximum local variables : 30
# Maximum amount of "eval cost" per thread - execution is halted when
# it is exceeded.
maximum evaluation cost : 500000
# This is the maximum array size allowed for one single array.
maximum array size : 15000
# This is the maximum allowed size of a variable of type 'buffer'.
maximum buffer size : 400000
# Max size for a mapping
maximum mapping size : 15000
# Max inherit chain size
inherit chain size : 30
# maximum length of a string variable
maximum string length : 200000
# Max size of a file allowed to be read by 'read_file()'.
maximum read file size : 200000
# max number of bytes you allow to be read and written with read_bytes
# and write_bytes
maximum byte transfer : 10000
# Reserve an extra memory area from malloc(), to free when we run out
# of memory and allow the mudlib to shutdown.
# If this value is 0, no area will be reserved.
reserved size : 0
# Define the size of the shared string hash table. This number should
# a prime, probably between 1000 and 30000; if you set it to about 1/5
# of the number of distinct strings you have, you will get a hit ratio
# (number of comparisons to find a string) very close to 1, as found strings
# are automatically moved to the head of a hash chain. You will never
# need more, and you will still get good results with a smaller table.
hash table size : 7001
# Object hash table size.
# Define this like you did with the strings; probably set to about 1/4 of
# the number of objects in a game, as the distribution of accesses to
# objects is somewhat more uniform than that of strings.
object table size : 1501
# default no-matching-action message
default fail message : What?
# default message when error() occurs (optional)
default error message :
# the external ports we support
external_port_1 : telnet 4000
external_port_2 : binary 4001
###############################################################################
# The following aren't currently used or implemented (yet) #
###############################################################################
# maximum number of users in the game (unused currently)
maximum users : 40
# Define the maximum stack size of the stack machine. This stack will also
# contain all local variables and arguments. (unused currently)
evaluator stack size : 1000
# Define the size of the compiler stack. This defines how complex
# expressions the compiler can parse. (unused currently)
compiler stack size : 200
# Define the maximum call depth for functions. (unused currently)
maximum call depth : 30
# There is a hash table for living objects, used by find_living().
# (unused currently)
living hash table size : 100
EOM
close(CFG);
print "\n\nCreating driver wrapper script...\n";
open(WRAPPER, ">$Bindir/startmudos");
print WRAPPER "#!/bin/csh\n\n";
print WRAPPER "while(1)\n\t$Bindir/driver mudos.cfg\nend\n";
close(WRAPPER);
system("chmod 770 $Bindir/startmudos");
print "Configuration complete.\n\n";
print "Issue the following commands:\n";
print "\t$Bindir/startmudos &\n";
print "\ttelnet localhost 4000\n";
sub GetAnswer {
local($def) = @_[0];
local($ans) = "";
$ans = <>;
chop($ans);
if( length($ans) == 0 ) { return $def; }
if( substr($ans, 0, 1) eq "!" ) {
system(substr($ans, 1, length($ans) - 1));
}
else { return $ans; }
return "";
}