
# Figure out our root directory
ROOTDIR=$(pwd)
unset CHROOT
if test "${ROOTDIR}" != "/"; then
  CHROOT="chroot ${ROOTDIR} "
  ROOTDIR="${ROOTDIR}/"
fi
if [ -x usr/lib/nss/unsupported-tools/shlibsign ]; then
  ${CHROOT} /usr/lib/nss/unsupported-tools/shlibsign -i usr/lib/libsoftokn3.so >/dev/null 2>/dev/null
  ${CHROOT} /usr/lib/nss/unsupported-tools/shlibsign -i usr/lib/libfreebl3.so >/dev/null 2>/dev/null
  ${CHROOT} /usr/lib/nss/unsupported-tools/shlibsign -i usr/lib/libnssdbm3.so >/dev/null 2>/dev/null
fi
if grep '^/usr/lib/seamonkey' etc/ld.so.conf 1> /dev/null 2> /dev/null ; then
  sed -i -e '/^\/usr\/lib\/seamonkey/s|^|#|g' etc/ld.so.conf
fi
if [ -x /sbin/ldconfig ]; then
  /sbin/ldconfig 2> /dev/null
fi
config() {
  NEW="$1"
  OLD="$(dirname $NEW)/$(basename $NEW .new)"
  # If there's no config file by that name, mv it over:
  if [ ! -r $OLD ]; then
    mv $NEW $OLD
  elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then
    # toss the redundant copy
    rm $NEW
  fi
  # Otherwise, we leave the .new copy for the admin to consider...
}
## List of conf files to check.  The conf files in your package should end in .new

config etc/pki/nssdb/cert8.db.new
config etc/pki/nssdb/cert9.db.new
config etc/pki/nssdb/key3.db.new
config etc/pki/nssdb/key4.db.new
config etc/pki/nssdb/pkcs11.txt.new
config etc/pki/nssdb/secmod.db.new

if [ -f etc/pki/nssdb/pkcs11.txt -a -x usr/bin/setup-nsssysinit.sh ] ;then
  ${CHROOT} /usr/bin/setup-nsssysinit.sh on
fi
