view dgl/dgamelaunch.conf @ 21:453278a81371

Add tablerecent() so recent.cgi will work as before. Port the tablerecent() function, which reads the most recent games directly from the logfile instead of the database. This allows recent.cgi to show games immediately without waiting for the recorder to put them in the database.
author John "Elwin" Edwards <elwin@sdf.org>
date Mon, 17 Sep 2012 13:41:10 -0700
parents f501c8dd6884
children ce26225f7d9d
line wrap: on
line source

# rlgallery.org configuration file for dgamelaunch


# Global config variables:


# Max amount of registered users to allow. Has no effect if dgl was
# compiled with SQLite
maxusers = 4096

# Allow registration of new nicks? (yes or no)
allow_new_nicks = yes

# Max length for newly registered nicks. Must be less than 20.
# By default, NetHack only stores the first 10 chars of a name into
# the record/logfile.
maxnicklen = 10

# Set the default watching-screen sorting mode. Can be one of
# "unsorted", "username" or "idletime".  Unsorted is the default.
sortmode = "username"

# Path to a prepared chroot jail.
chroot_path = "/var/dgl/"

# From inside the jail, dgamelaunch's working directory for rcfiles/ttyrec/etc
dglroot = "/dgldir/"

# Server ID string
server_id = "Roguelike Gallery - rlgallery.org"

# From inside the jail, location of a banner file, the topmost line will be
# shown in submenus that cannot be defined separately.
# Some string substitution is done for the file:
# $VERSION   replaced with "dgamelaunch v" + dgl version number.
# $SERVERID  replaced with the server_id string, as defined above.
banner = "/dgldir/dgl-banner"

# The following two options are fairly insecure. They will force us to
# load the password/group database into memory while still having root
# privileges. Replace them with shed_uid/shed_gid entries as soon as
# possible if you decide to use them. dgamelaunch will inform you of
# the uids/gids corresponding to your choices when it loads.
#
# Note that shed_uid and shed_gid will always take precedence over
# shed_user and shed_group if they are specified.

# shed_user: username to shed privileges to
#shed_user = "games"
# shed_group: group name to shed privileges to
#shed_group = "games"

# Preferably, you may use the respective gids/uids. This is for Debian:
# Use the rodney account instead of games:games
shed_uid = 501
shed_gid = 501

# The defaults are usually just fine for this. passwd refers to the file
# that stores the user database, and lockfile is only used internally by
# dgamelaunch.
# passwd doesn't matter if dgl was compiled with SQLite, as the name of
# the sqlite database will be defined at compile time.
passwd = "/dgldir/dgl-login"
lockfile = "/dgldir/dgl-lock"

#
# define some commands that are run when something happens. format is
# commands [ <time> ] = <command> ...
#
# <time> can be one of:
#   dglstart  = when someone telnets in
#   login     = when user has logged in
#   register  = right after a new user is registered
#   gamestart = just before a game is started
#
# <command> is:
#   mkdir "foo"        = create a directory "foo"
#   chdir "foo"        = change current work dir to "foo"
#   cp "foo" "bar"     = copy file "foo" to "bar", overwriting previous "bar"
#   ifnxcp "foo" "bar" = copy file "foo" to "bar", if "bar" doesn't exist
#   unlink "foo"       = delete file "foo"
#   setenv "foo" "bar" = set environment variable "foo" to "bar"
#   exec "foo" "bar"   = execute "foo" with "bar" as it's param
#   chpasswd           = do the change password prompting, if logged in
#   chmail             = do the change email prompting, if logged in
#   watch_menu         = go to the watching menu
#   quit               = quit dgl
#   ask_login          = do the login prompting, if not logged in
#   ask_register       = do register new user prompting, if not logged in and
#                        registration of new nicks is allowed.
#   edit_options "foo" = edit options for game which has the short name "foo"
#                        (user must be logged in)
#   play_game "foo"    = start game which has the short name "foo"
#                        (user must be logged in)
#   submenu "foo"      = go to submenu "foo"
#   return             = return from submenu
#
# The commands will be done inside the chroot and with the uid and gid
# defined above.
# Parameters to the commands are subject to variable substitution:
#   %r = dglroot, as defined above
#   %n = user nick, if user is logged in
#   %u = shed_uid, as defined above, but numeric
#   %g = game name, if user has selected a game.
#
# eg. commands[login] = mkdir "foo", unlink "bar", setenv "Z" "foo"
#

