#! /bin/sh -e

if [ -d /usr/share/doc/gcc-@BV@-base/java ] && [ ! -h /usr/share/doc/gcc-@BV@-base/java ]; then
    rm -rf /usr/share/doc/gcc-@BV@-base/java
    ln -s ../gcj-@BV@-base /usr/share/doc/gcc-@BV@-base/java
fi

prio=@java_priority@
update-alternatives --quiet \
    --install /usr/bin/javac javac /usr/bin/gcj-wrapper-@BV@ $prio \
    @GFDL@--slave /usr/share/man/man1/javac.1.gz javac.1.gz /usr/share/man/man1/gcj-wrapper-@BV@.1.gz

update-alternatives --quiet \
    --install /usr/bin/jar jar /usr/bin/gjar-@BV@ $prio \
    --slave /usr/share/man/man1/jar.1.gz jar.1.gz /usr/share/man/man1/gjar-@BV@.1.gz

update-alternatives --quiet \
    --install /usr/bin/jarsigner jarsigner /usr/bin/gjarsigner-@BV@ $prio \
    --slave /usr/share/man/man1/jarsigner.1.gz jarsigner.1.gz /usr/share/man/man1/gjarsigner-@BV@.1.gz

update-alternatives --quiet \
    --install /usr/bin/javah javah /usr/bin/gjavah-@BV@ $prio \
    --slave /usr/share/man/man1/javah.1.gz javah.1.gz /usr/share/man/man1/gjavah-@BV@.1.gz

update-alternatives --quiet \
    --install /usr/bin/javadoc javadoc /usr/bin/gjdoc-@BV@ $prio \
    --slave /usr/share/man/man1/javadoc.1.gz javadoc.1.gz /usr/share/man/man1/gjdoc-@BV@.1.gz

update-alternatives --quiet \
    --install /usr/bin/native2ascii native2ascii /usr/bin/gnative2ascii-@BV@ $prio \
    --slave /usr/share/man/man1/native2ascii.1.gz native2ascii.1.gz /usr/share/man/man1/gnative2ascii-@BV@.1.gz

update-alternatives --quiet \
    --install /usr/bin/rmic rmic /usr/bin/grmic-@BV@ $prio \
    @GFDL@--slave /usr/share/man/man1/rmic.1.gz rmic.1.gz /usr/share/man/man1/grmic-@BV@.1.gz

update-alternatives --quiet \
    --install /usr/bin/serialver serialver /usr/bin/gserialver-@BV@ $prio \
    --slave /usr/share/man/man1/serialver.1.gz serialver.1.gz /usr/share/man/man1/gserialver-@BV@.1.gz

update-alternatives --quiet \
    --install /usr/bin/tnameserv tnameserv /usr/bin/gtnameserv-@BV@ $prio \
    --slave /usr/share/man/man1/tnameserv.1.gz tnameserv.1.gz /usr/share/man/man1/gtnameserv-@BV@.1.gz

#DEBHELPER#
