source: oracle-java8-installer/trunk/fuentes/debian/oracle-java8-installer.prerm @ 2122

Last change on this file since 2122 was 566, checked in by jrpelegrina, 4 years ago

First release to xenial

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