#!/bin/sh -

set -e

case "$1" in
    remove|upgrade|deconfigure)
	if [ -w /usr/local/lib -a -e /usr/local/lib/site_ruby/@@version@@ ]
	then
	    rmdir -p /usr/local/lib/site_perl/@@version@@/@@arch@@ 2>/dev/null || exit 0
	fi
    ;;

    failed-upgrade)
    ;;

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

if [ \( "$1" = "upgrade" -o "$1" = "remove" \) -a -L /usr/doc/ruby ]; then
  rm -f /usr/doc/ruby
fi

exit 0
