Add Linux Distribution detection functions to SysUtils
package org.openecard.common.util;
+import java.io.File;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -52,6 +53,22 @@ public class SysUtils {
return os.contains("nux") || os.contains("nix") || os.contains("aix");
}
+ public static boolean isDebianOrDerivate() {
+ return new File("/etc/debian_version").exists();
+ }
+
+ public static boolean isRedhatOrDerivate() {
+ return new File("/etc/redhat-release").exists();
+ }
+
+ public static boolean isArchLinuxOrDerivate() {
+ return new File("/etc/arch-release").exists();
+ }
+
+ public static boolean isSuSEOrDerivate() {
+ return new File("/etc/SuSE-release").exists();
+ }
+
private static final Pattern CURLY_VAR_ENV = Pattern.compile("(\\\\)?(\\$\\{([A-Za-z0-9_]+)\\})");
private static final Pattern PLAIN_VAR_ENV = Pattern.compile("(\\\\)?(\\$([A-Za-z0-9_]+))");
