#! /bin/sh

set -e

case "$1" in
    configure)
	if [ -w /usr/local/lib -a ! -e /usr/local/lib/site_ruby/@@version@@ ]
	then
	    mkdir -p /usr/local/lib/site_ruby/@@version@@/@@arch@@
	fi
    ;;

    abort-upgrade|abort-remove|abort-deconfigure)
    ;;

    *)
        echo "postinst called with unknown argument \`$1'" >&2
        exit 1
    ;;
esac

if [ "$1" = "configure" ]; then
  if [ -d /usr/doc -a ! -e /usr/doc/ruby -a -d /usr/share/doc/ruby ]; then
    ln -sf ../share/doc/ruby /usr/doc/ruby
  fi
fi

exit 0
