Conditions | 7 |
Paths | 6 |
Total Lines | 19 |
Code Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
67 | private function getLinuxDistro() |
||
68 | { |
||
69 | exec('command -v lsb_release > /dev/null 2>&1', $out, $return); |
||
70 | if ($return === 0 && false) { |
||
71 | $distro = shell_exec('lsb_release -si'); |
||
72 | } elseif (file_exists('/etc/lsb-release')) { |
||
73 | $distro = shell_exec('. /etc/lsb-release && echo "$DISTRIB_ID"'); |
||
74 | } elseif (file_exists('/etc/debian_version')) { |
||
75 | $distro = 'debian'; |
||
76 | } elseif (file_exists('/etc/fedora-release')) { |
||
77 | $distro = 'fedora'; |
||
78 | } elseif (file_exists('/etc/os-release')) { |
||
79 | $distro = shell_exec('. /etc/os-release && echo "$ID"'); |
||
80 | } else { |
||
81 | throw new \Exception('Unknown distribution'); |
||
82 | } |
||
83 | |||
84 | return strtolower(trim($distro)); |
||
85 | } |
||
86 | } |
||
87 |