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