Subject: Re: SETGIDGAME and id games
To: None <tech-pkg@netbsd.org>
From: Jan Schaumann <jschauma@netmeister.org>
List: tech-pkg
Date: 05/09/2004 12:39:28
--sClP8c1IaQxyux9v
Content-Type: multipart/mixed; boundary="s5/bjXLgkIwAv6Hi"
Content-Disposition: inline


--s5/bjXLgkIwAv6Hi
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Jan Schaumann <jschauma@netmeister.org> wrote:
=20
> I just took a look at PR pkg/25313.  The problem here is that we
> currently do not have a ``games'' owner for any games that might be
> installed.  Some games, however, like to be installed setgid so they can
> write to a shared scorefile.

How about the attached diff?

Then we just need to set the correct GAME* flags in defs.OPSYS.mk (which
can remain empty) and then run through pkgsrc/games/* and fix the
installations.

-Jan

--=20
If you can read this, you're not the president.

--s5/bjXLgkIwAv6Hi
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=diff
Content-Transfer-Encoding: quoted-printable

Index: bsd.pkg.defaults.mk
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/pkgsrc/mk/bsd.pkg.defaults.mk,v
retrieving revision 1.237
diff -b -u -r1.237 bsd.pkg.defaults.mk
--- bsd.pkg.defaults.mk	2 May 2004 20:04:36 -0000	1.237
+++ bsd.pkg.defaults.mk	9 May 2004 16:34:15 -0000
@@ -490,6 +490,13 @@
 # Possible: any shell commands
 # Default: none
=20
+SETGIDGAME?=3D	no
+# This flags specifies whether or not certain games are installed setgid,
+# which would allow them to write to a group-owned score file.
+# See also:	GAMEGRP, GAMEMODE, GAMEOWN
+# Possible:	yes, no
+# Default:	no
+
 SU_CMD?=3D ${ROOT_CMD}
 # Command to perform before "make install", if the user does not have
 # an effective uid of 0.  A possible substitute is "sudo sh -c"
@@ -905,6 +912,29 @@
 # Possible: any group name
 # Default: jserver
=20
+GAMEGRP?=3D	${BINGRP}
+# Used for various games to allow writing to a group-owned score file.
+# If SETGIDGAME is 'yes', setting this to a dedicated group, such as 'game=
s'
+# would make sense.
+# See also:	GAMEMODE, GAMEOWN, SETGIDGAME
+# Possible:	any group name
+# Default:	${BINGRP}
+
+GAMEMODE?=3D	${BINMODE}
+# Used for various games to allow writing to a group-owned score file.
+# If SETGIDGAME is 'yes', setting this to 2555 would make sense.
+# See also:	GAMEGRP, GAMEOWN, SETGIDGAME
+# Possible:	any mode
+# Default:	${BINMODE}
+
+GAMEOWN?=3D	${BINOWN}
+# Used for various games to allow writing to a group-owned score file.
+# If SETGIDGAME is 'yes', setting this to a dedicated user, such as 'games'
+# would make sense.
+# See also:	GAMEGRP, GAMEMODE, SETGIDGAME
+# Possible:	any user name
+# Default:	${BINOWN}
+
 GAWK_ENABLE_PORTALS?=3D	NO
 # Used by gawk package to enable/disable handling file names that start wi=
th
 # `/p/' as a 4.4 BSD type portal file, i.e., a two-way pipe for `|&'.
Index: bsd.pkg.mk
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/pkgsrc/mk/bsd.pkg.mk,v
retrieving revision 1.1456
diff -b -u -r1.1456 bsd.pkg.mk
--- bsd.pkg.mk	8 May 2004 16:14:55 -0000	1.1456
+++ bsd.pkg.mk	9 May 2004 16:34:19 -0000
@@ -574,9 +574,13 @@
 .if !defined(INSTALL_UNSTRIPPED) || empty(INSTALL_UNSTRIPPED:M[yY][eE][sS])
 INSTALL_PROGRAM?=3D \
 	${INSTALL} ${COPY} ${_STRIPFLAG_INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${B=
INMODE}
+INSTALL_GAME?=3D		\
+	${INSTALL} ${COPY} ${_STRIPFLAG_INSTALL} -o ${GAMEOWN} -g ${GAMEGRP} -m $=
{GAMEMODE}
 .else
 INSTALL_PROGRAM?=3D \
 	${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE}
+INSTALL_GAME?=3D		\
+	${INSTALL} ${COPY} -o ${GAMEOWN} -g ${GAMEGRP} -m ${GAMEMODE}
 .endif
 INSTALL_SCRIPT?=3D \
 	${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE}
Index: defs.NetBSD.mk
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/pkgsrc/mk/defs.NetBSD.mk,v
retrieving revision 1.64
diff -b -u -r1.64 defs.NetBSD.mk
--- defs.NetBSD.mk	27 Apr 2004 13:43:05 -0000	1.64
+++ defs.NetBSD.mk	9 May 2004 16:34:19 -0000
@@ -207,3 +207,11 @@
 _OPSYS_MAX_CMDLEN!=3D	/sbin/sysctl -n kern.argmax
 CONFIGURE_ENV+=3D		lt_cv_sys_max_cmd_len=3D${_OPSYS_MAX_CMDLEN}
 .endif
+
+# if games are to be installed setgid, set the group and mode to meaningful
+# values
+.if !(empty(SETGIDGAME:M[yY][eE][sS]))
+GAMEOWN=3D		games
+GAMEGRP=3D		games
+GAMEMODE=3D		2555
+.endif

--s5/bjXLgkIwAv6Hi--

--sClP8c1IaQxyux9v
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (NetBSD)

iD8DBQFAnl7AfFtkr68iakwRAtlYAKCZHvpStc/66oap4X1gJtAbptz6OwCfTGUf
R+X26MMPKnVvGn+MrYqeXWk=
=Cmex
-----END PGP SIGNATURE-----

--sClP8c1IaQxyux9v--