1 |
caster 11/10/29 14:36:34 |
2 |
|
3 |
Modified: java-vm-2.eclass |
4 |
Log: |
5 |
Improve the postinst check for valid system VM to allow migrating icedtea6 to icedtea-6. Also use REPLACED_BY_VERSION to stop spamming about system VM removal on upgrades, for VM's migrated to EAPI=4. |
6 |
|
7 |
Revision Changes Path |
8 |
1.35 eclass/java-vm-2.eclass |
9 |
|
10 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/java-vm-2.eclass?rev=1.35&view=markup |
11 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/java-vm-2.eclass?rev=1.35&content-type=text/plain |
12 |
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/java-vm-2.eclass?r1=1.34&r2=1.35 |
13 |
|
14 |
Index: java-vm-2.eclass |
15 |
=================================================================== |
16 |
RCS file: /var/cvsroot/gentoo-x86/eclass/java-vm-2.eclass,v |
17 |
retrieving revision 1.34 |
18 |
retrieving revision 1.35 |
19 |
diff -u -r1.34 -r1.35 |
20 |
--- java-vm-2.eclass 11 Oct 2011 10:55:06 -0000 1.34 |
21 |
+++ java-vm-2.eclass 29 Oct 2011 14:36:34 -0000 1.35 |
22 |
@@ -1,6 +1,6 @@ |
23 |
# Copyright 1999-2004 Gentoo Foundation |
24 |
# Distributed under the terms of the GNU General Public License v2 |
25 |
-# $Header: /var/cvsroot/gentoo-x86/eclass/java-vm-2.eclass,v 1.34 2011/10/11 10:55:06 grobian Exp $ |
26 |
+# $Header: /var/cvsroot/gentoo-x86/eclass/java-vm-2.eclass,v 1.35 2011/10/29 14:36:34 caster Exp $ |
27 |
|
28 |
# ----------------------------------------------------------------------------- |
29 |
# @eclass-begin |
30 |
@@ -24,6 +24,7 @@ |
31 |
|
32 |
JAVA_VM_CONFIG_DIR="/usr/share/java-config-2/vm" |
33 |
JAVA_VM_DIR="/usr/lib/jvm" |
34 |
+JAVA_VM_SYSTEM="/etc/java-config-2/current-system-vm" |
35 |
JAVA_VM_BUILD_ONLY="${JAVA_VM_BUILD_ONLY:-FALSE}" |
36 |
|
37 |
EXPORT_FUNCTIONS pkg_setup pkg_postinst pkg_prerm pkg_postrm |
38 |
@@ -37,9 +38,18 @@ |
39 |
} |
40 |
|
41 |
java-vm-2_pkg_postinst() { |
42 |
- # Set the generation-2 system VM, if it isn't set |
43 |
- if [[ -z "$(java-config-2 -f)" ]]; then |
44 |
+ # Set the generation-2 system VM, if it isn't set or the setting is invalid |
45 |
+ # Note that we cannot rely on java-config here, as it will silently recognize |
46 |
+ # e.g. icedtea6-bin as valid system VM if icedtea6 is set but invalid (e.g. due |
47 |
+ # to the migration to icedtea-6) |
48 |
+ if [[ ! -L "${JAVA_VM_SYSTEM}" ]]; then |
49 |
java_set_default_vm_ |
50 |
+ else |
51 |
+ local current_vm_path="$(readlink "${JAVA_VM_SYSTEM}")" |
52 |
+ local current_vm="$(basename "${current_vm_path}")" |
53 |
+ if [[ ! -L "${JAVA_VM_DIR}/${current_vm}" ]]; then |
54 |
+ java_set_default_vm_ |
55 |
+ fi |
56 |
fi |
57 |
|
58 |
java-vm_check-nsplugin |
59 |
@@ -85,7 +95,8 @@ |
60 |
} |
61 |
|
62 |
java-vm-2_pkg_prerm() { |
63 |
- if [[ "$(java-config -f 2>/dev/null)" == "${VMHANDLE}" ]]; then |
64 |
+ # Although REPLACED_BY_VERSION is EAPI=4, we shouldn't need to check EAPI for this use case |
65 |
+ if [[ "$(java-config -f 2>/dev/null)" == "${VMHANDLE}" && -z "${REPLACED_BY_VERSION}" ]]; then |
66 |
ewarn "It appears you are removing your system-vm!" |
67 |
ewarn "Please run java-config -L to list available VMs," |
68 |
ewarn "then use java-config -S to set a new system-vm!" |