( cd usr/lib ; rm -rf libgnc-business-ledger.so )
( cd usr/lib ; ln -sf libgnc-business-ledger.so.0.0.0 libgnc-business-ledger.so )
( cd usr/lib ; rm -rf libgnc-core-utils.so )
( cd usr/lib ; ln -sf libgnc-core-utils.so.0.0.0 libgnc-core-utils.so )
( cd usr/lib ; rm -rf libgnc-qof.so )
( cd usr/lib ; ln -sf libgnc-qof.so.1.0.4 libgnc-qof.so )
( cd usr/lib ; rm -rf libgnc-gnome.so.0 )
( cd usr/lib ; ln -sf libgnc-gnome.so.0.0.0 libgnc-gnome.so.0 )
( cd usr/lib ; rm -rf libgnc-module.so.0 )
( cd usr/lib ; ln -sf libgnc-module.so.0.0.0 libgnc-module.so.0 )
( cd usr/lib ; rm -rf libgnc-module.so )
( cd usr/lib ; ln -sf libgnc-module.so.0.0.0 libgnc-module.so )
( cd usr/lib ; rm -rf libgnc-qof.so.1 )
( cd usr/lib ; ln -sf libgnc-qof.so.1.0.4 libgnc-qof.so.1 )
( cd usr/lib ; rm -rf libgnc-core-utils.so.0 )
( cd usr/lib ; ln -sf libgnc-core-utils.so.0.0.0 libgnc-core-utils.so.0 )
( cd usr/lib/gnucash ; rm -rf libgncmod-qif.so )
( cd usr/lib/gnucash ; ln -sf libgncmod-qif.so.0.0.0 libgncmod-qif.so )
( cd usr/lib/gnucash ; rm -rf libgncmod-qif.so.0 )
( cd usr/lib/gnucash ; ln -sf libgncmod-qif.so.0.0.0 libgncmod-qif.so.0 )
( cd usr/lib ; rm -rf libgnc-backend-file-utils.so.0 )
( cd usr/lib ; ln -sf libgnc-backend-file-utils.so.0.0.0 libgnc-backend-file-utils.so.0 )
( cd usr/lib ; rm -rf libgnc-gnome.so )
( cd usr/lib ; ln -sf libgnc-gnome.so.0.0.0 libgnc-gnome.so )
( cd usr/lib ; rm -rf libgnc-business-ledger.so.0 )
( cd usr/lib ; ln -sf libgnc-business-ledger.so.0.0.0 libgnc-business-ledger.so.0 )
( cd usr/lib ; rm -rf libgnc-backend-file-utils.so )
( cd usr/lib ; ln -sf libgnc-backend-file-utils.so.0.0.0 libgnc-backend-file-utils.so )
( cd usr/share/gnucash ; rm -rf gnome )
( cd usr/share/gnucash ; ln -sf ../gnome gnome )

