( cd usr/bin ; rm -rf gda-sql )
( cd usr/bin ; ln -sf gda-sql-4.0 gda-sql )
( cd usr/bin ; rm -rf gda-list-server-op )
( cd usr/bin ; ln -sf gda-list-server-op-4.0 gda-list-server-op )
( cd usr/bin ; rm -rf gda-list-config )
( cd usr/bin ; ln -sf gda-list-config-4.0 gda-list-config )
( cd usr/man/man1 ; rm -rf gda-sql.1.gz )
( cd usr/man/man1 ; ln -sf gda-sql-4.0.1.gz gda-sql.1.gz )
( cd usr/lib64 ; rm -rf libgda-xslt-4.0.so.4 )
( cd usr/lib64 ; ln -sf libgda-xslt-4.0.so.4.0.0 libgda-xslt-4.0.so.4 )
( cd usr/lib64 ; rm -rf libgda-report-4.0.so )
( cd usr/lib64 ; ln -sf libgda-report-4.0.so.4.0.0 libgda-report-4.0.so )
( cd usr/lib64 ; rm -rf libgda-4.0.so )
( cd usr/lib64 ; ln -sf libgda-4.0.so.4.0.0 libgda-4.0.so )
( cd usr/lib64 ; rm -rf libgda-4.0.so.4 )
( cd usr/lib64 ; ln -sf libgda-4.0.so.4.0.0 libgda-4.0.so.4 )
( cd usr/lib64 ; rm -rf libgda-xslt-4.0.so )
( cd usr/lib64 ; ln -sf libgda-xslt-4.0.so.4.0.0 libgda-xslt-4.0.so )
( cd usr/lib64 ; rm -rf libgda-report-4.0.so.4 )
( cd usr/lib64 ; ln -sf libgda-report-4.0.so.4.0.0 libgda-report-4.0.so.4 )

# 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/libgda-4.0/config.new
