aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMenno E. Duursma <druiloor@zonnet.nl>2010-05-11 22:53:49 +0200
committerDavid Somero <xgizzmo@slackbuilds.org>2010-05-11 22:53:49 +0200
commitce5e0babf5e3334e199eb9e16871d421c215f554 (patch)
tree4bed7e0687525a337962a8feb875f52f0f07ffc0
parent4b0fb07504ad8f172d27ddd9713cb49ccae8a29e (diff)
games/xbill: Added to 12.1 repository
-rw-r--r--games/xbill/README17
-rw-r--r--games/xbill/doinst.sh24
-rw-r--r--games/xbill/slack-desc19
-rw-r--r--games/xbill/xbill-wrapper.c82
-rw-r--r--games/xbill/xbill.SlackBuild91
-rw-r--r--games/xbill/xbill.desktop7
-rw-r--r--games/xbill/xbill.info8
-rw-r--r--games/xbill/xbill.pngbin0 -> 1990 bytes
8 files changed, 248 insertions, 0 deletions
diff --git a/games/xbill/README b/games/xbill/README
new file mode 100644
index 000000000000..c47fc79c2dc6
--- /dev/null
+++ b/games/xbill/README
@@ -0,0 +1,17 @@
+The xbill game tests your reflexes as you seek out and destroy all
+forms of Bill, establish a new operating system throughout the
+universe, and boldly go where no geek has gone before. Xbill has
+become an increasingly attractive option as the Linux Age progresses,
+and it is very popular at Red Hat.
+
+NOTE:
+Per default xbill sets its score file world writable
+which obviously allows cheating ones hi-score :-(
+Probably this came about since GTK+ doesn't allow setgid?
+
+In the install-script we move xbill to xbill-bin and install
+a wrapper thingy as xbill instead, with setuid and video group
+executable filesystem perms. There we change groups to games.
+
+In the resulting package /var/xbill is group-writable only...
+
diff --git a/games/xbill/doinst.sh b/games/xbill/doinst.sh
new file mode 100644
index 000000000000..ea4ae6fbe9ff
--- /dev/null
+++ b/games/xbill/doinst.sh
@@ -0,0 +1,24 @@
+config() {
+ NEW="$1"
+ OLD="$(dirname $NEW)/$(basename $NEW .new)"
+ # If there's no config file by that name, mv it over:
+ if [ ! -r $OLD ]; then
+ mv $NEW $OLD
+ elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then
+ # toss the redundant copy
+ rm $NEW
+ fi
+ # Otherwise, we leave the .new copy for the admin to consider...
+}
+
+# Keep old hi-scores if any
+config var/games/xbill/scores.new
+
+# Allow group games write and dissallow write access to others
+chgrp -R games var/games/xbill
+chmod -R g+w,o-w var/games/xbill
+
+# Change privs on our little wrapper
+chgrp video usr/bin/xbill
+chmod 4750 usr/bin/xbill
+
diff --git a/games/xbill/slack-desc b/games/xbill/slack-desc
new file mode 100644
index 000000000000..04129a783262
--- /dev/null
+++ b/games/xbill/slack-desc
@@ -0,0 +1,19 @@
+# HOW TO EDIT THIS FILE:
+# The "handy ruler" below makes it easier to edit a package description. Line
+# up the first '|' above the ':' following the base package name, and the '|'
+# on the right side marks the last column you can put a character in. You must
+# make exactly 11 lines for the formatting to be correct. It's also
+# customary to leave one space after the ':'.
+
+ |-----handy-ruler-----------------------------------------------------|
+xbill: XBill (Stop Bill from loading his OS into all the computers.)
+xbill:
+xbill: The xbill game tests your reflexes as you seek out and destroy all
+xbill: forms of Bill, establish a new operating system throughout the
+xbill: universe, and boldly go where no geek has gone before. Xbill has
+xbill: become an increasingly attractive option as the Linux Age progresses.
+xbill:
+xbill: XBill was mostly written by Brian Wellingtonxx and Matias Duarte.
+xbill:
+xbill:
+xbill:
diff --git a/games/xbill/xbill-wrapper.c b/games/xbill/xbill-wrapper.c
new file mode 100644
index 000000000000..a98cc37aee15
--- /dev/null
+++ b/games/xbill/xbill-wrapper.c
@@ -0,0 +1,82 @@
+/* Written by Menno E. Duursma for use with xbill */
+
+/*
+ * This program is free software. It comes without any warranty.
+ * Granted WTFPL, Version 2, as published by Sam Hocevar. See
+ * http://sam.zoy.org/wtfpl/COPYING for more details.
+ */
+
+/*
+ * Per default xbill sets its score file world writable
+ * which obviously allows cheating ones hi-score :-(
+ * Probably this came about since GTK+ doesn't allow setgid?
+ *
+ * In the install-script we move xbill to xbill-bin and install
+ * this here wrapper thing as xbill, with setuid and video group
+ * executable filesystem perms. Here we change groups to games.
+ *
+ * We should now be able make /var/xbill group-writable only...
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <errno.h>
+#include <string.h>
+#include <grp.h>
+
+int main(int argc, char *argv[], char *envp[])
+{
+
+ /*
+ * hardcoded path/program to exec
+ * and group to run under
+ */
+ char prog[] = "/usr/bin/xbill-bin";
+ char grpname[] = "games";
+
+ struct group *grp;
+ errno = 0;
+
+ /* get our gid */
+ grp = getgrnam(grpname);
+ if (grp == NULL) {
+ fprintf(stderr, "Error: getgrnam(%s) - %s\n",
+ grpname,
+ strerror(errno));
+ exit(EXIT_FAILURE);
+ }
+
+ /* drop to the gid */
+ if (setgid(grp->gr_gid)) {
+ fprintf(stderr, "Error: setgid(%d) - %s\n",
+ grp->gr_gid,
+ strerror(errno));
+ exit(EXIT_FAILURE);
+ }
+
+
+ /* drop back to calling uid */
+ if (setuid(getuid())) {
+ fprintf(stderr, "Error: setuid(%d) - %s\n",
+ getuid(),
+ strerror(errno));
+ exit(EXIT_FAILURE);
+ }
+
+ /* tell the viewers wat is going to happen */
+ fprintf(stderr, "Starting %s with uid = %d, gid = %d\n",
+ prog,
+ getuid(),
+ getgid());
+
+ /* fire it up */
+ if (execve(prog, argv, envp) == -1) {
+ fprintf(stderr, "Error: execve(%s, argv, envp) - %s\n",
+ prog,
+ strerror(errno));
+ exit(EXIT_FAILURE);
+ }
+
+ return EXIT_SUCCESS;
+}
diff --git a/games/xbill/xbill.SlackBuild b/games/xbill/xbill.SlackBuild
new file mode 100644
index 000000000000..bfab3c29131a
--- /dev/null
+++ b/games/xbill/xbill.SlackBuild
@@ -0,0 +1,91 @@
+#!/bin/sh
+
+# Slackware build script for XBill
+# Written by Menno E. Duursma <druiloor@zonnet.nl>
+
+# This program is free software. It comes without any warranty.
+# Granted WTFPL, Version 2, as published by Sam Hocevar. See
+# http://sam.zoy.org/wtfpl/COPYING for more details.
+
+# Modified by SlackBuilds.org
+
+PRGNAM=xbill
+VERSION=${VERSION:-2.1}
+ARCH=${ARCH:-i486}
+BUILD=${BUILD:-1}
+TAG=${TAG:-_SBo}
+
+CWD=$(pwd)
+TMP=${TMP:-/tmp/SBo}
+PKG=$TMP/package-$PRGNAM
+OUTPUT=${OUTPUT:-/tmp}
+
+if [ "$ARCH" = "i486" ]; then
+ SLKCFLAGS="-O2 -march=i486 -mtune=i686"
+elif [ "$ARCH" = "i686" ]; then
+ SLKCFLAGS="-O2 -march=i686 -mtune=i686"
+fi
+
+set -e
+
+rm -rf $PKG
+mkdir -p $TMP $PKG $OUTPUT
+cd $TMP
+rm -rf $PRGNAM-$VERSION
+tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
+cd $PRGNAM-$VERSION
+chown -R root:root .
+find . \
+ \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
+ -exec chmod 755 {} \; -o \
+ \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
+ -exec chmod 644 {} \;
+
+CFLAGS="$SLKCFLAGS" \
+CXXFLAGS="$SLKCFLAGS" \
+./configure \
+ --prefix=/usr \
+ --localstatedir=/var/games \
+ --mandir=/usr/man \
+ --with-x \
+ --enable-motif \
+ --enable-athena \
+ --enable-gtk
+
+make
+make install DESTDIR=$PKG
+
+# Don't overwrite hi-scores, if any
+mv $PKG/var/games/xbill/scores $PKG/var/games/xbill/scores.new
+
+# Do a little trick to disallow cheating, hopefully
+# Note: we do the privs stuff in doinst.sh for target system
+cp -a $PKG/usr/bin/xbill $PKG/usr/bin/xbill-bin
+gcc -Wall $SLKCFLAGS $CWD/xbill-wrapper.c -o $PKG/usr/bin/xbill
+
+find $PKG -type f | xargs file | grep -e "executable" -e "shared object" \
+ | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
+
+( cd $PKG/usr/man || exit 1
+ find . -type f -exec gzip -9 {} \;
+ for i in $( find . -type l ) ; do
+ ln -s $( readlink $i ).gz $i.gz ; rm $i
+ done
+)
+
+# Add desktop entry nicked from the spec file
+mkdir -p $PKG/usr/share/applications
+install -D -m 0644 $CWD/xbill.desktop $PKG/usr/share/applications/xbill.desktop
+install -D -m 0644 $CWD/xbill.png $PKG/usr/share/pixmaps/xbill.png
+
+mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
+cp -a INSTALL README README.Ports ChangeLog $PKG/usr/doc/$PRGNAM-$VERSION
+cat $CWD/xbill-wrapper.c > $PKG/usr/doc/$PRGNAM-$VERSION/xbill-wrapper.c
+cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
+
+mkdir -p $PKG/install
+cat $CWD/slack-desc > $PKG/install/slack-desc
+cat $CWD/doinst.sh > $PKG/install/doinst.sh
+
+cd $PKG
+/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.tgz
diff --git a/games/xbill/xbill.desktop b/games/xbill/xbill.desktop
new file mode 100644
index 000000000000..48135d4ea081
--- /dev/null
+++ b/games/xbill/xbill.desktop
@@ -0,0 +1,7 @@
+[Desktop Entry]
+Name=XBill
+Type=Application
+Comment=Save the world
+Icon=xbill
+Exec=xbill
+Categories=Game;
diff --git a/games/xbill/xbill.info b/games/xbill/xbill.info
new file mode 100644
index 000000000000..2709681798c5
--- /dev/null
+++ b/games/xbill/xbill.info
@@ -0,0 +1,8 @@
+PRGNAM="xbill"
+VERSION="2.1"
+HOMEPAGE="http://www.xbill.org/"
+DOWNLOAD="http://www.xbill.org/download/xbill-2.1.tar.gz"
+MD5SUM="585e4866b15255a24203db9959407b2f"
+MAINTAINER="Menno E. Duursma"
+EMAIL="druiloor@zonnet.nl"
+APPROVED="David Somero" \ No newline at end of file
diff --git a/games/xbill/xbill.png b/games/xbill/xbill.png
new file mode 100644
index 000000000000..0d7a876eea77
--- /dev/null
+++ b/games/xbill/xbill.png
Binary files differ