Use equivalent code using stat.
On CentOS this should detect /etc/redhat-release symlink.
---
src/dpkg.ml | 2 +-
src/pacman.ml | 2 +-
src/rpm.ml | 9 ++++++---
3 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/src/dpkg.ml b/src/dpkg.ml
index f96105f..1bb3f7f 100644
--- a/src/dpkg.ml
+++ b/src/dpkg.ml
@@ -28,7 +28,7 @@ let dpkg_detect () =
Config.dpkg_query <> "no" &&
Config.dpkg_divert <> "no" &&
Config.apt_get <> "no" &&
- file_exists "/etc/debian_version"
+ 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 6393cfa..e411816 100644
--- a/src/pacman.ml
+++ b/src/pacman.ml
@@ -24,7 +24,7 @@ open Package_handler
let pacman_detect () =
Config.pacman <> "no" && Config.fakeroot <>
"no" &&
- file_exists "/etc/arch-release" &&
+ (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 80c38d6..b08c60c 100644
--- a/src/rpm.ml
+++ b/src/rpm.ml
@@ -25,18 +25,21 @@ open Package_handler
let fedora_detect () =
Config.rpm <> "no" && Config.rpm2cpio <> "no"
&&
Config.yumdownloader <> "no" &&
- (file_exists "/etc/redhat-release" || file_exists
"/etc/fedora-release")
+ 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"
&&
Config.zypper <> "no" &&
- file_exists "/etc/SuSE-release"
+ try (stat "/etc/SuSE-release").st_kind = S_REG with Unix_error _ ->
false
let mageia_detect () =
Config.rpm <> "no" && Config.rpm2cpio <> "no"
&&
Config.urpmi <> "no" &&
Config.fakeroot <> "no" &&
- file_exists "/etc/mageia-release"
+ try (stat "/etc/mageia-release").st_kind = S_REG with Unix_error _ ->
false
let settings = ref no_settings
let rpm_major, rpm_minor = ref 0, ref 0
--
1.8.5.3