1.1 --- a/roundcube/roundcube.spec Thu Oct 18 12:51:30 2012 +0200 1.2 +++ b/roundcube/roundcube.spec Thu Oct 18 12:53:06 2012 +0200 1.3 @@ -40,7 +40,9 @@ 1.4 # list of sources 1.5 Source0: http://switch.dl.sourceforge.net/roundcubemail/%{version}/roundcubemail-%{version}.tar.gz 1.6 Source1: https://www.github.com/dennylin93/rcguard/tarball/master/dennylin93-rcguard-%{V_plug_rcguard}.tar.gz 1.7 -Source2: linen_login.png 1.8 +Source2: roundcube-apache.conf 1.9 +Source3: rc.roundcube 1.10 +Source4: linen_login.png 1.11 Patch0: roundcube.patch 1.12 1.13 # build information 1.14 @@ -84,7 +86,10 @@ 1.15 %install 1.16 # create directory structure 1.17 %{l_shtool} mkdir -f -p -m 755 \ 1.18 - $RPM_BUILD_ROOT%{l_prefix}/share/roundcube 1.19 + $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \ 1.20 + $RPM_BUILD_ROOT%{l_prefix}/share/roundcube \ 1.21 + $RPM_BUILD_ROOT%{l_prefix}/var/roundcube/log \ 1.22 + $RPM_BUILD_ROOT%{l_prefix}/var/roundcube/run 1.23 1.24 # install program 1.25 cp -rpf \ 1.26 @@ -101,6 +106,19 @@ 1.27 %{SOURCE linen_login.png} \ 1.28 $RPM_BUILD_ROOT%{l_prefix}/share/roundcube/skins/larry/images/ 1.29 1.30 + # install runcommand script 1.31 + %{l_shtool} install -c -m 755 %{l_value -s -a} \ 1.32 + %{SOURCE rc.roundcube} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ 1.33 + 1.34 + # install custom Apache configuration 1.35 + l_hostname=`%{l_shtool} echo -e %h` 1.36 + l_domainname=`%{l_shtool} echo -e %d | cut -c2-` 1.37 + %{l_shtool} install -c -m 644 %{l_value -s -a} \ 1.38 + -e "s;@l_hostname@;$l_hostname;g" \ 1.39 + -e "s;@l_domainname@;$l_domainname;g" \ 1.40 + %{SOURCE roundcube-apache.conf} \ 1.41 + $RPM_BUILD_ROOT%{l_prefix}/etc/roundcube/ 1.42 + 1.43 # determine package ingredients and tag config files 1.44 %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \ 1.45 %{l_files_std} \ 1.46 @@ -114,6 +132,7 @@ 1.47 %clean 1.48 1.49 %post 1.50 + if [ $1 -eq 1 ]; then 1.51 # display information about next steps 1.52 ( echo "Roundcube stores data in SQL and requires an existing" 1.53 echo "local or remote installation of PostgreSQL, MySQL, or" 1.54 @@ -124,10 +143,25 @@ 1.55 echo "CREATE USER 'username'@'localhost' IDENTIFIED BY 'newpwd';" 1.56 echo "GRANT ALL PRIVILEGES ON roundcubemail.* TO username@localhost IDENTIFIED BY 'newpwd';" 1.57 echo "FLUSH PRIVILEGES;" 1.58 + echo "" 1.59 + echo "After that, start the database server and finally start Roundcube:" 1.60 + echo " \$ $RPM_INSTALL_PREFIX/bin/openpkg rc roundcube start" 1.61 + echo "Cconnect with a browser to the URL:" 1.62 + echo " http://127.0.0.1:8080/roundcube/" 1.63 ) | %{l_rpmtool} msg -b -t notice 1.64 + fi 1.65 + if [ $1 -eq 2 ]; then 1.66 + # after upgrade, restart service 1.67 + eval `%{l_rc} roundcube status 2>/dev/null` 1.68 + [ ".$roundcube_active" = .yes ] && %{l_rc} roundcube restart 1.69 + fi 1.70 + exit 0 1.71 1.72 %preun 1.73 - # before erase, remove log files 1.74 + # before erase, stop service and remove log files 1.75 [ $1 -eq 0 ] || exit 0 1.76 + %{l_rc} roundcube stop 2>/dev/null 1.77 rm -f $RPM_INSTALL_PREFIX/var/roundcube/log/*.log >/dev/null 2>&1 || true 1.78 + rm -f $RPM_INSTALL_PREFIX/share/roundcube/logs/* >/dev/null 2>&1 || true 1.79 + rm -f $RPM_INSTALL_PREFIX/share/roundcube/temp/* >/dev/null 2>&1 || true 1.80