Sophie

Sophie

distrib > Mandriva > 9.0 > x86_64 > media > main > by-pkgid > 3698594ca859aefe87e722ce1da1e788 > scriptlet

postfix-1.1.11-4.2mdk.x86_64.rpm

PREIN

/bin/sh

/usr/share/rpm-helper/add-user postfix $1 postfix /var/spool/postfix /bin/false 
/usr/share/rpm-helper/add-group postfix $1 postdrop postfix

PREUN

/bin/sh

# selectively remove the rest of the queue directory structure
# first remove the "queues" (and assume the hash depth is still 2)
queue_directory_remove () {
    for dir in active bounce defer deferred flush incoming; do
        for a in 0 1 2 3 4 5 6 7 8 9 A B C D E F; do
   	    test -d $dir/$a && {
	        for b in 0 1 2 3 4 5 6 7 8 9 A B C D E F; do
		    test -d $dir/$a/$b && (
		        /bin/rm -f $dir/$a/$b/*
		        /bin/rmdir $dir/$a/$b
		    )
		done
		/bin/rmdir $dir/$a || echo "WARNING: preun - unable to remove directory /var/spool/postfix/$dir/$a"
	    }
        done
	/bin/rmdir $dir || echo "WARNING: preun - unable to remove directory /var/spool/postfix/$dir"
    done

    # now remove the other directories
    for dir in corrupt maildrop pid private public saved; do
        test -d $dir && {
            /bin/rm -f $dir/*
            /bin/rmdir $dir || echo "WARNING: preun - unable to remove directory /var/spool/postfix/$dir"
        }
    done
}

/usr/share/rpm-helper/del-service postfix $1 postfix 

if [ $1 = 0 ]; then
    		update-alternatives --remove mta /usr/sbin/sendmail.postfix

	cd /var/spool/postfix && {
		# Clean up chroot environment
		rm -rf /var/spool/postfix/lib64 /var/spool/postfix/usr /var/spool/postfix/etc
        	queue_directory_remove
	}
	true # to ensure we exit safely
fi

# Remove unneeded symbolic links
for i in samples README_FILES; do
  test -L /etc/postfix/$i && rm /etc/postfix/$i || true
done

POSTIN

/bin/sh
# upgrade configuration files if necessary
sh /etc/postfix/post-install \
	config_directory=/etc/postfix \
	daemon_directory=/usr/lib64/postfix \
	command_directory=/usr/sbin \
	mail_owner=postfix \
	setgid_group=postdrop \
	manpage_directory=/usr/share/man \
	sample_directory=/usr/share/doc/postfix-1.1.11/samples \
	readme_directory=/usr/share/doc/postfix-1.1.11/README_FILES \
	upgrade-package

/usr/share/rpm-helper/add-service postfix $1 postfix 

# setup chroot config
mkdir -p /var/spool/postfix//etc
[ -e /etc/localtime ] && cp /etc/localtime /var/spool/postfix//etc
# yves 1.1.10-1mdk -- ??
[ -e /etc/resolv.conf ] && cp /etc/resolv.conf /var/spool/postfix//etc
[ -e /etc/hosts ] && cp /etc/hosts /var/spool/postfix//etc

update-alternatives --install /usr/sbin/sendmail mta /usr/sbin/sendmail.postfix 30 --slave /usr/lib/sendmail mta-in_libdir /usr/sbin/sendmail.postfix --slave /usr/bin/mailq mta-mailq /usr/bin/mailq.postfix --slave /usr/bin/newaliases mta-newaliases /usr/bin/newaliases.postfix --slave /usr/bin/rmail mta-rmail /usr/bin/rmail.postfix --slave /usr/share/man/man1/mailq.1.bz2 mta-mailqman /usr/share/man/man1/mailq.postfix.1.bz2 --slave /usr/share/man/man1/newaliases.1.bz2 mta-newaliasesman /usr/share/man/man1/newaliases.postfix.1.bz2 --slave /usr/share/man/man5/aliases.5.bz2 mta-aliasesman /usr/share/man/man5/aliases.postfix.5.bz2 --slave /etc/aliases mta-etc_aliases /etc/postfix/aliases

# (gc) necessary when we upgrade from a non alternativized package, because it's executed after the old files are removed

POSTUN

/bin/sh

/usr/share/rpm-helper/del-user postfix $1 postfix 
/usr/share/rpm-helper/del-group postfix $1 postdrop 

[ $1 = 0 ] && exit 0
/sbin/service postfix condrestart 2>&1 > /dev/null || :

Triggers

postfix

/bin/sh
[ -e /usr/sbin/sendmail.postfix ] && update-alternatives --install /usr/sbin/sendmail mta /usr/sbin/sendmail.postfix 30 --slave /usr/lib/sendmail mta-in_libdir /usr/sbin/sendmail.postfix --slave /usr/bin/mailq mta-mailq /usr/bin/mailq.postfix --slave /usr/bin/newaliases mta-newaliases /usr/bin/newaliases.postfix --slave /usr/bin/rmail mta-rmail /usr/bin/rmail.postfix --slave /usr/share/man/man1/mailq.1.bz2 mta-mailqman /usr/share/man/man1/mailq.postfix.1.bz2 --slave /usr/share/man/man1/newaliases.1.bz2 mta-newaliasesman /usr/share/man/man1/newaliases.postfix.1.bz2 --slave /usr/share/man/man5/aliases.5.bz2 mta-aliasesman /usr/share/man/man5/aliases.postfix.5.bz2 --slave /etc/aliases mta-etc_aliases /etc/postfix/aliases || :

# Generate chroot jails on the fly when needed things are installed/upgraded

glibc

/bin/sh
copy() { file="`ls --sort=time $1 |head -n 1`"; ln -f "$file" "$2" 2>/dev/null || cp -df "$file" "$2"; }
# Kill off old versions
rm -rf /var/spool/postfix/lib64/libnss* /var/spool/postfix/lib64/libresolv*
# Copy the relevant parts in
LIBCVER=`ls -l /lib64/libc.so.6* | sed "s/.*libc-\(.*\).so$/\1/g"`
for i in compat dns files hesiod nis nisplus winbind wins; do
	[ -e /lib64/libnss_$i-${LIBCVER}.so ] && copy /lib64/libnss_$i-${LIBCVER}.so /var/spool/postfix/lib64/
	[ -e /lib64/libnss_$i.so ] && copy /lib64/libnss_$i.so /var/spool/postfix/lib64/
done
copy /lib64/libresolv-${LIBCVER}.so /var/spool/postfix/lib64/
ldconfig -n /var/spool/postfix/lib64

libldap2

/bin/sh
rm -rf /var/spool/postfix/usr/lib64/liblber* /var/spool/postfix/usr/lib64/libldap*
copy() { file="`ls --sort=time $1 |head -n 1`"; ln -f "$file" "$2" 2>/dev/null || cp -df "$file" "$2"; }
# yves 1.1.10-1mdk -- i like chrooting things..
# cp -L instead of copy_cmd
cp -L /usr/lib64/liblber.so.2 /var/spool/postfix/usr/lib64/
cp -L /usr/lib64/libldap_r.so.2 /var/spool/postfix/usr/lib64/
cp -L /usr/lib64/libldap.so.2 /var/spool/postfix/usr/lib64/
#ldconfig -n /var/spool/postfix/usr/lib64

setup

/bin/sh
rm -f /var/spool/postfix/etc/{services,host.conf}
copy() { file="`ls --sort=time $1 |head -n 1`"; ln -f "$file" "$2" 2>/dev/null || cp -df "$file" "$2"; }
copy /etc/services /var/spool/postfix/etc
# yves 1.1.10-1mdk -- ??
copy /etc/host.conf /var/spool/postfix/etc

# Put db3 in the chroot jail, but only if the soname is correct

libdb3.3

/bin/sh
copy() { file="`ls --sort=time $1 |head -n 1`"; ln -f "$file" "$2" 2>/dev/null || cp -df "$file" "$2"; } 
DBVER=`ldd /usr/lib64/postfix/pickup |grep libdb |perl -pi -e "s,\s+,,g;s,=>.*,,"`
if [ -e "/lib64/$DBVER" ]; then
        copy "/lib64/$DBVER" /var/spool/postfix/lib64
fi