rpms/njam/devel njam-1.25-drop-setgid.patch, NONE, 1.1 njam-1.25-html.patch, NONE, 1.1 njam.6, NONE, 1.1 njam.desktop, NONE, 1.1 njam.spec, NONE, 1.1 .cvsignore, 1.1, 1.2 sources, 1.1, 1.2

Hans de Goede (jwrdegoede) fedora-extras-commits at redhat.com
Wed Mar 29 19:45:02 UTC 2006


Author: jwrdegoede

Update of /cvs/extras/rpms/njam/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv19343/devel

Modified Files:
	.cvsignore sources 
Added Files:
	njam-1.25-drop-setgid.patch njam-1.25-html.patch njam.6 
	njam.desktop njam.spec 
Log Message:
auto-import njam-1.25-2 on branch devel from njam-1.25-2.src.rpm

njam-1.25-drop-setgid.patch:

--- NEW FILE njam-1.25-drop-setgid.patch ---
diff -ur njam-1.25-src.orig/src/njam.cpp njam-1.25-src/src/njam.cpp
--- njam-1.25-src.orig/src/njam.cpp	2005-12-13 12:56:43.000000000 +0100
+++ njam-1.25-src/src/njam.cpp	2006-03-26 20:29:22.000000000 +0200
@@ -32,6 +32,8 @@
 -----------------------------------------------------------------------------*/
 // needed for chdir
 #ifdef __linux__
+/* this must be done before the first include of unistd.h for setresgid */
+#define _GNU_SOURCE 
 #include <unistd.h>
 #include <defaults.h>
 #endif
@@ -47,12 +49,24 @@
 #include "njamfont.h"
 #include "njammap.h"
 #include "njam.h"
