Sophie

Sophie

distrib > Mandriva > 10.2 > x86_64 > by-pkgid > 8b047ad0f037f54dcfbfd306a5c79805 > files > 2

flyspray-0.9.5-1mdk.src.rpm

%define name    flyspray
%define version 0.9.5
%define release 1mdk
%define webroot /var/www/html/

# TODO
# ease the configuration

Summary:	A simple Bug tracking system
Name:		%name
Version:	%version
Release:	%release
License:	GPL
Group:		Networking/WWW
Url:        http://flyspray.rocks.cc/
Source0:	%{name}-%{version}.tar.bz2
BuildArch:	noarch
BuildRoot:	%{_tmppath}/%{name}-buildroot
Requires:   webserver ADOdb
%description
%{name} is a simple bug tracking system, written in php, aimed
at people who do not want to deploy Bugzilla.
It offer most of the features needed without a increased complexity.
The configuration is done trough a web interface, and you can fully
control who can do what on the various task.

%prep
%setup -q

%build


%install
rm -rf %buildroot
mkdir -p $RPM_BUILD_ROOT/%webroot/%name
cp -R * $RPM_BUILD_ROOT/%webroot/%name
mkdir -p $RPM_BUILD_ROOT/%_datadir/%{name}/
mv  $RPM_BUILD_ROOT/%webroot/%name/sql/ $RPM_BUILD_ROOT/%_datadir/%{name}/

mkdir -p $RPM_BUILD_ROOT/%_sysconfdir/%name/
mv $RPM_BUILD_ROOT/%webroot/%name/header.php $RPM_BUILD_ROOT/%_sysconfdir/%name/
perl -pi -e 's#/usr/share/adodb/#/usr/lib/adodb/#' $RPM_BUILD_ROOT/%_sysconfdir/%name/header.php
perl -pi -e 's#/var/www/flyspray#%webroot/flyspray#' $RPM_BUILD_ROOT/%_sysconfdir/%name/header.php


cat >  $RPM_BUILD_ROOT/%webroot/%name/header.php <<EOF
<?
include('%_sysconfdir/%name/header.php');
?>
EOF


cat > $RPM_BUILD_ROOT/%webroot/%name/not_configurated.html <<EOF
<html>
<body>
	Flyspray is not configured, please see %_defaultdocdir/%{name}-%{version}/README.POST
</body>
</html>
EOF

mkdir -p  $RPM_BUILD_ROOT/%{_sysconfdir}/httpd/conf.d/
cat > $RPM_BUILD_ROOT/%{_sysconfdir}/httpd/conf.d/%{name}.conf << EOF
# This file add a redirection to the not_configurated.html 
# in order to warn people and do not use a service with
# bad default ( think super, super as a login password..)

AliasMatch /flyspray/* /var/www/html/flyspray/not_configurated.html
EOF

cat > README.POST << EOF
The configuration file was moved to %{_sysconfdir}/%{name}/.

After the install of the rpm, you need to follow these step :

1) Set up your database, you need to create the table with the help
of the files in %_datadir/%name/sql subdirectory.
Do not forget to install the php module you need ( php-mysql or php-pgsql ),
and to reload apache after that.

2) Edit  %_sysconfdir/%name/header.php, to adapt it to your need.
The cookie have been already changed during the installation of the rpm.

3) Remove the first restriction in the file /etc/http/conf.d/flyspray.conf

4) Use the page http://localhost/flyspray/ to add a normal user
and remove the super user ( password and user are 'super', so this is
not good to keep them ).

5) Finish to configure flyspray as you want, and adjust the apache
configuration file to your need.
Do not forget to set base url trough the Admin menu.
EOF

%clean
rm -rf %buildroot


%post 

%{_initrddir}/httpd reload
if [ "$1" = 1 ]; then
	cookie=`head /dev/urandom | md5sum | cut -b 1-16 `
	perl -pi -e "s#\\\$cookiesalt = .*#\\\$cookiesalt = '$cookie';#" %_sysconfdir/%name/header.php
fi

%postun 
%{_initrddir}/httpd reload


%files
%defattr(0644,root,root,0755)
%doc AUTHORS BUGS CHANGELOG COPYING INSTALL README* TODO UPGRADING sql/*sql
%webroot/%{name}
%dir %attr(0755,apache,apache) %webroot/%{name}/attachments/
%_datadir/%{name}/
%config(noreplace) %{_sysconfdir}/%{name}/
%config(noreplace) %{_sysconfdir}/httpd/conf.d/%{name}.conf

%changelog

* Fri Apr 02 2004 Michael Scherer <misc@mandrake.org> 0.9.5-1mdk
- first package