GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — install-java/uninstall-java.sh at master · andreaslangsays/install-java Expand file tree/ Copy pathuninstall-java.shMore file actions executable file ·104 lines (87 loc) · 2.88 KB / Copy pathuninstall-java.shFile metadata and controlsexecutable file ·104 lines (87 loc) · 2.88 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 #!/bin/bash # Copyright 2015 M. Isuru Tharanga Chrishantha Perera # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # # ---------------------------------------------------------------------------- # Script for uninstalling Java # ---------------------------------------------------------------------------- java_dist_dir="" function help { echo "" echo "Usage: " echo "uninstall-java.sh -p <java_dist_dir>" echo "" echo "-p: Java distribution directory" echo "" } confirm () { # call with a prompt string or use a default read -r -p "${1:-Are you sure?} [y/N] " response case $response in [yY][eE][sS]|[yY]) true ;; *) false ;; esac } # Make sure the script is running as root. if [ "$UID" -ne "0" ]; then echo "You must be root to run $0. Try following"; echo "sudo $0"; exit 9 fi while getopts "p:" opts do case $opts in p) java_dist_dir=${OPTARG} ;; \?) help exit 1 ;; esac done if [[ ! -f $java_dist_dir/bin/java ]]; then echo "Please specify a valid java distribution directory" help exit 1 fi # Run update-alternatives commands commands=( "jar" "java" "javac" "javadoc" "javah" "javap" "javaws" "jcmd" "jconsole" "jarsigner" "jhat" "jinfo" "jmap" "jmc" "jps" "jstack" "jstat" "jstatd" "jvisualvm" "keytool" "policytool" "wsgen" "wsimport" ) if (confirm "Run update-alternatives commands?"); then echo "Running update-alternatives --remove for ${commands[@]} mozilla-javaplugin.so" for i in "${commands[@]}" do update-alternatives --remove "$i" "$java_dist_dir/bin/$i" done if [[ -d "/usr/lib/mozilla/plugins/" ]]; then update-alternatives --remove "mozilla-javaplugin.so" "$java_dist_dir/jre/lib/amd64/libnpjp2.so" fi fi if (confirm "Remove directory '$java_dist_dir'?"); then rm -rf $java_dist_dir fi jdk_major_version="" if [[ $java_dist_dir =~ .*jdk1\.([0-9]*).* ]]; then jdk_major_version=$(echo $java_dist_dir | sed -nE 's/.*jdk1\.([0-9]*).*/\1/p') elif [[ $java_dist_dir =~ .*jdk-([0-9]*).* ]]; then jdk_major_version=$(echo $java_dist_dir | sed -nE 's/.*jdk-([0-9]*).*/\1/p') fi applications_dir="$HOME/.local/share/applications" jmc_shortcut_file="$applications_dir/jmc_$jdk_major_version.desktop" if [ -f $jmc_shortcut_file ] && (confirm "Remove JMC shortcut?"); then rm $jmc_shortcut_file fi |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |