summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2003-09-21 04:47:33 +0000
committerMike Frysinger <vapier@gentoo.org>2003-09-21 04:47:33 +0000
commitf5f8e50e7eba104e30d72703e5584f7756f80d86 (patch)
tree58ee7026f2f4dd6e8514b2a2edaeab7a1f87ae0f /games-server/tetrix
parentinitial ebuild (diff)
downloadgentoo-2-f5f8e50e7eba104e30d72703e5584f7756f80d86.tar.gz
gentoo-2-f5f8e50e7eba104e30d72703e5584f7756f80d86.tar.bz2
gentoo-2-f5f8e50e7eba104e30d72703e5584f7756f80d86.zip
its a server
Diffstat (limited to 'games-server/tetrix')
-rw-r--r--games-server/tetrix/ChangeLog24
-rw-r--r--games-server/tetrix/Manifest8
-rw-r--r--games-server/tetrix/files/1.13.16.1.40c-droproot.patch171
-rw-r--r--games-server/tetrix/files/1.13.16.1.40c-paths.patch42
-rw-r--r--games-server/tetrix/files/digest-tetrix-1.13.16.1.40c-r11
-rw-r--r--games-server/tetrix/files/digest-tetrix-1.13.16.1.40c-r21
-rw-r--r--games-server/tetrix/files/tetrix.rc20
-rw-r--r--games-server/tetrix/tetrix-1.13.16.1.40c-r1.ebuild50
-rw-r--r--games-server/tetrix/tetrix-1.13.16.1.40c-r2.ebuild57
9 files changed, 374 insertions, 0 deletions
diff --git a/games-server/tetrix/ChangeLog b/games-server/tetrix/ChangeLog
new file mode 100644
index 000000000000..52847cd1312c
--- /dev/null
+++ b/games-server/tetrix/ChangeLog
@@ -0,0 +1,24 @@
+# ChangeLog for games-puzzle/tetrix
+# Copyright 2002-2003 Gentoo Technologies, Inc.; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/games-server/tetrix/ChangeLog,v 1.1 2003/09/21 04:47:33 vapier Exp $
+
+*tetrix-1.13.16.1.40c-r2 (17 Sep 2002)
+
+ 17 Sep 2003; Mike Frysinger <vapier@gentoo.org> :
+ Add a custom drop root patch. Hate to see this sucker
+ run as root on servers :).
+
+*tetrix-1.13.16.1.40c-r1 (13 Sep 2002)
+
+ 13 Sep 2003; Mike Frysinger <vapier@gentoo.org> :
+ Version bump + games.eclass support + reworked init script.
+
+*tetrix-1.13.16.1.40c (24 May 2002)
+
+ 02 Aug 2003; Chris Gianelloni <wolf31o2@gentoo.org>
+ tetrix-1.13.16.1.40c.ebuild:
+ Fixed to use mirror://sourceforge
+
+ 31 Mar 2003; Philip Walls <malverian@gentoo.org>
+ tetrix-1.13.16.1.40c.ebuild, files/tetrix, files/launch_tetrix :
+ Initial import.
diff --git a/games-server/tetrix/Manifest b/games-server/tetrix/Manifest
new file mode 100644
index 000000000000..6f4c81e29033
--- /dev/null
+++ b/games-server/tetrix/Manifest
@@ -0,0 +1,8 @@
+MD5 754b72a3f6b7b9a3e57ffb181b50240c files/tetrix.rc 501
+MD5 1c284bd8e5ee48f96a0b2206ab4a59be files/digest-tetrix-1.13.16.1.40c-r1 79
+MD5 1c284bd8e5ee48f96a0b2206ab4a59be files/digest-tetrix-1.13.16.1.40c-r2 79
+MD5 27b5d734fed2236551e85ffce4c47ac5 files/1.13.16.1.40c-paths.patch 2235
+MD5 a0341200b76305698044db11d69148e0 files/1.13.16.1.40c-droproot.patch 5224
+MD5 c10c0690cc814dacb9cdbffca4f0756a tetrix-1.13.16.1.40c-r2.ebuild 1416
+MD5 c4694a3e927867422218b18f2491f937 tetrix-1.13.16.1.40c-r1.ebuild 1151
+MD5 f0fa9c22e730a94669737d381207d47e ChangeLog 849
diff --git a/games-server/tetrix/files/1.13.16.1.40c-droproot.patch b/games-server/tetrix/files/1.13.16.1.40c-droproot.patch
new file mode 100644
index 000000000000..f04911f523fb
--- /dev/null
+++ b/games-server/tetrix/files/1.13.16.1.40c-droproot.patch
@@ -0,0 +1,171 @@
+diff -ur src.orig/game.c src/game.c
+--- src.orig/game.c 2003-09-17 13:55:17.000000000 -0400
++++ src/game.c 2003-09-17 23:01:10.644146104 -0400
+@@ -2,6 +2,8 @@
+ game.c
+
+ */
++#include <pwd.h>
++#include <grp.h>
+
+ /* securitywrite() */
+ /* Writes out the security structure into a text format game.secure file */
+@@ -149,6 +151,11 @@
+ fprintf(file_out,"# bindip [0.0.0.0] - What IP should server be bound to (0.0.0.0 means all)\n");
+ fprintf(file_out,"bindip=%s\n", game.bindip);
+ fprintf(file_out,"\n");
++ fprintf(file_out,"# username/group to switch UID/GID to");
++ fprintf(file_out,"droproot=%d\n", game.droproot);
++ fprintf(file_out,"dropuser=%s\n", game.user);
++ fprintf(file_out,"dropgroup=%s\n", game.group);
++ fprintf(file_out,"\n");
+ fprintf(file_out,"# maxchannels [1] - How many channels should be available on server\n");
+ fprintf(file_out,"maxchannels=%d\n", game.maxchannels);
+ fprintf(file_out,"\n");
+@@ -466,6 +473,21 @@
+ strncpy(game.bindip, id_value, IPLEN-1); game.bindip[IPLEN-1]=0;
+ error=0;
+ }
++ if (!strcasecmp(id_tag,"droproot"))
++ {
++ game.droproot=atoi(id_value);
++ error=0;
++ }
++ if (!strcasecmp(id_tag,"dropuser"))
++ {
++ strncpy(game.user, id_value, USERNAMELEN-1); game.bindip[USERNAMELEN-1]=0;
++ error=0;
++ }
++ if (!strcasecmp(id_tag,"dropgroup"))
++ {
++ strncpy(game.group, id_value, USERNAMELEN-1); game.bindip[USERNAMELEN-1]=0;
++ error=0;
++ }
+
+
+ if (!strcasecmp(id_tag,"maxchannels"))
+@@ -854,6 +876,22 @@
+ }
+ fclose(file_in);
+ lvprintf(3,"Read game configuration from %s\n", FILE_CONF);
++ if (game.droproot) {
++ struct passwd *vpw;
++ struct group *vgr;
++ game.droproot = 0;
++ vpw = getpwnam(game.user);
++ if (vpw) {
++ game.userid = vpw->pw_uid;
++ vgr = getgrnam(game.group);
++ if (vgr) {
++ game.groupid = vgr->gr_gid;
++ game.droproot = 1;
++ }
++ }
++ if (!game.droproot)
++ lvprintf(2,"Drop root was requested but the specified user/group were invalid!\n");
++ }
+ return(0);
+ }
+
+diff -ur src.orig/main.c src/main.c
+--- src.orig/main.c 2003-09-17 13:55:17.000000000 -0400
++++ src/main.c 2003-09-17 23:17:43.858154624 -0400
+@@ -4878,10 +4878,13 @@
+ long int timeticks, otimeticks;
+
+ /* Initialise */
++ xx = (argc == 2 && !strcmp(argv[1],"-q"));
++ if (!xx)
+ printf("Loading Tetrix. Please wait...\n");
+ init_main();
+ init_resolver();
+ init_game();
++ if (!xx)
+ printf("Initializing security/ban list...\n");
+ init_security();
+ init_banlist(banlist, MAXBAN);
+@@ -4890,6 +4893,7 @@
+ read_banlist(FILE_BAN_COMPROMISE, combanlist, MAXBAN);
+ init_allowlist();
+ read_allowlist();
++ if (!xx)
+ printf("Initializing winlist...\n");
+ init_winlist(winlist, MAXWINLIST);
+ init_winlist(winlist2, MAXWINLIST);
+@@ -4898,16 +4902,21 @@
+ readwinlist(FILE_WINLIST2, winlist2, MAXWINLIST);
+ readwinlist(FILE_WINLIST3, winlist3, MAXWINLIST);
+ sleep(1);
++ if (!xx)
+ printf("Initialize network connection...\n");
+ init_net();
++ if (!xx)
+ printf("Gameplay ... ");
+ usleep(300000);
+ init_telnet_port();
++ if (!xx)
+ printf("Spectator ... ");
+ usleep(300000);
+ init_playback_port();
++ if (!xx)
+ printf("Ircadm ... \n");
+ init_query_port();
++ if (!xx)
+ printf("Completed!!!\n");
+
+ if (securityread() < 0)
+@@ -4933,6 +4942,14 @@
+
+ /* Write out PID */
+ writepid();
++
++ /* drop root */
++ if (game.droproot) {
++ if (setgid(game.groupid))
++ perror("Could not setgid");
++ if (setuid(game.userid))
++ perror("Could not setuid");
++ }
+
+ /* Reset time */
+ timeticks = time(NULL);
+diff -ur src.orig/main.h src/main.h
+--- src.orig/main.h 2003-09-17 13:55:17.000000000 -0400
++++ src/main.h 2003-09-17 23:00:12.054053152 -0400
+@@ -48,6 +48,7 @@
+ /* Defines */
+ #define TETVERSION "1.13" /* What Tetrinet version we are for */
+ #define SERVERBUILD "16+qirc-1.40b" /* What build we are at */
++#define USERNAMELEN 30 /* Maximum length of username/group for droproot */
+ #define NICKLEN 30 /* Maximum length of Nickname */
+ #define VERLEN 10 /* Maximum length of Tetrinet version */
+ #define UHOSTLEN 121 /* Maximum length of Hostname */
+@@ -235,6 +236,12 @@
+
+ int verbose; /* Verbosity */
+ char pidfile[PIDFILELEN+1];
++
++ int droproot; /* should we drop root when starting ? */
++ char user[USERNAMELEN+1];
++ uid_t userid;
++ char group[USERNAMELEN+1];
++ gid_t groupid;
+ };
+
+
+Only in src: makefile
+Files src.orig/tetrix and src/tetrix differ
+--- bin/game.conf.orig 2003-09-17 23:19:02.703168360 -0400
++++ bin/game.conf 2003-09-17 23:18:58.062873792 -0400
+@@ -13,6 +13,11 @@
+ # bindip [0.0.0.0] - What IP should server be bound to (0.0.0.0 means all)
+ bindip=0.0.0.0
+
++# username/group to switch UID/GID to
++droproot=1
++dropuser=games-ded
++dropgroup=games
++
+ # maxchannels [1] - How many channels should be available on server
+ maxchannels=8
+
diff --git a/games-server/tetrix/files/1.13.16.1.40c-paths.patch b/games-server/tetrix/files/1.13.16.1.40c-paths.patch
new file mode 100644
index 000000000000..35b29a748c5d
--- /dev/null
+++ b/games-server/tetrix/files/1.13.16.1.40c-paths.patch
@@ -0,0 +1,42 @@
+--- src/config.h.orig 2003-09-13 21:04:28.894714336 -0400
++++ src/config.h 2003-09-13 21:07:43.610113096 -0400
+@@ -7,16 +7,16 @@
+ */
+
+ /* Location of the various external files */
+-#define FILE_MOTD "game.motd" /* Message of the Day File */
+-#define FILE_PMOTD "game.pmotd" /* Playback motd */
+-#define FILE_CONF "game.conf" /* Game configuration File */
+-#define FILE_WINLIST "game.winlist" /* Winlist storage file */
+-#define FILE_WINLIST2 "game.winlist2" /* Winlist storage file */
+-#define FILE_WINLIST3 "game.winlist3" /* Winlist storage file */
++#define FILE_MOTD "GENTOO_CONFDIR/game.motd" /* Message of the Day File */
++#define FILE_PMOTD "GENTOO_CONFDIR/game.pmotd" /* Playback motd */
++#define FILE_CONF "GENTOO_CONFDIR/game.conf" /* Game configuration File */
++#define FILE_WINLIST "GENTOO_STATEDIR/game.winlist" /* Winlist storage file */
++#define FILE_WINLIST2 "GENTOO_STATEDIR/game.winlist2" /* Winlist storage file */
++#define FILE_WINLIST3 "GENTOO_STATEDIR/game.winlist3" /* Winlist storage file */
+
+-#define FILE_BAN "game.ban" /* List of Banned IP's */
+-#define FILE_BAN_COMPROMISE "game.ban.compromise" /* List of Banned IP's */
+-#define FILE_ALLOW "game.allow" /* List of allow IP's */
+-#define FILE_LOG "game.log" /* Logfile */
+-#define FILE_PID "game.pid" /* Default PID */
+-#define FILE_SECURE "game.secure" /* Security file */
++#define FILE_BAN "GENTOO_CONFDIR/game.ban" /* List of Banned IP's */
++#define FILE_BAN_COMPROMISE "GENTOO_CONFDIR/game.ban.compromise" /* List of Banned IP's */
++#define FILE_ALLOW "GENTOO_CONFDIR/game.allow" /* List of allow IP's */
++#define FILE_LOG "GENTOO_LOGDIR/tetrix.log" /* Logfile */
++#define FILE_PID "/var/run/tetrix.pid" /* Default PID */
++#define FILE_SECURE "GENTOO_CONFDIR/game.secure" /* Security file */
+--- bin/game.conf.orig 2003-09-13 21:21:03.748473576 -0400
++++ bin/game.conf 2003-09-13 21:21:12.584130352 -0400
+@@ -8,7 +8,7 @@
+ # Any text after a # is ignored, and can be used as comments.
+
+ # pidfile [game.pid] - Where should the Process ID be written
+-pidfile=game.pid
++pidfile=/var/run/tetrix.pid
+
+ # bindip [0.0.0.0] - What IP should server be bound to (0.0.0.0 means all)
+ bindip=0.0.0.0
diff --git a/games-server/tetrix/files/digest-tetrix-1.13.16.1.40c-r1 b/games-server/tetrix/files/digest-tetrix-1.13.16.1.40c-r1
new file mode 100644
index 000000000000..90ab0b9dc712
--- /dev/null
+++ b/games-server/tetrix/files/digest-tetrix-1.13.16.1.40c-r1
@@ -0,0 +1 @@
+MD5 32e5306bc26afc9e5acdca9c093947c0 tetrinetx-1.13.16+qirc-1.40c.tar.gz 81447
diff --git a/games-server/tetrix/files/digest-tetrix-1.13.16.1.40c-r2 b/games-server/tetrix/files/digest-tetrix-1.13.16.1.40c-r2
new file mode 100644
index 000000000000..90ab0b9dc712
--- /dev/null
+++ b/games-server/tetrix/files/digest-tetrix-1.13.16.1.40c-r2
@@ -0,0 +1 @@
+MD5 32e5306bc26afc9e5acdca9c093947c0 tetrinetx-1.13.16+qirc-1.40c.tar.gz 81447
diff --git a/games-server/tetrix/files/tetrix.rc b/games-server/tetrix/files/tetrix.rc
new file mode 100644
index 000000000000..0fa289dc12be
--- /dev/null
+++ b/games-server/tetrix/files/tetrix.rc
@@ -0,0 +1,20 @@
+#!/sbin/runscript
+# Copyright 1999-2003 Gentoo Technologies, Inc.
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/games-server/tetrix/files/tetrix.rc,v 1.1 2003/09/21 04:47:33 vapier Exp $
+
+depend() {
+ need net
+}
+
+start() {
+ ebegin "Starting TetriNET Server"
+ /usr/games/bin/tetrix -q
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping TetriNET Server"
+ [ -e /var/run/tetrix.pid ] && kill $(</var/run/tetrix.pid)
+ eend $? "Could not kill tetrix server :("
+}
diff --git a/games-server/tetrix/tetrix-1.13.16.1.40c-r1.ebuild b/games-server/tetrix/tetrix-1.13.16.1.40c-r1.ebuild
new file mode 100644
index 000000000000..1c81398cebaf
--- /dev/null
+++ b/games-server/tetrix/tetrix-1.13.16.1.40c-r1.ebuild
@@ -0,0 +1,50 @@
+# Copyright 1999-2003 Gentoo Technologies, Inc.
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/games-server/tetrix/tetrix-1.13.16.1.40c-r1.ebuild,v 1.1 2003/09/21 04:47:33 vapier Exp $
+
+inherit games gcc
+
+MY_SV=${PV#*.*.*.}
+MY_PV=${PV%.${MY_SV}}
+MY_P="tetrinetx-${MY_PV}+qirc-${MY_SV}"
+
+DESCRIPTION="A GNU TetriNET server"
+HOMEPAGE="http://tetrinetx.sourceforge.net/"
+SRC_URI="mirror://sourceforge/tetrinetx/${MY_P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="x86"
+
+DEPEND="net-libs/adns"
+
+S=${WORKDIR}/${MY_P}
+
+src_unpack() {
+ unpack ${A}
+ cd ${S}
+ epatch ${FILESDIR}/${PV}-paths.patch
+ sed -i \
+ -e "s:GENTOO_CONFDIR:${GAMES_SYSCONFDIR}/${PN}:" \
+ -e "s:GENTOO_STATEDIR:${GAMES_STATEDIR}/${PN}:" \
+ -e "s:GENTOO_LOGDIR:${GAMES_LOGDIR}:" \
+ src/config.h bin/game.conf
+}
+
+src_compile() {
+ cd src
+ $(gcc-getCC) ${CFLAGS} main.c -o tetrix -ladns || die "compile failed"
+}
+
+src_install() {
+ dodoc AUTHORS ChangeLog README README.qirc.spectators
+
+ dogamesbin src/tetrix
+ insinto ${GAMES_SYSCONFDIR}/${PN}
+ doins bin/*
+
+ exeinto /etc/init.d
+ newexe ${FILESDIR}/tetrix.rc tetrix
+
+ prepgamesdirs
+}
diff --git a/games-server/tetrix/tetrix-1.13.16.1.40c-r2.ebuild b/games-server/tetrix/tetrix-1.13.16.1.40c-r2.ebuild
new file mode 100644
index 000000000000..41d0e6729dc4
--- /dev/null
+++ b/games-server/tetrix/tetrix-1.13.16.1.40c-r2.ebuild
@@ -0,0 +1,57 @@
+# Copyright 1999-2003 Gentoo Technologies, Inc.
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/games-server/tetrix/tetrix-1.13.16.1.40c-r2.ebuild,v 1.1 2003/09/21 04:47:33 vapier Exp $
+
+inherit games gcc
+
+MY_SV=${PV#*.*.*.}
+MY_PV=${PV%.${MY_SV}}
+MY_P="tetrinetx-${MY_PV}+qirc-${MY_SV}"
+
+DESCRIPTION="A GNU TetriNET server"
+HOMEPAGE="http://tetrinetx.sourceforge.net/"
+SRC_URI="mirror://sourceforge/tetrinetx/${MY_P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="x86"
+
+DEPEND="net-libs/adns"
+
+S=${WORKDIR}/${MY_P}
+
+src_unpack() {
+ unpack ${A}
+ cd ${S}
+ epatch ${FILESDIR}/${PV}-droproot.patch
+ epatch ${FILESDIR}/${PV}-paths.patch
+ sed -i \
+ -e "s:GENTOO_CONFDIR:${GAMES_SYSCONFDIR}/${PN}:" \
+ -e "s:GENTOO_STATEDIR:${GAMES_STATEDIR}/${PN}:" \
+ -e "s:GENTOO_LOGDIR:${GAMES_LOGDIR}:" \
+ src/config.h bin/game.conf
+}
+
+src_compile() {
+ cd src
+ $(gcc-getCC) ${CFLAGS} main.c -o tetrix -ladns || die "compile failed"
+}
+
+src_install() {
+ dodoc AUTHORS ChangeLog README README.qirc.spectators
+
+ dogamesbin src/tetrix
+ insinto ${GAMES_SYSCONFDIR}/${PN}
+ doins bin/*
+
+ exeinto /etc/init.d
+ newexe ${FILESDIR}/tetrix.rc tetrix
+
+ keepdir ${GAMES_STATEDIR}/${PN}
+ dodir ${GAMES_LOGDIR}
+ touch ${GAMES_LOGDIR}/${PN}.log
+
+ prepgamesdirs
+ fowners ${GAMES_USER_DED}:${GAMES_GROUP} ${GAMES_STATEDIR}/${PN}
+ fowners ${GAMES_USER_DED}:${GAMES_GROUP} ${GAMES_LOGDIR}/${PN}.log
+}