|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
Subject: Re: RPM Packaging of the latest Snapshot
From: Michael Tokarev (mjt
tls.msk.ru)Date: Mon Jun 05 2000 - 04:34:13 CDT
- Next message: Ulrich Gebauer: "postfix & mysql"
- Previous message: Liviu Daia: "Authenticating content filter (was: Content filter wants to know sender's IP)"
- In reply to: Bennett Todd: "RPM Packaging of the latest Snapshot"
- Next in thread: Matthias Andree: "Re: RPM Packaging of the latest Snapshot"
- Next in thread: Matthias Andree: "Re: RPM Packaging of the latest Snapshot"
- Reply: Michael Tokarev: "Re: RPM Packaging of the latest Snapshot"
- Reply: Matthias Andree: "Re: RPM Packaging of the latest Snapshot"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
The INSTALL.sh can be used to manually install things.
I used another one (inside .spec file).
Hers is my postfix.spec (that was sometime inherited from
those found at contrib.redhat.com, probably Bennet's one,
but it has no common parts with that today).
It is without chroot support, and it does NOT use chattr +S
on spool (that is BAD, but not for me, as I used it in
environment where power is relatively safe, and mail _can_
be lost (but never was), but speed is important -- excuse me
Wietse!) -- but this can easily be corrected.
Just to show an example... :)
%define vers 19991231
%define patchlevel pl08
Release: 1
Name: postfix
Group: System Environment/Daemons
URL: http://www.postfix.org
Copyright: IBM Public License -- see LICENSE for details
Summary: Postfix Mail Transport Agent
Packager: Michael Tokarev <mjt
tls.msk.ru>
Distribution: Experimental
Prereq: /sbin/chkconfig
Provides: MTA smtpd smtpdaemon
Conflicts: sendmail
%define ver %{vers}-%{patchlevel}
Version: %{vers}_%{patchlevel}
%define manpath /usr/man
%define libexecdir /usr/lib/postfix
%define spooldir /var/spool/postfix
# preferred user (postfix) and group (postdrop) ids
%define postfix_uid 89
%define postdrop_gid 89
# set this to 1 or 0 to use or not setgid for maildrop
%define setgid 1
# set to 1 to disable pcre even if found
%define no_pcre 0
# set to 1 to disable ldap even if found
%define no_ldap 1
BuildRoot: %{_tmppath}/%{name}-%{ver}-root
Source0: ftp://ftp.porcupine.org/mirrors/postfix-release/official/postfix-%{ver}.tar.gz
%description
Postfix, see http://www.postfix.org, aims to be an alternative to the
widely-used sendmail program, which is responsible for 70 percent of
all e-mail delivered on the Internet.
Although IBM supported the Postfix development, it abstains from control
over its evolution. The goal is to have Postfix installed on as many
systems as possible. To this end, the software is given away with no
strings attached, so that it can evolve with input from and under control
of its users.
Be sure to read http://www.moongroup.com/postfix-faq/c22.html which covers
steps which should be taken prior to and after the installation of Postfix.
%prep
umask 022
%setup -q -n %{name}-%{ver}
%build
umask 022
DEFS=
LIBS=
%if !%{no_pcre}
if [ -f /usr/include/pcre.h ] ; then
if [ -f /usr/lib/libpcre.a -o -f /usr/lib/libpcre.so ] ; then
DEFS="$DEFS -DHAS_PCRE"
LIBS="$LIBS -lpcre"
fi
fi
%endif
%if !%{no_ldap}
if [ -f /usr/include/ldap.h ] ; then
if [ -f /usr/lib/libldap.a -o -f /usr/lib/libldap.so ] ; then
if [ -f /usr/lib/liblber.a -o -f /usr/lib/liblber.so ] ; then
DEFS="$DEFS -DHAS_LDAP"
LIBS="$LIBS -lldap -llber"
fi
fi
fi
%endif
make makefiles \
DEBUG= \
OPT="$RPM_OPT_FLAGS \
-DDEF_PROGRAM_DIR='\"%{libexecdir}\"' \
-DDEF_QUEUE_DIR='\"%{spooldir}\"' \
$DEFS" \
AUXLIBS="$LIBS"
make
%install
umask 022
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT
rm -f file-list
touch file-list
mkdir -p $RPM_BUILD_ROOT/usr/sbin
for f in \
postalias postcat postconf postfix postkick \
postlock postlog postmap postsuper \
sendmail
do
cp bin/$f $RPM_BUILD_ROOT/usr/sbin/$f
echo "%%attr(0755,root,root) /usr/sbin/$f" >> file-list
done
cp bin/postdrop $RPM_BUILD_ROOT/usr/sbin/postdrop
%if %{setgid}
echo "%%attr(02755,root,postdrop) /usr/sbin/postdrop" >> file-list
%else
echo "%%attr(0755,root,root) /usr/sbin/postdrop" >> file-list
%endif
# sendmail-compatibles
mkdir -p $RPM_BUILD_ROOT/usr/{bin,lib}
ln -s ../sbin/sendmail $RPM_BUILD_ROOT/usr/bin/mailq
ln -s ../sbin/sendmail $RPM_BUILD_ROOT/usr/bin/newaliases
echo "/usr/bin/mailq" >> file-list
echo "/usr/bin/newaliases" >> file-list
# rmail wrapper
cp -p auxiliary/rmail/rmail $RPM_BUILD_ROOT/usr/bin/rmail
echo "%attr(0755,root,root) /usr/bin/rmail" >> file-list
mkdir -p $RPM_BUILD_ROOT%{libexecdir}
cp libexec/* $RPM_BUILD_ROOT%{libexecdir}/
echo "%%dir %{libexecdir}" >> file-list
echo "%{libexecdir}/*" >> file-list
mkdir -p $RPM_BUILD_ROOT%{manpath}
cp -pr man/man{1,5,8} $RPM_BUILD_ROOT%{manpath}
echo "%{manpath}/man?/*" >> file-list
mkdir -p $RPM_BUILD_ROOT/etc/postfix
echo "%%dir /etc/postfix" >> file-list
cp -p conf/LICENSE $RPM_BUILD_ROOT/etc/postfix/LICENSE
echo "/etc/postfix/LICENSE" >> file-list
sed \
-e 's|^daemon_directory.*|daemon_directory = %{libexecdir}|' \
-e 's|^queue_directory.*|queue_directory = %{spooldir}|' \
-e 's|^command_directory.*|command_directory = /usr/sbin|' \
-e 's|^#alias_maps = hash:/etc/aliases$|alias_maps = hash:/etc/postfix/aliases|' \
-e 's|^#alias_database = hash:/etc/aliases$|alias_database = hash:/etc/postfix/aliases|' \
conf/main.cf > $RPM_BUILD_ROOT/etc/postfix/main.cf
echo "%%config(noreplace) /etc/postfix/main.cf" >> file-list
# comment out cyrus, ifmail and bsmtp entries
sed \
-e '/^\(cyrus\|ifmail\|bsmtp\)/,/^ / s|^|#|' \
conf/master.cf > $RPM_BUILD_ROOT/etc/postfix/master.cf
echo "%%config(noreplace) /etc/postfix/master.cf" >> file-list
cp -p conf/postfix-script-%{!?setgid:no}sgid $RPM_BUILD_ROOT/etc/postfix/postfix-script
echo "/etc/postfix/postfix-script" >> file-list
# generate map database headers
for f in access canonical relocated transport virtual
do
cat > $RPM_BUILD_ROOT/etc/postfix/$f <<EOF
# This is postfix $f(5) database.
# In order to allow postfix to use it, edit main.cf.
# Do not forget to run
# postmap $f
# after any change in this file.
EOF
echo "%%config(noreplace) /etc/postfix/$f" >> file-list
done
cp -p conf/sample-* $RPM_BUILD_ROOT/etc/postfix/
echo "/etc/postfix/sample-*" >> file-list
cat >$RPM_BUILD_ROOT/etc/postfix/aliases <<EOF
# This is aliase file for postfix, /etc/postfix/aliases.
# See aliases(5) for details.
#
# Do not forget to execute
# postalias aliases
# or
# newaliases
# after each change of this file.
#
# For various security reasons, postfix WILL NOT deliver mail as root, so
# ensure that the root alias is aliased to a HUMAN user, as otherwise
# mail may get delivered to the \$default_privs user (nobody).
postmaster: root
abuse: postmaster
# Many mailers use this address to represent the empty SMTP return path
MAILER-DAEMON: postmaster
# Common aliases for system accounts.
bin: root
daemon: root
games: root
ingres: root
nobody: root
system: root
# Well-known aliases.
admin: root
manager: root
dumper: root
operator: root
#
noc: root
security: root
hostmaster: root
news: root
uucp: root
ftp: root
# Person who should get root's mail. This alias must exist.
# CHANGE THIS LINE to an account of a HUMAN
root: postfix
EOF
ln -s postfix/aliases $RPM_BUILD_ROOT/etc/aliases
echo "%%attr(0644,root,root) %%config(noreplace) /etc/postfix/aliases" >> file-list
echo "/etc/aliases" >> file-list
touch $RPM_BUILD_ROOT/etc/postfix/aliases.db
echo "%%config %%ghost /etc/postfix/aliases.db" >> file-list
mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d
startorder=80
stoporder=30
cat >$RPM_BUILD_ROOT/etc/rc.d/init.d/postfix <<EOF
#! /bin/sh
#
# postfix This shell script takes care of starting and stopping postfix.
#
# chkconfig: 2345 $startorder $stoporder
# description: Postfix is a MTA, which is the program that \\
# transfers mail from one machine to another
#
. /etc/rc.d/init.d/functions
. /etc/sysconfig/network
[ "\$NETWORKING" = no ] && exit 0
[ -x /usr/sbin/postfix ] || exit 0
case "\$1" in
start)
/usr/sbin/postfix start
if [ \$? = 0 ] ; then
touch /var/lock/subsys/postfix
exit 0
else
exit 1
fi
;;
stop)
/usr/sbin/postfix stop
if [ \$? = 0 ] ; then
rm -f /var/lock/subsys/postfix
exit 0
else
exit 1
fi
;;
restart)
\$0 stop
\$0 start
;;
reload|abort|flush|check)
/usr/sbin/postfix \$1
exit \$?
;;
*)
echo "Usage: postfix {start|stop|restart|reload|abort|flush|check}"
exit 1
esac
EOF
echo "%%attr(0755,root,root) /etc/rc.d/init.d/postfix" >> file-list
mkdir -p $RPM_BUILD_ROOT%{spooldir}
echo "%%dir %{spooldir}" >> file-list
mkdir $RPM_BUILD_ROOT%{spooldir}/maildrop
%if %{setgid}
echo "%%dir %%attr(01730,postfix,postdrop)" "%{spooldir}/maildrop" >> file-list
%else
echo "%%dir %%attr(01733,postfix,postdrop)" "%{spooldir}/maildrop" >> file-list
%endif
for f in pid public ; do
mkdir $RPM_BUILD_ROOT%{spooldir}/$f
echo "%%dir %%attr(0755,postfix,root) %{spooldir}/$f" >> file-list
done
for f in incoming active bounce defer deferred saved corrupt private ; do
mkdir $RPM_BUILD_ROOT%{spooldir}/$f
echo "%%dir %%attr(0700,postfix,root) %{spooldir}/$f" >> file-list
done
%clean
rm -rf $RPM_BUILD_ROOT
rm -f file-list
%pre
if ! grep -q '^postdrop:' /etc/group ; then
echo "Adding group postdrop with gid=%{postdrop_gid}"
if ! groupadd -g %{postdrop_gid} -r postdrop ; then
echo >&2 "Unable to add group postdrop"
echo >&2 "Either add group postdrop manually or delete group with gid=%{postdrop_gid}"
exit 1
fi
fi
if ! grep -q '^postfix:' /etc/passwd ; then
echo "Adding user postfix with uid=${postfix_uid}"
if grep -q '^[^:]*:${postfix_uid}:' /etc/passwd ; then
echo >&2 "Uid ${postfix_uid} already used"
echo >&2 "Add user postfix manually or delete user with uid=%{postfix_uid}"
exit 1
fi
useradd -d %{spooldir} -s /bin/true -g postdrop -M -r -u %{postfix_uid} postfix
fi
%post
/sbin/chkconfig --add postfix
# initialize alias database
/usr/sbin/postalias /etc/postfix/aliases
%preun
if [ "$1" = 0 ] ; then
/usr/sbin/postfix stop || :
# remove status files
rm -f %{spooldir}/{pid,public,private}/* || :
/sbin/chkconfig --del postfix
fi
%postun
if [ "$1" = 0 ] ; then
userdel postfix || :
grep -q '^postdrop:' /etc/group && groupdel postdrop || :
fi
exit 0
%files -f file-list
%defattr(-, root, root)
%doc [0A-Z]*[A-Z]
%doc html
%changelog
* Tue May 30 2000 Michael Tokarev <mjt
tls.msk.ru>
- 19991231-pl08
* Thu May 25 2000 Michael Tokarev <mjt
tls.msk.ru>
- initial release for postfix-19991231-pl07
- Next message: Ulrich Gebauer: "postfix & mysql"
- Previous message: Liviu Daia: "Authenticating content filter (was: Content filter wants to know sender's IP)"
- In reply to: Bennett Todd: "RPM Packaging of the latest Snapshot"
- Next in thread: Matthias Andree: "Re: RPM Packaging of the latest Snapshot"
- Next in thread: Matthias Andree: "Re: RPM Packaging of the latest Snapshot"
- Reply: Michael Tokarev: "Re: RPM Packaging of the latest Snapshot"
- Reply: Matthias Andree: "Re: RPM Packaging of the latest Snapshot"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]