Newer
Older
tbrehm
committed
<?php
/*
Copyright (c) 2007, Till Brehm, projektfarm Gmbh
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of ISPConfig nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
tbrehm
committed
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
error_reporting(E_ALL|E_STRICT);
if(version_compare(phpversion(), '7.0', '<')) {
require_once 'compatibility.inc.php';
}
$FILE = realpath('../install.php');
// This is the same code as in server/lib/classes/monitor_tools.inc.php
jwarnier
committed
// So if you change it here, you also have to change it in there!
Till Brehm
committed
//
// This function returns a string that describes the installed
// Linux distribution. e.g. debian40 for Debian GNU/Linux 4.0
tbrehm
committed
function get_distname() {
$distver = '';
$distid = '';
$distbaseid = '';
Till Brehm
committed
//** Debian or Ubuntu
if(file_exists('/etc/debian_version')) {
// Check if this is Ubuntu and not Debian
if (strstr(trim(file_get_contents('/etc/issue')), 'Ubuntu') || (is_file('/etc/os-release') && stristr(file_get_contents('/etc/os-release'), 'Ubuntu'))) {
$issue = file_get_contents('/etc/issue');
// Use content of /etc/issue file
if(strstr($issue,'Ubuntu')) {
if (strstr(trim($issue), 'LTS')) {
$lts=" LTS";
} else {
$lts="";
}
$distname = 'Ubuntu';
$distid = 'debian40';
$distbaseid = 'debian';
$ver = explode(' ', $issue);
$ver = array_filter($ver);
$ver = next($ver);
$mainver = explode('.', $ver);
$mainver = array_filter($mainver);
$mainver = current($mainver).'.'.next($mainver);
// Use content of /etc/os-release file
Till Brehm
committed
$os_release = file_get_contents('/etc/os-release');
if (strstr(trim($os_release), 'LTS')) {
$lts = " LTS";
} else {
$lts = "";
}
$distname = 'Ubuntu';
$distid = 'debian40';
$distbaseid = 'debian';
preg_match("/.*VERSION=\"(.*)\".*/ui", $os_release, $ver);
$ver = str_replace("LTS", "", $ver[1]);
$ver = explode(" ", $ver, 2);
$ver = reset($ver);
$mainver = $ver;
$mainver = explode('.', $ver);
$mainver = array_filter($mainver);
$mainver = current($mainver).'.'.next($mainver);
case "22.04":
$relname = "(Jammy Jellyfish)";
$distconfid = 'ubuntu2204';
break;
case "20.04":
$relname = "(Focal Fossa)";
$distconfid = 'ubuntu2004';
break;
case "18.04":
$relname = "(Bionic Beaver)";
$distconfid = 'ubuntu1804';
break;
case "17.10":
$relname = "(Artful Aardvark)";
$distconfid = 'ubuntu1710';
break;
case "17.04":
$relname = "(Zesty Zapus)";
$distconfid = 'ubuntu1604';
break;
case "16.10":
$relname = "(Yakkety Yak)";
$distconfid = 'ubuntu1604';
break;
case "16.04":
$relname = "(Xenial Xerus)";
Till Brehm
committed
$distconfid = 'ubuntu1604';
case "15.10":
$relname = "(Wily Werewolf)";
break;
case "15.04":
$relname = "(Vivid Vervet)";
break;
case "14.10":
$relname = "(Utopic Unicorn)";
break;
case "14.04":
$relname = "(Trusty Tahr)";
break;
case "13.10":
$relname = "(Saucy Salamander)";
break;
case "13.04":
$relname = "(Raring Ringtail)";
break;
case "12.10":
$relname = "(Quantal Quetzal)";
case "12.04":
$relname = "(Precise Pangolin)";
case "11.10":
$relname = "(Oneiric Ocelot)";
case "11.14":
$relname = "(Natty Narwhal)";
case "10.10":
$relname = "(Maverick Meerkat)";
case "10.04":
$relname = "(Lucid Lynx)";
case "9.10":
$relname = "(Karmic Koala)";
case "9.04":
$relname = "(Jaunty Jackpole)";
case "8.04":
$relname = "(Hardy Heron)";
case "7.10":
$relname = "(Gutsy Gibbon)";
case "7.04":
$relname = "(Feisty Fawn)";
case "6.10":
$relname = "(Edgy Eft)";
case "6.06":
$relname = "(Dapper Drake)";
case "5.10":
$relname = "(Breezy Badger)";
case "5.04":
$relname = "(Hoary Hedgehog)";
case "4.10":
$relname = "(Warty Warthog)";
default:
$relname = "UNKNOWN";
Loading full blame...