## ## squirrelmail.spec -- OpenPKG RPM Package Specification ## Copyright (c) 2000-2007 OpenPKG Foundation e.V. ## Copyright (c) 2000-2007 Ralf S. Engelschall ## ## Permission to use, copy, modify, and distribute this software for ## any purpose with or without fee is hereby granted, provided that ## the above copyright notice and this permission notice appear in all ## copies. ## ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF ## SUCH DAMAGE. ## # package version %define V_sqmail 1.4.10a %define V_locale 1.4.9-20070106 %define V_plugin_compat 2.0.7-1.0 %define V_plugin_logger 1.4.0-1.0.6 %define V_plugin_addgraphics 2.3-1.0.3 %define V_plugin_avelsieve 1.9.7 %define V_plugin_saslpwd 1.4.1-1.4 %define V_plugin_checkquota 1.4-1.2.7 %define V_plugin_foldersize 1.5-1.4.0 %define V_plugin_gnupg 2.0.1-1.4.2 %define V_plugin_ldif 1.4-1.2.x %define V_plugin_update 0.7-1.4.2 %define V_plugin_userip 3.3-1.2.2 %define V_plugin_smallcal 0.8-1.2.3 %define V_plugin_vkeyboard 0.9 %define V_plugin_username 2.3-1.0.0 # package information Name: squirrelmail Summary: SquirrelMail Webmail Client URL: http://www.squirrelmail.org/ Vendor: Squirrelmail Developers Packager: OpenPKG Foundation e.V. Distribution: OpenPKG Community Class: EVAL Group: Mail License: GPL Version: %{V_sqmail} Release: 20070622 # package options %option with_plugins no # list of sources Source0: http://switch.dl.sourceforge.net/squirrelmail/squirrelmail-%{version}.tar.bz2 Source1: http://switch.dl.sourceforge.net/squirrelmail/all_locales-%{V_locale}.tar.bz2 Source2: http://www.squirrelmail.org/plugins/compatibility-%{V_plugin_compat}.tar.gz Source3: http://www.squeaksoft.com/products/SquirrelLogger/squirrel_logger.%{V_plugin_logger}.tar.gz Source4: http://www.squirrelmail.org/plugins/addgraphics-%{V_plugin_addgraphics}.tar.gz Source5: http://www.squirrelmail.org/plugins/avelsieve-%{V_plugin_avelsieve}.tar.gz Source6: http://www.squirrelmail.org/plugins/chg_sasl_passwd-%{V_plugin_saslpwd}.tar.gz Source7: http://www.squirrelmail.org/plugins/check_quota-%{V_plugin_checkquota}.tar.gz Source8: http://www.squirrelmail.org/plugins/folder_sizes-%{V_plugin_foldersize}.tar.gz Source9: http://www.squirrelmail.org/plugins/gpg.%{V_plugin_gnupg}.tar.gz Source10: http://www.squirrelmail.org/plugins/ldifimport-%{V_plugin_ldif}.tar.gz Source11: http://www.squirrelmail.org/plugins/pupdate.%{V_plugin_update}.tar.gz Source12: http://www.squirrelmail.org/plugins/show_user_and_ip-%{V_plugin_userip}.tar.gz Source13: http://www.squirrelmail.org/plugins/smallcal-%{V_plugin_smallcal}.tar.gz Source14: http://www.squirrelmail.org/plugins/vkeyboard-%{V_plugin_vkeyboard}.tar.gz Source15: http://www.squirrelmail.org/plugins/username-%{V_plugin_username}.tar.gz Source16: config.php Source17: defprefs.txt Source18: opkg_large.png Source19: opkg_small.png Source20: rc.squirrelmail Patch0: squirrelmail.patch Patch1: squirrelmail.patch.plugins # build information Prefix: %{l_prefix} BuildRoot: %{l_buildroot} BuildPreReq: OpenPKG, openpkg >= 20060823 PreReq: OpenPKG, openpkg >= 20060823, imapd, MTA, apache PreReq: apache-php, apache-php::with_xml = yes AutoReq: no AutoReqProv: no %description SquirrelMail is a standards-based webmail package written in PHP4. It includes built-in pure PHP support for the IMAP and SMTP protocols, and all pages render in pure HTML 4.0 (with no Javascript) for maximum compatibility across browsers. It has very few requirements and is very easy to configure and install. SquirrelMail has all the functionality you would want from an email client, including strong MIME support, address books, and folder manipulation. %track prog squirrelmail = { version = %{V_sqmail} url = http://prdownloads.sourceforge.net/squirrelmail/ regex = squirrelmail-(\d+\.[02468]\.\d+[a-z]?)\.tar\.bz2 } prog squirrelmail:locales = { version = %{V_locale} url = http://prdownloads.sourceforge.net/squirrelmail/ regex = all_locales-(\d+\.[02468]\.\d+-\d+)\.tar\.bz2 } prog squirrelmail:compat = { version = %{V_plugin_compat} url = http://www.squirrelmail.org/plugins/ regex = compatibility-(__VER__)\.tar\.gz } prog squirrelmail:logger = { version = %{V_plugin_logger} url = http://www.squeaksoft.com/products/SquirrelLogger/ regex = squirrel_logger.(__VER__)\.tar\.gz } prog squirrelmail:addgraphics = { version = %{V_plugin_addgraphics} url = http://www.squirrelmail.org/plugins/ regex = addgraphics-(__VER__)\.tar\.gz } prog squirrelmail:avelsieve = { version = %{V_plugin_avelsieve} url = http://www.squirrelmail.org/plugins/ regex = avelsieve-(\d+\.\d+\.\d+)\.tar\.gz } prog squirrelmail:saslpwd = { version = %{V_plugin_saslpwd} url = http://www.squirrelmail.org/plugins/ regex = chg_sasl_passwd-(\d+\.\d+\.\d+-\d+\.\d+)\.tar\.gz } prog squirrelmail:checkquota = { version = %{V_plugin_checkquota} url = http://www.squirrelmail.org/plugins/ regex = check_quota-(__VER__)\.tar\.gz } prog squirrelmail:foldersize = { version = %{V_plugin_foldersize} url = http://www.squirrelmail.org/plugins/ regex = folder_sizes.(__VER__)\.tar\.gz } prog squirrelmail:gnupg = { version = %{V_plugin_gnupg} url = http://www.squirrelmail.org/plugins/ regex = gpg.(\d+\.\d+\.\d+-\d+\.\d+\.\d+)\.tar\.gz } prog squirrelmail:ldif = { version = %{V_plugin_ldif} url = http://www.squirrelmail.org/plugins/ regex = ldifimport-(__VER__)\.tar\.gz } prog squirrelmail:update = { version = %{V_plugin_update} url = http://www.squirrelmail.org/plugins/ regex = pupdate.(__VER__)\.tar\.gz } prog squirrelmail:userip = { version = %{V_plugin_userip} url = http://www.squirrelmail.org/plugins/ regex = show_user_and_ip-(__VER__)\.tar\.gz } prog squirrelmail:smallcal = { version = %{V_plugin_smallcal} url = http://www.squirrelmail.org/plugins/ regex = smallcal-(__VER__)\.tar\.gz } prog squirrelmail:vkeyboard = { version = %{V_plugin_vkeyboard} url = http://www.squirrelmail.org/plugins/ regex = vkeyboard-(__VER__)\.tar\.gz } prog squirrelmail:username = { version = %{V_plugin_username} url = http://www.squirrelmail.org/plugins/ regex = username-(__VER__)\.tar\.gz } %prep %setup -q -c -n squirrelmail %setup -q -D -T -a 1 -c -n squirrelmail/all_locales-%{V_locale} %setup -q -D -T -a 2 -n squirrelmail %setup -q -D -T -a 3 -n squirrelmail mv compatibility squirrelmail-%{V_sqmail}/plugins mv squirrel_logger squirrelmail-%{V_sqmail}/plugins %if "%{with_plugins}" == "yes" %setup -q -D -T -a 4 -n squirrelmail %setup -q -D -T -a 5 -n squirrelmail %setup -q -D -T -a 6 -n squirrelmail %setup -q -D -T -a 7 -n squirrelmail %setup -q -D -T -a 8 -n squirrelmail %setup -q -D -T -a 9 -n squirrelmail %setup -q -D -T -a 10 -n squirrelmail %setup -q -D -T -a 11 -n squirrelmail %setup -q -D -T -a 12 -n squirrelmail %setup -q -D -T -a 13 -n squirrelmail %setup -q -D -T -a 14 -n squirrelmail %setup -q -D -T -a 15 -n squirrelmail # move additional plugins where other are already placed for plug in addgraphics avelsieve check_quota chg_sasl_passwd \ folder_sizes gpg ldifimport pupdate show_user_and_ip \ smallcal vkeyboard username; do mv $plug squirrelmail-%{V_sqmail}/plugins done %endif # clean up login screen of distractions ( cd squirrelmail-%{V_sqmail} %patch -p0 ) || exit $? # rearrange documentation and remove archive script ( cd squirrelmail-%{V_sqmail} mv AUTHORS ChangeLog COPYING INSTALL README UPGRADE doc/ mv ReleaseNotes doc/ReleaseNotes.txt mv themes/README.themes doc/ for fil in `find plugins/ -name "README*" -o -name "Readme*" \ -o -name "INSTALL*" -o -name CHANGES -o -name HISTORY`; do %{l_shtool} mkdir -f -p -m 755 doc/`dirname $fil` mv -f $fil $_ done mv doc/plugins/squirrelspell/doc/README doc/plugins/squirrelspell rm -rf doc/plugins/squirrelspell/doc doc/plugins/squirrelspell/index.php mv plugins/squirrelspell/doc/* doc/plugins/squirrelspell rm -rf plugins/squirrelspell/doc rm -f plugins/make_archive.pl %if "%{with_plugins}" == "yes" mv plugins/pupdate/docs/* doc/plugins/pupdate rm -rf plugins/pupdate/docs %endif # postadjustment cosmetics %{l_shtool} subst \ -e 's;\(#ffffff., .border="0" width=\)"350";\1"250";1' \ src/login.php # set default prefs cat %{SOURCE defprefs.txt} >>data/default_pref ) || exit $? %build %install rm -rf $RPM_BUILD_ROOT # create directory structure %{l_shtool} mkdir -f -p -m 755 \ $RPM_BUILD_ROOT%{l_prefix}/bin \ $RPM_BUILD_ROOT%{l_prefix}/etc/squirrelmail \ $RPM_BUILD_ROOT%{l_prefix}/share/squirrelmail/prefs \ $RPM_BUILD_ROOT%{l_prefix}/var/squirrelmail/spool/attach \ $RPM_BUILD_ROOT%{l_prefix}/var/squirrelmail/log # install locales ( cd all_locales-%{V_locale} cp -rpf help images locale $RPM_BUILD_ROOT%{l_prefix}/share/squirrelmail/ ) || exit $? # install program ( cd squirrelmail-%{V_sqmail} # install default_pref %{l_shtool} install -c -m 644 \ data/default_pref \ $RPM_BUILD_ROOT%{l_prefix}/share/squirrelmail/prefs/ # create initial administrator list echo %{l_musr} >>$RPM_BUILD_ROOT%{l_prefix}/etc/squirrelmail/admins # install main index file to view in client browser %{l_shtool} install -c -m 644 \ index.php \ $RPM_BUILD_ROOT%{l_prefix}/share/squirrelmail/ # copy over most functional directories, a lot of stuff for dir in class doc functions include plugins src themes; do cp -rpf $dir $RPM_BUILD_ROOT%{l_prefix}/share/squirrelmail/ done cp -rpf images/* $RPM_BUILD_ROOT%{l_prefix}/share/squirrelmail/images/ cp -pf locale/timezones.cfg $RPM_BUILD_ROOT%{l_prefix}/share/squirrelmail/locale/ # install main config files l_fqdm=`%{l_shtool} echo -e %h%d` %{l_shtool} install -c -m 644 %{l_value -s -a} \ -e 's;config/\(config_local.php\);\1;g' \ -e "s;@l_fqdm@;${l_fqdm};g" \ %{SOURCE config.php} \ config/config_default.php \ $RPM_BUILD_ROOT%{l_prefix}/etc/squirrelmail/ %if "%{with_plugins}" == "yes" ( cd $RPM_BUILD_ROOT%{l_prefix} %{l_patch} -p0 <%{PATCH squirrelmail.patch.plugins} rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/squirrelmail/*.orig rm -f $RPM_BUILD_ROOT%{l_prefix}/share/squirrelmail/plugins/gpg/*.orig rm -f $RPM_BUILD_ROOT%{l_prefix}/share/squirrelmail/plugins/chg_sasl_passwd/*.orig ) || exit $? %endif %{l_shtool} install -c -m 644 \ config/config_local.php \ $RPM_BUILD_ROOT%{l_prefix}/share/squirrelmail/ # install plugin config files ( cd $RPM_BUILD_ROOT%{l_prefix}/share/squirrelmail/plugins %{l_shtool} subst \ -e 's;../data/access_log;../../../var/squirrelmail/log/access.log;' \ -e 's;\(\$sl_dateformat = \)"m/d/Y G:i:s";\1"d/m/Y G:i:s";' \ squirrel_logger/setup.php %if "%{with_plugins}" == "yes" cp -pf check_quota/config.php.sample check_quota/config.php cp -pf chg_sasl_passwd/config.php.sample chg_sasl_passwd/config.php cp -pf show_user_and_ip/config.php.sample show_user_and_ip/config.php %{l_shtool} install -c -m 644 \ -e "s;sm_logo\.png;opkg_small.png;" \ -e "s;SquirrelMail Logo;OpenPKG Logo;" \ -e "s;www\.squirrelmail\.org;www.openpkg.org;" \ -e "s;\/\/\(\$image_width.*\) = 308;\1 = 201;" \ -e "s;\/\/\(\$image_height.*\) = 111;\1 = 62;" \ addgraphics/config.php.typical.one.domain \ addgraphics/config.php %{l_shtool} install -c -m 644 \ -e 's/^\(\$sieve_preferred_sasl_mech =\).*/\1 "PLAIN LOGIN CRAM-MD5 DIGEST-MD5";/' \ -e 's/^\(\$avelsieve_oldcyrus =\).*/\1 false;/' \ -e 's/^\(\$startitems =\).*/\1 4;/' \ avelsieve/config/config_sample.php \ avelsieve/config/config.php %{l_shtool} subst \ -e 's;\(path_to_gpg=\)/usr/bin/gpg.*;\1%{l_prefix}/bin/gpg;' \ gpg/gpg_local_prefs.txt %{l_shtool} install -c -m 644 \ -e 's;\(adminusername = "\)[^"]*;\1%{l_musr};' \ -e 's;corehide = 1;corehide = 0;' \ pupdate/config.php.sample \ pupdate/config.php %{l_shtool} install -c -m 644 \ -e "s;\(\$vkeyboard_msgsize.*\)'medium';\1'x-small';" \ -e "s;\(\$vkeyboard_layout.*\)'us_english';\1'portuguese_abnt2';" \ -e "s;\(\$vkeyboard_height.*\)'250';\1'270';" \ vkeyboard/config.php.sample \ vkeyboard/config.php cp -pf username/config.php.sample username/config.php %{l_shtool} install -c -m 644 \ %{SOURCE opkg_small.png} \ $RPM_BUILD_ROOT%{l_prefix}/share/squirrelmail/images/ %endif ) || exit $? # install squirrelmail configuration perl script %{l_shtool} install -c -m 755 \ -e 's;chdir($dir);chdir("%{l_prefix}/etc/squirrelmail");g' \ -e 's;\.\./plugins;%{l_prefix}/share/squirrelmail/plugins;g' \ -e 's;\.\./themes;%{l_prefix}/share/squirrelmail/themes;g' \ -e 's;config/config_local.php;config_local.php;g' \ config/conf.pl \ $RPM_BUILD_ROOT%{l_prefix}/bin/squirrelconf # use our own logo, a squirrel next to a OpenPKG package %{l_shtool} install -c -m 644 \ %{SOURCE opkg_large.png} \ $RPM_BUILD_ROOT%{l_prefix}/share/squirrelmail/images/ ) || exit $? # install runcommand script %{l_shtool} mkdir -f -p -m 755 \ $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d %{l_shtool} install -c -m 755 %{l_value -s -a} \ %{SOURCE rc.squirrelmail} \ $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ # replace false /etc config paths throughout %{l_shtool} subst \ -e 's;SM_PATH \. \(.\)config/;\1%{l_prefix}/etc/squirrelmail/;g' \ -e 's;require_once(SM_PATH \. \(.*\)%{l_prefix};require_once(\1%{l_prefix};g' \ $RPM_BUILD_ROOT%{l_prefix}/share/squirrelmail/functions/*.php \ $RPM_BUILD_ROOT%{l_prefix}/share/squirrelmail/include/*.php \ $RPM_BUILD_ROOT%{l_prefix}/share/squirrelmail/plugins/abook_take/*.php \ $RPM_BUILD_ROOT%{l_prefix}/share/squirrelmail/plugins/administrator/*.php \ $RPM_BUILD_ROOT%{l_prefix}/share/squirrelmail/plugins/calendar/*.php \ $RPM_BUILD_ROOT%{l_prefix}/share/squirrelmail/src/*.php # determine package ingredients and tag config files %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \ %{l_files_std} \ '%config %{l_prefix}/etc/squirrelmail/*' \ '%config %{l_prefix}/share/squirrelmail/prefs/*' \ '%config %{l_prefix}/share/squirrelmail/plugins/squirrelspell/sqspell_config.php' \ %if "%{with_plugins}" == "yes" '%config %{l_prefix}/share/squirrelmail/plugins/addgraphics/config.php' \ '%config %{l_prefix}/share/squirrelmail/plugins/avelsieve/config/config.php' \ '%config %{l_prefix}/share/squirrelmail/plugins/check_quota/config.php' \ '%config %{l_prefix}/share/squirrelmail/plugins/chg_sasl_passwd/config.php' \ '%config %{l_prefix}/share/squirrelmail/plugins/folder_sizes/folder_sizes_config.php' \ '%config %{l_prefix}/share/squirrelmail/plugins/gpg/gpg_local_prefs.txt' \ '%config %{l_prefix}/share/squirrelmail/plugins/ldifimport/config.php' \ '%config %{l_prefix}/share/squirrelmail/plugins/pupdate/config.php' \ '%config %{l_prefix}/share/squirrelmail/plugins/show_user_and_ip/config.php' \ '%config %{l_prefix}/share/squirrelmail/plugins/vkeyboard/config.php' \ '%config %{l_prefix}/share/squirrelmail/plugins/username/config.php' \ %endif '%attr(755,%{l_nusr},%{l_ngrp}) %{l_prefix}/share/squirrelmail/prefs' \ '%attr(755,%{l_nusr},%{l_ngrp}) %{l_prefix}/var/squirrelmail/spool/attach' \ '%attr(755,%{l_nusr},%{l_ngrp}) %{l_prefix}/var/squirrelmail/log' %files -f files %clean rm -rf $RPM_BUILD_ROOT %preun # before erase, remove log files [ $1 -eq 0 ] || exit 0 rm -f $RPM_INSTALL_PREFIX/var/squirrelmail/log/*.log >/dev/null 2>&1 || true