Files
pi-control/install/resources/library/main/rpi.function.php
Gregor Schulte b303dd00d6 Init Repo
2021-06-17 12:24:22 +02:00

28 lines
595 B
PHP

<?php
if (!defined('PICONTROL')) exit();
function rpi_getRuntime()
{
$runtime = trim(@shell_exec('cat /proc/uptime | awk -F \'.\' \'{print $1}\''));
return $runtime;
}
function rpi_getDistribution()
{
$distribution = trim(@shell_exec('cat /etc/issue | cut -d " " -f 1-3'));
if ($distribution == '')
{
$distributionString = @shell_exec('cat /etc/*-release | grep PRETTY_NAME');
preg_match('/.*="([\w\s\d\/]*).*"/i', $distributionString, $match);
if (count($match) == 2)
$distribution = trim($match[1]);
else
$distribution = 'Unknown';
}
return $distribution;
}
?>