Sophie

Sophie

distrib > Scientific%20Linux > 5x > i386 > by-pkgid > e1b2e46a64064e4be294cdfce5c6c943 > scriptlet

openmpi-libs-1.4-7.el5.i386.rpm

PREUN

/bin/sh
# Count how many copies of this particular package are currently installed,
# knowing that on upgrade the new package being installed is already in this
# list by the time we are run, and that we are in the list too as we aren't
# removed until after our scripts complete.  If our count comes back as just
# 1, then we are the last copy of this particular version and we need to
# remove our registration.  This is true regardless of wheter this is an
# upgrade or an erase.  Note: we have to keep our arch in the query too or
# else multilib installations throw this count off.
COUNT=`rpm -q openmpi-1.4.i386 | wc -l`
if [ $COUNT -eq 1 ]; then
    mpi-selector --unregister openmpi-1.4-gcc-i386 \
	--yes >/dev/null 2>&1
fi
# We can't fail
/bin/true

POSTIN

/bin/sh
# Any and all upgrades/installs should remove all old dangling alternatives
# links except for the one case of openmpi-1.2.3 still installed because
# its %preun will fail if it can't remove the alternatives link itself.
# So, remove the links, and if 1.2.3 is installed, put it back.
/usr/sbin/alternatives --remove mpilibs32 \
    /usr/lib/openmpi/openmpi.ld.conf >/dev/null 2>&1
/usr/sbin/alternatives --remove mpilibs32 \
    /usr/lib/openmpi/1.2.3-gcc/openmpi.ld.conf >/dev/null 2>&1
rpm -q openmpi-libs-1.2.3.i386 > /dev/null 2>&1
if [ $? -eq 0 ]; then
    # 1.2.3 is installed, recreate the link
    /usr/sbin/alternatives --install \
	/etc/ld.so.conf.d/mpi32.conf mpilibs32 \
	/usr/lib/openmpi/1.2.3-gcc/openmpi.ld.conf 11 >/dev/null 2>&1
fi
# when upgrading 1.2.5, it expects a file in tmp to tell it what
# version we are...also it will fail to remove its mpi-selector
# registration, so we need to do that here
rpm -q openmpi-libs-1.2.5.i386 > /dev/null 2>&1
if [ $? -eq 0 ]; then
    FILE=`mktemp /tmp/openmpi-upgrade-version.XXXXXX`
    echo "VERSION=1.4" > $FILE
fi
# under certain specific circumstances, 1.2.5 will fail to remove its mpi
# registration.  so if we are an upgrade, we need to remove it, and even
# if it isn't installed we might need to remove it, so just remove it
# unilaterally
mpi-selector --unregister openmpi-1.2.5-gcc-i386 --yes >/dev/null 2>&1
# It is safe to reregister the same setup at every upgrade/reinstall/etc.
mpi-selector --register openmpi-1.4-gcc-i386 \
	--source-dir /usr/lib/openmpi/1.4-gcc/etc --yes
# We can't fail
/bin/true