Changeset 10166 in josm for trunk/src/org/openstreetmap/josm/tools
- Timestamp:
- 2016-04-29T15:50:47+02:00 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/PlatformHookUnixoid.java
r10003 r10166 112 112 @Override 113 113 public void startupHook() { 114 if (isDebianOrUbuntu()) { 115 // Invite users to install Java 8 if they are still with Java 7 and using a compatible distrib (Debian >= 8 or Ubuntu >= 15.10) 116 String java = System.getProperty("java.version"); 117 String os = getOSDescription(); 118 if (java != null && java.startsWith("1.7") && os != null && ( 119 os.startsWith("Linux Debian GNU/Linux 8") || os.matches("^Linux Ubuntu 1[567].*"))) { 120 String url; 121 // apturl does not exist on Debian (see #8465) 122 if (os.startsWith("Linux Debian")) { 123 url = "https://packages.debian.org/jessie-backports/openjdk-8-jre"; 124 } else if (getPackageDetails("apturl") != null) { 125 url = "apt://openjdk-8-jre"; 126 } else { 127 url = "http://packages.ubuntu.com/xenial/openjdk-8-jre"; 128 } 129 askUpdateJava(java, url); 130 } 131 } 114 132 } 115 133 … … 179 197 public boolean rename(File from, File to) { 180 198 return from.renameTo(to); 199 } 200 201 /** 202 * Determines if the distribution is Debian or Ubuntu, or a derivative. 203 * @return {@code true} if the distribution is Debian, Ubuntu or Mint, {@code false} otherwise 204 */ 205 public static boolean isDebianOrUbuntu() { 206 try { 207 String dist = Utils.execOutput(Arrays.asList("lsb_release", "-i", "-s")); 208 return "Debian".equalsIgnoreCase(dist) || "Ubuntu".equalsIgnoreCase(dist) || "Mint".equalsIgnoreCase(dist); 209 } catch (IOException e) { 210 Main.warn(e); 211 return false; 212 } 181 213 } 182 214
Note:
See TracChangeset
for help on using the changeset viewer.