diff --git a/package/blindcoder/dgamelaunch/dgamelaunch.conf b/package/blindcoder/dgamelaunch/dgamelaunch.conf new file mode 100644 index 000000000..65b2b6efb --- /dev/null +++ b/package/blindcoder/dgamelaunch/dgamelaunch.conf @@ -0,0 +1,72 @@ +# --- ROCK-COPYRIGHT-NOTE-BEGIN --- +# +# This copyright note is auto-generated by ./scripts/Create-CopyPatch. +# Please add additional copyright information _after_ the line containing +# the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by +# the ./scripts/Create-CopyPatch script. Do not edit this copyright text! +# +# ROCK Linux: rock-src/package/blindcoder/dgamelaunch/dgamelaunch.conf +# ROCK Linux is Copyright (C) 1998 - 2004 Clifford Wolf +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. A copy of the GNU General Public +# License can be found at Documentation/COPYING. +# +# Many people helped and are helping developing ROCK Linux. Please +# have a look at http://www.rocklinux.org/ and the Documentation/TEAM +# file for details. +# +# --- ROCK-COPYRIGHT-NOTE-END --- + +dgamelaunch_postmake(){ + cp ${confdir}/etc_dgamelaunch.conf ${root}/etc/dgamelaunch.conf + mkdir -p ${root}/usr/games/lib/dgamelaunch/inprogress + mkdir -p ${root}/usr/games/lib/dgamelaunch/mail + mkdir -p ${root}/usr/games/lib/dgamelaunch/rcfiles + mkdir -p ${root}/usr/games/lib/dgamelaunch/ttyrec + touch ${root}/usr/games/lib/dgamelaunch/dgl-lock + touch ${root}/usr/games/lib/dgamelaunch/dgl-login + cat >>${root}/usr/games/lib/dgamelaunch/dgl-banner< for details or a copy of the source code. +## ** Games on this server are recorded for in-progress viewing and playback! +EOF + cat >>${root}/usr/games/lib/dgamelaunch/dgl-default-rcfile <<-EOF +# This is an example nethackrc file. You should edit this to suit the needs +# of your personal nethack build and add some reasonable default options +# for your users. + +# If you compiled dgamelaunch with the \`vi' editor enabled instead of ee, +# perhaps a helpful blurb such as this might help: + +# This editor is vi-like. Type ESC a couple times, then ':q!' (without quotes) +# to exit if you get stuck. To save, hit ESC and then ZZ or type ':wq' +# (without quotes.) To insert text, hit 'i' to enter insert mode. + +# Here are some examples of reasonable defaults: + +OPTIONS=showexp,showscore,time,color,!autopickup +OPTIONS=autodig,fruit:slime mold,boulder:0 + +# For more information on what you can set in your nethackrc file, refer to: +# http://www.nethack.org/v343/Guidebook.html#_TOCentry_42 +# Happy hacking! +EOF + + # TODO This should later get postinstall + echo -e "#!/bin/bash\n/usr/sbin/dgamelaunch -q -f /etc/dgamelaunch.conf" >${root}/usr/sbin/dgamelaunch_telnetd + chmod +x ${root}/usr/sbin/dgamelaunch_telnetd + chown 0.0 ${root}/usr/sbin/dgamelaunch_telnetd + grep -q dgamelaunch /etc/inetd.conf || cat >>/etc/inetd.conf< +[M] Benjamin Schieder + +[C] extra/game + +[L] GPL +[S] Stable +[V] 1.4.6 +[P] X -----5---9 800.000 + +[D] 3155849319 dgamelaunch-1.4.6.tar.gz http://alt.org/~joshk/ + diff --git a/package/blindcoder/dgamelaunch/etc_dgamelaunch.conf b/package/blindcoder/dgamelaunch/etc_dgamelaunch.conf new file mode 100644 index 000000000..6e1b29ef8 --- /dev/null +++ b/package/blindcoder/dgamelaunch/etc_dgamelaunch.conf @@ -0,0 +1,58 @@ +# This is a sample dgamelaunch configuration file. Only bash-style comments +# are allowed, such as this. Each configuration option will be explained +# along with its default value. + +# 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 = "daemon" +# shed_group: group name to shed privileges to +#shed_group = "games" + +# Preferably, you may use the respective gids/uids. This is for Debian: +shed_uid = 2 +shed_gid = 4 + +# Max amount of registered users to allow. +maxusers = 64000 + +# Path to a prepared chroot jail. +chroot_path = "/" + +# From inside the jail, the location of the binary to be launched. +game_path = "/usr/games/lib/nethackdir/nethack" +game_name = "NetHack" + +# From inside the jail, dgamelaunch's working directory for rcfiles/ttyrec/etc +dglroot = "/usr/games/lib/dgamelaunch/" + +# From inside the jail, where dgamelaunch should put mail - should match up with +# NetHack settings. +spooldir = "/usr/games/lib/dgamelaunch/mail/" + +# From inside the jail, location of a banner file that contains no more than +# 14 lines of 80-column width text. Any more will be truncated. +banner = "/usr/games/lib/dgamelaunch/dgl-banner" + +# From inside the jail, the default .nethackrc that is copied for new users. +rc_template = "/usr/games/lib/dgamelaunch/dgl-default-rcfile" + +# 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 = "/usr/games/lib/dgamelaunch/dgl-login" +lockfile = "/usr/games/lib/dgamelaunch/dgl-lock" + +# From inside the jail, the path to the savefile. %u is replaced by the +# decimal representation of shed_uid, %n is replaced by the player's +# user name. Before starting the game, this file is copied to its name +# with ".bak" appended. Set to an empty string to disable this copying. +savefilefmt = "/usr/game/lib/dgamelaunch/%u%n.gz" diff --git a/package/blindcoder/dgamelaunch/nh343-simple_mail.diff b/package/blindcoder/dgamelaunch/nh343-simple_mail.diff new file mode 100644 index 000000000..41b42bf61 --- /dev/null +++ b/package/blindcoder/dgamelaunch/nh343-simple_mail.diff @@ -0,0 +1,233 @@ +# --- ROCK-COPYRIGHT-NOTE-BEGIN --- +# +# This copyright note is auto-generated by ./scripts/Create-CopyPatch. +# Please add additional copyright information _after_ the line containing +# the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by +# the ./scripts/Create-CopyPatch script. Do not edit this copyright text! +# +# ROCK Linux: rock-src/package/blindcoder/dgamelaunch/nh343-simple_mail.diff +# ROCK Linux is Copyright (C) 1998 - 2004 Clifford Wolf +# +# This patch file is dual-licensed. It is available under the license the +# patched project is licensed under, as long as it is an OpenSource license +# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms +# of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# +# --- ROCK-COPYRIGHT-NOTE-END --- + +diff -urN orig/nethack-3.4.3/include/decl.h nethack-3.4.3/include/decl.h +--- orig/nethack-3.4.3/include/decl.h 2003-12-07 15:39:13.000000000 -0800 ++++ nethack-3.4.3/include/decl.h 2004-01-03 15:57:34.000000000 -0800 +@@ -385,6 +385,10 @@ + }; + #endif /* AUTOPICKUP_EXCEPTIONS */ + ++#ifdef SIMPLE_MAIL ++E int mailckfreq; ++#endif ++ + #undef E + + #endif /* DECL_H */ +diff -urN orig/nethack-3.4.3/include/flag.h nethack-3.4.3/include/flag.h +--- orig/nethack-3.4.3/include/flag.h 2003-12-07 15:39:13.000000000 -0800 ++++ nethack-3.4.3/include/flag.h 2004-01-03 15:57:34.000000000 -0800 +@@ -175,6 +175,9 @@ + uchar bouldersym; /* symbol for boulder display */ + boolean travel1; /* first travel step */ + coord travelcc; /* coordinates for travel_cache */ ++#ifdef SIMPLE_MAIL ++ boolean simplemail; /* simple mail format $NAME:$MESSAGE */ ++#endif + #ifdef WIZARD + boolean sanity_check; /* run sanity checks */ + boolean mon_polycontrol; /* debug: control monster polymorphs */ +diff -urN orig/nethack-3.4.3/include/unixconf.h nethack-3.4.3/include/unixconf.h +--- orig/nethack-3.4.3/include/unixconf.h 2003-12-07 15:39:13.000000000 -0800 ++++ nethack-3.4.3/include/unixconf.h 2004-01-03 15:57:34.000000000 -0800 +@@ -193,7 +193,6 @@ + # endif + #endif + +-#define MAILCKFREQ 50 + #endif /* MAIL */ + + +diff -urN orig/nethack-3.4.3/src/mail.c nethack-3.4.3/src/mail.c +--- orig/nethack-3.4.3/src/mail.c 2003-12-07 15:39:13.000000000 -0800 ++++ nethack-3.4.3/src/mail.c 2004-01-03 16:07:21.000000000 -0800 +@@ -5,6 +5,8 @@ + #include "hack.h" + + #ifdef MAIL ++#include ++#include + #include "mail.h" + + /* +@@ -36,6 +38,8 @@ + STATIC_DCL boolean FDECL(md_rush,(struct monst *,int,int)); + STATIC_DCL void FDECL(newmail, (struct mail_info *)); + ++int mailckfreq = 0; ++ + extern char *viz_rmin, *viz_rmax; /* line-of-sight limits (vision.c) */ + + #ifdef OVL0 +@@ -464,11 +468,15 @@ + void + ckmailstatus() + { ++#ifdef SIMPLE_MAIL ++ if (mailckfreq == 0) ++ mailckfreq = (iflags.simplemail ? 5 : 10); ++#else ++ mailckfreq = 10; ++#endif ++ + if(!mailbox || u.uswallow || !flags.biff +-# ifdef MAILCKFREQ +- || moves < laststattime + MAILCKFREQ +-# endif +- ) ++ || moves < laststattime + mailckfreq) + return; + + laststattime = moves; +@@ -501,9 +509,68 @@ + readmail(otmp) + struct obj *otmp; + { +-# ifdef DEF_MAILREADER /* This implies that UNIX is defined */ ++#ifdef DEF_MAILREADER + register const char *mr = 0; ++#endif /* DEF_MAILREADER */ ++#ifdef SIMPLE_MAIL ++ if (iflags.simplemail) ++ { ++ FILE* mb = fopen(mailbox, "r"); ++ char curline[102], *msg; ++ boolean seen_one_already = FALSE; ++ struct flock fl = { 0 }; ++ ++ fl.l_type = F_RDLCK; ++ fl.l_whence = SEEK_SET; ++ fl.l_start = 0; ++ fl.l_len = 0; ++ ++ if (!mb) ++ goto bail; ++ ++ /* Allow this call to block. */ ++ if (fcntl (fileno (mb), F_SETLKW, &fl) == -1) ++ goto bail; ++ ++ errno = 0; ++ ++ while (fgets(curline, 102, mb) != NULL) ++ { ++ fl.l_type = F_UNLCK; ++ fcntl (fileno(mb), F_UNLCK, &fl); ++ ++ pline("There is a%s message on this scroll.", ++ seen_one_already ? "nother" : ""); ++ ++ msg = strchr(curline, ':'); ++ ++ if (!msg) ++ goto bail; ++ ++ *msg = '\0'; ++ msg++; ++ ++ pline ("This message is from '%s'.", curline); ++ ++ msg[strlen(msg) - 1] = '\0'; /* kill newline */ ++ pline ("It reads: \"%s\".", msg); ++ ++ seen_one_already = TRUE; ++ errno = 0; ++ ++ fl.l_type = F_RDLCK; ++ fcntl(fileno(mb), F_SETLKW, &fl); ++ } + ++ fl.l_type = F_UNLCK; ++ fcntl(fileno(mb), F_UNLCK, &fl); ++ ++ fclose(mb); ++ unlink(mailbox); ++ return; ++ } ++# endif /* SIMPLE_MAIL */ ++# ifdef DEF_MAILREADER /* This implies that UNIX is defined */ + display_nhwindow(WIN_MESSAGE, FALSE); + if(!(mr = nh_getenv("MAILREADER"))) + mr = DEF_MAILREADER; +@@ -512,15 +578,21 @@ + (void) execl(mr, mr, (char *)0); + terminate(EXIT_FAILURE); + } +-# else +-# ifndef AMS /* AMS mailboxes are directories */ ++# else ++# ifndef AMS /* AMS mailboxes are directories */ + display_file(mailbox, TRUE); +-# endif /* AMS */ +-# endif /* DEF_MAILREADER */ ++# endif /* AMS */ ++# endif /* DEF_MAILREADER */ + + /* get new stat; not entirely correct: there is a small time + window where we do not see new mail */ + getmailstatus(); ++ return; ++ ++#ifdef SIMPLE_MAIL ++bail: ++ pline("It appears to be all gibberish."); /* bail out _professionally_ */ ++#endif + } + + # endif /* UNIX */ +@@ -587,10 +659,7 @@ + static int laststattime = 0; + + if(u.uswallow || !flags.biff +-# ifdef MAILCKFREQ +- || moves < laststattime + MAILCKFREQ +-# endif +- ) ++ || moves < laststattime + mailckfreq) + return; + + laststattime = moves; +diff -urN orig/nethack-3.4.3/sys/unix/unixmain.c nethack-3.4.3/sys/unix/unixmain.c +--- orig/nethack-3.4.3/sys/unix/unixmain.c 2003-12-07 15:39:13.000000000 -0800 ++++ nethack-3.4.3/sys/unix/unixmain.c 2004-01-03 15:57:34.000000000 -0800 +@@ -54,7 +54,9 @@ + register char *dir; + #endif + boolean exact_username; +- ++#ifdef SIMPLE_MAIL ++ char* e_simple = NULL; ++#endif + #if defined(__APPLE__) + /* special hack to change working directory to a resource fork when + running from finder --sam */ +@@ -84,6 +86,12 @@ + } + #endif + ++#ifdef SIMPLE_MAIL ++ /* figure this out early */ ++ e_simple = nh_getenv("SIMPLEMAIL"); ++ iflags.simplemail = (e_simple ? 1 : 0); ++#endif ++ + hname = argv[0]; + hackpid = getpid(); + (void) umask(0777 & ~FCMASK); diff --git a/package/blindcoder/dgamelaunch/pkg_nethack_post.conf b/package/blindcoder/dgamelaunch/pkg_nethack_post.conf new file mode 100644 index 000000000..fa8a15fc6 --- /dev/null +++ b/package/blindcoder/dgamelaunch/pkg_nethack_post.conf @@ -0,0 +1 @@ +var_append patchfiles " " "${base}/package/blindcoder/dgamelaunch/nh343-simple_mail.diff"