mirror of
https://github.com/unraid/webgui.git
synced 2026-01-01 15:10:19 -06:00
Add initial display page.
This commit is contained in:
68
emhttp/plugins/dynamix/SysDrivers.page
Normal file
68
emhttp/plugins/dynamix/SysDrivers.page
Normal file
@@ -0,0 +1,68 @@
|
||||
Menu="UNRAID-OS"
|
||||
Title="System Modules/Drivers"
|
||||
Icon="fa-sitemap"
|
||||
Tag="server"
|
||||
---
|
||||
<?PHP
|
||||
/* Copyright 2005-2023, Lime Technology
|
||||
* Copyright 2012-2023, Bergware International.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*/
|
||||
|
||||
$select = [];
|
||||
|
||||
|
||||
$select[] = mk_option(1,"conf",'Modprobe.d conf only');
|
||||
$select[] = mk_option(0,"inuse",'Inuse');
|
||||
$select[] = mk_option(0,"all",'All');
|
||||
#var_dump($select[]) ;
|
||||
?>
|
||||
<style>
|
||||
table.pre{margin-top:0;background:transparent}
|
||||
table.pre td:first-child{width:144px}
|
||||
table tr td{padding:0 0 3px 0;margin:0}
|
||||
table tr td.thin{line-height:8px;height:8px}
|
||||
</style>
|
||||
<script>
|
||||
$(function(){
|
||||
$('#t1').load('/webGui/include/SysDrivers.php',{table:'t1',option:"inuse"});
|
||||
});
|
||||
function applyCfg() {
|
||||
var message = "_(System Devices)_: _(A reboot is required to apply changes)_";
|
||||
var string = "BIND=";
|
||||
var elements = document.getElementById("vfiopci").elements;
|
||||
for (var i = 0, element; element = elements[i++];) {
|
||||
if (element.type === "checkbox" && element.checked === true)
|
||||
string = string + element.value + " ";
|
||||
}
|
||||
string = string.trim();
|
||||
if (string === "BIND=") {
|
||||
string = "";
|
||||
}
|
||||
$.get( "/plugins/dynamix/include/update.vfio-pci-cfg.php", { cfg: string } )
|
||||
.done(function(d) {
|
||||
if (d==1) {
|
||||
addRebootNotice(message);
|
||||
document.getElementById("warning").innerHTML = "<b>_(ALERT)_: _(Changes saved)_. _(Reboot to take effect)_.</b>";
|
||||
} else {
|
||||
removeRebootNotice(message);
|
||||
document.getElementById("warning").innerHTML = "<b>_(No changes)_.</b>";
|
||||
}
|
||||
$("#applycfg").attr("disabled",true);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
//$('.tabs').append("<span class='status'><span class='lite label'>_(Select View)_:</span><select onchange='showLog(this.value)'><option value='inuse' selected>Inuse Drivers</option><option value='all' >All Drivers</option><option value='confonly'>Modprode Configs Only</option></select><? mk_option(1,"All",'syslog');?>");
|
||||
</script>
|
||||
|
||||
<pre><form id="vfiopci" class="js-confirm-leave" onsubmit="return false"><table id='t1' class='pre'><tr><td><div class="spinner"></div></td></tr></table></form></pre><br>
|
||||
|
||||
|
||||
114
emhttp/plugins/dynamix/include/SysDrivers.php
Normal file
114
emhttp/plugins/dynamix/include/SysDrivers.php
Normal file
@@ -0,0 +1,114 @@
|
||||
<?PHP
|
||||
/* Copyright 2005-2023, Lime Technology
|
||||
* Copyright 2012-2023, Bergware International.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*/
|
||||
?>
|
||||
<?
|
||||
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
|
||||
// add translations
|
||||
$_SERVER['REQUEST_URI'] = 'tools';
|
||||
require_once "$docroot/webGui/include/Translations.php";
|
||||
require_once "$docroot/webGui/include/Helpers.php";
|
||||
|
||||
switch ($_POST['table']) {
|
||||
case 't1':
|
||||
$option = $_POST['option'] ;
|
||||
$select = $_POST['select'] ;
|
||||
#$procmodules = file_get_contents("/proc/modules") ;
|
||||
#$procmodules = shell_exec('find /lib/modules/$(uname -r) -type f -not -path "/lib/modules/$(uname -r)/source/*" -not -path "/lib/modules/$(uname -r)/build/*" -name "*ko*" ') ;
|
||||
$procmodules = shell_exec('find /lib/modules/$(uname -r)/kernel/drivers/ -type f -not -path "/lib/modules/$(uname -r)/source/*" -not -path "/lib/modules/$(uname -r)/build/*" -name "*ko*" ') ;
|
||||
$procmodules = explode(PHP_EOL,$procmodules) ;
|
||||
$option = $_POST['option'] ;
|
||||
|
||||
$kernel = shell_exec("uname -r") ;
|
||||
$kernel = trim($kernel,"\n") ;
|
||||
foreach($procmodules as $line) {
|
||||
if ($line == "") continue ;
|
||||
$modprobe = "" ;
|
||||
$name = $line ;
|
||||
$modname = trim(shell_exec("modinfo $name"),"\n") ;
|
||||
$output=null ;
|
||||
exec("modinfo $name",$output,$error) ;
|
||||
$parms = array() ;
|
||||
foreach($output as $outline) {
|
||||
$data = explode(":",$outline) ;
|
||||
switch ($data[0])
|
||||
{
|
||||
case "name":
|
||||
$modname = trim($data[1]) ;
|
||||
break ;
|
||||
case "depends":
|
||||
$depends = trim($data[1]) ;
|
||||
break ;
|
||||
case "filename":
|
||||
$file = trim($data[1]) ;
|
||||
break ;
|
||||
case "description":
|
||||
$desc = trim($data[1]) ;
|
||||
break ;
|
||||
case "parm":
|
||||
$parms[] = trim(str_replace("parm:","",$outline)) ;
|
||||
break ;
|
||||
case "alias":
|
||||
case "author":
|
||||
case "firmware":
|
||||
case "intree":
|
||||
case "vermagic":
|
||||
case "retpoline":
|
||||
case "import_ns":
|
||||
case "license":
|
||||
break ;
|
||||
default:
|
||||
$parms[] = trim($outline) ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
$state = "Enabled" ;
|
||||
if (is_file("/boot/config/modprobe.d/$modname.conf")) {
|
||||
$modprobe = explode(PHP_EOL,file_get_contents("/boot/config/modprobe.d/$modname.conf")) ;
|
||||
$state = array_search("blacklist",$modprobe);
|
||||
if($state) {$state = "Disabled" ;}
|
||||
else $state="Custom" ;
|
||||
} else if($option == "conf") continue ;
|
||||
|
||||
$type = pathinfo($file) ;
|
||||
$dir = $type['dirname'] ;
|
||||
$dir = str_replace("/lib/modules/$kernel/kernel/drivers/", "" ,$dir) ;
|
||||
$dir = str_replace("/lib/modules/$kernel/kernel/", "" ,$dir) ;
|
||||
$arrModules[$modname] = [
|
||||
'modname' => $modname,
|
||||
'dependacy' => $depends,
|
||||
'parms' => $parms,
|
||||
'file' => $file,
|
||||
'modprobe' => $modprobe,
|
||||
'state' => $state,
|
||||
'type' => $dir,
|
||||
'description' => substr($desc , 0 ,60) ,
|
||||
] ;
|
||||
}
|
||||
echo "<tr><td>"._("Module/Driver")."</td><td>"._("Description")."</td><td>"._("State")."</td><td>"._("Type")."</td><td>"._("Modeprobe.d config file")."</td></tr>";
|
||||
|
||||
if (is_array($arrModules)) ksort($arrModules) ;
|
||||
foreach($arrModules as $modname => $module)
|
||||
{
|
||||
echo "<tr><td>$modname</td><td>{$module['description']}</td><td>{$module['state']}</td><td>{$module['type']}</td>";
|
||||
if (is_array($module["modprobe"])) {
|
||||
$i = 0 ;
|
||||
foreach($module["modprobe"] as $line) {
|
||||
if ($i) echo "<tr><td></td><td></td><td></td><td></td><td>$line</td></tr>" ; else echo "<td>$line</td></tr>" ;
|
||||
$i++ ;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user