On Wed, 2016-08-31 at 15:05 +0200, Pino Toscano wrote:
Check the ID field in /etc/os-release on the current system, before
checking for the other old-style release-/version-like files in /etc.
Some distributions (openSUSE Thumbleweed) are starting to remove them,
breaking the supermin detection.
---
src/dpkg.ml | 3 ++-
src/pacman.ml | 5 +++--
src/rpm.ml | 15 +++++++++------
3 files changed, 14 insertions(+), 9 deletions(-)
diff --git a/src/dpkg.ml b/src/dpkg.ml
index 70acfa2..1e785de 100644
--- a/src/dpkg.ml
+++ b/src/dpkg.ml
@@ -28,7 +28,8 @@ let dpkg_detect () =
Config.dpkg_query <> "no" &&
Config.dpkg_divert <> "no" &&
Config.apt_get <> "no" &&
- try (stat "/etc/debian_version").st_kind = S_REG with Unix_error _ ->
false
+ (List.mem (Os_release.get_id ()) [ "debian"; "ubuntu" ] ||
+ try (stat "/etc/debian_version").st_kind = S_REG with Unix_error _ ->
false)
let dpkg_primary_arch = ref ""
let settings = ref no_settings
diff --git a/src/pacman.ml b/src/pacman.ml
index 3340fa6..c35668a 100644
--- a/src/pacman.ml
+++ b/src/pacman.ml
@@ -24,8 +24,9 @@ open Package_handler
let pacman_detect () =
Config.pacman <> "no" && Config.fakeroot <>
"no" &&
- (stat "/etc/arch-release").st_kind = S_REG &&
- Config.pacman_g2 = "no" (* not Frugalware with pacman-g2 *)
+ (Os_release.get_id () = "arch" ||
+ ((stat "/etc/arch-release").st_kind = S_REG &&
+ Config.pacman_g2 = "no")) (* not Frugalware with pacman-g2 *)
let settings = ref no_settings
diff --git a/src/rpm.ml b/src/rpm.ml
index a5dc67a..e409e37 100644
--- a/src/rpm.ml
+++ b/src/rpm.ml
@@ -31,21 +31,24 @@ let stringset_of_list pkgs =
let fedora_detect () =
Config.rpm <> "no" && Config.rpm2cpio <> "no"
&& rpm_is_available () &&
(Config.yumdownloader <> "no" || Config.dnf <> "no")
&&
- try
- (stat "/etc/redhat-release").st_kind = S_REG ||
- (stat "/etc/fedora-release").st_kind = S_REG
- with Unix_error _ -> false
+ (List.mem (Os_release.get_id ()) [ "fedora"; "rhel";
"centos" ] ||
+ try
+ (stat "/etc/redhat-release").st_kind = S_REG ||
+ (stat "/etc/fedora-release").st_kind = S_REG
+ with Unix_error _ -> false)
let opensuse_detect () =
Config.rpm <> "no" && Config.rpm2cpio <> "no"
&& rpm_is_available () &&
Config.zypper <> "no" &&
- try (stat "/etc/SuSE-release").st_kind = S_REG with Unix_error _ ->
false
+ (List.mem (Os_release.get_id ()) [ "opensuse"; "sled";
"sles" ] ||
+ try (stat "/etc/SuSE-release").st_kind = S_REG with Unix_error _ ->
false)
let mageia_detect () =
Config.rpm <> "no" && Config.rpm2cpio <> "no"
&& rpm_is_available () &&
Config.urpmi <> "no" &&
Config.fakeroot <> "no" &&
- try (stat "/etc/mageia-release").st_kind = S_REG with Unix_error _ ->
false
+ (Os_release.get_id () = "mageia" ||
+ try (stat "/etc/mageia-release").st_kind = S_REG with Unix_error _ ->
false)
let ibm_powerkvm_detect () =
Config.rpm <> "no" && Config.rpm2cpio <> "no"
&& rpm_is_available () &&
Looks good to me, at least for the openSUSE / SLE parts.
--
Cedric