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...
}

config etc/gre.d/gre64.conf.new

# Ensure that xulrunner libraries are found by applications that need them
# (this way you can remove seamonkey completely):
if ! grep -q /usr/lib64/xulrunner etc/ld.so.conf ; then
  echo "/usr/lib64/xulrunner" >> etc/ld.so.conf
fi

( cd usr/lib64 ; rm -rf xulrunner-devel )
( cd usr/lib64 ; ln -sf xulrunner-devel-1.9.1.16 xulrunner-devel )
( cd usr/lib64/pkgconfig ; rm -rf xulrunner-xpcom.pc )
( cd usr/lib64/pkgconfig ; ln -sf mozilla-xpcom.pc xulrunner-xpcom.pc )
( cd usr/lib64/pkgconfig ; rm -rf xulrunner-nss.pc )
( cd usr/lib64/pkgconfig ; ln -sf mozilla-nss.pc xulrunner-nss.pc )
( cd usr/lib64/pkgconfig ; rm -rf xulrunner-nspr.pc )
( cd usr/lib64/pkgconfig ; ln -sf mozilla-nspr.pc xulrunner-nspr.pc )
( cd usr/lib64/pkgconfig ; rm -rf xulrunner-gtkmozembed.pc )
( cd usr/lib64/pkgconfig ; ln -sf mozilla-gtkmozembed.pc xulrunner-gtkmozembed.pc )
( cd usr/lib64/pkgconfig ; rm -rf xulrunner-gtkmozembed-embedding.pc )
( cd usr/lib64/pkgconfig ; ln -sf mozilla-gtkmozembed-embedding.pc xulrunner-gtkmozembed-embedding.pc )
( cd usr/lib64/pkgconfig ; rm -rf xulrunner-plugin.pc )
( cd usr/lib64/pkgconfig ; ln -sf mozilla-plugin.pc xulrunner-plugin.pc )
( cd usr/lib64/pkgconfig ; rm -rf xulrunner-js.pc )
( cd usr/lib64/pkgconfig ; ln -sf mozilla-js.pc xulrunner-js.pc )
( cd usr/lib64/xulrunner-devel-1.9.1.16/sdk/lib ; rm -rf libnssckbi.so )
( cd usr/lib64/xulrunner-devel-1.9.1.16/sdk/lib ; ln -sf /usr/lib64/xulrunner-1.9.1.16/libnssckbi.so libnssckbi.so )
( cd usr/lib64/xulrunner-devel-1.9.1.16/sdk/lib ; rm -rf libnssutil3.so )
( cd usr/lib64/xulrunner-devel-1.9.1.16/sdk/lib ; ln -sf /usr/lib64/xulrunner-1.9.1.16/libnssutil3.so libnssutil3.so )
( cd usr/lib64/xulrunner-devel-1.9.1.16/sdk/lib ; rm -rf libplc4.so )
( cd usr/lib64/xulrunner-devel-1.9.1.16/sdk/lib ; ln -sf /usr/lib64/xulrunner-1.9.1.16/libplc4.so libplc4.so )
( cd usr/lib64/xulrunner-devel-1.9.1.16/sdk/lib ; rm -rf libnspr4.so )
( cd usr/lib64/xulrunner-devel-1.9.1.16/sdk/lib ; ln -sf /usr/lib64/xulrunner-1.9.1.16/libnspr4.so libnspr4.so )
( cd usr/lib64/xulrunner-devel-1.9.1.16/sdk/lib ; rm -rf libnssdbm3.so )
( cd usr/lib64/xulrunner-devel-1.9.1.16/sdk/lib ; ln -sf /usr/lib64/xulrunner-1.9.1.16/libnssdbm3.so libnssdbm3.so )
( cd usr/lib64/xulrunner-devel-1.9.1.16/sdk/lib ; rm -rf libssl3.so )
( cd usr/lib64/xulrunner-devel-1.9.1.16/sdk/lib ; ln -sf /usr/lib64/xulrunner-1.9.1.16/libssl3.so libssl3.so )
( cd usr/lib64/xulrunner-devel-1.9.1.16/sdk/lib ; rm -rf libxpcom.so )
( cd usr/lib64/xulrunner-devel-1.9.1.16/sdk/lib ; ln -sf /usr/lib64/xulrunner-1.9.1.16/libxpcom.so libxpcom.so )
( cd usr/lib64/xulrunner-devel-1.9.1.16/sdk/lib ; rm -rf libxul.so )
( cd usr/lib64/xulrunner-devel-1.9.1.16/sdk/lib ; ln -sf /usr/lib64/xulrunner-1.9.1.16/libxul.so libxul.so )
( cd usr/lib64/xulrunner-devel-1.9.1.16/sdk/lib ; rm -rf libjavaxpcomglue.so )
( cd usr/lib64/xulrunner-devel-1.9.1.16/sdk/lib ; ln -sf /usr/lib64/xulrunner-1.9.1.16/libjavaxpcomglue.so libjavaxpcomglue.so )
( cd usr/lib64/xulrunner-devel-1.9.1.16/sdk/lib ; rm -rf libfreebl3.so )
( cd usr/lib64/xulrunner-devel-1.9.1.16/sdk/lib ; ln -sf /usr/lib64/xulrunner-1.9.1.16/libfreebl3.so libfreebl3.so )
( cd usr/lib64/xulrunner-devel-1.9.1.16/sdk/lib ; rm -rf libnss3.so )
( cd usr/lib64/xulrunner-devel-1.9.1.16/sdk/lib ; ln -sf /usr/lib64/xulrunner-1.9.1.16/libnss3.so libnss3.so )
( cd usr/lib64/xulrunner-devel-1.9.1.16/sdk/lib ; rm -rf libsmime3.so )
( cd usr/lib64/xulrunner-devel-1.9.1.16/sdk/lib ; ln -sf /usr/lib64/xulrunner-1.9.1.16/libsmime3.so libsmime3.so )
( cd usr/lib64/xulrunner-devel-1.9.1.16/sdk/lib ; rm -rf libsoftokn3.so )
( cd usr/lib64/xulrunner-devel-1.9.1.16/sdk/lib ; ln -sf /usr/lib64/xulrunner-1.9.1.16/libsoftokn3.so libsoftokn3.so )
( cd usr/lib64/xulrunner-devel-1.9.1.16/sdk/lib ; rm -rf libmozjs.so )
( cd usr/lib64/xulrunner-devel-1.9.1.16/sdk/lib ; ln -sf /usr/lib64/xulrunner-1.9.1.16/libmozjs.so libmozjs.so )
( cd usr/lib64/xulrunner-devel-1.9.1.16/sdk/lib ; rm -rf libplds4.so )
( cd usr/lib64/xulrunner-devel-1.9.1.16/sdk/lib ; ln -sf /usr/lib64/xulrunner-1.9.1.16/libplds4.so libplds4.so )
( cd usr/lib64/xulrunner-devel-1.9.1.16/sdk ; rm -rf idl )
( cd usr/lib64/xulrunner-devel-1.9.1.16/sdk ; ln -sf /usr/share/idl/xulrunner-1.9.1.16/stable idl )
( cd usr/lib64/xulrunner-devel-1.9.1.16/sdk ; rm -rf include )
( cd usr/lib64/xulrunner-devel-1.9.1.16/sdk ; ln -sf /usr/include/xulrunner-1.9.1.16/stable include )
( cd usr/lib64/xulrunner-devel-1.9.1.16 ; rm -rf lib )
( cd usr/lib64/xulrunner-devel-1.9.1.16 ; ln -sf /usr/lib64/xulrunner-devel-1.9.1.16/sdk/lib lib )
( cd usr/lib64/xulrunner-devel-1.9.1.16 ; rm -rf idl )
( cd usr/lib64/xulrunner-devel-1.9.1.16 ; ln -sf /usr/share/idl/xulrunner-1.9.1.16/unstable idl )
( cd usr/lib64/xulrunner-devel-1.9.1.16 ; rm -rf bin )
( cd usr/lib64/xulrunner-devel-1.9.1.16 ; ln -sf /usr/lib64/xulrunner-1.9.1.16 bin )
( cd usr/lib64/xulrunner-devel-1.9.1.16 ; rm -rf include )
( cd usr/lib64/xulrunner-devel-1.9.1.16 ; ln -sf /usr/include/xulrunner-1.9.1.16/unstable include )
( cd usr/lib64 ; rm -rf xulrunner )
( cd usr/lib64 ; ln -sf xulrunner-1.9.1.16 xulrunner )
( cd usr/bin ; rm -rf xulrunner )
( cd usr/bin ; ln -sf /usr/lib64/xulrunner-1.9.1.16/xulrunner xulrunner )
