Index: src/lib/com/izforge/izpack/panels/SudoPanel.java
===================================================================
--- src/lib/com/izforge/izpack/panels/SudoPanel.java (revision 1139)
+++ src/lib/com/izforge/izpack/panels/SudoPanel.java (working copy)
@@ -155,7 +155,7 @@
vars.put("password", pass);
List oses = new ArrayList();
- oses.add(new OsConstraint("unix", null, null, null));
+ oses.add(new OsConstraint("unix", null, null, null, null));
ArrayList plist = new ArrayList();
ParsableFile pf = new ParsableFile(file.getAbsolutePath(), null, null, oses);
Index: src/lib/com/izforge/izpack/util/OsConstraint.java
===================================================================
--- src/lib/com/izforge/izpack/util/OsConstraint.java (revision 1139)
+++ src/lib/com/izforge/izpack/util/OsConstraint.java (working copy)
@@ -55,6 +55,9 @@
/** OS architecture from java system properties */
private String arch;
+
+ /** OS release */
+ private String release;
/**
* Constructs a new instance. Please remember, MacOSX belongs to Unix family.
@@ -63,13 +66,15 @@
* @param name The exact OS name.
* @param version The exact OS version (check property os.version
for values).
* @param arch The machine architecture (check property os.arch
for values).
+ * @param release The release information found from OsVersion.getOsDetails()
*/
- public OsConstraint(String family, String name, String version, String arch)
+ public OsConstraint(String family, String name, String version, String arch, String release)
{
this.family = family != null ? family.toLowerCase() : null;
this.name = name != null ? name.toLowerCase() : null;
this.version = version != null ? version.toLowerCase() : null;
this.arch = arch != null ? arch.toLowerCase() : null;
+ this.release = release != null ? release.toLowerCase() : null;
}
/**
@@ -81,15 +86,22 @@
{
boolean match = true;
String osName = System.getProperty("os.name").toLowerCase();
-
+
if (arch != null && arch.length() != 0)
{
match = System.getProperty("os.arch").toLowerCase().equals(arch);
}
if (match && version != null && version.length() != 0)
{
- match = System.getProperty("os.version").toLowerCase().equals(version);
+ match = System.getProperty("os.version").toLowerCase().equals(version);
}
+ if (match && release != null && release.length() != 0)
+ {
+ if(OsVersion.getOsDetails() != null)
+ {
+ match = OsVersion.getOsDetails().toLowerCase().contains(release);
+ }
+ }
if (match && name != null && name.length() != 0)
{
match = osName.equals(name);
@@ -110,7 +122,7 @@
}
}
- return match && (family != null || name != null || version != null || arch != null);
+ return match && (family != null || name != null || version != null || arch != null || release != null);
}
/**
@@ -128,7 +140,7 @@
{
XMLElement os = (XMLElement) osIterator.next();
osList.add(new OsConstraint(os.getAttribute("family", null), os.getAttribute("name",
- null), os.getAttribute("version", null), os.getAttribute("arch", null)));
+ null), os.getAttribute("version", null), os.getAttribute("arch", null), os.getAttribute("release", null)));
}
// backward compatibility: still support os attribute
@@ -136,7 +148,7 @@
if (osattr != null && osattr.length() > 0)
{
// add the "os" attribute as a family constraint
- osList.add(new OsConstraint(osattr, null, null, null));
+ osList.add(new OsConstraint(osattr, null, null, null, null));
}
return osList;