+
+static FILE* highscore_fp;
+
 //-----------------------------------------------------------------------------
 int main(int argc, char *argv[])
 {
  	bool Fullscreen = true;
  	bool SWSurface = true;
 	bool UseDGA = false;
+	gid_t realgid;
+	
+	highscore_fp = fopen("/var/lib/games/njam.hs", "r+");
+        realgid = getgid();
+        if (setresgid(-1, realgid, realgid) != 0) {
+                perror("Could not drop setgid privileges.  Aborting.");
+                return 1;
+        }
+	
  	if (argc > 1)
  	{
  		for (int i=1; i<argc; i++)
@@ -237,12 +251,12 @@
 	}
 
 		// format: NAME#POINTS#LEVEL#
-	fp = fopen("hiscore.dat", "w+");
-	if (fp)
+	if (highscore_fp)
 	{
+		rewind(highscore_fp);
 		for (int i=0; i<10; i++)
-			fprintf(fp, "%s#%d#%d#\n", TopTenScores[i].name, TopTenScores[i].points, TopTenScores[i].level);
-		fclose(fp);
+			fprintf(highscore_fp, "%s#%d#%d#\n", TopTenScores[i].name, TopTenScores[i].points, TopTenScores[i].level);
+		fclose(highscore_fp);
 	}
 
 	if (m_SDL)
@@ -665,15 +679,14 @@
 
 	// load hiscore from file (if any)
 	// format: NAME#POINTS#LEVEL#
-	fp = fopen("hiscore.dat", "r");
-	if (fp)
+	if (highscore_fp)
 	{
-		LogFile("Reading hiscore.dat\n");
+		LogFile("Reading /var/games/njam.hs\n");
 		char buff[40];
 		int number = 0;
-		while (!feof(fp) && number < 10)
+		while (!feof(highscore_fp) && number < 10)
 		{
-			fgets(buff, 40, fp);
+			fgets(buff, 40, highscore_fp);
 			int i = 0, last;
 
 			// name
@@ -703,8 +716,6 @@
 
 			number++;
 		}
-
-		fclose(fp);
 	}
 
     LogFile("Opening audio...");

njam-1.25-html.patch:

--- NEW FILE njam-1.25-html.patch ---
--- njam-1.25-src/html/doc-editor.html~	2006-03-28 09:46:09.000000000 +0200
+++ njam-1.25-src/html/doc-editor.html	2006-03-28 09:46:09.000000000 +0200
@@ -30,7 +30,8 @@
       <td valign="top"><b><font face="Helvetica, Arial, sans-serif"
  color="#ffffff"> Njam is a full-featured cross-platform pacman-like game
 written in C++ using SDL library</font></b></td>
-      <td valign="top" align="right"><small><a href="index.html"><b><small><font
+      <td valign="top" align="right"><small><a
+ href="http://njam.sourceforge.net/"><b><small><font
  face="Helvetica, Arial, sans-serif" color="white">HOME  >></font></small></b></a></small><br>
       </td>
     </tr>


--- NEW FILE njam.6 ---
.\" $Header: /aolnet/dev/src/CVS/sgml/docbook-to-man/cmd/docbook-to-man.sh,v 1.1.1.1 1998/11/13 21:31:59 db3l Exp $
.\"
.\"	transcript compatibility for postscript use.
.\"
.\"	synopsis:  .P! <file.ps>
.\"
.de P!
.fl
\!!1 setgray
.fl
\\&.\"
.fl
\!!0 setgray
.fl			\" force out current output buffer
\!!save /psv exch def currentpoint translate 0 0 moveto
\!!/showpage{}def
.fl			\" prolog
.sy sed \-e 's/^/!/' \\$1\" bring in postscript file
\!!psv restore
.
.de pF
.ie     \\*(f1 .ds f1 \\n(.f
.el .ie \\*(f2 .ds f2 \\n(.f
.el .ie \\*(f3 .ds f3 \\n(.f
.el .ie \\*(f4 .ds f4 \\n(.f
.el .tm ? font overflow
.ft \\$1
..
.de fP
.ie     !\\*(f4 \{\
.	ft \\*(f4
.	ds f4\"
'	br \}
.el .ie !\\*(f3 \{\
.	ft \\*(f3
.	ds f3\"
'	br \}
.el .ie !\\*(f2 \{\
.	ft \\*(f2
.	ds f2\"
'	br \}
.el .ie !\\*(f1 \{\
.	ft \\*(f1
.	ds f1\"
'	br \}
.el .tm ? font underflow
..
.ds f1\"
.ds f2\"
.ds f3\"
.ds f4\"
'\" t 
.ta 8n 16n 24n 32n 40n 48n 56n 64n 72n  
.TH "NJAM" "6" 
.SH "NAME" 
njam \(em maze-game, eat all the cookies while avoiding the badguys
.SH "SYNOPSIS" 
.PP 
\fBnjam\fR [-w]  [-h]  [-d]  
.SH "DESCRIPTION" 
.PP 
\fBnjam\fR is a fast-paced maze-game where you must eat all the cookies while
avoiding the badguys. Special cookies give you the power to freeze or eat the
bad guys. The game features single and multiplayer modes, network play,
duelling and cooperative games, great music and sound effects, customizable
level skins, many different levels and an integrated level editor.
.SH "OPTIONS" 
.PP 
The options are; 
 
.IP "\fB\-w\fP 	" 10 
Start in windowed mode (as opposed to fullscreen) 
.IP "\fB\-h\fP 	" 10 
use hardware surfaces (faster, doesn't work well with all graphic cards 
.IP "\fB\-d\fP 	      " 10 
use DGA driver on Linux, (must faster, but must run as root) 
.SH "AUTHOR" 
.IP "Application:" 10 
M.Babuskov <mbabuskov at yahoo.com> 
.PP 
This manual page was written by Anibal Avelar avelar at gmail.com for the Debian
Project based on the manual wrote by Stephan Hermann sh at sourcecode.de for the
\fBUbuntu\fP system. It has been modified for \fBFedora Extras\fP by Hans de
Goede j.w.r.degoede at hhs.nl. Permission is granted to copy, distribute and/or
modify this document under the terms of the GNU General Public License, Version
2 or (at your option) any later version published by the Free Software
Foundation. 
 
.\" created by instant / docbook-to-man, Sun 20 Nov 2005, 20:58 


--- NEW FILE njam.desktop ---
[Desktop Entry]
Encoding=UTF-8
Name=Njam
GenericName=Maze-game where you must eat all the dots
Comment=Eat all the dots while avoiding the badguys
Exec=njam
Icon=njam.png
Terminal=false
StartupNotify=false
Type=Application
Categories=Application;Game;ArcadeGame;
Version=1.25


--- NEW FILE njam.spec ---
Name:           njam
Version:        1.25
Release:        2%{?dist}
Summary:        Maze-game, eat all the cookies while avoiding the badguys
Group:          Amusements/Games
License:        GPL
URL:            http://njam.sourceforge.net/
Source0:        http://download.sourceforge.net/%{name}/%{name}-%{version}-src.tar.gz
Source1:        njam.6
Source2:	njam.desktop
Patch0:         njam-1.25-drop-setgid.patch
Patch1:         njam-1.25-html.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires:  SDL-devel SDL_mixer-devel SDL_image-devel SDL_net-devel 
BuildRequires:  ImageMagick desktop-file-utils

%description
Njam is a fast-paced maze-game where you must eat all the cookies while
avoiding the badguys. Special cookies give you the power to freeze or eat the
bad guys. The game features single and multiplayer modes, network play,
duelling and cooperative games, great music and sound effects, customizable
level skins, many different levels and an integrated level editor.


%prep
%setup -q -n %{name}-%{version}-src
%patch0 -p1 -z .setgid
%patch1 -p1


%build
%configure
make %{?_smp_mflags}
convert -transparent black njamicon.ico %{name}.png


%install
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT

# make install installs the docs under /usr/share/njam. We want them in %doc.
rm $RPM_BUILD_ROOT%{_datadir}/%{name}/README
rm $RPM_BUILD_ROOT%{_datadir}/%{name}/levels/readme.txt
rm -fr $RPM_BUILD_ROOT%{_datadir}/%{name}/html

# clean up cruft
rm $RPM_BUILD_ROOT%{_datadir}/%{name}/%{name}.*
rm $RPM_BUILD_ROOT%{_datadir}/%{name}/njamicon.ico

# we want the hiscore in /var/lib/games
mkdir -p $RPM_BUILD_ROOT%{_var}/lib/games
mv $RPM_BUILD_ROOT%{_datadir}/%{name}/hiscore.dat \
  $RPM_BUILD_ROOT%{_var}/lib/games/%{name}.hs

# add the manpage (courtesy of Debian)
mkdir -p $RPM_BUILD_ROOT%{_mandir}/man6
install -m 644 %{SOURCE1} $RPM_BUILD_ROOT%{_mandir}/man6

# below is the desktop file and icon stuff.
mkdir -p $RPM_BUILD_ROOT%{_datadir}/applications
desktop-file-install --vendor fedora            \
  --dir $RPM_BUILD_ROOT%{_datadir}/applications \
  --add-category X-Fedora                       \
  %{SOURCE2}
mkdir -p $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/32x32/apps
install -p -m 644 %{name}.png \
  $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/32x32/apps


%clean
rm -rf $RPM_BUILD_ROOT


%post
touch --no-create %{_datadir}/icons/hicolor || :
if [ -x %{_bindir}/gtk-update-icon-cache ]; then
   %{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || :
fi

%postun
touch --no-create %{_datadir}/icons/hicolor || :
if [ -x %{_bindir}/gtk-update-icon-cache ]; then
   %{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || :
fi


%files
%defattr(-,root,root,-)
%doc COPYING ChangeLog NEWS README TODO levels/readme.txt html
%attr(2755,root,games) %{_bindir}/%{name}
%{_datadir}/%{name}
%{_mandir}/man6/%{name}.6.gz
%{_datadir}/applications/fedora-%{name}.desktop
%{_datadir}/icons/hicolor/32x32/apps/%{name}.png
%config(noreplace) %attr (0664,root,games) %{_var}/lib/games/%{name}.hs


%changelog
* Tue Mar 28 2006 Hans de Goede <j.w.r.degoede at hhs.nl> 1.25-2
- Cleaned up description in spec and man using the cleaner
  description provided in bz 186813
- Use cookies instead of dots in summary (bz 186813)
- Put manpage in man6 (bz 186813)
- fix broken home link in doc-editor.html (bz 186813)

* Wed Mar 22 2006 Hans de Goede <j.w.r.degoede at hhs.nl> 1.25-1
- initial Fedora Extras package


Index: .cvsignore
===================================================================
RCS file: /cvs/extras/rpms/njam/devel/.cvsignore,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- .cvsignore	29 Mar 2006 18:20:22 -0000	1.1
+++ .cvsignore	29 Mar 2006 19:45:02 -0000	1.2
@@ -0,0 +1 @@
+njam-1.25-src.tar.gz


Index: sources
===================================================================
RCS file: /cvs/extras/rpms/njam/devel/sources,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- sources	29 Mar 2006 18:20:22 -0000	1.1
+++ sources	29 Mar 2006 19:45:02 -0000	1.2
@@ -0,0 +1 @@
+231fda022d309e1ef4a0d993ca693462  njam-1.25-src.tar.gz




More information about the fedora-extras-commits mailing list