Hello,

I have an interesting question: Which dependencies should I set for 
Postfixadmin? (package is postfixadmin-svn in home:cboltz, specfile is 
attached for easier access)

Short summary:
- Postfixadmin is a PHP web interface, used for administration of 
  virtual domains in postfix
- it can use MySQL and PostgreSQL as database

Now to the dependency problems:
- php-mysql and/or php-pgsql? One of them is always unused, but you 
  never know which one in advance (from RPM's POV)
- Should I require MySQL and/or PostgreSQL? You never know which one is 
  used, and accessing the database on another machine is also possible, 
  so technically none of them is really needed.
- Should I require Postfix? Sure, Postfixadmin is used to administrate 
  it, but it's the same as with MySQL: It could run on another machine.

Postfixadmin also comes with a vacation script, which needs a 
user "vacation" and some additions to the postfix config.

- should I create the user "vacation" in %pre?
- if yes, should I delete it again in %preun? How to avoid this on 
  package updates?

- is it a good idea to add some lines to /etc/postfix/master.cf auto-
  matically ("grep vacation master.cf || cat some_lines >> master.cf")
  or should I let this to the user?


Other packaging questions:

- setup.php is installed by the package, but needs to be deleted to make 
  Postfixadmin work. Is there any special trick how to handle this in 
  RPM?

- any other comments on the specfile are also welcome ;-)

I'm quite sure there is no "perfect" solution for the above questions, 
but some hints about good practise would be welcome.


Regards,

Christian Boltz
-- 
There are no bugs expected after Beta3, that's why it is called RC.
[Jan Engelhardt]
Name: postfixadmin-svn
Version: 2.1.9.257
Release: 1
License: GPL
URL: http://postfixadmin.sourceforge.net/
Group: Productivity/Networking/Web/Frontends
Source0: %{name}-%{version}.tar.bz2
BuildArch: noarch
#Requires: httpd, postfix, php, mysql-server
Requires: mod_php_any php-mysql 
Requires: /usr/sbin/sendmail
Requires: perl-DBD-MySQL perl-Mail-Sendmail perl-MIME-tools perl-Email-Valid 
perl-MIME-EncWords perl-MIME-Charset
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-build

Summary: Postfix Admin is a Web Based Management tool created for Postfix

%if %{defined fedora_version}
BuildRequires: httpd-devel
%define serverroot %(/usr/sbin/apxs -q datadir 2>/dev/null || /usr/sbin/apxs -q 
PREFIX)/htdocs/
%else
BuildRequires:  apache2-devel
%define serverroot %(/usr/sbin/apxs2 -q datadir 2>/dev/null || /usr/sbin/apxs2 
-q PREFIX)/htdocs/
Recommends: postfix
Suggests: php-pgsql
%endif

%description
Postfixadmin is a PHP based application that handles Postfix Style Virtual 
Domains and
Users that are stored in MySQL.
Postfix Admin supports:
- Virtual Mailboxes / Virtual Aliases / Forwarders.
- Domain to Domain forwarding / Catch-All.
- Vacation (auto-response) for Virtual Mailboxes.
- Quota / Alias & Mailbox limits per domain.
- Backup MX.
- Packaged with over 25 languages.

%prep
%setup -q -n %{name}-%{version}

%build
echo "*** serverroot: %{serverroot} ***"
#find . -type d -exec rm -rf {}/.svn \;

%install
#rm -rf $RPM_BUILD_ROOT
mkdir -p -m0755 $RPM_BUILD_ROOT%{_sysconfdir}/%{name}
#mkdir -p -m0755 $RPM_BUILD_ROOT%{_datadir}/%{name}
mkdir -p -m0755 $RPM_BUILD_ROOT%{serverroot}/%{name}
mkdir -p -m0755 $RPM_BUILD_ROOT%{_var}/spool/vacation

# install the config files
#install -m 0640 config.inc.php.sample 
$RPM_BUILD_ROOT%{_sysconfdir}/%{name}/config.inc.php
#ln -s ../../../..%{_sysconfdir}/%{name}/config.inc.php \
#    $RPM_BUILD_ROOT%{_datadir}/%{name}/config.inc.php

# install index.php
install -m 0644 *.php *.css *.txt $RPM_BUILD_ROOT%{serverroot}/%{name}/
# we already check setup (at least i hope so:-)
#mv $RPM_BUILD_ROOT%{_datadir}/%{name}/setup.php 
$RPM_BUILD_ROOT%{_datadir}/%{name}/setup.php.ori

mv VIRTUAL_VACATION/vacation.pl $RPM_BUILD_ROOT%{_var}/spool/vacation/

# copy over the rest
for d in admin images languages templates users; do
    cp -rp $d $RPM_BUILD_ROOT%{serverroot}/%{name}/
done

# install the config file
#mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/httpd/conf.d
#install -m 644 $RPM_SOURCE_DIR/%{name}.conf \
#   $RPM_BUILD_ROOT%{_sysconfdir}/httpd/conf.d/

%clean
#rm -rf $RPM_BUILD_ROOT

#%pre
#if ! id vacation > /dev/null 2>&1 ; then
#    /usr/sbin/useradd -c "Virtual Vacation" -d %{_var}/spool/vacation -s 
/sbin/nologin -M -r vacation 2>/dev/null
#fi
#if [ -z "`grep vacation /etc/postfix/master.cf 2>/dev/null`" ]; then
#%{__cat} <<'EOF' >>/etc/postfix/master.cf
## Postfix Admin Vacation
#vacation       unix    -       n       n       -       -       pipe
#       flags=Rq user=vacation argv=/var/spool/vacation/vacation.pl -f 
${sender} -- ${recipient}
#EOF
#fi

#%preun
#if [ $1 = 0 ]; then
#    /usr/sbin/userdel vacation 2>/dev/null || :
#fi

%files
%defattr(-,root,root)
#%config %dir %{_sysconfdir}/%{name}
#%attr(640,root,www) %config(noreplace) %{_sysconfdir}/%{name}/*.php
#%config(noreplace) %{_sysconfdir}/httpd/conf.d/*.conf
%doc DOCUMENTS/* *.TXT ADDITIONS VIRTUAL_VACATION
%dir %{serverroot}/%{name}
%{serverroot}/%{name}/*
%attr(600,vacation,vacation) %{_var}/spool/vacation

%changelog
* Sun Dec 02 2007 Christian Boltz <packages (at) cboltz (dot) de>
- updated to SVN version
- commented out several sections
- auto-detect serverroot and install PHP files etc. there
* Fri Dec 15 2006 Levente Farkas <[EMAIL PROTECTED]> 2.1.1-0
- initial build

Reply via email to