source: oracle-java9-x64-installer/trunk/fuentes/debian/oracle-java9-x64-installer.prerm @ 6504

Last change on this file since 6504 was 6504, checked in by mabarracus, 2 years ago

Initial commit oracle-jdk9-x64-installer

  • Property svn:executable set to *
File size: 3.0 KB
Line 
1#!/bin/sh
2
3set -e
4
5case $(dpkg --print-architecture) in
6  'amd64'  ) arch=amd64; dld=x64
7   ;;
8  *         )
9    echo "Please report to author unsupported platform '`uname -m`'.";
10    echo "Proceeding without web browser plugin support";
11    arch='';
12esac
13
14J_INSTALL_DIR=/usr/lib/jvm/java-9-x64-oracle
15
16if [ "$1" = "remove" ] || [ "$1" = "deconfigure" ]; then
17
18    for f in $J_INSTALL_DIR/bin/*; do
19        name=`basename $f`;
20        if [ ! -f "/usr/bin/$name" -o -L "/usr/bin/$name" ]; then  #some files, like jvisualvm might not be links
21            if [ -f "$J_INSTALL_DIR/man/man1/$name.1.gz" ]; then
22                                        if [ ! $arch = "arm" ]; then
23                update-alternatives --remove $name $J_INSTALL_DIR/bin/$name $LATEST
24                                        else
25                                                # There's no javaws, jvisualvm or jmc on arm
26                                                [ ! $name = "javaws" ] && [ ! $name = "jvisualvm" ] && [ ! $name = "jmc" ] && update-alternatives --remove $name $J_INSTALL_DIR/bin/$name
27                                        fi
28             else #no man pages available
29                # [ ! $name = "javaws.real" ] = skip javaws.real     
30                [ ! $name = "javaws.real" ] && update-alternatives --remove $name $J_INSTALL_DIR/bin/$name $LATEST
31             fi
32        fi
33    done
34
35    #This will issue ignorable warnings for alternatives that are not part of a group
36    if [ -d "$J_INSTALL_DIR/man/man1" ];then
37        for f in $J_INSTALL_DIR/man/man1/*; do
38            name=`basename $f .1.gz`;
39            #some files, like jvisualvm might not be links. Further assume this for corresponding man page
40            if [ ! -f "/usr/bin/$name" -o -L "/usr/bin/$name" ]; then
41                if [ ! -f "$J_INSTALL_DIR/man/man1/$name.1.gz" ]; then
42                    name=`basename $f .1`;          #handle any legacy uncompressed pages
43                fi
44                update-alternatives --remove $name $J_INSTALL_DIR/bin/$name
45            fi
46        done
47
48    else  #no man pages available
49                                if [ -e $J_INSTALL_DIR/bin/ ]; then
50                for f in $J_INSTALL_DIR/bin/*; do
51                          name=`basename $f`;
52                          if [ ! -f "/usr/bin/$name" -o -L "/usr/bin/$name" ]; then  #some files, like jvisualvm might not be links
53                              update-alternatives --remove $name $J_INSTALL_DIR/bin/$name
54                                fi
55                done
56                                fi
57    fi
58
59
60if which update-binfmts >/dev/null; then
61    # try to remove and ignore the error
62    if [ -e /var/lib/binfmts/jar ]; then
63        update-binfmts --package oracle-java9 --remove jar /usr/bin/jexec || true
64    fi
65fi
66
67#Remove links without man pages
68[ -f $J_INSTALL_DIR/bin/jcontrol ]    && update-alternatives --remove    jcontrol    $J_INSTALL_DIR/bin/jcontrol
69
70#Remove manually installed jexec
71[ -f $J_INSTALL_DIR/lib/jexec ] && update-alternatives --remove jexec $J_INSTALL_DIR/lib/jexec
72[ -f $J_INSTALL_DIR/bin/java ] && update-alternatives --remove java $J_INSTALL_DIR/bin/java
73
74#Remove Firefox (and compatible) plugin.
75[ -f $J_INSTALL_DIR/lib/$arch/libnpjp2.so ] && update-alternatives --remove mozilla-javaplugin.so $J_INSTALL_DIR/lib/$arch/libnpjp2.so
76
77fi
78
79
80#DEBHELPER#
81
82exit 0
83
84# vim: ts=2 sw=2
Note: See TracBrowser for help on using the repository browser.