# HG changeset patch # User Michael Schloh von Bennewitz # Date 1350557586 -7200 # Node ID 75275e2bcfd76f9595293c5a0c9186ab809c907e # Parent 55a8b8e82e569f9ee5fb1f85da91c882f7633277 Refine specification, using other PHP dependent web packages as reference. diff -r 55a8b8e82e56 -r 75275e2bcfd7 roundcube/rc.roundcube --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/roundcube/rc.roundcube Thu Oct 18 12:53:06 2012 +0200 @@ -0,0 +1,53 @@ +#!@l_prefix@/bin/openpkg rc +## +## rc.roundcube -- Run-Commands +## + +%config + roundcube_enable="$openpkg_rc_def" + roundcube_log_prolog="true" + roundcube_log_epilog="true" + roundcube_log_numfiles="10" + roundcube_log_minsize="1M" + roundcube_log_complevel="9" + +%status -u @l_susr@ -o + roundcube_usable="no" + roundcube_active="no" + @l_prefix@/sbin/apache -t \ + -f @l_prefix@/etc/roundcube/roundcube-apache.conf 2>/dev/null && \ + roundcube_usable="yes" + [ -f @l_prefix@/var/roundcube/run/apache.pid ] && \ + kill -0 `cat @l_prefix@/var/roundcube/run/apache.pid` && \ + roundcube_active="yes" + echo "roundcube_enable=\"$roundcube_enable\"" + echo "roundcube_usable=\"$roundcube_usable\"" + echo "roundcube_active=\"$roundcube_active\"" + +%start -u @l_susr@ + rcService roundcube enable yes || exit 0 + rcService roundcube active yes && exit 0 + @l_prefix@/sbin/apache \ + -f @l_prefix@/etc/roundcube/roundcube-apache.conf + +%stop -u @l_susr@ + rcService roundcube enable yes || exit 0 + rcService roundcube active no && exit 0 + [ -f @l_prefix@/var/roundcube/run/apache.pid ] && \ + kill -TERM `cat @l_prefix@/var/roundcube/run/apache.pid` + sleep 2 + +%restart -u @l_susr@ + rcService roundcube enable yes || exit 0 + rcService roundcube active no && exit 0 + rc roundcube stop start + +%daily -u @l_nusr@ + rcService roundcube enable yes || exit 0 + shtool rotate -f \ + -n ${roundcube_log_numfiles} -s ${roundcube_log_minsize} -d \ + -z ${roundcube_log_complevel} -m 644 -o @l_nusr@ -g @l_ngrp@ \ + -P "${roundcube_log_prolog}" \ + -E "${roundcube_log_epilog}" \ + @l_prefix@/share/roundcube/logs/errors + diff -r 55a8b8e82e56 -r 75275e2bcfd7 roundcube/roundcube-apache.conf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/roundcube/roundcube-apache.conf Thu Oct 18 12:53:06 2012 +0200 @@ -0,0 +1,116 @@ +## +## roundcube-apache.conf -- Roundcube Apache Custom Configuration +## + +ServerRoot @l_prefix@ +ServerAdmin root@@l_hostname@.@l_domainname@ +ServerName @l_hostname@.@l_domainname@ +ServerTokens Prod +User @l_rusr@ +Group @l_rgrp@ +Listen 127.0.0.1:8080 + +# runtime files +PidFile @l_prefix@/var/roundcube/run/apache.pid +ScoreBoardFile @l_prefix@/var/roundcube/run/apache.sb +LockFile @l_prefix@/var/roundcube/run/apache.lck + +# include apache-php +Include @l_prefix@/etc/apache/apache.d/apache-php.conf + +# server behaviour +Timeout 300 +KeepAlive on +MaxKeepAliveRequests 100 +KeepAliveTimeout 15 +MinSpareServers 5 +MaxSpareServers 10 +StartServers 5 +MaxClients 15 +MaxRequestsPerChild 500 +HostnameLookups off +UseCanonicalName on + +# access logging +LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined +LogFormat "%h %l %u %t \"%r\" %>s %b" common +LogFormat "%{Referer}i -> %U" referer +LogFormat "%{User-agent}i" agent +CustomLog @l_prefix@/var/roundcube/log/apache.access.log common + +# error logging +LogLevel warn +ErrorLog @l_prefix@/var/roundcube/log/apache.error.log +ServerSignature on + +# secure root directory + + Options FollowSymLinks + AllowOverride None + + +# browser specifics +BrowserMatch "Mozilla/2" nokeepalive +BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0 +BrowserMatch "RealPlayer 4\.0" force-response-1.0 +BrowserMatch "Java/1\.0" force-response-1.0 +BrowserMatch "JDK/1\.0" force-response-1.0 + +# SSL/TLS support + + SSLRandomSeed startup builtin + SSLRandomSeed connect builtin + SSLMutex sem + SSLSessionCache shmcb:@l_prefix@/var/roundcube/run/apache.scache(512000) + SSLSessionCacheTimeout 300 + SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL + SetEnvIf User-Agent ".*MSIE.*" \ + nokeepalive ssl-unclean-shutdown \ + downgrade-1.0 force-response-1.0 + + SSLOptions +StdEnvVars + + + SSLOptions +StdEnvVars + + + +# configure PHP for Roundcube +AddType application/x-httpd-php .php +php_admin_flag magic_quotes_gpc off +php_admin_flag register_globals off +php_admin_flag session.auto_start off +php_admin_value session.save_handler user +php_admin_value session.cache_limiter none +php_admin_value error_reporting 6135 +php_admin_value memory_limit 64M +php_admin_value mbstring.http_input pass +php_admin_value mbstring.http_output pass +php_admin_flag mbstring.encoding_translation off +php_admin_value include_path .:@l_prefix@/share/roundcube/includes +php_admin_value upload_max_filesize 2M +php_admin_value post_max_size 8M + +# configure Roundcube +RewriteEngine on +RewriteRule ^/$ /roundcube/ [R,L] +Alias /roundcube @l_prefix@/share/roundcube +DocumentRoot @l_prefix@/share/roundcube +DirectoryIndex index.php +ErrorDocument 404 /index.php +ExpiresByType text/html A1 + + Options -Indexes +FollowSymLinks + AllowOverride All + Order allow,deny + Allow from all + RewriteEngine On + RewriteBase /roundcube + + + SetOutputFilter DEFLATE + + + SetOutputFilter DEFLATE + + diff -r 55a8b8e82e56 -r 75275e2bcfd7 roundcube/roundcube.spec --- a/roundcube/roundcube.spec Thu Oct 18 12:51:30 2012 +0200 +++ b/roundcube/roundcube.spec Thu Oct 18 12:53:06 2012 +0200 @@ -40,7 +40,9 @@ # list of sources Source0: http://switch.dl.sourceforge.net/roundcubemail/%{version}/roundcubemail-%{version}.tar.gz Source1: https://www.github.com/dennylin93/rcguard/tarball/master/dennylin93-rcguard-%{V_plug_rcguard}.tar.gz -Source2: linen_login.png +Source2: roundcube-apache.conf +Source3: rc.roundcube +Source4: linen_login.png Patch0: roundcube.patch # build information @@ -84,7 +86,10 @@ %install # create directory structure %{l_shtool} mkdir -f -p -m 755 \ - $RPM_BUILD_ROOT%{l_prefix}/share/roundcube + $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \ + $RPM_BUILD_ROOT%{l_prefix}/share/roundcube \ + $RPM_BUILD_ROOT%{l_prefix}/var/roundcube/log \ + $RPM_BUILD_ROOT%{l_prefix}/var/roundcube/run # install program cp -rpf \ @@ -101,6 +106,19 @@ %{SOURCE linen_login.png} \ $RPM_BUILD_ROOT%{l_prefix}/share/roundcube/skins/larry/images/ + # install runcommand script + %{l_shtool} install -c -m 755 %{l_value -s -a} \ + %{SOURCE rc.roundcube} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ + + # install custom Apache configuration + l_hostname=`%{l_shtool} echo -e %h` + l_domainname=`%{l_shtool} echo -e %d | cut -c2-` + %{l_shtool} install -c -m 644 %{l_value -s -a} \ + -e "s;@l_hostname@;$l_hostname;g" \ + -e "s;@l_domainname@;$l_domainname;g" \ + %{SOURCE roundcube-apache.conf} \ + $RPM_BUILD_ROOT%{l_prefix}/etc/roundcube/ + # determine package ingredients and tag config files %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \ %{l_files_std} \ @@ -114,6 +132,7 @@ %clean %post + if [ $1 -eq 1 ]; then # display information about next steps ( echo "Roundcube stores data in SQL and requires an existing" echo "local or remote installation of PostgreSQL, MySQL, or" @@ -124,10 +143,25 @@ echo "CREATE USER 'username'@'localhost' IDENTIFIED BY 'newpwd';" echo "GRANT ALL PRIVILEGES ON roundcubemail.* TO username@localhost IDENTIFIED BY 'newpwd';" echo "FLUSH PRIVILEGES;" + echo "" + echo "After that, start the database server and finally start Roundcube:" + echo " \$ $RPM_INSTALL_PREFIX/bin/openpkg rc roundcube start" + echo "Cconnect with a browser to the URL:" + echo " http://127.0.0.1:8080/roundcube/" ) | %{l_rpmtool} msg -b -t notice + fi + if [ $1 -eq 2 ]; then + # after upgrade, restart service + eval `%{l_rc} roundcube status 2>/dev/null` + [ ".$roundcube_active" = .yes ] && %{l_rc} roundcube restart + fi + exit 0 %preun - # before erase, remove log files + # before erase, stop service and remove log files [ $1 -eq 0 ] || exit 0 + %{l_rc} roundcube stop 2>/dev/null rm -f $RPM_INSTALL_PREFIX/var/roundcube/log/*.log >/dev/null 2>&1 || true + rm -f $RPM_INSTALL_PREFIX/share/roundcube/logs/* >/dev/null 2>&1 || true + rm -f $RPM_INSTALL_PREFIX/share/roundcube/temp/* >/dev/null 2>&1 || true