# create the user's dirs when they register
commands[register] = mkdir "%ruserdata/%n",
                     mkdir "%rttyrec/%n",
                     mkdir "%rttyrec/%n/rogue3",
                     mkdir "%rttyrec/%n/rogue4",
                     mkdir "%rttyrec/%n/rogue5",
                     mkdir "%rttyrec/%n/srogue",
                     mkdir "%rttyrec/%n/arogue5"

commands[login] = mkdir "%ruserdata/%n",
                  mkdir "%rttyrec/%n",
                  mkdir "%rttyrec/%n/rogue3",
                  mkdir "%rttyrec/%n/rogue4",
                  mkdir "%rttyrec/%n/rogue5",
                  mkdir "%rttyrec/%n/srogue",
                  mkdir "%rttyrec/%n/arogue5"





# Define the main menus.
# You _must_ define "mainmenu_anon" and "mainmenu_user".
# $VERSION and $SERVERID will be replaced, as per the bannerfile above.

# First, the menu shown to anonymous user:
menu["mainmenu_anon"] {
        bannerfile = "/dgldir/dgl_menu_main_anon.txt"
        commands["l"] = ask_login
        commands["r"] = ask_register
        commands["w"] = watch_menu
        commands["q"] = quit
}

# Then the menu shown when the user has logged in:
# $USERNAME in here will be replaced with the user name.
menu["mainmenu_user"] {
# contents of this file are written to screen.
# the file must be inside the chroot.
        bannerfile = "/dgldir/dgl_menu_main_user.txt"
# after which cursor is moved to this location
# if cursor-definition is missing, the cursor is put
# to the end of the last line of the banner.
#        cursor = (5,18)
# keys we accept. format is
#  commands["string_of_keys"] = <commandlist>
# for example, you could use commands["qQ"] = quit
        commands["c"] = chpasswd
        commands["e"] = chmail
        commands["w"] = watch_menu
        commands["3"] = play_game "RogV3"
        commands["4"] = play_game "RogV4"
        commands["5"] = play_game "RogV5"
        commands["Ss"] = play_game "SRog"
        commands["Aa"] = play_game "ARog5"
        commands["q"] = quit
}

# this menu is shown when user presses '?' in the watching menu
menu["watchmenu_help"] {
	bannerfile = "/dgldir/dgl_menu_watchmenu_help.txt"
	commands["qQ "] = return
}


# Next, we'll define one game's data:

#DEFINE {
#  # From inside the jail, the location of the binary to be launched.
#  game_path = "/bin/nethackstub"
#
#  # Full name of the game
#  game_name = "NetHack stub"
#
#  # Short name, used in the watching menu
#  short_name = "NHstb"
#
#  # arguments for when we exec the binary
#  game_args = "/bin/nethackstub",
#	      "foo",
#	      "user:%n",
#	      "shed_uid:%u",
#	      "bar"
#
#  # From inside the jail, where dgamelaunch should put mail.
#  spooldir = "/var/mail/"
#
#  # From inside the jail, the default .nethackrc that is copied for new users.
#  # rc_template = "/dgl-default-rcfile"
#
#  # Make sure the inprogress dir actually exists. default is "inprogress/"
#  # Each game you define here must have it's own.
#  inprogressdir = "%rinprogress-nethackstub/"
#
#  # We can also define per-game commands, that are executed
#  # when the game starts:
#  # commands = chdir "/dgldir", mkdir "foo_%u_%g"
#}


