Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #
- # Fetch and Installation script by Quixadhal <quixadhal@shadowlord.org>
- #
- GURBA_GIT="git@github.com:sirdude/gurbalib.git"
- DGD_GIT="git@github.com:dworkin/dgd.git"
- TOP_DIR="$PWD"
- LIB_DIR="$TOP_DIR/gurba/lib"
- TELNET_PORT=4000 # default value
- BIN_PORT=$[ $TELNET_PORT + 1 ]
- FTP_PORT=$[ $TELNET_PORT + 1 ]
- MUD_NAME=""
- EMAIL=""
- URL=""
- function get_config {
- while :
- do
- read -e -i "$MUD_NAME" -p "Please enter your MUD name> " MUD_NAME
- read -e -i "$TELNET_PORT" -p "Please enter a PORT number for the MAIN TELNET port> " TELNET_PORT
- BIN_PORT=$[ $TELNET_PORT + 1 ]
- FTP_PORT=$[ $TELNET_PORT + 1 ]
- read -e -i "$BIN_PORT" -p "Please enter a PORT number for the BINARY port> " BIN_PORT
- read -e -i "$EMAIL" -p "Please enter your EMAIL address> " EMAIL
- read -e -i "$URL" -p "Please enter your WEB server URL> " URL
- echo -en "You specified the following options -- \n"
- echo -en "\t\tMUD Name: $MUD_NAME\n"
- echo -en "\t\tMUD PORT: $TELNET_PORT\n"
- echo -en "\t\tBINARY PORT: $BIN_PORT\n"
- echo -en "\t\tEMAIL: $EMAIL\n"
- echo -en "\t\tURL: $URL\n"
- read -e -p "Is that correct? (Y/N): " OK
- case "$OK" in
- [yY] | [yY][eE][sS] )
- break
- ;;
- esac
- done
- echo -en "\n"
- return 0
- }
- function fetch_gurba {
- echo -en "Fetching gurba distribution..."
- git clone -q $GURBA_GIT gurba >$TOP_DIR/fetch.log 2>&1
- if [ -d gurba ]; then
- echo -en "done.\n"
- return 0
- else
- echo -en "\n\nFailed to retrieve Gurbalib!\n\n"
- cat $TOP_DIR/fetch.log
- echo -en "\n\nFailed to retrieve Gurbalib!\n\n"
- exit 1
- fi
- }
- function setup_dirs {
- echo -en "Creating missing data directories..."
- cd gurba
- cat <<EOM | perl scripts/create_data_dirs.pl >>$TOP_DIR/fetch.log 2>&1
- y
- y
- y
- EOM
- cd ..
- echo -en "done.\n"
- return 0
- }
- function fetch_dgd {
- echo -en "Fetching DGD distribution..."
- cd gurba/src
- git clone -q $DGD_GIT dgd >>$TOP_DIR/fetch.log 2>&1
- if [ -d dgd ]; then
- cd ../..
- echo -en "done.\n"
- return 0
- else
- echo -en "\n\nFailed to retrieve DGD!\n\n"
- cat $TOP_DIR/fetch.log
- echo -en "\n\nFailed to retrieve DGD!\n\n"
- exit 1
- fi
- }
- function setup_makefile {
- echo -en "Configuring Makefile..."
- cd gurba/src/dgd/src
- patch >$TOP_DIR/make.log 2>&1 <<EOM
- --- Makefile.orig 2013-09-09 11:32:42.298783919 -0400
- +++ Makefile 2013-09-09 11:39:48.540900428 -0400
- @@ -39,7 +39,7 @@
- \$(error HOST is undefined)
- endif
- -DEFINES=-D\$(HOST) # -DSLASHSLASH -DNETWORK_EXTENSIONS -DNOFLOAT -DCLOSURES -DCO_THROTTLE=50
- +DEFINES=-D\$(HOST) -DSLASHSLASH -DNETWORK_EXTENSIONS # -DNOFLOAT -DCLOSURES -DCO_THROTTLE=50
- DEBUG= -g
- CCFLAGS=\$(DEFINES) \$(DEBUG)
- CFLAGS= -I. -Icomp -Ilex -Ied -Iparser -Ikfun \$(CCFLAGS)
- EOM
- cd ../../../..
- echo -en "done.\n"
- return 0
- }
- function build_dgd {
- echo -en "Building DGD driver..."
- cd gurba/src/dgd/src
- make >>$TOP_DIR/make.log 2>&1 && make install >>$TOP_DIR/make.log 2>&1
- if [ -f ../bin/driver ]; then
- cp -p ../bin/driver ../../../bin/
- cd ../../../..
- echo -en "done.\n"
- return 0
- else
- echo -en "\n\nFailed to build DGD!\n\n"
- cat $TOP_DIR/make.log
- echo -en "\n\nFailed to build DGD!\n\n"
- exit 1
- fi
- }
- function setup_config {
- echo -en "Setting up configuration files..."
- cd gurba
- cp -p mud.dgd.examp mud.dgd
- patch >$TOP_DIR/config.log 2>&1 <<EOM
- --- mud.dgd.examp 2013-09-09 13:06:33.616248233 -0400
- +++ mud.dgd 2013-09-09 13:06:50.971847581 -0400
- @@ -1,6 +1,6 @@
- -telnet_port = 4000; /* telnet port number */
- -binary_port = 4001;
- -directory = "/gurbalib/lib/";/* base directory (MUST be absolute) */
- +telnet_port = $TELNET_PORT; /* telnet port number */
- +binary_port = $BIN_PORT;
- +directory = "$LIB_DIR/";/* base directory (MUST be absolute) */
- users = 40; /* max # of users */
- editors = 40; /* max # of editor sessions */
- ports = 16; /* max # of open ports
- EOM
- cp -p scripts/startmud bin/startmud
- cd bin
- patch >>$TOP_DIR/config.log 2>&1 <<EOM
- --- startmud.orig 2013-09-09 13:06:33.616248233 -0400
- +++ startmud 2013-09-09 13:06:50.971847581 -0400
- @@ -1,6 +1,6 @@
- #!/bin/bash
- -ROOT=/Users/mein/mud/dgd/gurbalib
- +ROOT=$LIB_DIR
- LOG=\$ROOT/lib/logs/gurba-driver.log
- rm -rf \$LOG
- EOM
- cd ..
- cd lib/kernel/include
- cp -p local_config.h.default local_config.h
- patch >>$TOP_DIR/config.log 2>&1 <<EOM
- --- local_config.h.default 2013-09-09 13:06:33.608248418 -0400
- +++ local_config.h 2013-09-09 13:06:50.975847489 -0400
- @@ -10,16 +10,16 @@
- */
- /* What you want your mud to be called (avoid spaces) */
- -#define MUD_NAME "GurbaLib"
- +#define MUD_NAME "$MUD_NAME"
- /* Name for your mud on Intermud (avoid spaces) */
- -#define IMUD_NAME "GurbaLib"
- +#define IMUD_NAME "$MUD_NAME"
- /* To define your email address: */
- -#define ADMIN_EMAIL "you@some.place"
- +#define ADMIN_EMAIL "$EMAIL"
- /* Website for the mud if you have one */
- -#define WEBSITE "https://github.com/sirdude/gurbalib"
- +#define WEBSITE "$URL"
- /* To set the linkdeadth timeout (after this linkdead players will be
- disconnected) */
- EOM
- cd ../../../..
- echo -en "done.\n"
- return 0
- }
- get_config
- fetch_gurba
- setup_dirs
- fetch_dgd
- setup_makefile
- build_dgd
- setup_config
- cat <<EOM
- It looks like everything worked, but you might want to double-check
- the log files that were created in this directory.
- If they look ok, you can launch the MUD by running the startmud script
- ./gurba/bin/startmud
- If all went well, you can now connect to the telnet port of your local
- machine.
- telnet localhost $TELNET_PORT
- The first character logging in will automatically get the
- admin role, so be sure its you.
- Gurbalib ships with an ftp server which is enabled by default,
- on whatever port you select + 1, currently $FTP_PORT.
- For more information, please read the documentation in ./gurba/doc/
- EOM
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement