Refine specification, using other PHP dependent web packages as reference.

Thu, 18 Oct 2012 12:53:06 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 18 Oct 2012 12:53:06 +0200
changeset 746
75275e2bcfd7
parent 745
55a8b8e82e56
child 747
0b57a67721e7

Refine specification, using other PHP dependent web packages as reference.

roundcube/rc.roundcube file | annotate | diff | comparison | revisions
roundcube/roundcube-apache.conf file | annotate | diff | comparison | revisions
roundcube/roundcube.spec file | annotate | diff | comparison | revisions
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/roundcube/rc.roundcube	Thu Oct 18 12:53:06 2012 +0200
     1.3 @@ -0,0 +1,53 @@
     1.4 +#!@l_prefix@/bin/openpkg rc
     1.5 +##
     1.6 +##  rc.roundcube -- Run-Commands
     1.7 +##
     1.8 +
     1.9 +%config
    1.10 +    roundcube_enable="$openpkg_rc_def"
    1.11 +    roundcube_log_prolog="true"
    1.12 +    roundcube_log_epilog="true"
    1.13 +    roundcube_log_numfiles="10"
    1.14 +    roundcube_log_minsize="1M"
    1.15 +    roundcube_log_complevel="9"
    1.16 +
    1.17 +%status -u @l_susr@ -o
    1.18 +    roundcube_usable="no"
    1.19 +    roundcube_active="no"
    1.20 +    @l_prefix@/sbin/apache -t \
    1.21 +        -f @l_prefix@/etc/roundcube/roundcube-apache.conf 2>/dev/null && \
    1.22 +        roundcube_usable="yes"
    1.23 +    [ -f @l_prefix@/var/roundcube/run/apache.pid ] && \
    1.24 +        kill -0 `cat @l_prefix@/var/roundcube/run/apache.pid` && \
    1.25 +        roundcube_active="yes"
    1.26 +    echo "roundcube_enable=\"$roundcube_enable\""
    1.27 +    echo "roundcube_usable=\"$roundcube_usable\""
    1.28 +    echo "roundcube_active=\"$roundcube_active\""
    1.29 +
    1.30 +%start -u @l_susr@
    1.31 +    rcService roundcube enable yes || exit 0
    1.32 +    rcService roundcube active yes && exit 0
    1.33 +    @l_prefix@/sbin/apache \
    1.34 +        -f @l_prefix@/etc/roundcube/roundcube-apache.conf
    1.35 +
    1.36 +%stop -u @l_susr@
    1.37 +    rcService roundcube enable yes || exit 0
    1.38 +    rcService roundcube active no  && exit 0
    1.39 +    [ -f @l_prefix@/var/roundcube/run/apache.pid ] && \
    1.40 +        kill -TERM `cat @l_prefix@/var/roundcube/run/apache.pid`
    1.41 +    sleep 2
    1.42 +
    1.43 +%restart -u @l_susr@
    1.44 +    rcService roundcube enable yes || exit 0
    1.45 +    rcService roundcube active no  && exit 0
    1.46 +    rc roundcube stop start
    1.47 +
    1.48 +%daily -u @l_nusr@
    1.49 +    rcService roundcube enable yes || exit 0
    1.50 +    shtool rotate -f \
    1.51 +        -n ${roundcube_log_numfiles} -s ${roundcube_log_minsize} -d \
    1.52 +        -z ${roundcube_log_complevel} -m 644 -o @l_nusr@ -g @l_ngrp@ \
    1.53 +        -P "${roundcube_log_prolog}" \
    1.54 +        -E "${roundcube_log_epilog}" \
    1.55 +        @l_prefix@/share/roundcube/logs/errors
    1.56 +
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/roundcube/roundcube-apache.conf	Thu Oct 18 12:53:06 2012 +0200
     2.3 @@ -0,0 +1,116 @@
     2.4 +##
     2.5 +##  roundcube-apache.conf -- Roundcube Apache Custom Configuration
     2.6 +##
     2.7 +
     2.8 +ServerRoot             @l_prefix@
     2.9 +ServerAdmin            root@@l_hostname@.@l_domainname@
    2.10 +ServerName             @l_hostname@.@l_domainname@
    2.11 +ServerTokens           Prod
    2.12 +User                   @l_rusr@
    2.13 +Group                  @l_rgrp@
    2.14 +Listen                 127.0.0.1:8080
    2.15 +
    2.16 +#   runtime files
    2.17 +PidFile                @l_prefix@/var/roundcube/run/apache.pid
    2.18 +ScoreBoardFile         @l_prefix@/var/roundcube/run/apache.sb
    2.19 +LockFile               @l_prefix@/var/roundcube/run/apache.lck
    2.20 +
    2.21 +#   include apache-php
    2.22 +Include                @l_prefix@/etc/apache/apache.d/apache-php.conf
    2.23 +
    2.24 +#  server behaviour
    2.25 +Timeout                300
    2.26 +KeepAlive              on
    2.27 +MaxKeepAliveRequests   100
    2.28 +KeepAliveTimeout       15
    2.29 +MinSpareServers        5
    2.30 +MaxSpareServers        10
    2.31 +StartServers           5
    2.32 +MaxClients             15
    2.33 +MaxRequestsPerChild    500
    2.34 +HostnameLookups        off
    2.35 +UseCanonicalName       on
    2.36 +
    2.37 +#   access logging
    2.38 +LogFormat              "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
    2.39 +LogFormat              "%h %l %u %t \"%r\" %>s %b" common
    2.40 +LogFormat              "%{Referer}i -> %U" referer
    2.41 +LogFormat              "%{User-agent}i" agent
    2.42 +CustomLog              @l_prefix@/var/roundcube/log/apache.access.log common
    2.43 +
    2.44 +#   error logging
    2.45 +LogLevel               warn
    2.46 +ErrorLog               @l_prefix@/var/roundcube/log/apache.error.log
    2.47 +ServerSignature        on
    2.48 +
    2.49 +#   secure root directory
    2.50 +<Directory />
    2.51 +    Options FollowSymLinks
    2.52 +    AllowOverride None
    2.53 +</Directory>
    2.54 +
    2.55 +#   browser specifics
    2.56 +BrowserMatch "Mozilla/2"       nokeepalive
    2.57 +BrowserMatch "MSIE 4\.0b2;"    nokeepalive downgrade-1.0 force-response-1.0
    2.58 +BrowserMatch "RealPlayer 4\.0" force-response-1.0
    2.59 +BrowserMatch "Java/1\.0"       force-response-1.0
    2.60 +BrowserMatch "JDK/1\.0"        force-response-1.0
    2.61 +
    2.62 +#   SSL/TLS support
    2.63 +<IfModule ssl_module>
    2.64 +    SSLRandomSeed           startup builtin
    2.65 +    SSLRandomSeed           connect builtin
    2.66 +    SSLMutex                sem
    2.67 +    SSLSessionCache         shmcb:@l_prefix@/var/roundcube/run/apache.scache(512000)
    2.68 +    SSLSessionCacheTimeout  300
    2.69 +    SSLCipherSuite          ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
    2.70 +    SetEnvIf User-Agent ".*MSIE.*" \
    2.71 +             nokeepalive ssl-unclean-shutdown \
    2.72 +             downgrade-1.0 force-response-1.0
    2.73 +    <Files ~ "\.(cgi|shtml|phtml|php?)$">
    2.74 +        SSLOptions +StdEnvVars
    2.75 +    </Files>
    2.76 +    <Directory "@l_prefix@/cgi">
    2.77 +        SSLOptions +StdEnvVars
    2.78 +    </Directory>
    2.79 +</IfModule>
    2.80 +
    2.81 +#   configure PHP for Roundcube
    2.82 +AddType           application/x-httpd-php       .php
    2.83 +php_admin_flag    magic_quotes_gpc              off
    2.84 +php_admin_flag    register_globals              off
    2.85 +php_admin_flag    session.auto_start            off
    2.86 +php_admin_value   session.save_handler          user
    2.87 +php_admin_value   session.cache_limiter         none
    2.88 +php_admin_value   error_reporting               6135
    2.89 +php_admin_value   memory_limit                  64M
    2.90 +php_admin_value   mbstring.http_input           pass
    2.91 +php_admin_value   mbstring.http_output          pass
    2.92 +php_admin_flag    mbstring.encoding_translation off
    2.93 +php_admin_value   include_path                  .:@l_prefix@/share/roundcube/includes
    2.94 +php_admin_value   upload_max_filesize           2M
    2.95 +php_admin_value   post_max_size                 8M
    2.96 +
    2.97 +#   configure Roundcube
    2.98 +RewriteEngine     on
    2.99 +RewriteRule       ^/$ /roundcube/ [R,L]
   2.100 +Alias             /roundcube @l_prefix@/share/roundcube
   2.101 +DocumentRoot      @l_prefix@/share/roundcube
   2.102 +DirectoryIndex    index.php
   2.103 +ErrorDocument     404 /index.php
   2.104 +ExpiresByType     text/html A1
   2.105 +<Directory        @l_prefix@/share/roundcube>
   2.106 +    Options       -Indexes +FollowSymLinks
   2.107 +    AllowOverride All
   2.108 +    Order         allow,deny
   2.109 +    Allow         from all
   2.110 +    RewriteEngine On
   2.111 +    RewriteBase   /roundcube
   2.112 +</Directory>
   2.113 +<Location /roundcube/sites/default/files/js>
   2.114 +    SetOutputFilter DEFLATE
   2.115 +</Location>
   2.116 +<Location /roundcube/sites/default/files/css>
   2.117 +    SetOutputFilter DEFLATE
   2.118 +</Location>
   2.119 +
     3.1 --- a/roundcube/roundcube.spec	Thu Oct 18 12:51:30 2012 +0200
     3.2 +++ b/roundcube/roundcube.spec	Thu Oct 18 12:53:06 2012 +0200
     3.3 @@ -40,7 +40,9 @@
     3.4  #   list of sources
     3.5  Source0:      http://switch.dl.sourceforge.net/roundcubemail/%{version}/roundcubemail-%{version}.tar.gz
     3.6  Source1:      https://www.github.com/dennylin93/rcguard/tarball/master/dennylin93-rcguard-%{V_plug_rcguard}.tar.gz
     3.7 -Source2:      linen_login.png
     3.8 +Source2:      roundcube-apache.conf
     3.9 +Source3:      rc.roundcube
    3.10 +Source4:      linen_login.png
    3.11  Patch0:       roundcube.patch
    3.12  
    3.13  #   build information
    3.14 @@ -84,7 +86,10 @@
    3.15  %install
    3.16      #   create directory structure
    3.17      %{l_shtool} mkdir -f -p -m 755 \
    3.18 -        $RPM_BUILD_ROOT%{l_prefix}/share/roundcube
    3.19 +        $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
    3.20 +        $RPM_BUILD_ROOT%{l_prefix}/share/roundcube \
    3.21 +        $RPM_BUILD_ROOT%{l_prefix}/var/roundcube/log \
    3.22 +        $RPM_BUILD_ROOT%{l_prefix}/var/roundcube/run
    3.23  
    3.24      #   install program
    3.25      cp -rpf \
    3.26 @@ -101,6 +106,19 @@
    3.27          %{SOURCE linen_login.png} \
    3.28          $RPM_BUILD_ROOT%{l_prefix}/share/roundcube/skins/larry/images/
    3.29  
    3.30 +    #   install runcommand script
    3.31 +    %{l_shtool} install -c -m 755 %{l_value -s -a} \
    3.32 +        %{SOURCE rc.roundcube} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
    3.33 +
    3.34 +    #   install custom Apache configuration
    3.35 +    l_hostname=`%{l_shtool} echo -e %h`
    3.36 +    l_domainname=`%{l_shtool} echo -e %d | cut -c2-`
    3.37 +    %{l_shtool} install -c -m 644 %{l_value -s -a} \
    3.38 +        -e "s;@l_hostname@;$l_hostname;g" \
    3.39 +        -e "s;@l_domainname@;$l_domainname;g" \
    3.40 +        %{SOURCE roundcube-apache.conf} \
    3.41 +        $RPM_BUILD_ROOT%{l_prefix}/etc/roundcube/
    3.42 +
    3.43      #   determine package ingredients and tag config files
    3.44      %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
    3.45          %{l_files_std} \
    3.46 @@ -114,6 +132,7 @@
    3.47  %clean
    3.48  
    3.49  %post
    3.50 +    if [ $1 -eq 1 ]; then
    3.51          #   display information about next steps
    3.52          ( echo "Roundcube stores data in SQL and requires an existing"
    3.53            echo "local or remote installation of PostgreSQL, MySQL, or"
    3.54 @@ -124,10 +143,25 @@
    3.55            echo "CREATE USER 'username'@'localhost' IDENTIFIED BY 'newpwd';"
    3.56            echo "GRANT ALL PRIVILEGES ON roundcubemail.* TO username@localhost IDENTIFIED BY 'newpwd';"
    3.57            echo "FLUSH PRIVILEGES;"
    3.58 +          echo ""
    3.59 +          echo "After that, start the database server and finally start Roundcube:"
    3.60 +          echo "     \$ $RPM_INSTALL_PREFIX/bin/openpkg rc roundcube start"
    3.61 +          echo "Cconnect with a browser to the URL:"
    3.62 +          echo "     http://127.0.0.1:8080/roundcube/"
    3.63          ) | %{l_rpmtool} msg -b -t notice
    3.64 +    fi
    3.65 +    if [ $1 -eq 2 ]; then
    3.66 +        #   after upgrade, restart service
    3.67 +        eval `%{l_rc} roundcube status 2>/dev/null`
    3.68 +        [ ".$roundcube_active" = .yes ] && %{l_rc} roundcube restart
    3.69 +    fi
    3.70 +    exit 0
    3.71  
    3.72  %preun
    3.73 -    #   before erase, remove log files
    3.74 +    #   before erase, stop service and remove log files
    3.75      [ $1 -eq 0 ] || exit 0
    3.76 +    %{l_rc} roundcube stop 2>/dev/null
    3.77      rm -f $RPM_INSTALL_PREFIX/var/roundcube/log/*.log >/dev/null 2>&1 || true
    3.78 +    rm -f $RPM_INSTALL_PREFIX/share/roundcube/logs/* >/dev/null 2>&1 || true
    3.79 +    rm -f $RPM_INSTALL_PREFIX/share/roundcube/temp/* >/dev/null 2>&1 || true
    3.80  

mercurial