Fix-up this port score file handling

- The score file should not be in ${PREFIX}/lib/X11/xsoldier, where only
  static content should be put, move it to /var/games/xsoldier.scores and
  add INSTALL/DEINSTALL scripts to handle it
- Make the score file group-writable to 'games' and the game setgid 'games'
  instead of setuid root
Bump package name to reflect changes
This commit is contained in:
pvalchev 2002-09-16 08:18:11 +00:00
parent a710ae31f9
commit 888bd5db18
6 changed files with 131 additions and 13 deletions

View File

@ -1,11 +1,10 @@
# $OpenBSD: Makefile,v 1.13 2002/03/21 20:57:08 espie Exp $
#
# $OpenBSD: Makefile,v 1.14 2002/09/16 08:18:11 pvalchev Exp $
COMMENT= "shooting game for X11"
DISTNAME= xsoldier-0.96
PKGNAME= ${DISTNAME}p1
CATEGORIES= games x11
NEED_VERSION= 1.515
# License: GPL
PERMIT_PACKAGE_CDROM= Yes

View File

@ -1,5 +1,5 @@
--- Imakefile.orig Fri Feb 28 08:48:57 1997
+++ Imakefile Mon Apr 17 12:07:29 2000
+++ Imakefile Mon Sep 16 02:01:05 2002
@@ -6,58 +6,58 @@
@ -16,12 +16,13 @@
+/* Install Directory */
+/* You can't install without write permission of these. => Unplayable. (^^;*/
+PIXMAPDIR = ${PREFIX}/lib/X11/xsoldier
+SCOREDIR = ${PREFIX}/lib/X11/xsoldier
+SCOREDIR = /var/games
+BINDIR = ${PREFIX}/bin
-/* スコアファイル名SCOREDIR 以下に置かれます. */
-SCOREFILE = .scorefile
+/* Score File Name. It's under SCOREDIR. */
SCOREFILE = .scorefile
+SCOREFILE = xsoldier.scores
/* ----------------------------------------------------------------------- */
@ -80,12 +81,22 @@
/* */
/* ----------------------------------------------------------------------- */
@@ -85,7 +85,7 @@
@@ -85,9 +85,9 @@ LOCAL_LDFLAGS = $(XPMLIBFLAGS)
OBJS = $(SRCS:.c=.o)
-ComplexProgramTarget(xsoldier)
+ComplexProgramTargetNoMan(xsoldier)
install:: install.pixmap install.score install.bin
-install:: install.pixmap install.score install.bin
+install:: install.pixmap install.bin
update:: install.pixmap install.bin
@echo "install update . done"
@@ -109,5 +109,5 @@ install.pixmap::
install.bin::
@if [ -d $(BINDIR) ]; then set +x; \
else (set -x; $(MKDIRHIER) $(BINDIR)); fi
- $(INSTALL) -c -m 4755 $(PROGRAM) $(BINDIR)/$(PROGRAM)
+ $(INSTALL) -c -m 2755 -g games $(PROGRAM) $(BINDIR)/$(PROGRAM)
@echo "install bin . done"

View File

@ -1,6 +1,7 @@
--- main.c Fri Feb 28 08:50:07 1997
+++ main.c.new Wed Dec 15 19:35:37 1999
@@ -129,14 +129,14 @@
$OpenBSD: patch-main_c,v 1.2 2002/09/16 08:18:11 pvalchev Exp $
--- main.c.orig Fri Feb 28 08:50:07 1997
+++ main.c Mon Sep 16 01:57:49 2002
@@ -129,14 +129,14 @@ static void arginit(int argc, char *argv
argv0++;
else
argv0 = argv[0];

View File

@ -0,0 +1,47 @@
#!/bin/sh
# $OpenBSD: DEINSTALL,v 1.1 2002/09/16 08:18:11 pvalchev Exp $
#
# xsoldier de-installation script
set -e
PATH=/bin:/usr/bin:/sbin:/usr/sbin
PREFIX=${PKG_PREFIX:-/usr/local}
SCORE_FILE=/var/games/xsoldier.scores
do_notice()
{
echo
echo "+---------------"
echo "| To completely deinstall the $1 package you need to perform"
echo "| this step as root:"
echo "|"
echo "| rm -f $SCORE_FILE"
echo "|"
echo "| Do not do this if you plan on re-installing $1"
echo "| at some future time."
echo "+---------------"
echo
}
# Verify proper execution
#
if [ $# -ne 2 ]; then
echo "usage: $0 distname DEINSTALL" >&2
exit 1
fi
# Verify/process the command
#
case $2 in
DEINSTALL)
if [ -d $SCORE_DIR ]; then
do_notice "$1"
fi
;;
*)
echo "usage: $0 distname DEINSTALL" >&2
exit 1
;;
esac
exit 0

View File

@ -0,0 +1,61 @@
#!/bin/sh
# $OpenBSD: INSTALL,v 1.1 2002/09/16 08:18:11 pvalchev Exp $
#
# installation score file setup for xsoldier
# exit on errors, use a sane path and install prefix
#
set -e
PATH=/bin:/usr/bin:/sbin:/usr/sbin
PREFIX=${PKG_PREFIX:-/usr/local}
SCORE_FILE=/var/games/xsoldier.scores
# Function: tell the user what they need to do to use the port just installed
#
do_notice()
{
echo
echo "+---------------"
echo "| The existing $1 score file,"
echo "| $SCORE_FILE,"
echo "| has NOT been changed."
echo "+---------------"
echo
}
# Function: install a blank file to be used as the icebreaker score file
#
do_install()
{
touch $SCORE_FILE
chown root.games $SCORE_FILE
chmod 664 $SCORE_FILE
}
# verify proper execution
#
if [ $# -ne 2 ]; then
echo "usage: $0 distname { PRE-INSTALL | POST-INSTALL }" >&2
exit 1
fi
# Verify/process the command
#
case $2 in
PRE-INSTALL)
: nothing to pre-install for this port
;;
POST-INSTALL)
if [ -f $SCORE_FILE ]; then
do_notice $1
else
do_install $1
fi
;;
*)
echo "usage: $0 distname { PRE-INSTALL | POST-INSTALL }" >&2
exit 1
;;
esac
exit 0

View File

@ -1,6 +1,5 @@
@comment $OpenBSD: PLIST,v 1.3 2002/04/07 01:54:50 naddy Exp $
@comment $OpenBSD: PLIST,v 1.4 2002/09/16 08:18:11 pvalchev Exp $
bin/xsoldier
lib/X11/xsoldier/.scorefile
lib/X11/xsoldier/Boss1.xpm
lib/X11/xsoldier/Boss2.xpm
lib/X11/xsoldier/Boss3.xpm