#DEFINE {
#  game_path = "/nh343/nethack"
#  game_name = "NetHack 3.4.3"
#  short_name = "NH343"
#
#  game_args = "/nh343/nethack", "-u", "%n"
#
#  spooldir = "/mail/"
#  rc_template = "/dgl-default-rcfile.nh343"
#
#  rc_fmt = "%ruserdata/%n/%n.nh343rc"
#
#  inprogressdir = "%rinprogress-nh343/"
#
## The place where ttyrecs are stored for this game.
## If this is not defined, ttyrecs are not saved for this game.
## Leaving this undefined also means the games cannot be spectated.
#  ttyrecdir = "%ruserdata/%n/ttyrec/"
#
#
#  # back up savefile
#  commands = cp "/nh343/var/save/%u%n.gz" "/nh343/var/save/%u%n.gz.bak",
#  # set NETHACKOPTIONS to point to the rcfile
#             setenv "NETHACKOPTIONS" "@%ruserdata/%n/%n.nh343rc",
#  # set up nethack mail stuff, assuming it's compiled with it...
#             setenv "MAIL" "/mail/%n",
#             setenv "SIMPLEMAIL" "1",
#  # don't let the mail file grow
#             unlink "/mail/%n"
#}

# Rogue V3: short and simple, like the game
DEFINE {
  game_path = "/bin/rogue3"
  game_name = "Rogue V3 (3.6)"
  short_name = "RogV3"

  game_args = "/bin/rogue3", "-n", "%n"

  inprogressdir = "%rinprogress-rogue3/"
  ttyrecdir = "%rttyrec/%n/rogue3/"

  # Don't do anything with rcfiles.  Rogue has none.

  # Back up the savefile, just in case
  commands = cp "/var/games/roguelike/rogue3save/%u-%n.r3sav" "%rbackup/%u-%n.r3sav.bak"
}

# Rogue V4: just like it, but a little different
DEFINE {
  game_path = "/bin/rogue4"
  game_name = "Rogue V4 (5.2)"
  short_name = "RogV4"

  game_args = "/bin/rogue4", "-n", "%n"
  inprogressdir = "%rinprogress-rogue4/"
  ttyrecdir = "%rttyrec/%n/rogue4/"

  commands = cp "/var/games/roguelike/rogue4save/%u-%n.r4sav" "%rbackup/%u-%n.r4sav.bak"
}

# Rogue V5: a little more different from both
DEFINE {
  game_path = "/bin/rogue5"
  game_name = "Rogue V5 (5.4)"
  short_name = "RogV5"

  game_args = "/bin/rogue5", "-n", "%n"
  inprogressdir = "%rinprogress-rogue5/"
  ttyrecdir = "%rttyrec/%n/rogue5/"

  commands = cp "/var/games/roguelike/rogue5save/%u-%n.r5sav" "%rbackup/%u-%n.r5sav.bak"
}

# Super-Rogue: different?
DEFINE {
  game_path = "/bin/srogue"
  game_name = "Super-Rogue"
  short_name = "SRog"

  game_args = "/bin/srogue", "-n", "%n"
  inprogressdir = "%rinprogress-srogue/"
  ttyrecdir = "%rttyrec/%n/srogue/"

  commands = cp "/var/games/roguelike/sroguesave/%u-%n.srsav" "%rbackup/%u-%n.srsav.bak"
}

# Advanced Rogue 5: not different?
DEFINE {
  game_path = "/bin/arogue5"
  game_name = "Advanced Rogue 5"
  short_name = "ARog5"

  game_args = "/bin/arogue5", "-n", "%n"
  inprogressdir = "%rinprogress-arogue5/"
  ttyrecdir = "%rttyrec/%n/arogue5/"

  commands = cp "/var/games/roguelike/arogue5save/%u-%n.ar5sav" "%rbackup/%u-%n.ar5sav.bak"
}