From 1de464754fda1cf4a6fc9dd3742e653d7705ac9a Mon Sep 17 00:00:00 2001 From: SimonFair <39065407+SimonFair@users.noreply.github.com> Date: Thu, 6 Jul 2023 17:21:14 +0100 Subject: [PATCH] Modprobe file update. --- emhttp/plugins/dynamix/SysDrivers.page | 23 +++++++++++++++- emhttp/plugins/dynamix/include/SysDrivers.php | 27 +++++++++++-------- 2 files changed, 38 insertions(+), 12 deletions(-) diff --git a/emhttp/plugins/dynamix/SysDrivers.page b/emhttp/plugins/dynamix/SysDrivers.page index 7446d806f..bc9ccfb80 100644 --- a/emhttp/plugins/dynamix/SysDrivers.page +++ b/emhttp/plugins/dynamix/SysDrivers.page @@ -61,13 +61,34 @@ function showDrivers(options) { $.post('/webGui/include/SysDrivers.php',{table:'t1',option:option},function(data){ clearTimeout(timers.refresh); $('#t1').html(data); + $('div.spinner.fixed').hide('slow'); }); } +function textedit(module) { + var i=module ; + $('#text'+module).prop('disabled', false); + $('#save'+module).attr('hidden', false); + $('#text'+module).attr('hidden', false); +} -$('.tabs').append("_(Select View)_:"); +function textsave(module) { + var i=module ; + $('#text'+module).prop('disabled', true); + $('#save'+module).attr('hidden', true); + var x = document.getElementById("text" + module).value; + $.post('/webGui/include/SysDrivers.php',{table:'update',module:module,conf:x},function(data){ + + select = document.getElementById("select").value; + showDrivers(select) ; + var message = "_(System Drivers)_: _(A reboot is required to apply changes)_"; + addRebootNotice(message); + }); +} + +$('.tabs').append("_(Select View)_:");

diff --git a/emhttp/plugins/dynamix/include/SysDrivers.php b/emhttp/plugins/dynamix/include/SysDrivers.php index 74ef59c76..e3f52ee52 100644 --- a/emhttp/plugins/dynamix/include/SysDrivers.php +++ b/emhttp/plugins/dynamix/include/SysDrivers.php @@ -120,14 +120,15 @@ foreach($procmodules as $line) { } - echo ""._("Module/Driver").""._("Description").""._("State").""._("Type").""._("Modeprobe.d config file").""; - + echo ""._("Module/Driver").""._("Description").""._("State").""._("Type").""._("Modeprobe.d config file").""; + 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": @@ -136,18 +137,22 @@ foreach($procmodules as $line) { case "all": break ; } - - echo "$modname{$module['description']}{$module['state']}{$module['type']}"; + if (substr($module['state'],0,9) == "(builtin)") $disable = "disabled" ; else $disable = "" ; + $disable = "disabled" ; + echo " $modname{$module['description']}{$module['state']}{$module['type']}"; + $text = "" ; if (is_array($module["modprobe"])) { - $i = 0 ; - foreach($module["modprobe"] as $line) { - if ($i) echo "$line" ; else echo "$line" ; - $i++ ; - } - } + $text = implode("\n",$module["modprobe"]) ; + echo ""; + } else 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) ; + echo $error ; } ?>