%define name popfile %define version 0.22.1 %define release 1mdk Summary: Automatic Email Classification Name: %{name} Version: %{version} Release: %{release} License: GPL Group: Networking/Mail Source0: popfile-%{version}.zip Source1: popfile_16x16.png Source2: popfile_32x32.png Source3: popfile_48x48.png Source4: popfile.init.bz2 URL: http://popfile.sourceforge.net/ PreReq: rpm-helper BuildRequires: perl BuildPreReq: unzip BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot Buildarch: noarch %description POPFile is an email classification tool with a Naive Bayes classifier, a POP3 proxy and a web interface. It runs on most platforms and with most email clients. %prep %setup -q -c %{name}-%{version} # fix dir perms find . -type d | xargs chmod 755 # fix file perms find . -type f | xargs chmod 644 # fix exec file perms find . -type f -name "*.pl" | xargs chmod 755 # strip away annoying ^M for i in pm pl html css msg; do find . -type f -name "*.${i}" | xargs perl -p -i -e 's/\r//' done %build %install [ "%{buildroot}" != "/" ] && rm -rf %{buildroot} install -d %{buildroot}%{_initrddir} install -d %{buildroot}%{_menudir} install -d %{buildroot}%{_liconsdir} install -d %{buildroot}%{_iconsdir} install -d %{buildroot}%{_miconsdir} install -d %{buildroot}%{_datadir}/%{name} bzcat %{SOURCE4} > %{buildroot}%{_initrddir}/%{name} chmod 755 %{buildroot}%{_initrddir}/%{name} cp -aRf * %{buildroot}%{_datadir}/%{name}/ # install script to call the web interface from the menu. cat > %{buildroot}%{_datadir}/%{name}/%{name} << EOF #!/bin/sh url='http://localhost:8080/' if ! [ -z "\$BROWSER" ] && ( which \$BROWSER ); then browser=\`which \$BROWSER\` elif [ -x /usr/bin/netscape ]; then browser=/usr/bin/netscape elif [ -x /usr/bin/konqueror ]; then browser=/usr/bin/konqueror elif [ -x /usr/bin/lynx ]; then browser='xterm -bg black -fg white -e lynx' elif [ -x /usr/bin/links ]; then browser='xterm -bg black -fg white -e links' else xmessage "No web browser found, install one or set the BROWSER environment variable!" exit 1 fi \$browser \$url EOF chmod 755 %{buildroot}%{_datadir}/%{name}/%{name} # fix menu stuff cat > %{buildroot}%{_menudir}/%{name} << EOF ?package(%{name}): \ command="%{_datadir}/%{name}/%{name}" \ needs="X11" \ icon="%{name}.png" \ section="Networking/Mail" \ title="POPFile - Automatic Email Classification" \ longtitle="An email classification tool with a Naive Bayes classifier." EOF chmod 644 %{buildroot}/%{_menudir}/%{name}* install -m0644 %{SOURCE1} %{buildroot}%{_miconsdir}/%{name}.png install -m0644 %{SOURCE2} %{buildroot}%{_iconsdir}/%{name}.png install -m0644 %{SOURCE3} %{buildroot}%{_liconsdir}/%{name}.png # clean up rm -f %{buildroot}%{_datadir}/%{name}/v%{version}.change %post %_post_service %{name} %update_menus %postun %clean_menus %preun %_preun_service %{name} %clean [ "%{buildroot}" != "/" ] && rm -rf %{buildroot} %files %defattr(-,root,root) %doc *.change %config(noreplace) %attr(0755,root,root) %{_initrddir}/%{name} %{_menudir}/%{name} %{_miconsdir}/* %{_iconsdir}/* %{_liconsdir}/* %{_datadir}/%{name} %changelog * Sat Nov 13 2004 Oden Eriksson <oeriksson@mandrakesoft.com> 0.22.1-1mdk - 0.22.1 * Tue Oct 21 2003 Oden Eriksson <oden.eriksson@linux-mandrake.com> 0.20.0a-1mdk - 0.20.0a * Sun Aug 24 2003 Oden Eriksson <oden.eriksson@linux-mandrake.com> 0.19.1-1mdk - initial cooker contrib. - added S1 - S3 + menu magic - added S4