String versionLine = Iterables.find(LINE_SPLITTER.split(text), Predicates2.contains("CentOS"));
Matcher matcher = Pattern.compile("release\\s+([^\\s]+)").matcher(versionLine);
if (!matcher.find()) {
throw new ValidationException("could not parse OS version: " + versionLine);
}
version = Versions.VERSION_SCHEME.parseVersion(matcher.group(1));
} else if (text.contains("Ubuntu")) {
flavour = UnixFlavour.UBUNTU;
subFlavour = UnixSubFlavour.UBUNTU;
Matcher matcher = Pattern.compile("Ubuntu\\s+(\\d+\\.\\d+)").matcher(text);
if (!matcher.find()) {
throw new ValidationException("could not parse OS version: " + text);
}
version = Versions.VERSION_SCHEME.parseVersion(matcher.group(1));
} else {
throw new UnsupportedOperationException("todo support: " + text);