diff --git a/install/dist/conf/centos52.conf.php b/install/dist/conf/centos52.conf.php deleted file mode 100644 index c738b7ff618d5cfafe37cc2f58ee963661f2aeae..0000000000000000000000000000000000000000 --- a/install/dist/conf/centos52.conf.php +++ /dev/null @@ -1,209 +0,0 @@ - diff --git a/install/dist/conf/centos53.conf.php b/install/dist/conf/centos53.conf.php deleted file mode 100644 index c738b7ff618d5cfafe37cc2f58ee963661f2aeae..0000000000000000000000000000000000000000 --- a/install/dist/conf/centos53.conf.php +++ /dev/null @@ -1,209 +0,0 @@ - diff --git a/install/dist/conf/opensuse110.conf.php b/install/dist/conf/opensuse110.conf.php deleted file mode 100644 index eaf7763bba7b19c54f019d2a9dcd470edb9c0630..0000000000000000000000000000000000000000 --- a/install/dist/conf/opensuse110.conf.php +++ /dev/null @@ -1,209 +0,0 @@ - diff --git a/install/dist/lib/centos52.lib.php b/install/dist/lib/centos52.lib.php deleted file mode 100644 index 2cec3447b58059d38e3cfadb905e9c3a882e8075..0000000000000000000000000000000000000000 --- a/install/dist/lib/centos52.lib.php +++ /dev/null @@ -1,40 +0,0 @@ - diff --git a/install/dist/lib/centos53.lib.php b/install/dist/lib/centos53.lib.php deleted file mode 100644 index b7f45bcfb375b86fbe0b58aa3c81176f4bd2d83d..0000000000000000000000000000000000000000 --- a/install/dist/lib/centos53.lib.php +++ /dev/null @@ -1,40 +0,0 @@ - diff --git a/install/dist/lib/opensuse110.lib.php b/install/dist/lib/opensuse110.lib.php deleted file mode 100644 index aeda9b9fd1c6b83d7388fc91bde429a6e4dd5b81..0000000000000000000000000000000000000000 --- a/install/dist/lib/opensuse110.lib.php +++ /dev/null @@ -1,36 +0,0 @@ - diff --git a/install/install.php b/install/install.php index d5578b932e658ff173798d3162521c6b9d0a5949..251de72ad822e3d2ded562762bb0ee177f1c0854 100644 --- a/install/install.php +++ b/install/install.php @@ -106,6 +106,7 @@ if(is_installed('amavisd-new') && !is_installed('patch')) die('The patch command $dist = get_distname(); if($dist['id'] == '') die('Linux distribution or version not recognized.'); +if(!is_supported_dist($dist)) die('This distribution is not supported.'); //** Include the autoinstaller configuration (for non-interactive setups) error_reporting(E_ALL ^ E_NOTICE); diff --git a/install/lib/install.lib.php b/install/lib/install.lib.php index cb31fb28e62269572da9d81e1946922adc1f7deb..8dfe130f7f7a73550434bb344ce001317f7ff420 100644 --- a/install/lib/install.lib.php +++ b/install/lib/install.lib.php @@ -34,6 +34,44 @@ $FILE = realpath('../install.php'); require_once realpath(dirname(__FILE__)) . '/classes/libbashcolor.inc.php'; +function is_supported_dist($dist) { + $name = $dist['name']; + $version = $dist['version']; + + $min_version = false; + if($name === 'Ubuntu') { + $tmp = explode(" ", $version); + $version = reset($tmp); // Dist name is appended on get_distname + $min_version = '16.04'; + $add_versions = array('Testing', 'Unknown'); + } elseif($name === 'Debian') { + $min_version = '8'; + $add_versions = array('Testing', 'Unknown'); + } elseif($name === 'Devuan') { + $min_version = '1.0'; + $add_versions = array('Jessie', 'Ceres'); + } elseif($name === 'openSUSE') { + $min_version = '11.2'; + $add_versions = false; + } elseif($name === 'Fedora') { + $min_version = '11'; + $add_versions = array('Unknown'); + } elseif($name === 'CentOS') { + $min_version = '7.0'; + $add_versions = array('Unknown'); + } elseif($name === 'Gentoo') { + $min_version = '1.0'; + } + + if($version && $min_version && preg_match('/^[0-9]+/', $version)) { + if(version_compare($version, $min_version, '>=')) return true; + } elseif($version && !preg_match('/^[0-9]+/', $version) && !empty($add_versions)) { + if(in_array($version, $add_versions, true)) return true; + } + + return false; +} + //** Get distribution identifier //** IMPORTANT! // This is the same code as in server/lib/classes/monitor_tools.inc.php @@ -347,6 +385,7 @@ function get_distname() { $var=explode(" ", $content); $var=explode(".", $var[3]); $var=$var[0].".".$var[1]; + $distver = $var; if($var=='7.0' || $var=='7.1') { $distid = 'centos70'; } else { diff --git a/install/update.php b/install/update.php index f621e7bd9feb0613869f73deda831a65705b8fb2..24337fbe0281e4730f860956173fc2c866394fb3 100644 --- a/install/update.php +++ b/install/update.php @@ -109,6 +109,7 @@ $conf_old = $conf; unset($conf); if($dist['id'] == '') die('Linux distribution or version not recognized.'); +if(!is_supported_dist($dist)) die('This distribution is not supported.'); //** Include the autoinstaller configuration (for non-interactive setups) error_reporting(E_ALL ^ E_NOTICE);