$modname| {$module['description']} | {$module['state']} | {$module['type']} | ";
+ echo "| $modname | {$module['description']} | {$module['state']} | {$module['type']} | ";
$text = "" ;
if (is_array($module["modprobe"])) {
$text = implode("\n",$module["modprobe"]) ;
@@ -155,6 +156,10 @@ case "update":
$module = $_POST['module'] ;
if ($conf == "") $error = unlink("/boot/config/modprobe.d/$module.conf") ;
else $error = file_put_contents("/boot/config/modprobe.d/$module.conf",$conf) ;
- echo $error ;
+ getmodules($module) ;
+ $return = $arrModules[$module] ;
+ if (is_array($return["modprobe"]))$return["modprobe"] = implode("\n",$return["modprobe"]) ;
+ if ($error !== false) $return["error"] = false ; else $return["error"] = true ;
+ echo json_encode($return) ;
}
?>
From 8933d4e18de306cc4a1acaea0dbbeeb2fa4c29b1 Mon Sep 17 00:00:00 2001
From: SimonFair <39065407+SimonFair@users.noreply.github.com>
Date: Sat, 8 Jul 2023 13:38:28 +0100
Subject: [PATCH 09/40] New load methods
---
emhttp/plugins/dynamix/SysDrivers.page | 20 ++--
emhttp/plugins/dynamix/include/SysDrivers.php | 94 ++++++++++++++-----
2 files changed, 87 insertions(+), 27 deletions(-)
diff --git a/emhttp/plugins/dynamix/SysDrivers.page b/emhttp/plugins/dynamix/SysDrivers.page
index 9616ff0ee..dae33c7fe 100644
--- a/emhttp/plugins/dynamix/SysDrivers.page
+++ b/emhttp/plugins/dynamix/SysDrivers.page
@@ -45,22 +45,28 @@ table.t1 tr>td+td+td+td+td+td+td+td+td+td+td+td+td{text-align:left;}
-
+
diff --git a/emhttp/plugins/dynamix/include/SysDrivers.php b/emhttp/plugins/dynamix/include/SysDrivers.php
index ee72ebf70..614807a63 100644
--- a/emhttp/plugins/dynamix/include/SysDrivers.php
+++ b/emhttp/plugins/dynamix/include/SysDrivers.php
@@ -99,26 +99,26 @@ $arrModules[$modname] = [
switch ($_POST['table']) {
case 't1':
- $option = $_POST['option'] ;
- $select = $_POST['select'] ;
- $builtinmodules = file_get_contents("/lib/modules/$kernel/modules.builtin") ;
- $builtinmodules = explode(PHP_EOL,$builtinmodules) ;
- $procmodules =file_get_contents("/lib/modules/$kernel/modules.order") ;
- $procmodules = explode(PHP_EOL,$procmodules) ;
- $option = $_POST['option'] ;
- $arrModules = array() ;
-
- foreach($builtinmodules as $bultin)
- {
- if ($bultin == "") continue ;
- getmodules(pathinfo($bultin)["filename"]) ;
- }
-
-foreach($procmodules as $line) {
- if ($line == "") continue ;
- getmodules(pathinfo($line)["filename"]) ;
-}
+ $option = $_POST['option'] ;
+ $select = $_POST['select'] ;
+ $builtinmodules = file_get_contents("/lib/modules/$kernel/modules.builtin") ;
+ $builtinmodules = explode(PHP_EOL,$builtinmodules) ;
+ $procmodules =file_get_contents("/lib/modules/$kernel/modules.order") ;
+ $procmodules = explode(PHP_EOL,$procmodules) ;
+ $arrModules = array() ;
+
+ foreach($builtinmodules as $bultin)
+ {
+ if ($bultin == "") continue ;
+ getmodules(pathinfo($bultin)["filename"]) ;
+ }
+
+ foreach($procmodules as $line) {
+ if ($line == "") continue ;
+ getmodules(pathinfo($line)["filename"]) ;
+ }
+
echo "| "._("Module/Driver")." | "._("Description")." | "._("State")." | "._("Type")." | "._("Modeprobe.d config file")." |
";
# echo "
| Total Number of drivers the system:".count($arrModules)." |
" ;
echo "" ;
@@ -139,8 +139,8 @@ foreach($procmodules as $line) {
break ;
}
#echo " $modname| {$module['description']} | {$module['state']} | {$module['type']} | ";
+ $status = _('loading').'...';
+ echo "| $modname | $status | $status | $status | ";
$text = "" ;
if (is_array($module["modprobe"])) {
$text = implode("\n",$module["modprobe"]) ;
@@ -151,6 +151,58 @@ foreach($procmodules as $line) {
echo "" ;
break;
+ case 't1update':
+ $option = $_POST['option'] ;
+ $select = $_POST['select'] ;
+ $builtinmodules = file_get_contents("/lib/modules/$kernel/modules.builtin") ;
+ $builtinmodules = explode(PHP_EOL,$builtinmodules) ;
+ $procmodules =file_get_contents("/lib/modules/$kernel/modules.order") ;
+ $procmodules = explode(PHP_EOL,$procmodules) ;
+ $arrModules = array() ;
+
+ foreach($builtinmodules as $bultin)
+ {
+ if ($bultin == "") continue ;
+ getmodules(pathinfo($bultin)["filename"]) ;
+ }
+
+ foreach($procmodules as $line) {
+ if ($line == "") continue ;
+ getmodules(pathinfo($line)["filename"]) ;
+ }
+
+ echo "| "._("Module/Driver")." | "._("Description")." | "._("State")." | "._("Type")." | "._("Modeprobe.d config file")." |
";
+ # echo "
| Total Number of drivers the system:".count($arrModules)." |
" ;
+ echo "" ;
+ if (is_array($arrModules)) ksort($arrModules) ;
+ foreach($arrModules as $modname => $module)
+ {
+
+ switch ($_POST['option']){
+ case "inuse":
+ if ($module['state'] == "Available" || $module['state'] == "(builtin)") continue(2) ;
+ break ;
+
+ case "confonly":
+ if ($module['modprobe'] == "" ) continue(2) ;
+ break ;
+
+ case "all":
+ break ;
+ }
+ #echo " $modname| {$module['description']} | {$module['state']} | {$module['type']} | ";
+ $text = "" ;
+ if (is_array($module["modprobe"])) {
+ $text = implode("\n",$module["modprobe"]) ;
+ echo " | ";
+ } else echo " | ";
+
+ }
+ echo "" ;
+ break;
+
case "update":
$conf = $_POST['conf'] ;
$module = $_POST['module'] ;
From aa93672c5958297a605e42d9d9156452fb72d437 Mon Sep 17 00:00:00 2001
From: SimonFair <39065407+SimonFair@users.noreply.github.com>
Date: Sat, 8 Jul 2023 20:14:22 +0100
Subject: [PATCH 10/40] Revert to original load model.
---
emhttp/plugins/dynamix/SysDrivers.page | 11 +++---
emhttp/plugins/dynamix/include/SysDrivers.php | 37 +++++++++++++++----
2 files changed, 34 insertions(+), 14 deletions(-)
diff --git a/emhttp/plugins/dynamix/SysDrivers.page b/emhttp/plugins/dynamix/SysDrivers.page
index dae33c7fe..e0dc52262 100644
--- a/emhttp/plugins/dynamix/SysDrivers.page
+++ b/emhttp/plugins/dynamix/SysDrivers.page
@@ -23,8 +23,8 @@ Tag="server"
?>
+
From e4e5c09b49e533c81dbdec441274f506744e86e2 Mon Sep 17 00:00:00 2001
From: SimonFair <39065407+SimonFair@users.noreply.github.com>
Date: Fri, 14 Jul 2023 17:58:13 +0100
Subject: [PATCH 18/40] Updates to selection and PHP updates.
---
emhttp/plugins/dynamix/SysDrivers.page | 20 +++---
emhttp/plugins/dynamix/include/SysDrivers.php | 72 ++++++++++++++++---
2 files changed, 74 insertions(+), 18 deletions(-)
diff --git a/emhttp/plugins/dynamix/SysDrivers.page b/emhttp/plugins/dynamix/SysDrivers.page
index 028b620d7..09d87956e 100644
--- a/emhttp/plugins/dynamix/SysDrivers.page
+++ b/emhttp/plugins/dynamix/SysDrivers.page
@@ -76,9 +76,6 @@ function showDrivers(options, init = false) {
});
$('div.spinner.fixed').hide('slow');
-
- $('#t1').trigger('search', [ filter ]);
- //showDriversupdate(options)
});
} else {
@@ -86,14 +83,17 @@ function showDrivers(options, init = false) {
if (option === "inuse") filter[3] = "Inuse|Custom|Disabled";
if (option === "all") filter[3] = "";
$('#t1').trigger('search', [ filter ]);
- };
+ }
}
function showDriversupdate(options) {
option = options ;
- $.post('/webGui/include/SysDrivers.php',{table:'t1update',option:option},function(data){
- $('#t1').html(data);
- });
+ filter = [];
+ if (option === "inuse") filter[3] = "Inuse|Custom|Disabled";
+ if (option === "all") filter[3] = "";
+
+ $('#t1').trigger('search', [ filter ]);
+
}
function textedit(module) {
@@ -128,9 +128,9 @@ function textsave(module) {
},"json");
}
-$('.tabs').append("_(Select View)_:");
-//select = document.getElementById("select").value;
-showDrivers("all",true),function() { sleep(1000);showDriver("inuse") ;} ;
+$('.tabs').append("_(Select View)_:");
+
+showDrivers("all",true) ;
diff --git a/emhttp/plugins/dynamix/include/SysDrivers.php b/emhttp/plugins/dynamix/include/SysDrivers.php
index 0f672f583..a891e538b 100644
--- a/emhttp/plugins/dynamix/include/SysDrivers.php
+++ b/emhttp/plugins/dynamix/include/SysDrivers.php
@@ -34,11 +34,13 @@ function getplugin($in) {
}
function getmodules($line) {
- global $arrModules,$lsmod,$kernel ;
+ global $arrModules,$lsmod,$kernel,$list ;
$modprobe = "" ;
+ $desc = $file = $pluginfile = $option = $filename = $depends = $supporturl = $dir = null ;
$name = $line ;
#echo $line ;
- $modname = trim(shell_exec("modinfo $name > /dev/null"),"\n") ;
+ $modname = shell_exec("modinfo $name > /dev/null") ;
+ if ($modname != null) $modname = trim($modname,"\n") ;
$output=null ;
exec("modinfo $name",$output,$error) ;
$parms = array() ;
@@ -79,11 +81,13 @@ function getmodules($line) {
break ;
}
}
-if (strpos($lsmod, $modname,0)) $state = "Inuse" ; else $state = "Available";
+if ($modname != null) if (strpos($lsmod, $modname,0)) $state = "Inuse" ; else $state = "Available";
if (is_file("/boot/config/modprobe.d/$modname.conf")) {
$modprobe = file_get_contents("/boot/config/modprobe.d/$modname.conf") ;
$state = strpos($modprobe, "blacklist");
$supportpos = strpos($modprobe, "#Plugin:");
+ if (isset($file[$modname])) { $supporturl = getplugin($file[$modname]) ; }
+ else {
if ($supportpos !== false) {
$support = true ;
$supportendpos = strpos($modprobe,"\n",$supportpos) ;
@@ -95,21 +99,26 @@ if (is_file("/boot/config/modprobe.d/$modname.conf")) {
$support = false ;
$plugin = "" ;
}
+}
$modprobe = explode(PHP_EOL,$modprobe) ;
if($state !== false) {$state = "Disabled" ;}
else $state="Custom" ;
} else if($option == "conf") return ;
if ($filename != "(builtin)") {
+if ($filename != null) {
$type = pathinfo($filename) ;
$dir = $type['dirname'] ;
+
$dir = str_replace("/lib/modules/$kernel/kernel/drivers/", "" ,$dir) ;
$dir = str_replace("/lib/modules/$kernel/kernel/", "" ,$dir) ;
+}
} else {
$dir = $file ;
$dir = str_replace("drivers/", "" ,$dir) ;
if ($state == "Inuse") $state= "(builtin) - Inuse"; else $state="(builtin)" ;
}
+if ($desc != null) $description = substr($desc , 0 ,60) ; else $description = null ;
$arrModules[$modname] = [
'modname' => $modname,
'dependacy' => $depends,
@@ -121,10 +130,46 @@ $arrModules[$modname] = [
'type' => $dir,
'support' => $support,
'supporturl' => $supporturl,
- 'description' => substr($desc , 0 ,60) ,
+ 'description' => $description ,
] ;
}
+function modtoplg() {
+ global $list ;
+ $rii = new RecursiveIteratorIterator(new RecursiveDirectoryIterator('/boot/config/plugins'));
+ $files = array();
+
+ /** @var SplFileInfo $file */
+ foreach ($rii as $file) {
+ if ($file->isDir()){
+ continue;
+ }
+ if ($file->getExtension() != "tgz" && $file->getExtension() != "txz") continue ;
+ $files[] = $file->getPathname();
+ }
+
+ #$list = getDirContents("/boot/config/plugins/") ;
+ $list =array() ;
+ foreach ($files as $f)
+ {
+ $plugin = str_replace("/boot/config/plugins/", "", $f) ;
+ $plugin = substr($plugin,0,strpos($plugin,'/') ) ;
+ exec("tar -tf $f | grep -E '.ko.xz|.ko' ",$tar) ;
+
+ #var_dump($plugin) ;
+ foreach ($tar as $t) {
+ $p = pathinfo($t) ;
+ $filename = str_replace(".ko","",$p["filename"]) ;
+ $list[$filename] = $plugin ;
+ }
+
+ }
+
+ file_put_contents("/tmp/modulestoplg",json_encode($list)) ;
+
+}
+
+#modtoplg() ;
switch ($_POST['table']) {
case 't1pre':
$option = $_POST['option'] ;
@@ -189,7 +234,7 @@ case 't1pre':
case 't1':
$option = $_POST['option'] ;
- $select = $_POST['select'] ;
+
$builtinmodules = file_get_contents("/lib/modules/$kernel/modules.builtin") ;
$builtinmodules = explode(PHP_EOL,$builtinmodules) ;
$procmodules =file_get_contents("/lib/modules/$kernel/modules.order") ;
@@ -206,9 +251,18 @@ case 't1pre':
if ($line == "") continue ;
getmodules(pathinfo($line)["filename"]) ;
}
-
- echo "| "._("Actions")." | "._("Module/Driver")." | "._("Description")." | "._("State")." | "._("Type")." | "._("Modeprobe.d config file")." |
";
+
+ $lsmod2 = explode(PHP_EOL,$lsmod) ;
+ foreach($lsmod2 as $line) {
+ if ($line == "") continue ;
+ $line2 = explode(" ",$line) ;
+ getmodules($line2['0']) ;
+ }
+
+ var_dump(count($arrModules)) ;
+ echo "| "._("Actions")." | "._("Module/Driver")." | "._("Description")." | "._("State")." | "._("Type")." | "._("Modeprobe.d config file")." |
";
echo "" ;
+
if (is_array($arrModules)) ksort($arrModules) ;
foreach($arrModules as $modname => $module)
{
@@ -246,6 +300,7 @@ case 't1pre':
}
echo "" ;
+
break;
case "update":
@@ -259,5 +314,6 @@ case "update":
if (is_array($return["modprobe"]))$return["modprobe"] = implode("\n",$return["modprobe"]) ;
if ($error !== false) $return["error"] = false ; else $return["error"] = true ;
echo json_encode($return) ;
-}
+ break ;
+}
?>
From 7d803ad7dbfa828da3d3c6952003b1b1f656799e Mon Sep 17 00:00:00 2001
From: SimonFair <39065407+SimonFair@users.noreply.github.com>
Date: Sat, 15 Jul 2023 09:44:16 +0100
Subject: [PATCH 19/40] Code Tidy
---
emhttp/plugins/dynamix/SysDrivers.page | 14 +-
emhttp/plugins/dynamix/include/SysDrivers.php | 243 ++++++------------
2 files changed, 89 insertions(+), 168 deletions(-)
diff --git a/emhttp/plugins/dynamix/SysDrivers.page b/emhttp/plugins/dynamix/SysDrivers.page
index 09d87956e..5d7b00976 100644
--- a/emhttp/plugins/dynamix/SysDrivers.page
+++ b/emhttp/plugins/dynamix/SysDrivers.page
@@ -54,7 +54,7 @@ table.t1 tr>td+td+td+td+td+td+td+td+td+td+td+td+td{text-align:left;}
function showDrivers(options, init = false) {
option = options ;
if (init) {
- $.post('/webGui/include/SysDrivers.php',{table:'t1',option:"all"},function(data){
+ $.post('/webGui/include/SysDrivers.php',{table:'t1load',option:"all"},function(data){
clearTimeout(timers.refresh);
filter = [];
filter[3] = "Inuse|Custom|Disabled";
@@ -86,14 +86,8 @@ function showDrivers(options, init = false) {
}
}
-function showDriversupdate(options) {
- option = options ;
- filter = [];
- if (option === "inuse") filter[3] = "Inuse|Custom|Disabled";
- if (option === "all") filter[3] = "";
-
- $('#t1').trigger('search', [ filter ]);
-
+function showDriversupdate() {
+ $.post('/webGui/include/SysDrivers.php',{table:'t1create',option:"all"}) ;
}
function textedit(module) {
@@ -123,6 +117,7 @@ function textsave(module) {
}
}
}
+ //showDriversupdate() ;
var message = "_(System Drivers)_: _(A reboot is required to apply changes)_";
addRebootNotice(message);
},"json");
@@ -131,6 +126,7 @@ function textsave(module) {
$('.tabs').append("_(Select View)_:");
showDrivers("all",true) ;
+showDriversupdate() ;
diff --git a/emhttp/plugins/dynamix/include/SysDrivers.php b/emhttp/plugins/dynamix/include/SysDrivers.php
index a891e538b..b175c355b 100644
--- a/emhttp/plugins/dynamix/include/SysDrivers.php
+++ b/emhttp/plugins/dynamix/include/SysDrivers.php
@@ -22,19 +22,18 @@ $kernel = shell_exec("uname -r") ;
$kernel = trim($kernel,"\n") ;
$lsmod = shell_exec("lsmod") ;
$supportpage = true;
+$arrModtoPlg = json_decode(file_get_contents("/tmp/modulestoplg.json") ,TRUE) ;
function getplugin($in) {
-
$plugins = "/var/log/plugins/";
$plugin_link = $plugins.$in ;
$plugin_file = @readlink($plugin_link);
$support = plugin('support',$plugin_file) ?: "";
- #$support = $support ? ""._('Support Thread')."" : "";
return($support) ;
}
function getmodules($line) {
- global $arrModules,$lsmod,$kernel,$list ;
+ global $arrModules,$lsmod,$kernel,$arrModtoPlg,$modplugins ;
$modprobe = "" ;
$desc = $file = $pluginfile = $option = $filename = $depends = $supporturl = $dir = null ;
$name = $line ;
@@ -81,29 +80,17 @@ function getmodules($line) {
break ;
}
}
-if ($modname != null) if (strpos($lsmod, $modname,0)) $state = "Inuse" ; else $state = "Available";
+if ($modname != null) {
+ if (strpos($lsmod, $modname,0)) $state = "Inuse" ; else $state = "Available";
+ if (isset($arrModtoPlg[$modname])) { $support = true ; $supporturl = plugin("support", $modplugins[$arrModtoPlg[$modname]]) ; $pluginfile = "Plugin name: {$arrModtoPlg[$modname]}" ; } else { $support = false ; $supporturl = null ; }
+ }
if (is_file("/boot/config/modprobe.d/$modname.conf")) {
$modprobe = file_get_contents("/boot/config/modprobe.d/$modname.conf") ;
$state = strpos($modprobe, "blacklist");
- $supportpos = strpos($modprobe, "#Plugin:");
- if (isset($file[$modname])) { $supporturl = getplugin($file[$modname]) ; }
- else {
- if ($supportpos !== false) {
- $support = true ;
- $supportendpos = strpos($modprobe,"\n",$supportpos) ;
- $pluginfileget = substr($modprobe,$supportpos + 8,$supportendpos ) ;
- $pluginfile = str_replace("\n","",$pluginfileget) ;
- $supporturl = getplugin($pluginfile) ;
- #$modprobe = str_replace($pluginfileget,"",$modprobe) ;
- } else {
- $support = false ;
- $plugin = "" ;
- }
-}
$modprobe = explode(PHP_EOL,$modprobe) ;
if($state !== false) {$state = "Disabled" ;}
else $state="Custom" ;
- } else if($option == "conf") return ;
+ }
if ($filename != "(builtin)") {
if ($filename != null) {
@@ -135,7 +122,6 @@ $arrModules[$modname] = [
}
function modtoplg() {
- global $list ;
$rii = new RecursiveIteratorIterator(new RecursiveDirectoryIterator('/boot/config/plugins'));
$files = array();
@@ -148,166 +134,105 @@ function modtoplg() {
$files[] = $file->getPathname();
}
- #$list = getDirContents("/boot/config/plugins/") ;
- $list =array() ;
- foreach ($files as $f)
- {
+ $list = array() ;
+ foreach ($files as $f) {
$plugin = str_replace("/boot/config/plugins/", "", $f) ;
$plugin = substr($plugin,0,strpos($plugin,'/') ) ;
+ $tar = [] ;
exec("tar -tf $f | grep -E '.ko.xz|.ko' ",$tar) ;
-
- #var_dump($plugin) ;
foreach ($tar as $t) {
$p = pathinfo($t) ;
$filename = str_replace(".ko","",$p["filename"]) ;
$list[$filename] = $plugin ;
}
+ }
- }
-
- file_put_contents("/tmp/modulestoplg",json_encode($list)) ;
+ file_put_contents("/tmp/modulestoplg.json",json_encode($list,JSON_PRETTY_PRINT)) ;
}
-#modtoplg() ;
switch ($_POST['table']) {
-case 't1pre':
- $option = $_POST['option'] ;
- $select = $_POST['select'] ;
- $builtinmodules = file_get_contents("/lib/modules/$kernel/modules.builtin") ;
- $builtinmodules = explode(PHP_EOL,$builtinmodules) ;
- $procmodules =file_get_contents("/lib/modules/$kernel/modules.order") ;
- $procmodules = explode(PHP_EOL,$procmodules) ;
- $arrModules = array() ;
- foreach($builtinmodules as $bultin)
- {
- if ($bultin == "") continue ;
- getmodules(pathinfo($bultin)["filename"]) ;
- }
-
- foreach($procmodules as $line) {
- if ($line == "") continue ;
- getmodules(pathinfo($line)["filename"]) ;
- }
+ case 't1create':
+ $builtinmodules = file_get_contents("/lib/modules/$kernel/modules.builtin") ;
+ $builtinmodules = explode(PHP_EOL,$builtinmodules) ;
+ $procmodules =file_get_contents("/lib/modules/$kernel/modules.order") ;
+ $procmodules = explode(PHP_EOL,$procmodules) ;
+ $arrModules = array() ;
-
- echo "| "._("Module/Driver")." | "._("Description")." | "._("State")." | "._("Type")." | "._("Modeprobe.d config file")." |
";
- echo "" ;
- if (is_array($arrModules)) ksort($arrModules) ;
- foreach($arrModules as $modname => $module)
- {
-
- switch ($_POST['option']){
- case "inuse":
- if ($module['state'] == "Available" || $module['state'] == "(builtin)") continue(2) ;
- break ;
-
- case "confonly":
- if ($module['modprobe'] == "" ) continue(2) ;
- break ;
-
- case "all":
- break ;
- }
- #echo "| " ;
- if ($module['support'] == false) {
- $supporthtml = "title='"._("Support Page")."' id=\"support'.$modname.'\" class='fa fa-circle' disabled " ;
- } else {
- $supporturl = $module['supporturl'] ;
- $supporthtml = ""._('Support Thread')."";
- }
- echo "$supporthtml $modname | " ;
- echo " $status | $status | " ;
- echo " $status | ";
- $text = "" ;
- if (is_array($module["modprobe"])) {
- $text = implode("\n",$module["modprobe"]) ;
- echo " | ";
- } else echo " | ";
-
- }
- echo "" ;
- break;
-
- case 't1':
- $option = $_POST['option'] ;
-
- $builtinmodules = file_get_contents("/lib/modules/$kernel/modules.builtin") ;
- $builtinmodules = explode(PHP_EOL,$builtinmodules) ;
- $procmodules =file_get_contents("/lib/modules/$kernel/modules.order") ;
- $procmodules = explode(PHP_EOL,$procmodules) ;
- $arrModules = array() ;
-
- foreach($builtinmodules as $bultin)
- {
- if ($bultin == "") continue ;
- getmodules(pathinfo($bultin)["filename"]) ;
- }
-
- foreach($procmodules as $line) {
- if ($line == "") continue ;
- getmodules(pathinfo($line)["filename"]) ;
- }
-
- $lsmod2 = explode(PHP_EOL,$lsmod) ;
- foreach($lsmod2 as $line) {
- if ($line == "") continue ;
- $line2 = explode(" ",$line) ;
- getmodules($line2['0']) ;
- }
-
- var_dump(count($arrModules)) ;
- echo "| "._("Actions")." | "._("Module/Driver")." | "._("Description")." | "._("State")." | "._("Type")." | "._("Modeprobe.d config file")." |
";
- echo "" ;
-
- if (is_array($arrModules)) ksort($arrModules) ;
- foreach($arrModules as $modname => $module)
- {
-
- switch ($_POST['option']){
- case "inuse":
- if ($module['state'] == "Available" || $module['state'] == "(builtin)") continue(2) ;
- break ;
-
- case "confonly":
- if ($module['modprobe'] == "" ) continue(2) ;
- break ;
-
- case "all":
- break ;
+ $list = scandir('/var/log/plugins/') ;
+ foreach($list as $f) $modplugins[plugin("name" , @readlink("/var/log/plugins/$f"))] = readlink("/var/log/plugins/$f") ;
+
+ foreach($builtinmodules as $bultin)
+ {
+ if ($bultin == "") continue ;
+ getmodules(pathinfo($bultin)["filename"]) ;
}
-
- echo "| " ;
- if ($supportpage) {
- if ($module['support'] == false) {
- $supporthtml = "" ;
- } else {
- $supporturl = $module['supporturl'] ;
- $supporthtml = "" ;
+
+ foreach($procmodules as $line) {
+ if ($line == "") continue ;
+ getmodules(pathinfo($line)["filename"]) ;
}
- }
- echo "$supporthtml | $modname | " ;
- echo "{$module['description']} | {$module['state']} | {$module['type']} | ";
-
- $text = "" ;
- if (is_array($module["modprobe"])) {
- $text = implode("\n",$module["modprobe"]) ;
- echo " |
";
- } else echo " | ";
-
- }
- echo "" ;
- break;
+ $lsmod2 = explode(PHP_EOL,$lsmod) ;
+ foreach($lsmod2 as $line) {
+ if ($line == "") continue ;
+ $line2 = explode(" ",$line) ;
+ getmodules($line2['0']) ;
+ }
+
+ unset($arrModules['null']);
+ file_put_contents("/tmp/sysdrivers.json",json_encode($arrModules,JSON_PRETTY_PRINT)) ;
+ modtoplg() ;
+
+ break;
+
+ case 't1load':
+ $list = file_get_contents("/tmp/sysdrivers.json") ;
+ $arrModules = json_decode($list,TRUE) ;
+ echo "| "._("Actions")." | "._("Module/Driver")." | "._("Description")." | "._("State")." | "._("Type")." | "._("Modeprobe.d config file")." |
";
+ echo "" ;
+
+ if (is_array($arrModules)) ksort($arrModules) ;
+ foreach($arrModules as $modname => $module) {
+ if ($modname == "") continue ;
+
+ if (is_file("/boot/config/modprobe.d/$modname.conf")) {
+ $modprobe = file_get_contents("/boot/config/modprobe.d/$modname.conf") ;
+ $state = strpos($modprobe, "blacklist");
+ $modprobe = explode(PHP_EOL,$modprobe) ;
+ if($state !== false) {$state = "Disabled" ;} else $state="Custom" ;
+ $module['state'] = $state ;
+ $module['modprobe'] = $modprobe ;
+ }
+
+ echo "| " ;
+ if ($supportpage) {
+ if ($module['support'] == false) {
+ $supporthtml = "" ;
+ } else {
+ $supporturl = $module['supporturl'] ;
+ $pluginname = $module['plugin'] ;
+ $supporthtml = "" ;
+ }
+ }
+ echo "$supporthtml | $modname | " ;
+ echo "{$module['description']} | {$module['state']} | {$module['type']} | ";
+
+ $text = "" ;
+ if (is_array($module["modprobe"])) {
+ $text = implode("\n",$module["modprobe"]) ;
+ echo " |
";
+ } else echo " | ";
+
+ }
+ echo "" ;
+ break;
case "update":
$conf = $_POST['conf'] ;
$module = $_POST['module'] ;
- if ($conf == "") $error = unlink("/boot/config/modprobe.d/$module.conf") ;
- else $error = file_put_contents("/boot/config/modprobe.d/$module.conf",$conf) ;
+ if ($conf == "") $error = unlink("/boot/config/modprobe.d/$module.conf") ; else $error = file_put_contents("/boot/config/modprobe.d/$module.conf",$conf) ;
getmodules($module) ;
$return = $arrModules[$module] ;
$return['supportpage'] = $supportpage ;
From bfdb01559f323ddd664858b1ce10262da1277c01 Mon Sep 17 00:00:00 2001
From: SimonFair <39065407+SimonFair@users.noreply.github.com>
Date: Sat, 15 Jul 2023 10:14:38 +0100
Subject: [PATCH 20/40] Create SysDriversInit event.
---
.../event/disks_mounted/SysDriversInit.php | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
create mode 100644 emhttp/plugins/dynamix/event/disks_mounted/SysDriversInit.php
diff --git a/emhttp/plugins/dynamix/event/disks_mounted/SysDriversInit.php b/emhttp/plugins/dynamix/event/disks_mounted/SysDriversInit.php
new file mode 100644
index 000000000..8c88f9bf9
--- /dev/null
+++ b/emhttp/plugins/dynamix/event/disks_mounted/SysDriversInit.php
@@ -0,0 +1,18 @@
+#!/usr/bin/php
+"t1create","csrf_token" => $var['csrf_token']]) ;
+echo $rtn ;
+?>
\ No newline at end of file
From dc58e2fd6975a467789be0bb7452108a58889a8b Mon Sep 17 00:00:00 2001
From: SimonFair <39065407+SimonFair@users.noreply.github.com>
Date: Sat, 15 Jul 2023 10:16:14 +0100
Subject: [PATCH 21/40] Make script executable
---
emhttp/plugins/dynamix/event/disks_mounted/SysDriversInit.php | 0
1 file changed, 0 insertions(+), 0 deletions(-)
mode change 100644 => 100755 emhttp/plugins/dynamix/event/disks_mounted/SysDriversInit.php
diff --git a/emhttp/plugins/dynamix/event/disks_mounted/SysDriversInit.php b/emhttp/plugins/dynamix/event/disks_mounted/SysDriversInit.php
old mode 100644
new mode 100755
From 90f26f43125f20761dfb0cd1d851f484b52e2496 Mon Sep 17 00:00:00 2001
From: SimonFair <39065407+SimonFair@users.noreply.github.com>
Date: Sat, 15 Jul 2023 10:28:43 +0100
Subject: [PATCH 22/40] Set Timeout for curl process
---
emhttp/plugins/dynamix/event/disks_mounted/SysDriversInit.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/emhttp/plugins/dynamix/event/disks_mounted/SysDriversInit.php b/emhttp/plugins/dynamix/event/disks_mounted/SysDriversInit.php
index 8c88f9bf9..a402f2e23 100755
--- a/emhttp/plugins/dynamix/event/disks_mounted/SysDriversInit.php
+++ b/emhttp/plugins/dynamix/event/disks_mounted/SysDriversInit.php
@@ -7,6 +7,7 @@ function httpPost($url, $data)
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
+ curl_setopt($curl, CURLOPT_TIMEOUT_MS, 1000);
$response = curl_exec($curl);
curl_close($curl);
return $response;
@@ -14,5 +15,4 @@ function httpPost($url, $data)
$var = @parse_ini_file("/var/local/emhttp/var.ini") ?: [];
$rtn = httpPost("http://localhost/webGui/include/SysDrivers.php", ["table"=>"t1create","csrf_token" => $var['csrf_token']]) ;
-echo $rtn ;
?>
\ No newline at end of file
From 2e712e4b33f4db0e9681d9610c3d0e666606c80d Mon Sep 17 00:00:00 2001
From: SimonFair <39065407+SimonFair@users.noreply.github.com>
Date: Sat, 15 Jul 2023 10:35:23 +0100
Subject: [PATCH 23/40] Fix php warnings.
---
emhttp/plugins/dynamix/include/SysDrivers.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/emhttp/plugins/dynamix/include/SysDrivers.php b/emhttp/plugins/dynamix/include/SysDrivers.php
index b175c355b..231854c85 100644
--- a/emhttp/plugins/dynamix/include/SysDrivers.php
+++ b/emhttp/plugins/dynamix/include/SysDrivers.php
@@ -35,7 +35,7 @@ function getplugin($in) {
function getmodules($line) {
global $arrModules,$lsmod,$kernel,$arrModtoPlg,$modplugins ;
$modprobe = "" ;
- $desc = $file = $pluginfile = $option = $filename = $depends = $supporturl = $dir = null ;
+ $desc = $file = $pluginfile = $option = $filename = $depends = $support = $supporturl = $dir = null ;
$name = $line ;
#echo $line ;
$modname = shell_exec("modinfo $name > /dev/null") ;
@@ -161,7 +161,7 @@ switch ($_POST['table']) {
$arrModules = array() ;
$list = scandir('/var/log/plugins/') ;
- foreach($list as $f) $modplugins[plugin("name" , @readlink("/var/log/plugins/$f"))] = readlink("/var/log/plugins/$f") ;
+ foreach($list as $f) $modplugins[plugin("name" , @readlink("/var/log/plugins/$f"))] = @readlink("/var/log/plugins/$f") ;
foreach($builtinmodules as $bultin)
{
From a562e98a7535b08e8ebbbf311eb8cd30dea41dd3 Mon Sep 17 00:00:00 2001
From: SimonFair <39065407+SimonFair@users.noreply.github.com>
Date: Sat, 15 Jul 2023 11:13:30 +0100
Subject: [PATCH 24/40] Change order of json file creation.
---
emhttp/plugins/dynamix/include/SysDrivers.php | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/emhttp/plugins/dynamix/include/SysDrivers.php b/emhttp/plugins/dynamix/include/SysDrivers.php
index 231854c85..b67d9e287 100644
--- a/emhttp/plugins/dynamix/include/SysDrivers.php
+++ b/emhttp/plugins/dynamix/include/SysDrivers.php
@@ -154,6 +154,8 @@ function modtoplg() {
switch ($_POST['table']) {
case 't1create':
+ modtoplg() ;
+ $arrModtoPlg = json_decode(file_get_contents("/tmp/modulestoplg.json") ,TRUE) ;
$builtinmodules = file_get_contents("/lib/modules/$kernel/modules.builtin") ;
$builtinmodules = explode(PHP_EOL,$builtinmodules) ;
$procmodules =file_get_contents("/lib/modules/$kernel/modules.order") ;
@@ -182,9 +184,7 @@ switch ($_POST['table']) {
}
unset($arrModules['null']);
- file_put_contents("/tmp/sysdrivers.json",json_encode($arrModules,JSON_PRETTY_PRINT)) ;
- modtoplg() ;
-
+ file_put_contents("/tmp/sysdrivers.json",json_encode($arrModules,JSON_PRETTY_PRINT)) ;
break;
case 't1load':
From a19f33757580b270fc95adc2b22ea703c0619bf9 Mon Sep 17 00:00:00 2001
From: SimonFair <39065407+SimonFair@users.noreply.github.com>
Date: Sat, 15 Jul 2023 20:29:03 +0100
Subject: [PATCH 25/40] Move iniit and php fixes.
---
emhttp/plugins/dynamix/SysDrivers.page | 11 +++--------
.../SysDriversInit.php | 0
2 files changed, 3 insertions(+), 8 deletions(-)
rename emhttp/plugins/dynamix/event/{disks_mounted => driver_loaded}/SysDriversInit.php (100%)
mode change 100755 => 100644
diff --git a/emhttp/plugins/dynamix/SysDrivers.page b/emhttp/plugins/dynamix/SysDrivers.page
index 5d7b00976..751951de8 100644
--- a/emhttp/plugins/dynamix/SysDrivers.page
+++ b/emhttp/plugins/dynamix/SysDrivers.page
@@ -15,12 +15,6 @@ Tag="server"
* 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');
- $newmodel = version_compare($version['version'],'6.12.0-beta5', '>') ? "true" : "false" ;
-
?>
From 74b8b47d931db97a152f4951e9765dabc1ff5548 Mon Sep 17 00:00:00 2001
From: SimonFair <39065407+SimonFair@users.noreply.github.com>
Date: Sat, 15 Jul 2023 23:21:07 +0100
Subject: [PATCH 27/40] Make script executable
---
emhttp/plugins/dynamix/event/driver_loaded/SysDriversInit.php | 0
1 file changed, 0 insertions(+), 0 deletions(-)
mode change 100644 => 100755 emhttp/plugins/dynamix/event/driver_loaded/SysDriversInit.php
diff --git a/emhttp/plugins/dynamix/event/driver_loaded/SysDriversInit.php b/emhttp/plugins/dynamix/event/driver_loaded/SysDriversInit.php
old mode 100644
new mode 100755
From c3e5801e82ed427f2aeb4b8b6327c7ce2d45e3f9 Mon Sep 17 00:00:00 2001
From: SimonFair <39065407+SimonFair@users.noreply.github.com>
Date: Sun, 16 Jul 2023 15:08:06 +0100
Subject: [PATCH 28/40] Fix scrolling/php issues add search box. Set colours.
Only show support if available next to name,
---
emhttp/plugins/dynamix/SysDrivers.page | 49 ++++++++-----
emhttp/plugins/dynamix/include/SysDrivers.php | 69 +++++++++++++++----
2 files changed, 86 insertions(+), 32 deletions(-)
diff --git a/emhttp/plugins/dynamix/SysDrivers.page b/emhttp/plugins/dynamix/SysDrivers.page
index 901cbc9f1..ae1f16818 100644
--- a/emhttp/plugins/dynamix/SysDrivers.page
+++ b/emhttp/plugins/dynamix/SysDrivers.page
@@ -19,8 +19,7 @@ $theme = $display['theme'] ;
?>
@@ -68,15 +75,12 @@ function showDrivers(options, init = false) {
$.post('/webGui/include/SysDrivers.php',{table:'t1load',option:"all"},function(data){
clearTimeout(timers.refresh);
filter = [];
- filter[3] = "Inuse|Custom|Disabled";
+ filter[2] = "Inuse|Custom|Disabled";
$("#t1").trigger("destroy");
$('#t1').html(data);
$('#t1').tablesorter({
- sortList:[[1,0]],
- sortAppend:[[1,0]],
- headers:{
- 0:{sorter:false}
- },
+ sortList:[[0,0]],
+ sortAppend:[[0,0]],
widgets: ['stickyHeaders','filter', 'zebra'],
widgetOptions: {
// on black and white, offset is height of #menu
@@ -92,12 +96,18 @@ function showDrivers(options, init = false) {
} else {
filter = [];
- if (option === "inuse") filter[3] = "Inuse|Custom|Disabled";
- if (option === "all") filter[3] = "";
- $('#t1').trigger('search', [ filter ]);
+ filterDrivers() ;
}
}
+function filterDrivers() {
+ var totalColumns = $('#t1')[0].config.columns;
+ var filter = [];
+ filter[2] = ($('#select').val() === "inuse") ? "Inuse|Custom|Disabled" : "";
+ filter[totalColumns] = $('#driversearch').val(); // this searches all columns
+ $('#t1').trigger('search', [ filter ]);
+}
+
function showDriversupdate() {
$.post('/webGui/include/SysDrivers.php',{table:'t1create',option:"all"}) ;
}
@@ -142,6 +152,7 @@ showDriversupdate() ;
+
diff --git a/emhttp/plugins/dynamix/include/SysDrivers.php b/emhttp/plugins/dynamix/include/SysDrivers.php
index b67d9e287..ef5645221 100644
--- a/emhttp/plugins/dynamix/include/SysDrivers.php
+++ b/emhttp/plugins/dynamix/include/SysDrivers.php
@@ -22,6 +22,9 @@ $kernel = shell_exec("uname -r") ;
$kernel = trim($kernel,"\n") ;
$lsmod = shell_exec("lsmod") ;
$supportpage = true;
+$modtoplgfile = "/tmp/modulestoplg.json" ;
+$sysdrvfile = "/tmp/sysdrivers.json" ;
+if (!is_file($modtoplgfile) || !is_file($sysdrvfile)) { modtoplg() ; createlist() ;}
$arrModtoPlg = json_decode(file_get_contents("/tmp/modulestoplg.json") ,TRUE) ;
function getplugin($in) {
@@ -35,7 +38,7 @@ function getplugin($in) {
function getmodules($line) {
global $arrModules,$lsmod,$kernel,$arrModtoPlg,$modplugins ;
$modprobe = "" ;
- $desc = $file = $pluginfile = $option = $filename = $depends = $support = $supporturl = $dir = null ;
+ $desc = $file = $pluginfile = $option = $filename = $depends = $support = $supporturl = $dir = $state = null ;
$name = $line ;
#echo $line ;
$modname = shell_exec("modinfo $name > /dev/null") ;
@@ -122,6 +125,7 @@ $arrModules[$modname] = [
}
function modtoplg() {
+ global $modtoplgfile ;
$rii = new RecursiveIteratorIterator(new RecursiveDirectoryIterator('/boot/config/plugins'));
$files = array();
@@ -147,21 +151,56 @@ function modtoplg() {
}
}
- file_put_contents("/tmp/modulestoplg.json",json_encode($list,JSON_PRETTY_PRINT)) ;
+ file_put_contents($modtoplgfile,json_encode($list,JSON_PRETTY_PRINT)) ;
}
+function createlist() {
+ global $modtoplgfile, $sysdrvfile, $lsmod, $kernel,$arrModules ;
+ $arrModtoPlg = json_decode(file_get_contents($modtoplgfile) ,TRUE) ;
+ $builtinmodules = file_get_contents("/lib/modules/$kernel/modules.builtin") ;
+ $builtinmodules = explode(PHP_EOL,$builtinmodules) ;
+ $procmodules =file_get_contents("/lib/modules/$kernel/modules.order") ;
+ $procmodules = explode(PHP_EOL,$procmodules) ;
+ $arrModules = array() ;
+
+ $list = scandir('/var/log/plugins/') ;
+ foreach($list as $f) $modplugins[plugin("name" , @readlink("/var/log/plugins/$f"))] = @readlink("/var/log/plugins/$f") ;
+
+ foreach($builtinmodules as $bultin)
+ {
+ if ($bultin == "") continue ;
+ getmodules(pathinfo($bultin)["filename"]) ;
+ }
+
+ foreach($procmodules as $line) {
+ if ($line == "") continue ;
+ getmodules(pathinfo($line)["filename"]) ;
+ }
+
+ $lsmod2 = explode(PHP_EOL,$lsmod) ;
+ foreach($lsmod2 as $line) {
+ if ($line == "") continue ;
+ $line2 = explode(" ",$line) ;
+ getmodules($line2['0']) ;
+ }
+
+ unset($arrModules['null']);
+ file_put_contents($sysdrvfile,json_encode($arrModules,JSON_PRETTY_PRINT)) ;
+}
+
switch ($_POST['table']) {
case 't1create':
modtoplg() ;
- $arrModtoPlg = json_decode(file_get_contents("/tmp/modulestoplg.json") ,TRUE) ;
+ createlist() ;
+ /*$arrModtoPlg = json_decode(file_get_contents($modtoplgfile) ,TRUE) ;
$builtinmodules = file_get_contents("/lib/modules/$kernel/modules.builtin") ;
$builtinmodules = explode(PHP_EOL,$builtinmodules) ;
$procmodules =file_get_contents("/lib/modules/$kernel/modules.order") ;
$procmodules = explode(PHP_EOL,$procmodules) ;
$arrModules = array() ;
-
+
$list = scandir('/var/log/plugins/') ;
foreach($list as $f) $modplugins[plugin("name" , @readlink("/var/log/plugins/$f"))] = @readlink("/var/log/plugins/$f") ;
@@ -182,15 +221,17 @@ switch ($_POST['table']) {
$line2 = explode(" ",$line) ;
getmodules($line2['0']) ;
}
-
+
unset($arrModules['null']);
- file_put_contents("/tmp/sysdrivers.json",json_encode($arrModules,JSON_PRETTY_PRINT)) ;
+ file_put_contents($sysdrvfile,json_encode($arrModules,JSON_PRETTY_PRINT)) ; */
+
break;
case 't1load':
- $list = file_get_contents("/tmp/sysdrivers.json") ;
+ $list = file_get_contents($sysdrvfile) ;
$arrModules = json_decode($list,TRUE) ;
- echo "| "._("Actions")." | "._("Module/Driver")." | "._("Description")." | "._("State")." | "._("Type")." | "._("Modeprobe.d config file")." |
";
+ #echo "| "._("Actions")." | "._("Driver")." | "._("Description")." | "._("State")." | "._("Type")." | "._("Modeprobe.d config file")." |
";
+ echo "| "._("Driver")." | "._("Description")." | "._("State")." | "._("Type")." | "._("Modeprobe.d config file")." |
";
echo "" ;
if (is_array($arrModules)) ksort($arrModules) ;
@@ -206,24 +247,26 @@ switch ($_POST['table']) {
$module['modprobe'] = $modprobe ;
}
- echo "" ;
+ echo "" ;
+ #echo " | " ;
if ($supportpage) {
if ($module['support'] == false) {
- $supporthtml = "" ;
+ #$supporthtml = "" ;
+ $supporthtml = "" ;
} else {
$supporturl = $module['supporturl'] ;
$pluginname = $module['plugin'] ;
$supporthtml = "" ;
}
}
- echo "$supporthtml$modname | " ;
+ echo "$modname$supporthtml | " ;
echo "{$module['description']} | {$module['state']} | {$module['type']} | ";
$text = "" ;
if (is_array($module["modprobe"])) {
$text = implode("\n",$module["modprobe"]) ;
- echo " | ";
- } else echo " | |
";
+ echo " | ";
+ } else echo " | ";
}
echo "" ;
From 8372970be843e2cbbb9ebc2643a65e3e17765cf7 Mon Sep 17 00:00:00 2001
From: SimonFair <39065407+SimonFair@users.noreply.github.com>
Date: Sun, 16 Jul 2023 19:10:43 +0100
Subject: [PATCH 29/40] Fix support url.
---
emhttp/plugins/dynamix/include/SysDrivers.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/emhttp/plugins/dynamix/include/SysDrivers.php b/emhttp/plugins/dynamix/include/SysDrivers.php
index ef5645221..fef8dc092 100644
--- a/emhttp/plugins/dynamix/include/SysDrivers.php
+++ b/emhttp/plugins/dynamix/include/SysDrivers.php
@@ -156,7 +156,7 @@ function modtoplg() {
}
function createlist() {
- global $modtoplgfile, $sysdrvfile, $lsmod, $kernel,$arrModules ;
+ global $modtoplgfile, $sysdrvfile, $lsmod, $kernel,$arrModules, $modplugins ;
$arrModtoPlg = json_decode(file_get_contents($modtoplgfile) ,TRUE) ;
$builtinmodules = file_get_contents("/lib/modules/$kernel/modules.builtin") ;
$builtinmodules = explode(PHP_EOL,$builtinmodules) ;
From d617c7508a181d8e842fe129033fa2ca6b11d2f9 Mon Sep 17 00:00:00 2001
From: SimonFair <39065407+SimonFair@users.noreply.github.com>
Date: Sun, 16 Jul 2023 23:15:59 +0100
Subject: [PATCH 30/40] Code Tidy
---
emhttp/plugins/dynamix/SysDrivers.page | 6 ++----
emhttp/plugins/dynamix/include/SysDrivers.php | 2 +-
2 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/emhttp/plugins/dynamix/SysDrivers.page b/emhttp/plugins/dynamix/SysDrivers.page
index ae1f16818..b7593fe4e 100644
--- a/emhttp/plugins/dynamix/SysDrivers.page
+++ b/emhttp/plugins/dynamix/SysDrivers.page
@@ -74,8 +74,6 @@ function showDrivers(options, init = false) {
if (init) {
$.post('/webGui/include/SysDrivers.php',{table:'t1load',option:"all"},function(data){
clearTimeout(timers.refresh);
- filter = [];
- filter[2] = "Inuse|Custom|Disabled";
$("#t1").trigger("destroy");
$('#t1').html(data);
$('#t1').tablesorter({
@@ -148,11 +146,11 @@ function textsave(module) {
$('.tabs').append("_(Select View)_:");
showDrivers("all",true) ;
-showDriversupdate() ;
+
-
+
diff --git a/emhttp/plugins/dynamix/include/SysDrivers.php b/emhttp/plugins/dynamix/include/SysDrivers.php
index fef8dc092..95f41c791 100644
--- a/emhttp/plugins/dynamix/include/SysDrivers.php
+++ b/emhttp/plugins/dynamix/include/SysDrivers.php
@@ -108,7 +108,7 @@ $dir = str_replace("/lib/modules/$kernel/kernel/", "" ,$dir) ;
$dir = str_replace("drivers/", "" ,$dir) ;
if ($state == "Inuse") $state= "(builtin) - Inuse"; else $state="(builtin)" ;
}
-if ($desc != null) $description = substr($desc , 0 ,60) ; else $description = null ;
+if ($desc != null) $description = substr($desc , 0 ,70) ; else $description = null ;
$arrModules[$modname] = [
'modname' => $modname,
'dependacy' => $depends,
From 3dcd3a7e71d08ba54c0ba7c4c94ee64b856d0db5 Mon Sep 17 00:00:00 2001
From: SimonFair <39065407+SimonFair@users.noreply.github.com>
Date: Mon, 17 Jul 2023 17:25:31 +0100
Subject: [PATCH 31/40] Updates to rebuild.
---
emhttp/plugins/dynamix/SysDrivers.page | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/emhttp/plugins/dynamix/SysDrivers.page b/emhttp/plugins/dynamix/SysDrivers.page
index b7593fe4e..447fe9c1b 100644
--- a/emhttp/plugins/dynamix/SysDrivers.page
+++ b/emhttp/plugins/dynamix/SysDrivers.page
@@ -72,6 +72,8 @@ div.tablesorter-header-inner {color:#606e7f;background-color:#e4e2e4;}
function showDrivers(options, init = false) {
option = options ;
if (init) {
+ $('#driversearch').prop('disabled', true);
+ $('#select').prop('disabled', true);
$.post('/webGui/include/SysDrivers.php',{table:'t1load',option:"all"},function(data){
clearTimeout(timers.refresh);
$("#t1").trigger("destroy");
@@ -90,6 +92,8 @@ function showDrivers(options, init = false) {
});
$('div.spinner.fixed').hide('slow');
+ $('#driversearch').prop('disabled', false);
+ $('#select').prop('disabled', false);
});
} else {
@@ -107,7 +111,16 @@ function filterDrivers() {
}
function showDriversupdate() {
- $.post('/webGui/include/SysDrivers.php',{table:'t1create',option:"all"}) ;
+ $('#rebuild').prop('disabled', true);
+ $('#t1').html("");
+ $('#driversearch').prop('disabled', true);
+ $('#select').prop('disabled', true);
+ $('div.spinner.fixed').show('slow');
+ $.post('/webGui/include/SysDrivers.php',{table:'t1create',option:"all"},function(data){
+ $('#rebuild').prop('disabled', false);
+ showDrivers("all",true) ;
+ $('div.spinner.fixed').hide('slow');
+ }) ;
}
function textedit(module) {
@@ -152,5 +165,5 @@ showDrivers("all",true) ;
-
+
From f0b13665a21f4bdd723e71e75c576e220b1b9bd4 Mon Sep 17 00:00:00 2001
From: SimonFair <39065407+SimonFair@users.noreply.github.com>
Date: Mon, 17 Jul 2023 23:25:58 +0100
Subject: [PATCH 32/40] Change (builtin) to Kernel
Include Kernel - Inuse in selection.
---
emhttp/plugins/dynamix/SysDrivers.page | 2 +-
emhttp/plugins/dynamix/include/SysDrivers.php | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/emhttp/plugins/dynamix/SysDrivers.page b/emhttp/plugins/dynamix/SysDrivers.page
index 447fe9c1b..b071241e2 100644
--- a/emhttp/plugins/dynamix/SysDrivers.page
+++ b/emhttp/plugins/dynamix/SysDrivers.page
@@ -105,7 +105,7 @@ function showDrivers(options, init = false) {
function filterDrivers() {
var totalColumns = $('#t1')[0].config.columns;
var filter = [];
- filter[2] = ($('#select').val() === "inuse") ? "Inuse|Custom|Disabled" : "";
+ filter[2] = ($('#select').val() === "inuse") ? "Inuse|Custom|Disabled|'Kernel - Inuse'" : "";
filter[totalColumns] = $('#driversearch').val(); // this searches all columns
$('#t1').trigger('search', [ filter ]);
}
diff --git a/emhttp/plugins/dynamix/include/SysDrivers.php b/emhttp/plugins/dynamix/include/SysDrivers.php
index 95f41c791..30ddf988a 100644
--- a/emhttp/plugins/dynamix/include/SysDrivers.php
+++ b/emhttp/plugins/dynamix/include/SysDrivers.php
@@ -106,9 +106,9 @@ $dir = str_replace("/lib/modules/$kernel/kernel/", "" ,$dir) ;
} else {
$dir = $file ;
$dir = str_replace("drivers/", "" ,$dir) ;
- if ($state == "Inuse") $state= "(builtin) - Inuse"; else $state="(builtin)" ;
+ if ($state == "Inuse") $state= "Kernel - Inuse"; else $state="Kernel" ;
}
-if ($desc != null) $description = substr($desc , 0 ,70) ; else $description = null ;
+if ($desc != null) $description = substr($desc , 0 ,60) ; else $description = null ;
$arrModules[$modname] = [
'modname' => $modname,
'dependacy' => $depends,
@@ -231,7 +231,7 @@ switch ($_POST['table']) {
$list = file_get_contents($sysdrvfile) ;
$arrModules = json_decode($list,TRUE) ;
#echo "| "._("Actions")." | "._("Driver")." | "._("Description")." | "._("State")." | "._("Type")." | "._("Modeprobe.d config file")." |
";
- echo "| "._("Driver")." | "._("Description")." | "._("State")." | "._("Type")." | "._("Modeprobe.d config file")." |
";
+ echo "| "._("Driver")." | "._("Description")." | "._("State")." | "._("Type")." | "._("Modprobe.d config file")." |
";
echo "" ;
if (is_array($arrModules)) ksort($arrModules) ;
From 33230da120086f31305a4463eecb352bf559a79c Mon Sep 17 00:00:00 2001
From: SimonFair <39065407+SimonFair@users.noreply.github.com>
Date: Fri, 21 Jul 2023 23:19:02 +0100
Subject: [PATCH 33/40] Update initial build process
---
.../event/driver_loaded/SysDriversBuild | 3 +
emhttp/plugins/dynamix/include/SysDrivers.php | 198 +-----------------
.../dynamix/include/SysDriversHelpers.php | 176 ++++++++++++++++
.../dynamix/include/SysDriversInit.php | 33 +++
4 files changed, 214 insertions(+), 196 deletions(-)
create mode 100644 emhttp/plugins/dynamix/event/driver_loaded/SysDriversBuild
create mode 100644 emhttp/plugins/dynamix/include/SysDriversHelpers.php
create mode 100644 emhttp/plugins/dynamix/include/SysDriversInit.php
diff --git a/emhttp/plugins/dynamix/event/driver_loaded/SysDriversBuild b/emhttp/plugins/dynamix/event/driver_loaded/SysDriversBuild
new file mode 100644
index 000000000..132c40dfc
--- /dev/null
+++ b/emhttp/plugins/dynamix/event/driver_loaded/SysDriversBuild
@@ -0,0 +1,3 @@
+#!/bin/bash
+/usr/bin/logger "Submitting SysDrivers Build"
+/usr/local/emhttp/plugins/dynamix/include/SysDriversInit.php &> /dev/null &
\ No newline at end of file
diff --git a/emhttp/plugins/dynamix/include/SysDrivers.php b/emhttp/plugins/dynamix/include/SysDrivers.php
index 30ddf988a..a32de7a18 100644
--- a/emhttp/plugins/dynamix/include/SysDrivers.php
+++ b/emhttp/plugins/dynamix/include/SysDrivers.php
@@ -16,6 +16,7 @@ $docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
$_SERVER['REQUEST_URI'] = 'tools';
require_once "$docroot/webGui/include/Translations.php";
require_once "$docroot/webGui/include/Helpers.php";
+require_once "$docroot/webGui/include/SysDriversHelpers.php";
require_once "$docroot/plugins/dynamix.plugin.manager/include/PluginHelpers.php";
$kernel = shell_exec("uname -r") ;
@@ -27,210 +28,17 @@ $sysdrvfile = "/tmp/sysdrivers.json" ;
if (!is_file($modtoplgfile) || !is_file($sysdrvfile)) { modtoplg() ; createlist() ;}
$arrModtoPlg = json_decode(file_get_contents("/tmp/modulestoplg.json") ,TRUE) ;
-function getplugin($in) {
- $plugins = "/var/log/plugins/";
- $plugin_link = $plugins.$in ;
- $plugin_file = @readlink($plugin_link);
- $support = plugin('support',$plugin_file) ?: "";
- return($support) ;
-}
-
-function getmodules($line) {
- global $arrModules,$lsmod,$kernel,$arrModtoPlg,$modplugins ;
- $modprobe = "" ;
- $desc = $file = $pluginfile = $option = $filename = $depends = $support = $supporturl = $dir = $state = null ;
- $name = $line ;
- #echo $line ;
- $modname = shell_exec("modinfo $name > /dev/null") ;
- if ($modname != null) $modname = trim($modname,"\n") ;
- $output=null ;
- exec("modinfo $name",$output,$error) ;
- $parms = array() ;
- foreach($output as $outline) {
- $data = explode(":",$outline) ;
- $support = false ; $supporturl = null ;
- switch ($data[0])
- {
- case "name":
- $modname = trim($data[1]) ;
- break ;
- case "depends":
- $depends = trim($data[1]) ;
- break ;
- case "filename":
- $filename = trim($data[1]) ;
- break ;
- case "description":
- $desc = trim($data[1]) ;
- break ;
- case "parm":
- $parms[] = trim(str_replace("parm:","",$outline)) ;
- break ;
- case "file":
- $file = trim(str_replace("file:","",$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 ;
- }
-}
-if ($modname != null) {
- if (strpos($lsmod, $modname,0)) $state = "Inuse" ; else $state = "Available";
- if (isset($arrModtoPlg[$modname])) { $support = true ; $supporturl = plugin("support", $modplugins[$arrModtoPlg[$modname]]) ; $pluginfile = "Plugin name: {$arrModtoPlg[$modname]}" ; } else { $support = false ; $supporturl = null ; }
- }
-if (is_file("/boot/config/modprobe.d/$modname.conf")) {
- $modprobe = file_get_contents("/boot/config/modprobe.d/$modname.conf") ;
- $state = strpos($modprobe, "blacklist");
- $modprobe = explode(PHP_EOL,$modprobe) ;
- if($state !== false) {$state = "Disabled" ;}
- else $state="Custom" ;
- }
-
-if ($filename != "(builtin)") {
-if ($filename != null) {
-$type = pathinfo($filename) ;
-$dir = $type['dirname'] ;
-
-$dir = str_replace("/lib/modules/$kernel/kernel/drivers/", "" ,$dir) ;
-$dir = str_replace("/lib/modules/$kernel/kernel/", "" ,$dir) ;
-}
-} else {
- $dir = $file ;
- $dir = str_replace("drivers/", "" ,$dir) ;
- if ($state == "Inuse") $state= "Kernel - Inuse"; else $state="Kernel" ;
-}
-if ($desc != null) $description = substr($desc , 0 ,60) ; else $description = null ;
-$arrModules[$modname] = [
- 'modname' => $modname,
- 'dependacy' => $depends,
- 'parms' => $parms,
- 'file' => $file,
- 'modprobe' => $modprobe,
- 'plugin' => $pluginfile ,
- 'state' => $state,
- 'type' => $dir,
- 'support' => $support,
- 'supporturl' => $supporturl,
- 'description' => $description ,
-] ;
-}
-
-function modtoplg() {
- global $modtoplgfile ;
- $rii = new RecursiveIteratorIterator(new RecursiveDirectoryIterator('/boot/config/plugins'));
- $files = array();
-
- /** @var SplFileInfo $file */
- foreach ($rii as $file) {
- if ($file->isDir()){
- continue;
- }
- if ($file->getExtension() != "tgz" && $file->getExtension() != "txz") continue ;
- $files[] = $file->getPathname();
- }
-
- $list = array() ;
- foreach ($files as $f) {
- $plugin = str_replace("/boot/config/plugins/", "", $f) ;
- $plugin = substr($plugin,0,strpos($plugin,'/') ) ;
- $tar = [] ;
- exec("tar -tf $f | grep -E '.ko.xz|.ko' ",$tar) ;
- foreach ($tar as $t) {
- $p = pathinfo($t) ;
- $filename = str_replace(".ko","",$p["filename"]) ;
- $list[$filename] = $plugin ;
- }
- }
-
- file_put_contents($modtoplgfile,json_encode($list,JSON_PRETTY_PRINT)) ;
-
-}
-
-function createlist() {
- global $modtoplgfile, $sysdrvfile, $lsmod, $kernel,$arrModules, $modplugins ;
- $arrModtoPlg = json_decode(file_get_contents($modtoplgfile) ,TRUE) ;
- $builtinmodules = file_get_contents("/lib/modules/$kernel/modules.builtin") ;
- $builtinmodules = explode(PHP_EOL,$builtinmodules) ;
- $procmodules =file_get_contents("/lib/modules/$kernel/modules.order") ;
- $procmodules = explode(PHP_EOL,$procmodules) ;
- $arrModules = array() ;
-
- $list = scandir('/var/log/plugins/') ;
- foreach($list as $f) $modplugins[plugin("name" , @readlink("/var/log/plugins/$f"))] = @readlink("/var/log/plugins/$f") ;
-
- foreach($builtinmodules as $bultin)
- {
- if ($bultin == "") continue ;
- getmodules(pathinfo($bultin)["filename"]) ;
- }
-
- foreach($procmodules as $line) {
- if ($line == "") continue ;
- getmodules(pathinfo($line)["filename"]) ;
- }
-
- $lsmod2 = explode(PHP_EOL,$lsmod) ;
- foreach($lsmod2 as $line) {
- if ($line == "") continue ;
- $line2 = explode(" ",$line) ;
- getmodules($line2['0']) ;
- }
-
- unset($arrModules['null']);
- file_put_contents($sysdrvfile,json_encode($arrModules,JSON_PRETTY_PRINT)) ;
-}
-
switch ($_POST['table']) {
case 't1create':
modtoplg() ;
createlist() ;
- /*$arrModtoPlg = json_decode(file_get_contents($modtoplgfile) ,TRUE) ;
- $builtinmodules = file_get_contents("/lib/modules/$kernel/modules.builtin") ;
- $builtinmodules = explode(PHP_EOL,$builtinmodules) ;
- $procmodules =file_get_contents("/lib/modules/$kernel/modules.order") ;
- $procmodules = explode(PHP_EOL,$procmodules) ;
- $arrModules = array() ;
-
- $list = scandir('/var/log/plugins/') ;
- foreach($list as $f) $modplugins[plugin("name" , @readlink("/var/log/plugins/$f"))] = @readlink("/var/log/plugins/$f") ;
-
- foreach($builtinmodules as $bultin)
- {
- if ($bultin == "") continue ;
- getmodules(pathinfo($bultin)["filename"]) ;
- }
-
- foreach($procmodules as $line) {
- if ($line == "") continue ;
- getmodules(pathinfo($line)["filename"]) ;
- }
-
- $lsmod2 = explode(PHP_EOL,$lsmod) ;
- foreach($lsmod2 as $line) {
- if ($line == "") continue ;
- $line2 = explode(" ",$line) ;
- getmodules($line2['0']) ;
- }
-
- unset($arrModules['null']);
- file_put_contents($sysdrvfile,json_encode($arrModules,JSON_PRETTY_PRINT)) ; */
-
+
break;
case 't1load':
$list = file_get_contents($sysdrvfile) ;
$arrModules = json_decode($list,TRUE) ;
- #echo "| "._("Actions")." | "._("Driver")." | "._("Description")." | "._("State")." | "._("Type")." | "._("Modeprobe.d config file")." |
";
echo "| "._("Driver")." | "._("Description")." | "._("State")." | "._("Type")." | "._("Modprobe.d config file")." |
";
echo "" ;
@@ -248,10 +56,8 @@ switch ($_POST['table']) {
}
echo "" ;
- #echo " | " ;
if ($supportpage) {
if ($module['support'] == false) {
- #$supporthtml = "" ;
$supporthtml = "" ;
} else {
$supporturl = $module['supporturl'] ;
diff --git a/emhttp/plugins/dynamix/include/SysDriversHelpers.php b/emhttp/plugins/dynamix/include/SysDriversHelpers.php
new file mode 100644
index 000000000..a3a621e66
--- /dev/null
+++ b/emhttp/plugins/dynamix/include/SysDriversHelpers.php
@@ -0,0 +1,176 @@
+ /dev/null") ;
+ if ($modname != null) $modname = trim($modname,"\n") ;
+ $output=null ;
+ exec("modinfo $name",$output,$error) ;
+ $parms = array() ;
+ foreach($output as $outline) {
+ $data = explode(":",$outline) ;
+ $support = false ; $supporturl = null ;
+ switch ($data[0])
+ {
+ case "name":
+ $modname = trim($data[1]) ;
+ break ;
+ case "depends":
+ $depends = trim($data[1]) ;
+ break ;
+ case "filename":
+ $filename = trim($data[1]) ;
+ break ;
+ case "description":
+ $desc = trim($data[1]) ;
+ break ;
+ case "parm":
+ $parms[] = trim(str_replace("parm:","",$outline)) ;
+ break ;
+ case "file":
+ $file = trim(str_replace("file:","",$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 ;
+ }
+}
+if ($modname != null) {
+ if (strpos($lsmod, $modname,0)) $state = "Inuse" ; else $state = "Available";
+ if (isset($arrModtoPlg[$modname])) { $support = true ; $supporturl = plugin("support", $modplugins[$arrModtoPlg[$modname]]) ; $pluginfile = "Plugin name: {$arrModtoPlg[$modname]}" ; } else { $support = false ; $supporturl = null ; }
+ }
+if (is_file("/boot/config/modprobe.d/$modname.conf")) {
+ $modprobe = file_get_contents("/boot/config/modprobe.d/$modname.conf") ;
+ $state = strpos($modprobe, "blacklist");
+ $modprobe = explode(PHP_EOL,$modprobe) ;
+ if($state !== false) {$state = "Disabled" ;}
+ else $state="Custom" ;
+ }
+
+if ($filename != "(builtin)") {
+if ($filename != null) {
+$type = pathinfo($filename) ;
+$dir = $type['dirname'] ;
+
+$dir = str_replace("/lib/modules/$kernel/kernel/drivers/", "" ,$dir) ;
+$dir = str_replace("/lib/modules/$kernel/kernel/", "" ,$dir) ;
+}
+} else {
+ $dir = $file ;
+ $dir = str_replace("drivers/", "" ,$dir) ;
+ if ($state == "Inuse") $state= "Kernel - Inuse"; else $state="Kernel" ;
+}
+if ($desc != null) $description = substr($desc , 0 ,60) ; else $description = null ;
+$arrModules[$modname] = [
+ 'modname' => $modname,
+ 'dependacy' => $depends,
+ 'parms' => $parms,
+ 'file' => $file,
+ 'modprobe' => $modprobe,
+ 'plugin' => $pluginfile ,
+ 'state' => $state,
+ 'type' => $dir,
+ 'support' => $support,
+ 'supporturl' => $supporturl,
+ 'description' => $description ,
+] ;
+}
+
+function modtoplg() {
+ global $modtoplgfile ;
+ $rii = new RecursiveIteratorIterator(new RecursiveDirectoryIterator('/boot/config/plugins'));
+ $files = array();
+
+ /** @var SplFileInfo $file */
+ foreach ($rii as $file) {
+ if ($file->isDir()){
+ continue;
+ }
+ if ($file->getExtension() != "tgz" && $file->getExtension() != "txz") continue ;
+ $files[] = $file->getPathname();
+ }
+
+ $list = array() ;
+ foreach ($files as $f) {
+ $plugin = str_replace("/boot/config/plugins/", "", $f) ;
+ $plugin = substr($plugin,0,strpos($plugin,'/') ) ;
+ $tar = [] ;
+ exec("tar -tf $f | grep -E '.ko.xz|.ko' ",$tar) ;
+ foreach ($tar as $t) {
+ $p = pathinfo($t) ;
+ $filename = str_replace(".ko","",$p["filename"]) ;
+ $list[$filename] = $plugin ;
+ }
+ }
+
+ file_put_contents($modtoplgfile,json_encode($list,JSON_PRETTY_PRINT)) ;
+
+}
+
+function createlist() {
+ global $modtoplgfile, $sysdrvfile, $lsmod, $kernel,$arrModules, $modplugins ;
+ $arrModtoPlg = json_decode(file_get_contents($modtoplgfile) ,TRUE) ;
+ $builtinmodules = file_get_contents("/lib/modules/$kernel/modules.builtin") ;
+ $builtinmodules = explode(PHP_EOL,$builtinmodules) ;
+ $procmodules =file_get_contents("/lib/modules/$kernel/modules.order") ;
+ $procmodules = explode(PHP_EOL,$procmodules) ;
+ $arrModules = array() ;
+
+ $list = scandir('/var/log/plugins/') ;
+ foreach($list as $f) $modplugins[plugin("name" , @readlink("/var/log/plugins/$f"))] = @readlink("/var/log/plugins/$f") ;
+
+ foreach($builtinmodules as $bultin)
+ {
+ if ($bultin == "") continue ;
+ getmodules(pathinfo($bultin)["filename"]) ;
+ }
+
+ foreach($procmodules as $line) {
+ if ($line == "") continue ;
+ getmodules(pathinfo($line)["filename"]) ;
+ }
+
+ $lsmod2 = explode(PHP_EOL,$lsmod) ;
+ foreach($lsmod2 as $line) {
+ if ($line == "") continue ;
+ $line2 = explode(" ",$line) ;
+ getmodules($line2['0']) ;
+ }
+
+ unset($arrModules['null']);
+ file_put_contents($sysdrvfile,json_encode($arrModules,JSON_PRETTY_PRINT)) ;
+}
+
+?>
\ No newline at end of file
diff --git a/emhttp/plugins/dynamix/include/SysDriversInit.php b/emhttp/plugins/dynamix/include/SysDriversInit.php
new file mode 100644
index 000000000..ad2d6b75a
--- /dev/null
+++ b/emhttp/plugins/dynamix/include/SysDriversInit.php
@@ -0,0 +1,33 @@
+#!/usr/bin/php
+
\ No newline at end of file
From d2634e821a28030e03ddb5a808c7505fc793e75e Mon Sep 17 00:00:00 2001
From: SimonFair <39065407+SimonFair@users.noreply.github.com>
Date: Fri, 21 Jul 2023 23:19:16 +0100
Subject: [PATCH 34/40] Delete SysDriversInit.php
---
.../event/driver_loaded/SysDriversInit.php | 18 ------------------
1 file changed, 18 deletions(-)
delete mode 100755 emhttp/plugins/dynamix/event/driver_loaded/SysDriversInit.php
diff --git a/emhttp/plugins/dynamix/event/driver_loaded/SysDriversInit.php b/emhttp/plugins/dynamix/event/driver_loaded/SysDriversInit.php
deleted file mode 100755
index a402f2e23..000000000
--- a/emhttp/plugins/dynamix/event/driver_loaded/SysDriversInit.php
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/usr/bin/php
-"t1create","csrf_token" => $var['csrf_token']]) ;
-?>
\ No newline at end of file
From beb3fe1527f92f9f9e74cee1396f08681cc5a550 Mon Sep 17 00:00:00 2001
From: SimonFair <39065407+SimonFair@users.noreply.github.com>
Date: Fri, 21 Jul 2023 23:20:07 +0100
Subject: [PATCH 35/40] Make script executable
---
emhttp/plugins/dynamix/event/driver_loaded/SysDriversBuild | 0
emhttp/plugins/dynamix/include/SysDriversInit.php | 0
2 files changed, 0 insertions(+), 0 deletions(-)
mode change 100644 => 100755 emhttp/plugins/dynamix/event/driver_loaded/SysDriversBuild
mode change 100644 => 100755 emhttp/plugins/dynamix/include/SysDriversInit.php
diff --git a/emhttp/plugins/dynamix/event/driver_loaded/SysDriversBuild b/emhttp/plugins/dynamix/event/driver_loaded/SysDriversBuild
old mode 100644
new mode 100755
diff --git a/emhttp/plugins/dynamix/include/SysDriversInit.php b/emhttp/plugins/dynamix/include/SysDriversInit.php
old mode 100644
new mode 100755
From 6ec8cc9334d5f8b0cc7ae0e8f9cf26d066fc9b3f Mon Sep 17 00:00:00 2001
From: SimonFair <39065407+SimonFair@users.noreply.github.com>
Date: Sat, 22 Jul 2023 00:05:45 +0100
Subject: [PATCH 36/40] Disable rebuild button first time after boot.
---
emhttp/plugins/dynamix/SysDrivers.page | 8 +++++--
emhttp/plugins/dynamix/include/SysDrivers.php | 24 ++++++++++++-------
2 files changed, 22 insertions(+), 10 deletions(-)
diff --git a/emhttp/plugins/dynamix/SysDrivers.page b/emhttp/plugins/dynamix/SysDrivers.page
index b071241e2..f4b2ef9c0 100644
--- a/emhttp/plugins/dynamix/SysDrivers.page
+++ b/emhttp/plugins/dynamix/SysDrivers.page
@@ -74,10 +74,12 @@ function showDrivers(options, init = false) {
if (init) {
$('#driversearch').prop('disabled', true);
$('#select').prop('disabled', true);
+ $('#rebuild').prop('disabled', true);
+
$.post('/webGui/include/SysDrivers.php',{table:'t1load',option:"all"},function(data){
clearTimeout(timers.refresh);
$("#t1").trigger("destroy");
- $('#t1').html(data);
+ $('#t1').html(data.html);
$('#t1').tablesorter({
sortList:[[0,0]],
sortAppend:[[0,0]],
@@ -94,7 +96,9 @@ function showDrivers(options, init = false) {
$('div.spinner.fixed').hide('slow');
$('#driversearch').prop('disabled', false);
$('#select').prop('disabled', false);
- });
+ $('#rebuild').prop('disabled', data.init);
+
+ },"json");
} else {
filter = [];
diff --git a/emhttp/plugins/dynamix/include/SysDrivers.php b/emhttp/plugins/dynamix/include/SysDrivers.php
index a32de7a18..9976e7863 100644
--- a/emhttp/plugins/dynamix/include/SysDrivers.php
+++ b/emhttp/plugins/dynamix/include/SysDrivers.php
@@ -25,6 +25,7 @@ $lsmod = shell_exec("lsmod") ;
$supportpage = true;
$modtoplgfile = "/tmp/modulestoplg.json" ;
$sysdrvfile = "/tmp/sysdrivers.json" ;
+$sysdrvinit = "/tmp/sysdrivers.init" ;
if (!is_file($modtoplgfile) || !is_file($sysdrvfile)) { modtoplg() ; createlist() ;}
$arrModtoPlg = json_decode(file_get_contents("/tmp/modulestoplg.json") ,TRUE) ;
@@ -39,8 +40,9 @@ switch ($_POST['table']) {
case 't1load':
$list = file_get_contents($sysdrvfile) ;
$arrModules = json_decode($list,TRUE) ;
- echo "| "._("Driver")." | "._("Description")." | "._("State")." | "._("Type")." | "._("Modprobe.d config file")." |
";
- echo "
" ;
+ $init = file_get_contents($sysdrvinit) ;
+ $html = "| "._("Driver")." | "._("Description")." | "._("State")." | "._("Type")." | "._("Modprobe.d config file")." |
";
+ $html .= "" ;
if (is_array($arrModules)) ksort($arrModules) ;
foreach($arrModules as $modname => $module) {
@@ -55,7 +57,7 @@ switch ($_POST['table']) {
$module['modprobe'] = $modprobe ;
}
- echo "" ;
+ $html .= "
" ;
if ($supportpage) {
if ($module['support'] == false) {
$supporthtml = "" ;
@@ -65,17 +67,23 @@ switch ($_POST['table']) {
$supporthtml = "" ;
}
}
- echo "| $modname$supporthtml | " ;
- echo "{$module['description']} | {$module['state']} | {$module['type']} | ";
+ $html .= "$modname$supporthtml | " ;
+ $html .= "{$module['description']} | {$module['state']} | {$module['type']} | ";
$text = "" ;
if (is_array($module["modprobe"])) {
$text = implode("\n",$module["modprobe"]) ;
- echo " |
";
- } else echo " | ";
+ $html .= " | ";
+ } else $html .= " | ";
}
- echo "" ;
+ $html .= "" ;
+ #if ($init) {unlink($sysdrvinit) ; $init = true ;}
+ $rtn = array() ;
+ $rtn['html'] = $html ;
+ if ($init !== false) {$init = true ; unlink($sysdrvinit) ;}
+ $rtn['init'] = $init ;
+ echo json_encode($rtn) ;
break;
case "update":
From c66026364b4f37952e5247c032048fa2cc4f1ed8 Mon Sep 17 00:00:00 2001
From: SimonFair <39065407+SimonFair@users.noreply.github.com>
Date: Sat, 22 Jul 2023 08:14:21 +0100
Subject: [PATCH 37/40] Fix support icon after system boot
---
emhttp/plugins/dynamix/include/SysDriversHelpers.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/emhttp/plugins/dynamix/include/SysDriversHelpers.php b/emhttp/plugins/dynamix/include/SysDriversHelpers.php
index a3a621e66..6727258b5 100644
--- a/emhttp/plugins/dynamix/include/SysDriversHelpers.php
+++ b/emhttp/plugins/dynamix/include/SysDriversHelpers.php
@@ -140,7 +140,7 @@ function modtoplg() {
}
function createlist() {
- global $modtoplgfile, $sysdrvfile, $lsmod, $kernel,$arrModules, $modplugins ;
+ global $modtoplgfile, $sysdrvfile, $lsmod, $kernel,$arrModules, $modplugins,$arrModtoPlg ;
$arrModtoPlg = json_decode(file_get_contents($modtoplgfile) ,TRUE) ;
$builtinmodules = file_get_contents("/lib/modules/$kernel/modules.builtin") ;
$builtinmodules = explode(PHP_EOL,$builtinmodules) ;
From e7fc92e231afd916a87d760d92413c0307b37189 Mon Sep 17 00:00:00 2001
From: SimonFair <39065407+SimonFair@users.noreply.github.com>
Date: Sun, 23 Jul 2023 08:28:49 +0100
Subject: [PATCH 38/40] Check if rebuild is running.
---
emhttp/plugins/dynamix/include/SysDrivers.php | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/emhttp/plugins/dynamix/include/SysDrivers.php b/emhttp/plugins/dynamix/include/SysDrivers.php
index 9976e7863..9a06aa556 100644
--- a/emhttp/plugins/dynamix/include/SysDrivers.php
+++ b/emhttp/plugins/dynamix/include/SysDrivers.php
@@ -31,10 +31,12 @@ $arrModtoPlg = json_decode(file_get_contents("/tmp/modulestoplg.json") ,TRUE) ;
switch ($_POST['table']) {
- case 't1create':
+ case 't1create':
+ if (is_file("/tmp/sysdrvbuild.running")) break ;
+ touch("/tmp/sysdrvbuild.running") ;
modtoplg() ;
createlist() ;
-
+ unlink("/tmp/sysdrvbuild.running") ;
break;
case 't1load':
From 6a23a3d432d52ffe60bf870bc548c89bd1c5e8f5 Mon Sep 17 00:00:00 2001
From: dlandon
Date: Mon, 24 Jul 2023 17:29:24 -0500
Subject: [PATCH 39/40] Add previous Unraid version to diagnostics version txt
file.
---
emhttp/plugins/dynamix/scripts/diagnostics | 23 ++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/emhttp/plugins/dynamix/scripts/diagnostics b/emhttp/plugins/dynamix/scripts/diagnostics
index 342c745b9..e288050e9 100755
--- a/emhttp/plugins/dynamix/scripts/diagnostics
+++ b/emhttp/plugins/dynamix/scripts/diagnostics
@@ -333,6 +333,29 @@ file_put_contents("/$diag/unraid-".$unraid['version'].".txt",$unraid['version'].
// add bz*.sha256 values
run("tail /boot/bz*.sha256 >> ".escapeshellarg("/$diag/unraid-".$unraid['version'].".txt"));
+// Get the previous version of Unraid from the previous directory on flash
+$changes = '/boot/previous/changes.txt';
+
+if (file_exists($changes)) {
+ exec("head -n4 $changes",$rows);
+ foreach ($rows as $row) {
+ $i = stripos($row, 'version');
+ if ($i !== false) {
+ [$version,$date] = explode(' ', trim(substr($row,$i+7)));
+ break;
+ }
+ }
+ $branch = strpos($version,'rc')!==false ? 'Next' : (strpos($version,'beta')!==false ? 'Beta' : 'Stable');
+
+ $previous_version = "Previous Version: ".$version." ".$branch;
+ file_put_contents("/$diag/unraid-".$unraid['version'].".txt", "\r\n".$previous_version."\r\n", FILE_APPEND);
+
+ $upgraded = "Upgraded on: ".date("F d Y", filemtime($changes));
+ file_put_contents("/$diag/unraid-".$unraid['version'].".txt", $upgraded."\r\n", FILE_APPEND);
+} else {
+ file_put_contents("/$diag/unraid-".$unraid['version'].".txt", "\r\nNo Previous Version Found\r\n", FILE_APPEND);
+}
+
// copy ini variables
foreach (glob("$path/*.ini") as $file) {
$ini = basename($file,".ini");
From ab277ce2036b03027f4b11fcfce4d4bb2e70fbdd Mon Sep 17 00:00:00 2001
From: dlandon
Date: Mon, 24 Jul 2023 18:00:21 -0500
Subject: [PATCH 40/40] Remove branch from previous version.
---
emhttp/plugins/dynamix/scripts/diagnostics | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/emhttp/plugins/dynamix/scripts/diagnostics b/emhttp/plugins/dynamix/scripts/diagnostics
index e288050e9..963d585c0 100755
--- a/emhttp/plugins/dynamix/scripts/diagnostics
+++ b/emhttp/plugins/dynamix/scripts/diagnostics
@@ -345,9 +345,7 @@ if (file_exists($changes)) {
break;
}
}
- $branch = strpos($version,'rc')!==false ? 'Next' : (strpos($version,'beta')!==false ? 'Beta' : 'Stable');
-
- $previous_version = "Previous Version: ".$version." ".$branch;
+ $previous_version = "Previous Version: ".$version;
file_put_contents("/$diag/unraid-".$unraid['version'].".txt", "\r\n".$previous_version."\r\n", FILE_APPEND);
$upgraded = "Upgraded on: ".date("F d Y", filemtime($changes));