New design for policy on disk allowing multiple policy rpms to be simultaniously installed.

Jeff Johnson n3npq at nc.rr.com
Thu May 27 00:45:27 UTC 2004


Stephen Smalley wrote:

>On Tue, 2004-05-25 at 15:18, Jeff Johnson wrote:
>  
>
>>Well, the existing means to handle simultaneous installs of otherwise 
>>mutually exclusive packages is the
>>alternatives mechanism used to handle sendmail vs. postfix and lpd vs. cups.
>>
>>Yes, symlinks, feeble, but that is the existing mechanism, might as well 
>>use if in the distro.
>>    
>>
>
>Can you elaborate on how this works presently?  How do you avoid
>conflicts among multiple packages owning those symlinks?
>
>  
>

Sure.

sendmail and postfix are mutually conflicting because both wish to use 
/usr/lib/sendmail.

So the path is a symlink, conflicts avoided because the symlink is not part
of any package, but rather a side effect of the install:
$ rpm -qf /usr/lib/sendmail
file /usr/lib/sendmail is not owned by any package

See also "man alternatives".

Here are the scripts from the sendmail package, edited to remove "other 
stuff":

$ rpm -q --scripts sendmail

postinstall scriptlet (using /bin/sh):

#
# Set up the alternatives files for MTAs.
#
/usr/sbin/alternatives --install /usr/sbin/sendmail mta 
/usr/sbin/sendmail.sendmail 90 \
        --slave /usr/bin/mailq mta-mailq /usr/bin/mailq.sendmail \
        --slave /usr/bin/newaliases mta-newaliases 
/usr/bin/newaliases.sendmail \
        --slave /usr/bin/rmail mta-rmail /usr/bin/rmail.sendmail \
        --slave /usr/lib/sendmail mta-sendmail /usr/lib/sendmail.sendmail \
        --slave /etc/pam.d/smtp mta-pam /etc/pam.d/smtp.sendmail \
        --slave /usr/share/man/man8/sendmail.8.gz mta-sendmailman 
/usr/share/man/man8/sendmail.sendmail.8.gz \
        --slave /usr/share/man/man1/mailq.1.gz mta-mailqman 
/usr/share/man/man1/mailq.sendmail.1.gz \
        --slave /usr/share/man/man1/newaliases.1.gz mta-newaliasesman 
/usr/share/man/man1/newaliases.sendmail.1.gz \
        --slave /usr/share/man/man5/aliases.5.gz mta-aliasesman 
/usr/share/man/man5/aliases.sendmail.5.gz \
        --initscript sendmail
 
 

preuninstall scriptlet (using /bin/sh):
if [ $1 = 0 ]; then
        /usr/sbin/alternatives --remove mta /usr/sbin/sendmail.sendmail
fi
exit 0
postuninstall scriptlet (using /bin/sh):
if [ "$1" -ge "1" ]; then
        mta=`readlink /etc/alternatives/mta`
        if [ "$mta" == "/usr/sbin/sendmail.sendmail" ]; then
                /usr/sbin/alternatives --set mta /usr/sbin/sendmail.sendmail
        fi
fi
exit 0

HTH

73 de Jeff




More information about the fedora-selinux-list mailing list