File dekiwiki.spec of Package dekiwiki_nightlybuild
Name: dekiwiki
Version: trunk.16879
Release: 1
Summary: a powerful opensource wiki which runs on Mono
License: GPLv2
Icon: mindtouch.xpm
Vendor: MindTouch
URL: http://developer.mindtouch.com/
Group: Applications/Internet
#Packager: services@mindtouch.com
Provides: mono(mindtouch.dream) = 1.7.1
Source0: %{name}-%{version}.tar.bz2
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildArch: noarch
%if 0%{?fedora}||0%{?fedora_version}||0%{?rhel_version}||0%{?centos_version}
# REDHAT flavor specificities
Requires: httpd, curl, ImageMagick, mysql, mysql-server, php, php-cli
Requires: php-common, php-gd, php-mbstring, php-mysql, unzip
%define webroot /var/www
%define webuser apache
%define webgroup apache
%define webhome /var/www
%define apache httpd
%define mysql mysqld
%endif
#%elseif 0%{?suse_version}
%if 0%{?suse_version} || 0%{?sles_version}
# OpenSUSE flavor specificities
BuildRequires: unzip, pwdutils, apache2
Requires: apache2, apache2-mod_php5, curl, gd, ImageMagick, mysql
Requires: mono-core >= 1.2, mono-data-sqlite >= 1.2, mono-web >= 1.2
Requires: php5, php5-bz2, php5-ctype, php5-curl, php5-dom, php5-gd
Requires: php5-iconv, php5-json, php5-mbstring, php5-mcrypt
Requires: php5-mysql, php5-pdo, php5-pear
Requires: php5-pear-log, php5-sqlite, php5-tokenizer
Requires: php5-xmlreader, php5-xmlrpc, php5-zlib, wv, unzip
%if 0%{?suse_version} <= 1100
Requires: php5-mhash
%endif
%if 0%{?sles_version} != 10
Requires: php5-hash, php5-pear-auth_sasl, php5-pear-date, php5-pear-db
Requires: php5-pear-file, php5-pear-mail, php5-pear-mail_mime, php5-xmlwriter
%endif
%define webroot /srv/www
%define webuser wwwrun
%define webgroup www
%define webhome /var/lib/wwwrun
%define apache apache2
%define mysql mysql
%endif
%description
MindTouch Deki is a free open source wiki and application platform for
communities and enterprises. Deki is an easy to use and sophisticated wiki
for authoring, aggregating, organizing, and sharing content. Deki is also
a platform for creating collaborative applications, or adding wiki
capabilities to existing applications.
###########################################
%prep
###########################################
%setup -q
###########################################
%build
# Remove Google analytics key
#sed -i -e '/^insert into.*config_key.*analytics-key.*/d' \
# web/maintenance/data.sql
# Changing apache user depending on the linux flavor
echo "Changing Apache User to %{webuser}"
for I in $(find -type f | xargs -i grep -H "www-data" "{}" \
| sed -e 's@\(^[^:]*\):.*@\1@' | uniq)
do
echo "$I:"
sed -i -e 's@www-data@'%{webuser}'@g' "$I"
echo ------------
done
# Changing web path depending on the linux flavor
echo "Changing Web Path to %{webroot}"
for I in $(find -type f | xargs -i grep -H "/var/www/" "{}" \
| sed -e 's@\(^[^:]*\):.*@\1@' | uniq)
do
echo "$I:"
sed -i -e 's@/var/www/@'%{webroot}'/@g' "$I"
echo ------------
done
echo "All Done"
sync
###########################################
%install
rm -rf ${RPM_BUILD_ROOT}
# Set up license to be installed as a doc
mv web/COPYING ./
# logrotate script
install -D -m 0644 config/dekiwiki.logrotate \
${RPM_BUILD_ROOT}/etc/logrotate.d/dekiwiki
# dataWiki script
install -D -m 0755 src/scripts/dataWiki.sh \
${RPM_BUILD_ROOT}/usr/bin/dataWiki.sh
# Apache conf
install -D -m 0644 config/deki-apache.conf \
${RPM_BUILD_ROOT}/etc/%{apache}/conf.d/deki-apache.conf.disabled
%if 0%{?fedora}||0%{?fedora_version}||0%{?rhel_version}||0%{?centos_version}
# Make sure paths are good for RedHat
sed -i -e 's/\/var\/log\/apache2/\/var\/log\/httpd/g' \
${RPM_BUILD_ROOT}/etc/%{apache}/conf.d/deki-apache.conf.disabled
%endif
#%elseif 0%{?suse_version}
%if 0%{?suse_version} || 0%{?sles_version}
# For OpenSUSE we need to change some default values
sed -i -e 's/\/var\/log\/httpd/\/var\/log\/apache2/g' \
-e 's/\/var\/www/\/srv\/www/g' \
${RPM_BUILD_ROOT}/etc/%{apache}/conf.d/deki-apache.conf.disabled
%endif
# installing init script
%if 0%{?fedora}||0%{?fedora_version}||0%{?rhel_version}||0%{?centos_version}
install -D -m 0755 config/dekiwiki-init.redhat \
${RPM_BUILD_ROOT}/etc/init.d/dekiwiki
%endif
#%elseif 0%{?suse_version}
%if 0%{?suse_version} || 0%{?sles_version}
install -D -m 0755 config/dekiwiki-init.suse \
${RPM_BUILD_ROOT}/etc/init.d/dekiwiki
%endif
# Web document root
install -d ${RPM_BUILD_ROOT}%{webroot}
cp -r web ${RPM_BUILD_ROOT}%{webroot}/dekiwiki
# Attachments directory
install -d -m 0755 ${RPM_BUILD_ROOT}%{webroot}/dekiwiki/attachments
# Lucene index location
install -d -m 0755 ${RPM_BUILD_ROOT}%{webroot}/dekiwiki/bin/cache/luceneindex
# Creating mono .wapi directory
install -d -m 0755 ${RPM_BUILD_ROOT}%{webhome}/.wapi
# Creating mono .config directory
install -d -m 0755 ${RPM_BUILD_ROOT}%{webhome}/.config
# Create the deki-api log file
install -d -m 0755 ${RPM_BUILD_ROOT}/var/log/dekiwiki
touch ${RPM_BUILD_ROOT}/var/log/dekiwiki/deki-api.log
# Create our dekiwiki config dir and empty config files for now
install -d ${RPM_BUILD_ROOT}/etc/dekiwiki
touch ${RPM_BUILD_ROOT}/etc/dekiwiki/mindtouch.host.conf
touch ${RPM_BUILD_ROOT}/etc/dekiwiki/mindtouch.deki.startup.xml
# Create LocalSettings and AdminSettings ghosted config files
touch ${RPM_BUILD_ROOT}%{webroot}/dekiwiki/LocalSettings.php
touch ${RPM_BUILD_ROOT}%{webroot}/dekiwiki/AdminSettings.php
###########################################
%clean
rm -rf ${RPM_BUILD_ROOT}
###########################################
%pre
# Create dekiwiki user
grep "^dekiwiki" /etc/passwd >>/dev/null
if [ $? -ne 0 ]; then
useradd -s /bin/sh -d %{webhome} -g %{webgroup} \
-c "DekiWiki user" dekiwiki 2>/dev/null
fi
exit 0
###########################################
%post
# Populate the conf files with the host name
HNAME=$(hostname)
SHNAME=$(hostname -s)
sed -i -e "s/.*ServerName.*/ ServerName $HNAME/" \
/etc/%{apache}/conf.d/deki-apache.conf.disabled
sed -i -e "s/.*ServerAlias.*/ ServerAlias $SHNAME/" \
/etc/%{apache}/conf.d/deki-apache.conf.disabled
# Changing init script to use dekiwiki user
sed -i -e "s/^DEKIWIKI_USER=.*$/"'DEKIWIKI_USER="dekiwiki"/' \
/etc/init.d/dekiwiki
# configure the runlevels for the init script
/sbin/chkconfig --add dekiwiki >>/dev/null
%if 0%{?suse_version} || 0%{?sles_version}
# On OpenSUSE, we need to enable mod_rewrite and mod_proxy for Apache
grep "^APACHE_MODULES=\"rewrite proxy" /etc/sysconfig/apache2 >>/dev/null
if [ $? -ne 0 ]; then
sed -i -e 's/^APACHE_MODULES="/APACHE_MODULES="rewrite proxy /g' \
/etc/sysconfig/apache2
fi
a2enmod env >>/dev/null
a2enmod rewrite >>/dev/null
a2enmod proxy >>/dev/null
a2enmod proxy_http >>/dev/null
%endif
# Updating database schema
cd %{webroot}/dekiwiki/maintenance
if [ -f %{webroot}/dekiwiki/LocalSettings.php ]
then
php update-db.php >>/dev/null
service dekiwiki restart
echo "The Apache configuration might have changed, please check your /etc/%{apache}/conf.d directory"
fi
# Make sure perms are okay
chown -R dekiwiki:%{webgroup} %{webroot}/dekiwiki/bin %{webroot}/dekiwiki/editor/fckeditor/editor
exit 0
###########################################
%preun
# Except in case of upgrade, disable dekiwiki service
if [ $1 -ne 1 ]; then
service dekiwiki stop
/sbin/chkconfig --del dekiwiki >>/dev/null
fi
# cache cleanup
rm -rf %{webroot}/dekiwiki/skins/common/cache/*
exit 0
###########################################
%postun
# Run this if we're on a simple removal (ie not a package upgrade)
if [ $1 -eq 0 ]; then
# Remove dekiwiki user (if it's not an upgrade)
userdel -f dekiwiki
fi
exit 0
###########################################
%files
%defattr(644,dekiwiki,%{webgroup},755)
%doc COPYING README
%config(noreplace) /etc/%{apache}/conf.d/deki-apache.conf.disabled
%attr(755,root,root) /etc/init.d/dekiwiki
%attr(644,root,root) /etc/logrotate.d/dekiwiki
%dir %attr(750,dekiwiki,%{webgroup}) /etc/dekiwiki
%ghost %config(noreplace,missingok) /etc/dekiwiki/mindtouch.host.conf
%ghost %config(noreplace,missingok) /etc/dekiwiki/mindtouch.deki.startup.xml
%dir %attr(755,dekiwiki,%{webgroup}) /var/log/dekiwiki
%ghost /var/log/dekiwiki/deki-api.log
%attr(755,dekiwiki,root) /usr/bin/dataWiki.sh
%dir %attr(755,dekiwiki,%{webgroup}) %{webhome}/.wapi
%dir %attr(755,dekiwiki,%{webgroup}) %{webhome}/.config
%attr(-,root,root) %{webroot}/dekiwiki
%dir %attr(755,root,root) %{webroot}/dekiwiki
%ghost %config(noreplace,missingok) %{webroot}/dekiwiki/LocalSettings.php
%ghost %config(noreplace,missingok) %{webroot}/dekiwiki/AdminSettings.php
%dir %attr(775,dekiwiki,%{webgroup}) %{webroot}/dekiwiki/skins/common/cache
%dir %attr(775,dekiwiki,%{webgroup}) %{webroot}/dekiwiki/config
%dir %attr(775,dekiwiki,%{webgroup}) %{webroot}/dekiwiki/attachments
%dir %attr(755,dekiwiki,%{webgroup}) %{webroot}/dekiwiki/bin
%dir %attr(775,dekiwiki,%{webgroup}) %{webroot}/dekiwiki/editor/fckeditor/editor
###########################################
%changelog
* Fri Nov 13 2009 MindTouch <services@mindtouch.com>
- trunk.16879 nightly built
* Tue Oct 27 2009 MindTouch <services@mindtouch.com>
- 9.08.1 Minneopa release
* Sat Sep 05 2009 MindTouch <services@mindtouch.com>
- 9.08.0 Minneopa release
* Wed Jul 07 2009 MindTouch <services@mindtouch.com>
- 9.02.4 Lyons release
* Fri May 29 2009 MindTouch <services@mindtouch.com>
- 9.02.2 Lyons release
* Tue Apr 14 2009 MindTouch <services@mindtouch.com>
- 9.02.1 Lyons release
* Tue Mar 24 2009 MindTouch <services@mindtouch.com>
- 09.02.00 Lyons release
* Wed Dec 03 2008 MindTouch <services@mindtouch.com>
- 8.08.2 Kilen Woods release
- several improvements in order to make the RPM more standard
* Tue Oct 28 2008 MindTouch <services@mindtouch.com>
- 8.08.1a Kilen Woods release
* Fri Oct 20 2008 MindTouch <services@mindtouch.com>
- 8.08.1 Kilen Woods release
* Fri Sep 05 2008 MindTouch <services@mindtouch.com>
- 8.08 Kilen Woods release
* Wed Jul 02 2008 MindTouch <services@mindtouch.com>
- 8.05.2 Jay Cooke release
- Deki service now runs under its own user
- Added mozroots installation
* Mon Jun 23 2008 MindTouch <services@mindtouch.com>
- 8.05.1 Jay Cooke release
- added upgrade capability
* Tue May 13 2008 MindTouch <services@mindtouch.com>
- 8.05 Jay Cooke release
- make apache VirtualHost config a manual step
- don't modify /etc/sudoers
- don't usermod, init script uses /bin/bash explicitly
* Tue Mar 11 2008 MindTouch <services@mindtouch.com>
- initial packaging for 1.9.0
#EOF