if [ -x usr/bin/gconftool-2 ]; then
GCONF_CONFIG_SOURCE="xml::etc/gconf/gconf.xml.defaults"     usr/bin/gconftool-2 --makefile-install-rule etc/gconf/schemas/apps_gnucash_dialog_business_common.schemas >/dev/null 2>&1
GCONF_CONFIG_SOURCE="xml::etc/gconf/gconf.xml.defaults"     usr/bin/gconftool-2 --makefile-install-rule etc/gconf/schemas/apps_gnucash_dialog_commodities.schemas >/dev/null 2>&1
GCONF_CONFIG_SOURCE="xml::etc/gconf/gconf.xml.defaults"     usr/bin/gconftool-2 --makefile-install-rule etc/gconf/schemas/apps_gnucash_dialog_common.schemas >/dev/null 2>&1
GCONF_CONFIG_SOURCE="xml::etc/gconf/gconf.xml.defaults"     usr/bin/gconftool-2 --makefile-install-rule etc/gconf/schemas/apps_gnucash_dialog_prices.schemas >/dev/null 2>&1
GCONF_CONFIG_SOURCE="xml::etc/gconf/gconf.xml.defaults"     usr/bin/gconftool-2 --makefile-install-rule etc/gconf/schemas/apps_gnucash_dialog_print_checks.schemas >/dev/null 2>&1
GCONF_CONFIG_SOURCE="xml::etc/gconf/gconf.xml.defaults"     usr/bin/gconftool-2 --makefile-install-rule etc/gconf/schemas/apps_gnucash_dialog_reconcile.schemas >/dev/null 2>&1
GCONF_CONFIG_SOURCE="xml::etc/gconf/gconf.xml.defaults"     usr/bin/gconftool-2 --makefile-install-rule etc/gconf/schemas/apps_gnucash_dialog_scheduled_transctions.schemas >/dev/null 2>&1
GCONF_CONFIG_SOURCE="xml::etc/gconf/gconf.xml.defaults"     usr/bin/gconftool-2 --makefile-install-rule etc/gconf/schemas/apps_gnucash_dialog_totd.schemas >/dev/null 2>&1
GCONF_CONFIG_SOURCE="xml::etc/gconf/gconf.xml.defaults"     usr/bin/gconftool-2 --makefile-install-rule etc/gconf/schemas/apps_gnucash_general.schemas >/dev/null 2>&1
GCONF_CONFIG_SOURCE="xml::etc/gconf/gconf.xml.defaults"     usr/bin/gconftool-2 --makefile-install-rule etc/gconf/schemas/apps_gnucash_history.schemas >/dev/null 2>&1
GCONF_CONFIG_SOURCE="xml::etc/gconf/gconf.xml.defaults"     usr/bin/gconftool-2 --makefile-install-rule etc/gconf/schemas/apps_gnucash_import_generic_matcher.schemas >/dev/null 2>&1
GCONF_CONFIG_SOURCE="xml::etc/gconf/gconf.xml.defaults"     usr/bin/gconftool-2 --makefile-install-rule etc/gconf/schemas/apps_gnucash_import_qif.schemas >/dev/null 2>&1
GCONF_CONFIG_SOURCE="xml::etc/gconf/gconf.xml.defaults"     usr/bin/gconftool-2 --makefile-install-rule etc/gconf/schemas/apps_gnucash_warnings.schemas >/dev/null 2>&1
GCONF_CONFIG_SOURCE="xml::etc/gconf/gconf.xml.defaults"     usr/bin/gconftool-2 --makefile-install-rule etc/gconf/schemas/apps_gnucash_window_pages_account_tree.schemas >/dev/null 2>&1
GCONF_CONFIG_SOURCE="xml::etc/gconf/gconf.xml.defaults"     usr/bin/gconftool-2 --makefile-install-rule etc/gconf/schemas/apps_gnucash_window_pages_register.schemas >/dev/null 2>&1
fi
# Preserve new configuration files
install_file() {
  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...
}

install_file etc/gnucash/config.new

# Install new info files
if [ -x usr/bin/install-info ]; then
  usr/bin/install-info usr/info/gnucash-design.info.gz usr/info/dir >/dev/null 2>&1
fi

# update rarian database
if [ -x usr/bin/rarian-sk-update ]; then
  usr/bin/rarian-sk-update 1> /dev/null 2> /dev/null
fi

# update mime database
if [ -x usr/bin/update-mime-database ]; then
  usr/bin/update-mime-database usr/share/mime 1> /dev/null 2> /dev/null
fi

# update desktop entries
if [ -x usr/bin/update-desktop-database ]; then
  usr/bin/update-desktop-database 1> /dev/null 2> /dev/null
fi

# update hicolor icons
if [ -e usr/share/icons/hicolor/icon-theme.cache ]; then
    rm -f usr/share/icons/hicolor/icon-theme.cache
fi
usr/bin/gtk-update-icon-cache -f -q --ignore-theme-index usr/share/icons/hicolor

# Restart gconfd-2 if running to reload new gconf settings
if ps acx | grep -q gconfd-2 ; then
        killall -HUP gconfd-2 ;
fi

# Create required slibcat file
if [ -x usr/bin/guile ]; then
  usr/bin/guile -c "(use-modules (ice-9 slib)) (require 'new-catalog)" 1> /dev/null 2> /dev/null
fi;
