POSTIN
/bin/sh
# Taken from the RedHat/OmniAll.spec file from the Omni source tree
# add /opt/Omni/lib to /etc/ld.so.conf
if ! grep /opt/Omni/lib /etc/ld.so.conf >/dev/null 2>&1; then \
cp /etc/ld.so.conf /etc/ld.so.conf.preomni; \
echo /opt/Omni/lib >> /etc/ld.so.conf; \
ldconfig; \
fi
# add omni.sh to /etc/profile.d
if [ ! -f /etc/profile.d/omni.sh ]; then \
echo 'if ! echo $PATH | /bin/grep -q "/opt/Omni/bin" ; then' > /etc/profile.d/omni.sh; \
echo ' PATH=$PATH:/opt/Omni/bin' >> /etc/profile.d/omni.sh; \
echo 'fi' >> /etc/profile.d/omni.sh; \
chmod a+rx /etc/profile.d/omni.sh; \
fi
# add omni.csh to /etc/profile.d
if [ ! -f /etc/profile.d/omni.csh ]; then \
echo 'if ( `echo $PATH | grep /opt/Omni/bin`"a" == "a" ) then' > /etc/profile.d/omni.csh; \
echo ' setenv PATH "${PATH}:/opt/Omni/bin"' >> /etc/profile.d/omni.csh; \
echo 'endif' >> /etc/profile.d/omni.csh; \
chmod a+rx /etc/profile.d/omni.csh; \
fi
# check for old path
if grep /opt/Omni/bin /etc/profile >/dev/null 2>&1; then \
/bin/cp /etc/profile /etc/profile.postomni; \
sed '/\/opt\/Omni\/bin/d' /etc/profile > /tmp/$$; \
/bin/cp /tmp/$$ /etc/profile.conf; \
/bin/rm /tmp/$$; \
fi
# Remove old Foomatic data of Omni (to assure that the new Foomatic data
# will get installed)
rm -f /usr/share/foomatic/db/source/*/omni*.xml
rm -f `grep -l "Foomatic entry automatically generated by Omni" /usr/share/foomatic/db/source/printer/*.xml`
# Generate Foomatic data
omnitmp=/tmp/`basename $0`-$$/
mkdir -p $omnitmp
( cd $omnitmp
mkdir -p foomatic-db/db/source/driver
mkdir -p foomatic-db/db/source/opt
mkdir -p foomatic-db/db/source/printer
export PATH=$PATH:/opt/Omni/bin
/opt/Omni/bin/OmniFoomaticGenerator
# Replace "-dPARANOIDSAFER" by "-dSAFER" in all GhostScript command
# lines in the Foomatic database, as it breaks CJK printing
#perl -p -i -e "s/-dPARANOIDSAFER/-dSAFER/" foomatic-db/db/source/driver/*.xml
# Install the Omni Foomatic data
/usr/sbin/foomatic-kitload -k foomatic-db/db/source > /dev/null 2>&1 || :
)
rm -rf $omnitmp
# Determine the recommended drivers taking Omni into account
/usr/sbin/foomatic-preferred-driver > /dev/null 2>&1
POSTUN
/bin/sh
if [ "$1" -eq "0" ]; then
# On removal
# Taken from the RedHat/OmniAll.spec file from the Omni source tree
# remove /opt/Omni/lib to /etc/ld.so.conf
if grep /opt/Omni/lib /etc/ld.so.conf >/dev/null 2>&1; then \
/bin/cp /etc/ld.so.conf /etc/ld.so.conf.postomni; \
sed '/\/opt\/Omni\/lib/d' /etc/ld.so.conf > /tmp/$$; \
/bin/cp /tmp/$$ /etc/ld.so.conf; \
/bin/rm /tmp/$$; \
ldconfig; \
fi
# remove omni.sh from /etc/profile.d
if [ -f /etc/profile.d/omni.sh ]; then \
/bin/rm /etc/profile.d/omni.sh; \
fi
# remove omni.csh from /etc/profile.d
if [ -f /etc/profile.d/omni.csh ]; then \
/bin/rm /etc/profile.d/omni.csh; \
fi
# Remove Foomatic data of Omni
rm -f /usr/share/foomatic/db/source/*/omni*.xml
rm -f `grep -l "Foomatic entry automatically generated by Omni" /usr/share/foomatic/db/source/printer/*.xml`
# Clean up Foomatic recommended drivers
/usr/sbin/foomatic-preferred-driver > /dev/null 2>&1
fi