GeezerVison is showing github.com — use update-alternative slave to allow switching all execuatables in o… · chrishantha/install-java@14abab4
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: install-java.sh +7-6Lines changed: 7 additions & 6 deletions | Original file line number | Diff line number | Diff line change |
|---|
|
182 | 182 | # Run update-alternatives commands |
183 | 183 | if (confirm "Run update-alternatives commands?"); then |
184 | 184 | echo "Running update-alternatives..." |
185 | | - declare -a commands=($(ls -1 ${extracted_dirname}/bin)) |
| 185 | + cmd="update-alternatives --install /usr/bin/java java $extracted_dirname/bin/java 10000" |
| 186 | + declare -a commands=($(ls -1 ${extracted_dirname}/bin | grep -v ^java$)) |
186 | 187 | for command in "${commands[@]}"; do |
187 | 188 | command_path=$extracted_dirname/bin/$command |
188 | 189 | if [[ -x $command_path ]]; then |
189 | | - update-alternatives --install "/usr/bin/$command" "$command" "$command_path" 10000 |
190 | | - update-alternatives --set "$command" "$command_path" |
| 190 | + cmd="$cmd --slave /usr/bin/$command $command $command_path" |
191 | 191 | fi |
192 | 192 | done |
193 | | - |
194 | 193 | lib_path=$extracted_dirname/jre/lib/amd64/libnpjp2.so |
195 | 194 | if [[ -d "/usr/lib/mozilla/plugins/" ]] && [[ -f $lib_path ]]; then |
196 | | - update-alternatives --install "/usr/lib/mozilla/plugins/libjavaplugin.so" "mozilla-javaplugin.so" "$lib_path" 10000 |
197 | | - update-alternatives --set "mozilla-javaplugin.so" "$lib_path" |
| 195 | + cmd="$cmd --slave /usr/lib/mozilla/plugins/libjavaplugin.so mozilla-javaplugin.so $lib_path" |
198 | 196 | fi |
| 197 | + echo $cmd |
| 198 | + exec $cmd |
| 199 | + update-alternatives --set java $extracted_dirname/bin/java |
199 | 200 | fi |
200 | 201 |
|
201 | 202 | # Create system preferences directory |
|
Collapse file
Copy file name to clipboardExpand all lines: uninstall-java.sh +1-12Lines changed: 1 addition & 12 deletions | Original file line number | Diff line number | Diff line change |
|---|
|
79 | 79 | # Run update-alternatives commands |
80 | 80 | if (confirm "Run update-alternatives commands?"); then |
81 | 81 | echo "Running update-alternatives..." |
82 | | - declare -a commands=($(ls -1 ${java_dist_dir}/bin)) |
83 | | - for command in "${commands[@]}"; do |
84 | | - command_path="$java_dist_dir/bin/$command" |
85 | | - if [[ -x $command_path ]]; then |
86 | | - update-alternatives --remove "$command" "$command_path" |
87 | | - fi |
88 | | - done |
89 | | - |
90 | | - lib_path="$java_dist_dir/jre/lib/amd64/libnpjp2.so" |
91 | | - if [[ -d "/usr/lib/mozilla/plugins/" ]] && [[ -f $lib_path ]]; then |
92 | | - update-alternatives --remove "mozilla-javaplugin.so" "$lib_path" |
93 | | - fi |
| 82 | + update-alternatives --remove java ${java_dist_dir}/bin/java |
94 | 83 | fi |
95 | 84 |
|
96 | 85 | if (confirm "Remove directory '$java_dist_dir'?"); then |
|