[packages/occ] - new
qboosh
qboosh at pld-linux.org
Sat Sep 24 18:21:19 CEST 2016
commit 05b24ae91a9f57742fb843c6f4ce15629f36d877
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date: Sat Sep 24 18:22:57 2016 +0200
- new
occ-datadir.patch | 33 ++++++++++++++
occ.spec | 130 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 163 insertions(+)
---
diff --git a/occ.spec b/occ.spec
new file mode 100644
index 0000000..26b7a69
--- /dev/null
+++ b/occ.spec
@@ -0,0 +1,130 @@
+# TODO: verify/complete webserver configs (only apache 2.4 tested)
+Summary: Online Chess Club - small PHP chess game
+Summary(pl.UTF-8): Online Chess Club - mała gra w szachy w PHP
+Name: occ
+Version: 1.3.5
+Release: 1
+License: GPL v2
+Group: Applications/WWW
+Source0: http://downloads.sourceforge.net/lgames/%{name}-%{version}.tar.gz
+# Source0-md5: e0db96d6b867eded1c6c8a00b30fd50d
+Patch0: %{name}-datadir.patch
+URL: http://lgames.sourceforge.net/OCC/
+BuildRequires: rpmbuild(macros) >= 1.268
+Requires: php(session)
+Requires: webapps
+Requires: webserver(php)
+BuildArch: noarch
+BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%define _webapps /etc/webapps
+%define _webapp %{name}
+%define _sysconfdir %{_webapps}/%{_webapp}
+%define _appdir %{_datadir}/%{_webapp}
+
+%description
+Online Chess Club (OCC) is a small PHP chess game. It is not meant for
+public use but rather for playing with friends. Any number of games
+can be opened and the idea is to check once in a while (like once a
+day) whether somebody has moved and if so respond along with a
+comment. While it is possible to play a quick game by hitting Refresh
+frequently or using a chat tool for communication this is not the aim
+of OCC. Other online chess games may fit this purpose better.
+
+OCC stores all moves of a game (can be replayed in history browser)
+and automatically recognizes checkmate and stalemate. A draw can be
+proposed at any time (opponent needs to agree). When a game is
+finished it is archived. All games can be saved as PGN to analyse them
+with your favorite chess tool, e.g., with Fritz.
+
+%description -l pl.UTF-8
+Online Chess Club (OCC) to mała gra w szachy napisana w PHP. Nie jest
+przeznaczona do użytku publicznego, raczej do grania ze znajomymi.
+Można rozpocząć dowolną liczbę gier, a idea polaga na tym, żeby
+sprawdzać co jakiś czas (np. raz dziennie), czy ktoś się ruszył i
+reagować na ruch wraz z komentarzem. O ile możliwa jest szybka
+rozgrywka poprzez częste wciskanie przycisku "Refresh" albo
+wykorzystywanie komunikatora do komunikacji, nie jest to celem OCC -
+inne gry w szachy online mogą być lepsze do tego celu.
+
+OCC zapisuje wszystkie ruchy z gry (można je odtworzyć w przeglądarce
+historii) i automatycznie rozpoznaje sytuacje mata i pata. W każdej
+chwili można zaproponować remis (za zgodą przeciwnika). Po zakończeniu
+gra jest archiwizowana. Wszystkie gry można zapisać w formacie PGN w
+celu przeanalizowania dowolnym narzędziem, np. Fritzem.
+
+%prep
+%setup -q
+%patch0 -p1
+
+cat > apache.conf <<'EOF'
+Alias /%{name} %{_appdir}
+<Directory %{_appdir}>
+ # Apache 2.x
+ <IfModule !mod_authz_core.c>
+ Order allow,deny
+ Allow from all
+ </IfModule>
+ # Apache 2.4
+ <IfModule mod_authz_core.c>
+ Require all granted
+ </IfModule>
+</Directory>
+EOF
+
+cat > lighttpd.conf <<'EOF'
+alias.url += (
+ "/%{name}" => "%{_appdir}",
+)
+EOF
+
+%install
+rm -rf $RPM_BUILD_ROOT
+install -d $RPM_BUILD_ROOT{%{_sysconfdir},%{_appdir},/var/lib/%{name}}
+
+cp -a images *.php *.js $RPM_BUILD_ROOT%{_appdir}
+cp -a occ-data tmp $RPM_BUILD_ROOT/var/lib/%{name}
+
+cp -p apache.conf $RPM_BUILD_ROOT%{_sysconfdir}/apache.conf
+cp -p apache.conf $RPM_BUILD_ROOT%{_sysconfdir}/httpd.conf
+cp -p lighttpd.conf $RPM_BUILD_ROOT%{_sysconfdir}/lighttpd.conf
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%triggerin -- apache1 < 1.3.37-3, apache1-base
+%webapp_register apache %{_webapp}
+
+%triggerun -- apache1 < 1.3.37-3, apache1-base
+%webapp_unregister apache %{_webapp}
+
+%triggerin -- apache < 2.2.0, apache-base
+%webapp_register httpd %{_webapp}
+
+%triggerun -- apache < 2.2.0, apache-base
+%webapp_unregister httpd %{_webapp}
+
+%triggerin -- lighttpd
+%webapp_register lighttpd %{_webapp}
+
+%triggerun -- lighttpd
+%webapp_unregister lighttpd %{_webapp}
+
+%files
+%defattr(644,root,root,755)
+%doc Changelog README
+%dir %attr(750,root,http) %{_sysconfdir}
+%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/apache.conf
+%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/httpd.conf
+%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/lighttpd.conf
+%{_appdir}
+%attr(710,root,http) %dir /var/lib/%{name}
+%attr(710,root,http) %dir /var/lib/%{name}/occ-data
+%attr(770,root,http) %dir /var/lib/%{name}/occ-data/archive
+%attr(770,root,http) %dir /var/lib/%{name}/occ-data/games
+%attr(710,root,http) %dir /var/lib/%{name}/occ-data/users
+%attr(770,root,http) %dir /var/lib/%{name}/occ-data/users/lhistory
+%attr(770,root,http) %dir /var/lib/%{name}/occ-data/users/notes
+%attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) /var/lib/%{name}/occ-data/users/accounts.php
+%attr(660,root,http) %config(noreplace) %verify(not md5 mtime size) /var/lib/%{name}/occ-data/users/stats
+%attr(770,root,http) %dir /var/lib/%{name}/tmp
diff --git a/occ-datadir.patch b/occ-datadir.patch
new file mode 100644
index 0000000..478a04a
--- /dev/null
+++ b/occ-datadir.patch
@@ -0,0 +1,33 @@
+--- occ-1.3.5/io.php.orig 2016-06-12 13:52:20.000000000 +0200
++++ occ-1.3.5/io.php 2016-09-24 09:35:17.320297226 +0200
+@@ -11,9 +11,9 @@
+ include_once 'misc.php';
+
+ /* Data locations */
+-$res_users='occ-data/users';
+-$res_games='occ-data/games';
+-$res_archive='occ-data/archive';
++$res_users='/var/lib/occ/occ-data/users';
++$res_games='/var/lib/occ/occ-data/games';
++$res_archive='/var/lib/occ/occ-data/archive';
+
+ /* E-Mail header for notifications */
+ $mail_header="From: noreply-occ at yourdomain.org\n".
+@@ -34,7 +34,7 @@
+
+ if ($ioref++==0) {
+ $attempts=0;
+- while (($hfile=fopen('tmp/iolock','x'))===false) {
++ while (($hfile=fopen('/var/lib/occ/tmp/iolock','x'))===false) {
+ usleep(100000);
+ if (++$attempts==20)
+ break;
+@@ -50,7 +50,7 @@
+ if ($ioref==0)
+ return;
+ if (--$ioref==0)
+- unlink('tmp/iolock');
++ unlink('/var/lib/occ/tmp/iolock');
+ }
+
+ /* Load a game (try active games first, then archived games) and set various
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/occ.git/commitdiff/05b24ae91a9f57742fb843c6f4ce15629f36d877
More information about the pld-cvs-commit
mailing list