( cd usr/lib ; rm -rf libgda-report-3.0.so.3 )
( cd usr/lib ; ln -sf libgda-report-3.0.so.3.0.0 libgda-report-3.0.so.3 )
( cd usr/lib ; rm -rf libgdasql-3.0.so.3 )
( cd usr/lib ; ln -sf libgdasql-3.0.so.3.0.0 libgdasql-3.0.so.3 )
( cd usr/lib ; rm -rf libgda-3.0.so.3 )
( cd usr/lib ; ln -sf libgda-3.0.so.3.0.0 libgda-3.0.so.3 )
( cd usr/lib ; rm -rf libgda-3.0.so )
( cd usr/lib ; ln -sf libgda-3.0.so.3.0.0 libgda-3.0.so )
( cd usr/lib ; rm -rf libgda-report-3.0.so )
( cd usr/lib ; ln -sf libgda-report-3.0.so.3.0.0 libgda-report-3.0.so )
( cd usr/lib ; rm -rf libgdasql-3.0.so )
( cd usr/lib ; ln -sf libgdasql-3.0.so.3.0.0 libgdasql-3.0.so )

ldconfig -r .

function install_file() {
  # $1 = File to process

  FILE="$(dirname "$1")/$(basename "$1" .new)"
  if [ ! -e "$FILE" ]
  then
    mv "$FILE.new" "$FILE"
  elif [ "$(cat "$FILE" | md5sum)" != "$(cat "$FILE.new" | md5sum)" ]
  then
    #     |--------|--------------------------------------------------|
    echo "WARNING: $FILE has been customised."
    echo "         Examine the $FILE.new file"
    echo "         and integrate any changes into the custom file."
    echo
  else
    rm -f "$FILE.new"
  fi
}

install_file etc/libgda-3.0/config.new
