mirror of
https://github.com/unraid/webgui.git
synced 2026-05-04 00:39:32 -05:00
Merge pull request #1439 from bergware/master
Miscellaneous updates and fixes
This commit is contained in:
@@ -314,7 +314,7 @@ if ($method == 'install') {
|
|||||||
copy($xml_file, $lang_file);
|
copy($xml_file, $lang_file);
|
||||||
symlink($lang_file, $link_file);
|
symlink($lang_file, $link_file);
|
||||||
write("language: $lang language pack installed\n");
|
write("language: $lang language pack installed\n");
|
||||||
logger("language: $lang language pack installed");
|
logger("$lang language pack installed");
|
||||||
// run hook scripts for post processing
|
// run hook scripts for post processing
|
||||||
post_hooks();
|
post_hooks();
|
||||||
done(0);
|
done(0);
|
||||||
@@ -396,7 +396,7 @@ if ($method == 'update') {
|
|||||||
copy($xml_file, $lang_file);
|
copy($xml_file, $lang_file);
|
||||||
symlink($lang_file, $link_file);
|
symlink($lang_file, $link_file);
|
||||||
write("language: $lang language pack updated\n");
|
write("language: $lang language pack updated\n");
|
||||||
logger("language: $lang language pack updated");
|
logger("$lang language pack updated");
|
||||||
// run hook scripts for post processing
|
// run hook scripts for post processing
|
||||||
post_hooks();
|
post_hooks();
|
||||||
done(0);
|
done(0);
|
||||||
@@ -423,7 +423,7 @@ if ($method == 'remove') {
|
|||||||
done(1);
|
done(1);
|
||||||
}
|
}
|
||||||
write("language: $lang language pack removed\n");
|
write("language: $lang language pack removed\n");
|
||||||
logger("language: $lang language pack removed");
|
logger("$lang language pack removed");
|
||||||
// run hook scripts for post processing
|
// run hook scripts for post processing
|
||||||
post_hooks();
|
post_hooks();
|
||||||
done(0);
|
done(0);
|
||||||
|
|||||||
@@ -382,12 +382,12 @@ function plugin($method, $plugin_file, &$error) {
|
|||||||
// If file already exists, check the SHA256/MD5 (if supplied)
|
// If file already exists, check the SHA256/MD5 (if supplied)
|
||||||
if (file_exists($name)) {
|
if (file_exists($name)) {
|
||||||
if ($file->SHA256) {
|
if ($file->SHA256) {
|
||||||
logger("plugin: checking: $name - SHA256");
|
logger("checking: $name - SHA256");
|
||||||
if (hash_file('sha256', $name) != $file->SHA256) {
|
if (hash_file('sha256', $name) != $file->SHA256) {
|
||||||
unlink($name);
|
unlink($name);
|
||||||
}
|
}
|
||||||
} elseif ($file->MD5) {
|
} elseif ($file->MD5) {
|
||||||
logger("plugin: checking: $name - MD5");
|
logger("checking: $name - MD5");
|
||||||
if (md5_file($name) != $file->MD5) {
|
if (md5_file($name) != $file->MD5) {
|
||||||
unlink($name);
|
unlink($name);
|
||||||
}
|
}
|
||||||
@@ -396,12 +396,12 @@ function plugin($method, $plugin_file, &$error) {
|
|||||||
// If file already exists, do not overwrite
|
// If file already exists, do not overwrite
|
||||||
//
|
//
|
||||||
if (file_exists($name)) {
|
if (file_exists($name)) {
|
||||||
logger("plugin: skipping: $name already exists");
|
logger("skipping: $name already exists");
|
||||||
} elseif ($file->LOCAL) {
|
} elseif ($file->LOCAL) {
|
||||||
// Create the file
|
// Create the file
|
||||||
//
|
//
|
||||||
// for local file, just copy it
|
// for local file, just copy it
|
||||||
logger("plugin: creating: $name - copying LOCAL file $file->LOCAL");
|
logger("creating: $name - copying LOCAL file $file->LOCAL");
|
||||||
if (!copy($file->LOCAL, $name)) {
|
if (!copy($file->LOCAL, $name)) {
|
||||||
$error = "unable to copy LOCAL file: $name";
|
$error = "unable to copy LOCAL file: $name";
|
||||||
@unlink($name);
|
@unlink($name);
|
||||||
@@ -409,10 +409,10 @@ function plugin($method, $plugin_file, &$error) {
|
|||||||
}
|
}
|
||||||
} elseif ($file->INLINE) {
|
} elseif ($file->INLINE) {
|
||||||
// for inline file, create with inline contents
|
// for inline file, create with inline contents
|
||||||
logger("plugin: creating: $name - from INLINE content");
|
logger("creating: $name - from INLINE content");
|
||||||
$contents = trim($file->INLINE).PHP_EOL;
|
$contents = trim($file->INLINE).PHP_EOL;
|
||||||
if ($file->attributes()->Type == 'base64') {
|
if ($file->attributes()->Type == 'base64') {
|
||||||
logger("plugin: decoding: $name as base64");
|
logger("decoding: $name as base64");
|
||||||
$contents = base64_decode($contents);
|
$contents = base64_decode($contents);
|
||||||
if ($contents === false) {
|
if ($contents === false) {
|
||||||
$error = "unable to decode inline base64: $name";
|
$error = "unable to decode inline base64: $name";
|
||||||
@@ -426,20 +426,20 @@ function plugin($method, $plugin_file, &$error) {
|
|||||||
}
|
}
|
||||||
} elseif ($file->URL) {
|
} elseif ($file->URL) {
|
||||||
// for download file, download and maybe verify the file MD5
|
// for download file, download and maybe verify the file MD5
|
||||||
logger("plugin: creating: $name - downloading from URL $file->URL");
|
logger("creating: $name - downloading from URL $file->URL");
|
||||||
if ( (download($file->URL, $name, $error) === false) && (download(filter_url($file->URL), $name, $error) === false) ) {
|
if ( (download($file->URL, $name, $error) === false) && (download(filter_url($file->URL), $name, $error) === false) ) {
|
||||||
@unlink($name);
|
@unlink($name);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if ($file->SHA256) {
|
if ($file->SHA256) {
|
||||||
logger("plugin: checking: $name - SHA256");
|
logger("checking: $name - SHA256");
|
||||||
if (hash_file('sha256', $name) != $file->SHA256) {
|
if (hash_file('sha256', $name) != $file->SHA256) {
|
||||||
$error = "bad file SHA256: $name";
|
$error = "bad file SHA256: $name";
|
||||||
unlink($name);
|
unlink($name);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} elseif ($file->MD5) {
|
} elseif ($file->MD5) {
|
||||||
logger("plugin: checking: $name - MD5");
|
logger("checking: $name - MD5");
|
||||||
if (md5_file($name) != $file->MD5) {
|
if (md5_file($name) != $file->MD5) {
|
||||||
$error = "bad file MD5: $name";
|
$error = "bad file MD5: $name";
|
||||||
unlink($name);
|
unlink($name);
|
||||||
@@ -452,7 +452,7 @@ function plugin($method, $plugin_file, &$error) {
|
|||||||
if ($file->attributes()->Mode) {
|
if ($file->attributes()->Mode) {
|
||||||
// if file has 'Mode' attribute, apply it
|
// if file has 'Mode' attribute, apply it
|
||||||
$mode = $file->attributes()->Mode;
|
$mode = $file->attributes()->Mode;
|
||||||
logger("plugin: setting: $name - mode to $mode");
|
logger("setting: $name - mode to $mode");
|
||||||
if (!chmod($name, octdec($mode))) {
|
if (!chmod($name, octdec($mode))) {
|
||||||
$error = "chmod failure: $name";
|
$error = "chmod failure: $name";
|
||||||
return false;
|
return false;
|
||||||
@@ -464,13 +464,13 @@ function plugin($method, $plugin_file, &$error) {
|
|||||||
if ($file->attributes()->Run) {
|
if ($file->attributes()->Run) {
|
||||||
$command = $file->attributes()->Run;
|
$command = $file->attributes()->Run;
|
||||||
if ($name) {
|
if ($name) {
|
||||||
logger(escapeshellarg("plugin: running: $command $name"));
|
logger("running: $command $name");
|
||||||
$retval = run("$command $name");
|
$retval = run("$command $name");
|
||||||
} elseif ($file->LOCAL) {
|
} elseif ($file->LOCAL) {
|
||||||
logger(escapeshellarg("plugin: running: $command $file->LOCAL"));
|
logger("running: $command $file->LOCAL");
|
||||||
$retval = run("$command $file->LOCAL");
|
$retval = run("$command $file->LOCAL");
|
||||||
} elseif ($file->INLINE) {
|
} elseif ($file->INLINE) {
|
||||||
logger("plugin: running: 'anonymous'");
|
logger("running: 'anonymous'");
|
||||||
$name = '/tmp/inline.sh';
|
$name = '/tmp/inline.sh';
|
||||||
file_put_contents($name, $file->INLINE);
|
file_put_contents($name, $file->INLINE);
|
||||||
$retval = run("$command $name");
|
$retval = run("$command $name");
|
||||||
@@ -718,7 +718,7 @@ if ($method == 'install') {
|
|||||||
if ($target != $plugin_file) copy($plugin_file, $target);
|
if ($target != $plugin_file) copy($plugin_file, $target);
|
||||||
symlink($target, $symlink);
|
symlink($target, $symlink);
|
||||||
write("plugin: $plugin installed\n");
|
write("plugin: $plugin installed\n");
|
||||||
logger("plugin: $plugin installed");
|
logger("$plugin installed");
|
||||||
} else {
|
} else {
|
||||||
write("script: $plugin executed\n");
|
write("script: $plugin executed\n");
|
||||||
logger("script: $plugin executed");
|
logger("script: $plugin executed");
|
||||||
@@ -835,7 +835,7 @@ if ($method == 'update') {
|
|||||||
copy($plugin_file, $target);
|
copy($plugin_file, $target);
|
||||||
symlink($target, $symlink);
|
symlink($target, $symlink);
|
||||||
write("plugin: $plugin updated\n");
|
write("plugin: $plugin updated\n");
|
||||||
logger("plugin: $plugin updated");
|
logger("$plugin updated");
|
||||||
// run hook scripts for post processing
|
// run hook scripts for post processing
|
||||||
post_hooks();
|
post_hooks();
|
||||||
done(0);
|
done(0);
|
||||||
@@ -867,7 +867,7 @@ if ($method == 'remove') {
|
|||||||
// remove the plugin file
|
// remove the plugin file
|
||||||
move($installed_plugin_file, "$boot-removed");
|
move($installed_plugin_file, "$boot-removed");
|
||||||
write("plugin: $plugin removed\n");
|
write("plugin: $plugin removed\n");
|
||||||
logger("plugin: $plugin removed");
|
logger("$plugin removed");
|
||||||
exec("/usr/local/sbin/update_cron");
|
exec("/usr/local/sbin/update_cron");
|
||||||
// run hook scripts for post processing
|
// run hook scripts for post processing
|
||||||
post_hooks();
|
post_hooks();
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ exec("sed -ri 's/^\.logLine\{color:#......;/.logLine{color:$fgcolor;/' $docroot/
|
|||||||
|
|
||||||
exec("/etc/rc.d/rc.docker status >/dev/null",$dummy,$dockerd);
|
exec("/etc/rc.d/rc.docker status >/dev/null",$dummy,$dockerd);
|
||||||
exec("/etc/rc.d/rc.libvirt status >/dev/null",$dummy,$libvirtd);
|
exec("/etc/rc.d/rc.libvirt status >/dev/null",$dummy,$libvirtd);
|
||||||
|
$domain_cfg = parse_ini_file("/boot/config/domain.cfg");
|
||||||
$dockerd = $dockerd==0;
|
$dockerd = $dockerd==0;
|
||||||
$libvirtd = $libvirtd==0;
|
$libvirtd = $libvirtd==0;
|
||||||
$apcupsd = file_exists('/var/run/apcupsd.pid');
|
$apcupsd = file_exists('/var/run/apcupsd.pid');
|
||||||
@@ -816,30 +817,21 @@ if ($.cookie('port_select')!=null && !ports.includes($.cookie('port_select'))) $
|
|||||||
var port_select = $.cookie('port_select')||ports[0];
|
var port_select = $.cookie('port_select')||ports[0];
|
||||||
|
|
||||||
function selectsnapshot(uuid, name ,snaps, opt, getlist){
|
function selectsnapshot(uuid, name ,snaps, opt, getlist){
|
||||||
|
|
||||||
var root = <?= '"'.$domain_cfg["MEDIADIR"].'"';?>;
|
var root = <?= '"'.$domain_cfg["MEDIADIR"].'"';?>;
|
||||||
var match= ".iso";
|
var match= ".iso";
|
||||||
var box = $("#dialogWindow2");
|
var box = $("#dialogWindow2");
|
||||||
box.html($("#templatesnapshot"+opt).html());
|
box.html($("#templatesnapshot"+opt).html());
|
||||||
var height = 200;
|
var height = 200;
|
||||||
const Capopt = opt.charAt(0).toUpperCase() + opt.slice(1) ;
|
const Capopt = opt.charAt(0).toUpperCase() + opt.slice(1);
|
||||||
var optiontext = Capopt + " Snapshot" ;
|
var optiontext = Capopt + " Snapshot";
|
||||||
box.find('#VMName').html(name) ;
|
box.find('#VMName').html(name);
|
||||||
box.find('#targetsnap').val(snaps) ;
|
box.find('#targetsnap').val(snaps);
|
||||||
box.find('#targetsnapl').html(snaps) ;
|
box.find('#targetsnapl').html(snaps);
|
||||||
if (getlist) {
|
if (getlist) {
|
||||||
var only = 1 ;
|
var only = (opt == "remove") ? 0 : 1;
|
||||||
if (opt == "remove") only = 0;
|
$.post("/plugins/dynamix.vm.manager/include/VMajax.php", {action:"snap-images", uuid:uuid, snapshotname:snaps, only:only}, function(data){if (data.html) box.find('#targetsnapimages').html(data.html);},'json');
|
||||||
$.post("/plugins/dynamix.vm.manager/include/VMajax.php", {action:"snap-images", uuid:uuid , snapshotname:snaps, only:only}, function(data) {
|
|
||||||
if (data.html) {
|
|
||||||
box.find('#targetsnapimages').html(data.html) ;
|
|
||||||
}
|
|
||||||
},'json');
|
|
||||||
}
|
}
|
||||||
|
document.getElementById("targetsnapfspc").checked = true;
|
||||||
|
|
||||||
document.getElementById("targetsnapfspc").checked = true ;
|
|
||||||
|
|
||||||
box.dialog({
|
box.dialog({
|
||||||
title: "_("+optiontext+ ")_",
|
title: "_("+optiontext+ ")_",
|
||||||
resizable: false,
|
resizable: false,
|
||||||
@@ -848,34 +840,29 @@ function selectsnapshot(uuid, name ,snaps, opt, getlist){
|
|||||||
modal: true,
|
modal: true,
|
||||||
show: {effect:'fade', duration:250},
|
show: {effect:'fade', duration:250},
|
||||||
hide: {effect:'fade', duration:250},
|
hide: {effect:'fade', duration:250},
|
||||||
|
|
||||||
buttons: {
|
buttons: {
|
||||||
"_(Proceed)_": function(){
|
"_(Proceed)_": function(){
|
||||||
var target = box.find('#targetsnap');
|
var target = box.find('#targetsnap');
|
||||||
if (target.length) {
|
if (target.length) {
|
||||||
target = target.val();
|
target = target.val();
|
||||||
if (!target ) {errorTarget(); return;}
|
if (!target) {errorTarget(); return;}
|
||||||
} else target = '';
|
} else target = '';
|
||||||
var remove = 'yes'
|
var remove = 'yes';
|
||||||
var keep = 'yes'
|
var removemeta = 'yes';
|
||||||
var removemeta = 'yes'
|
var keep = 'yes';
|
||||||
var free = 'yes'
|
var free = 'yes';
|
||||||
var desc = ''
|
var desc = '';
|
||||||
box.find('#targetsnap').prop('disabled',true);
|
box.find('#targetsnap').prop('disabled',true);
|
||||||
if (opt == "revert") {
|
if (opt == "revert") {
|
||||||
const x = box.find('#targetsnaprmv').prop('checked') ;
|
remove = box.find('#targetsnaprmv').prop('checked') ? 'yes' : 'no';
|
||||||
if (x) remove = 'yes' ; else remove = 'no' ;
|
removemeta = box.find('#targetsnaprmvmeta').prop('checked') ? 'yes' : 'no';
|
||||||
x = box.find('#targetsnaprmvmeta').prop('checked') ;
|
keep = box.find('#targetsnapkeep').prop('checked') ? 'yes' : 'no';
|
||||||
if (x) removemeta = 'yes' ; else removemeta = 'no' ;
|
|
||||||
x = box.find('#targetsnapkeep').prop('checked') ;
|
|
||||||
if (x) keep = 'yes' ; else keep = 'no' ;
|
|
||||||
}
|
}
|
||||||
if (opt == "create") {
|
if (opt == "create") {
|
||||||
const x = box.find('#targetsnapfspc').prop('checked') ;
|
free = box.find('#targetsnapfspc').prop('checked') ? 'yes' : 'no';
|
||||||
if (x) free = 'yes' ; else free = 'no' ;
|
desc = box.find("#targetsnapdesc").prop('value');
|
||||||
var desc = box.find("#targetsnapdesc").prop('value') ;
|
|
||||||
}
|
}
|
||||||
ajaxVMDispatch({action:"snap-" + opt +'-external', uuid:uuid , snapshotname:target , remove:remove, free:free, desc:desc } , "loadlist");
|
ajaxVMDispatch({action:"snap-" + opt +'-external', uuid:uuid, snapshotname:target, remove:remove, free:free, desc:desc}, "loadlist");
|
||||||
box.dialog('close');
|
box.dialog('close');
|
||||||
},
|
},
|
||||||
"_(Cancel)_": function(){
|
"_(Cancel)_": function(){
|
||||||
@@ -1583,7 +1570,6 @@ $(function() {
|
|||||||
$('.ui-button-text').css({'padding':'0px 5px'});
|
$('.ui-button-text').css({'padding':'0px 5px'});
|
||||||
}
|
}
|
||||||
function VMClone(uuid, name){
|
function VMClone(uuid, name){
|
||||||
|
|
||||||
//var root = <?= '"'.$domain_cfg["MEDIADIR"].'"';?>;
|
//var root = <?= '"'.$domain_cfg["MEDIADIR"].'"';?>;
|
||||||
var match= ".iso";
|
var match= ".iso";
|
||||||
var box = $("#dialogWindow");
|
var box = $("#dialogWindow");
|
||||||
@@ -1603,24 +1589,19 @@ function VMClone(uuid, name){
|
|||||||
show: {effect:'fade', duration:250},
|
show: {effect:'fade', duration:250},
|
||||||
hide: {effect:'fade', duration:250},
|
hide: {effect:'fade', duration:250},
|
||||||
buttons: {
|
buttons: {
|
||||||
"_(Clone)_" : function(){
|
"_(Clone)_": function(){
|
||||||
var target = box.find('#target');
|
var target = box.find('#target');
|
||||||
if (target.length) {
|
if (target.length) {
|
||||||
target = target.val();
|
target = target.val();
|
||||||
//if (!target ) {errorTarget(); return;}
|
//if (!target ) {errorTarget(); return;}
|
||||||
} else target = '';
|
} else target = '';
|
||||||
|
var clone = box.find("#target").prop('value');
|
||||||
var clone = box.find("#target").prop('value') ;
|
var start = box.find('#Start').prop('checked') ? 'yes' : 'no';
|
||||||
x = box.find('#Start').prop('checked') ;
|
var edit = box.find('#Edit').prop('checked') ? 'yes' : 'no';
|
||||||
if (x) start = 'yes' ; else start = 'no' ;
|
var overwrite = box.find('#Overwrite').prop('checked') ? 'yes' : 'no';
|
||||||
x = box.find('#Edit').prop('checked') ;
|
var free = box.find('#Free').prop('checked') ? 'yes' : 'no';
|
||||||
if (x) edit = 'yes' ; else edit = 'no' ;
|
var scripturl = "VMClone.php " + encodeURIComponent("/usr/local/emhttp/plugins/dynamix.vm.manager/include/VMClone.php&" + $.param({action:"clone", name:name, clone:clone, overwrite:overwrite, edit:edit, start:start, free:free}));
|
||||||
x = box.find('#Overwrite').prop('checked') ;
|
openVMAction((scripturl),"VM Clone", "dynamix.vm.manager", "loadlist");
|
||||||
if (x) overwrite = 'yes' ; else overwrite = 'no' ;
|
|
||||||
x = box.find('#Free').prop('checked') ;
|
|
||||||
if (x) free = 'yes' ; else free = 'no' ;
|
|
||||||
scripturl = "VMClone.php " + encodeURIComponent("/usr/local/emhttp/plugins/dynamix.vm.manager/include/VMClone.php&" + $.param({action:"clone" , name:name ,clone:clone, overwrite:overwrite , edit:edit, start,start, free:free})) ;
|
|
||||||
openVMAction((scripturl),"VM Clone", "dynamix.vm.manager", "loadlist") ;
|
|
||||||
box.dialog('close');
|
box.dialog('close');
|
||||||
},
|
},
|
||||||
"_(Cancel)_": function(){
|
"_(Cancel)_": function(){
|
||||||
|
|||||||
@@ -14,59 +14,20 @@ Tag="server"
|
|||||||
* The above copyright notice and this permission notice shall be included in
|
* The above copyright notice and this permission notice shall be included in
|
||||||
* all copies or substantial portions of the Software.
|
* all copies or substantial portions of the Software.
|
||||||
*/
|
*/
|
||||||
global $var ;
|
|
||||||
$theme = $display['theme'] ;
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
table.t1{margin-top:0; border-collapse: collapse; border-spacing: 0;}
|
table.t1{margin-top:0; border-collapse: collapse; border-spacing: 0;}
|
||||||
table tr td{padding:0 0 3px 0;margin:0}
|
table.t1 tr td{padding:0 0 3px 0;margin:0}
|
||||||
table tr td.thin{line-height:8px;height:8px}
|
table.t1 tr td.thin{line-height:8px;height:8px}
|
||||||
table.t1 tr>td{width: 1%; ; text-align:centre ;white-space: nowrap;}
|
table.t1 tr>td{width:1%;text-align:centre;white-space: nowrap}
|
||||||
table.t1 tr>td+td{width: 1%; white-space: nowrap; }
|
table.t1 tr>td+td{width:1%;white-space:nowrap}
|
||||||
table.t1 tr>td+td+td{width:auto ; text-align:left;}
|
table.t1 tr>td+td+td{width:auto;text-align:left}
|
||||||
table.t1 tr>td+td+td+td{text-align:left;}
|
table.t1 tr>td+td+td+td{text-align:left}
|
||||||
table.t1 tr>td+td+td+td+td{text-align:left;}
|
table.t1 tr>td+td+td+td+td{text-align:left}
|
||||||
table.t1 tr>td+td+td+td+td+td{text-align:left;}
|
.t1.tablesorter .filtered{display:none}
|
||||||
table.t1 tr>td+td+td+td+td+td{text-align:left;}
|
|
||||||
table.t1 tr>td+td+td+td+td+td+td{text-align:left;}
|
|
||||||
table.t1 tr>td+td+td+td+td+td+td+td{text-align:left;}
|
|
||||||
table.t1 tr>td+td+td+td+td+td+td+td+td{text-align:left;}
|
|
||||||
table.t1 tr>td+td+td+td+td+td+td+td+td+td{text-align:left;}
|
|
||||||
table.t1 tr>td+td+td+td+td+td+td+td+td+td+td{text-align:left;}
|
|
||||||
table.t1 tr>td+td+td+td+td+td+td+td+td+td+td+td{text-align:left;}
|
|
||||||
table.t1 tr>td+td+td+td+td+td+td+td+td+td+td+td+td{text-align:left;}
|
|
||||||
.tablesorter .filtered {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
<?if ($theme == "black"):?>
|
|
||||||
table.tablesorter tbody tr.alt-row {background-color:#212121;}
|
|
||||||
table.tablesorter tbody tr.normal-row {background-color:#1c1b1b;}
|
|
||||||
input.search {color:#f2f2f2;background-color:#1c1b1b;}
|
|
||||||
<?endif;?>
|
|
||||||
<?if ($theme == "white"):?>
|
|
||||||
table.tablesorter tbody tr.alt-row {background-color:#ededed;}
|
|
||||||
table.tablesorter tbody tr.normal-row {background-color:#f2f2f2;}
|
|
||||||
input.search {color:#1c1b1b;background-color:#f2f2f2;}
|
|
||||||
<?endif;?>
|
|
||||||
<?if ($theme == "gray"):?>
|
|
||||||
table.tablesorter tbody tr.alt-row {solid #0c0f0b;}
|
|
||||||
table.tablesorter tbody tr.normal-row {background-color:#1b1d1b;}
|
|
||||||
input.search {color:#606e7f;background-color:#1b1d1b;}
|
|
||||||
table.tablesorter thead th {color:#606e7f;background-color:#1b1d1b;}
|
|
||||||
div.tablesorter-header-inner {color:#606e7f;background-color:#1b1d1b;}
|
|
||||||
<?endif;?>
|
|
||||||
<?if ($theme == "azure"):?>
|
|
||||||
table.tablesorter tbody tr.alt-row {background-color:#e4e2e4; }
|
|
||||||
table.tablesorter tbody tr.normal-row {solid #f3f0f4;}
|
|
||||||
input.search {color:#606e7f;background-color:#e4e2e4;}
|
|
||||||
table.tablesorter thead th {color:#606e7f;background-color:#e4e2e4;}
|
|
||||||
div.tablesorter-header-inner {color:#606e7f;background-color:#e4e2e4;}
|
|
||||||
<?endif;?>
|
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
<script type="text/javascript" src="/webGui/javascript/jquery.tablesorter.widgets.js"></script>
|
|
||||||
|
|
||||||
|
<script type="text/javascript" src="/webGui/javascript/jquery.tablesorter.widgets.js"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
function showDrivers(options, init = false) {
|
function showDrivers(options, init = false) {
|
||||||
@@ -75,36 +36,32 @@ function showDrivers(options, init = false) {
|
|||||||
$('#driversearch').prop('disabled', true);
|
$('#driversearch').prop('disabled', true);
|
||||||
$('#select').prop('disabled', true);
|
$('#select').prop('disabled', true);
|
||||||
$('#rebuild').prop('disabled', true);
|
$('#rebuild').prop('disabled', true);
|
||||||
|
|
||||||
$.post('/webGui/include/SysDrivers.php',{table:'t1load',option:"all"},function(data){
|
$.post('/webGui/include/SysDrivers.php',{table:'t1load',option:"all"},function(data){
|
||||||
clearTimeout(timers.refresh);
|
clearTimeout(timers.refresh);
|
||||||
$("#t1").trigger("destroy");
|
$("#t1").trigger("destroy");
|
||||||
$('#t1').html(data.html);
|
$('#t1').html(data.html);
|
||||||
$('#t1').tablesorter({
|
$('#t1').tablesorter({
|
||||||
sortList:[[0,0]],
|
sortList:[[0,0]],
|
||||||
sortAppend:[[0,0]],
|
sortAppend:[[0,0]],
|
||||||
widgets: ['stickyHeaders','filter', 'zebra'],
|
widgets: ['stickyHeaders','filter', 'zebra'],
|
||||||
widgetOptions: {
|
widgetOptions: {
|
||||||
// on black and white, offset is height of #menu
|
// on black and white, offset is height of #menu
|
||||||
// on azure and gray, offset is height of #header
|
// on azure and gray, offset is height of #header
|
||||||
stickyHeaders_offset: ( $('#menu').height() < 50 ) ? $('#menu').height() : $('#header').height(),
|
stickyHeaders_offset: ( $('#menu').height() < 50 ) ? $('#menu').height() : $('#header').height(),
|
||||||
filter_columnFilters: false,
|
filter_columnFilters: false,
|
||||||
zebra : [ "normal-row", "alt-row" ]
|
zebra : [ "normal-row", "alt-row" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
$('div.spinner.fixed').hide('slow');
|
$('div.spinner.fixed').hide('slow');
|
||||||
$('#driversearch').prop('disabled', false);
|
$('#driversearch').prop('disabled', false);
|
||||||
$('#select').prop('disabled', false);
|
$('#select').prop('disabled', false);
|
||||||
$('#rebuild').prop('disabled', data.init);
|
$('#rebuild').prop('disabled', data.init);
|
||||||
|
|
||||||
},"json");
|
},"json");
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
filter = [];
|
filter = [];
|
||||||
filterDrivers() ;
|
filterDrivers() ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function filterDrivers() {
|
function filterDrivers() {
|
||||||
var totalColumns = $('#t1')[0].config.columns;
|
var totalColumns = $('#t1')[0].config.columns;
|
||||||
@@ -124,7 +81,7 @@ function showDriversupdate() {
|
|||||||
$('#rebuild').prop('disabled', false);
|
$('#rebuild').prop('disabled', false);
|
||||||
showDrivers("all",true) ;
|
showDrivers("all",true) ;
|
||||||
$('div.spinner.fixed').hide('slow');
|
$('div.spinner.fixed').hide('slow');
|
||||||
}) ;
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function textedit(module) {
|
function textedit(module) {
|
||||||
@@ -132,11 +89,9 @@ function textedit(module) {
|
|||||||
$('#text'+module).prop('disabled', false);
|
$('#text'+module).prop('disabled', false);
|
||||||
$('#save'+module).attr('hidden', false);
|
$('#save'+module).attr('hidden', false);
|
||||||
$('#text'+module).attr('hidden', false);
|
$('#text'+module).attr('hidden', false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function removecfg(module)
|
function removecfg(module) {
|
||||||
{
|
|
||||||
swal({title:"_(Proceed)_?",text:"_(Remove custom modprobe.d configuration?)_: "+module,type:'warning',html:true,showCancelButton:true,confirmButtonText:"_(Proceed)_",cancelButtonText:"_(Cancel)_"},function(p){if (p) textsave(module, true); else return false;});
|
swal({title:"_(Proceed)_?",text:"_(Remove custom modprobe.d configuration?)_: "+module,type:'warning',html:true,showCancelButton:true,confirmButtonText:"_(Proceed)_",cancelButtonText:"_(Cancel)_"},function(p){if (p) textsave(module, true); else return false;});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -146,7 +101,7 @@ function textsave(module,remove = false) {
|
|||||||
$('#save'+module).attr('hidden', true);
|
$('#save'+module).attr('hidden', true);
|
||||||
var x = (remove) ? "" : document.getElementById("text" + module).value;
|
var x = (remove) ? "" : document.getElementById("text" + module).value;
|
||||||
$.post('/webGui/include/SysDrivers.php',{table:'update',module:module,conf:x},function(data){
|
$.post('/webGui/include/SysDrivers.php',{table:'update',module:module,conf:x},function(data){
|
||||||
if(data) {
|
if (data) {
|
||||||
formHasUnsavedChanges=false;
|
formHasUnsavedChanges=false;
|
||||||
$('#text'+module).val(data.modprobe) ;
|
$('#text'+module).val(data.modprobe) ;
|
||||||
$('#status'+module).html(data.state) ;
|
$('#status'+module).html(data.state) ;
|
||||||
@@ -159,24 +114,22 @@ function textsave(module,remove = false) {
|
|||||||
if (data.supportpage == true) {
|
if (data.supportpage == true) {
|
||||||
if (data.support == true) {
|
if (data.support == true) {
|
||||||
document.getElementById("link" + module).innerHTML = "<a href='" + data.supporturl + "'target='_blank'><i title='" + _("Support page")_ + "' class='fa fa-phone-square'></i></a>" ;
|
document.getElementById("link" + module).innerHTML = "<a href='" + data.supporturl + "'target='_blank'><i title='" + _("Support page")_ + "' class='fa fa-phone-square'></i></a>" ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$('#t1').trigger("updateCell",[document.getElementById('text'+module), false, null]);
|
$('#t1').trigger("updateCell",[document.getElementById('text'+module), false, null]);
|
||||||
$('#t1').trigger("updateCell",[document.getElementById('status'+module), false, null]);
|
$('#t1').trigger("updateCell",[document.getElementById('status'+module), false, null]);
|
||||||
var message = "_(System Drivers)_: _(A reboot is required to apply changes)_";
|
var message = "_(System Drivers)_: _(A reboot is required to apply changes)_";
|
||||||
addRebootNotice(message);
|
addRebootNotice(message);
|
||||||
},"json");
|
},"json");
|
||||||
}
|
}
|
||||||
|
|
||||||
$('.tabs').append("<span class='status'><span class='lite label'>_(Select View)_:</span><select id='select' onchange='showDrivers(this.value)'><option value='all' >All Drivers</option><option value='inuse' selected >Inuse Drivers</option></select>");
|
$('.tabs').append("<span class='status'><span class='lite label'>_(Select View)_:</span><select id='select' onchange='showDrivers(this.value)'><option value='all' >All Drivers</option><option value='inuse' selected >Inuse Drivers</option></select>");
|
||||||
showDrivers("all",true) ;
|
showDrivers("all",true) ;
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
:sysdrivers_intro_help:
|
:sysdrivers_intro_help:
|
||||||
|
|
||||||
<form autocomplete="off" onsubmit="return false;"><span><input class="search" id="driversearch" type="search" placeholder="Search..." onchange="filterDrivers();"></span></form>
|
<form autocomplete="off" onsubmit="return false;"><span><input class="t1 search" id="driversearch" type="search" placeholder="Search..." onchange="filterDrivers();"></span></form>
|
||||||
<pre><form id="sysdrivers" class="js-confirm-leave" onsubmit="return false"><table id='t1' class="t1 disk_status tablesorter " ><tr><td><div class="spinner"></div></td></tr></table></form></pre><br>
|
<pre><form id="sysdrivers" class="js-confirm-leave" onsubmit="return false"><table id='t1' class="t1 disk_status tablesorter"><tr><td><div class="spinner"></div></td></tr></table></form></pre><br>
|
||||||
<input type="button" value="_(Done)_" onclick="done()"><input type="button" id="rebuild" value="_(Rebuild Modules)_" onclick="showDriversupdate()">
|
<input type="button" value="_(Done)_" onclick="done()"><input type="button" id="rebuild" value="_(Rebuild Modules)_" onclick="showDriversupdate()">
|
||||||
|
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ $dnsserver = _var($$ethX,'DNS_SERVER1');
|
|||||||
|
|
||||||
$link = iflink($ethX);
|
$link = iflink($ethX);
|
||||||
$postUp0 = "$script add $link WireGuard-<wg> $server <port> <port> udp";
|
$postUp0 = "$script add $link WireGuard-<wg> $server <port> <port> udp";
|
||||||
$postUp1 = "logger -t wireguard -- \"Tunnel WireGuard-<wg> started\";$services";
|
$postUp1 = "logger -t wireguard -- 'Tunnel WireGuard-<wg> started';$services";
|
||||||
$postUp2 = "iptables -t nat -A POSTROUTING -s <source> -o $link -j MASQUERADE";
|
$postUp2 = "iptables -t nat -A POSTROUTING -s <source> -o $link -j MASQUERADE";
|
||||||
$postUp3 = "iptables -N WIREGUARD_DROP_<WG>;iptables -A WIREGUARD -o $link -j WIREGUARD_DROP_<WG>";
|
$postUp3 = "iptables -N WIREGUARD_DROP_<WG>;iptables -A WIREGUARD -o $link -j WIREGUARD_DROP_<WG>";
|
||||||
$postUpX = "iptables -A WIREGUARD_DROP_<WG> -s <source> -d <target> -j DROP";
|
$postUpX = "iptables -A WIREGUARD_DROP_<WG> -s <source> -d <target> -j DROP";
|
||||||
@@ -149,7 +149,7 @@ $postUp36 = "ip6tables -N WIREGUARD_DROP_<WG>;ip6tables -A WIREGUARD -o $link -
|
|||||||
$postUpX6 = "ip6tables -A WIREGUARD_DROP_<WG> -s <source> -d <target> -j DROP";
|
$postUpX6 = "ip6tables -A WIREGUARD_DROP_<WG> -s <source> -d <target> -j DROP";
|
||||||
$postUpZ6 = "ip6tables -A WIREGUARD_DROP_<WG> -s <source> -j ACCEPT;ip6tables -A WIREGUARD_DROP_<WG> -j RETURN";
|
$postUpZ6 = "ip6tables -A WIREGUARD_DROP_<WG> -s <source> -j ACCEPT;ip6tables -A WIREGUARD_DROP_<WG> -j RETURN";
|
||||||
$postDown0 = "$script del $link <port> udp";
|
$postDown0 = "$script del $link <port> udp";
|
||||||
$postDown1 = "logger -t wireguard -- \"Tunnel WireGuard-<wg> stopped\";$services";
|
$postDown1 = "logger -t wireguard -- 'Tunnel WireGuard-<wg> stopped';$services";
|
||||||
$postDown2 = "iptables -t nat -D POSTROUTING -s <source> -o $link -j MASQUERADE";
|
$postDown2 = "iptables -t nat -D POSTROUTING -s <source> -o $link -j MASQUERADE";
|
||||||
$postDown3 = "iptables -F WIREGUARD_DROP_<WG>;iptables -D WIREGUARD -o $link -j WIREGUARD_DROP_<WG>;iptables -X WIREGUARD_DROP_<WG>";
|
$postDown3 = "iptables -F WIREGUARD_DROP_<WG>;iptables -D WIREGUARD -o $link -j WIREGUARD_DROP_<WG>;iptables -X WIREGUARD_DROP_<WG>";
|
||||||
$postDown26= "ip6tables -t nat -D POSTROUTING -s <source> -o $link -j MASQUERADE";
|
$postDown26= "ip6tables -t nat -D POSTROUTING -s <source> -o $link -j MASQUERADE";
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ while IFS='\n' read -r net; do
|
|||||||
[[ -n $net4 ]] && nets+=("$net4 = $net;")
|
[[ -n $net4 ]] && nets+=("$net4 = $net;")
|
||||||
done <<< $(ip -br -4 addr|awk '/^(br|bond|eth|wg)[0-9]+(\.[0-9]+)?/ {print $3}'|uniq -d)
|
done <<< $(ip -br -4 addr|awk '/^(br|bond|eth|wg)[0-9]+(\.[0-9]+)?/ {print $3}'|uniq -d)
|
||||||
|
|
||||||
while IFS='\n' read -r net; do
|
while IFS=$'\n' read -r net; do
|
||||||
net=${net%/*}
|
net=${net%/*}
|
||||||
net6=$(ip -br -6 addr show to $net 2>/dev/null|awk '$1 !~ "^shim" {print $1}'|tr '\n' ','|sed 's/,$//')
|
net6=$(ip -br -6 addr show to $net 2>/dev/null|awk '$1 !~ "^shim" {print $1}'|tr '\n' ','|sed 's/,$//')
|
||||||
[[ -n $net6 ]] && nets+=("$net6 = $net;")
|
[[ -n $net6 ]] && nets+=("$net6 = $net;")
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ lock=/tmp/atlock.tmp
|
|||||||
# run & log functions
|
# run & log functions
|
||||||
. /etc/rc.d/rc.runlog
|
. /etc/rc.d/rc.runlog
|
||||||
|
|
||||||
log "${1:-1}s"
|
log "delay = ${1:-1}s"
|
||||||
rm -f $lock
|
rm -f $lock
|
||||||
echo "sleep ${1:-1};/usr/local/emhttp/webGui/scripts/reload_services $lock"|at -M now 2>/dev/null
|
echo "sleep ${1:-1};/usr/local/emhttp/webGui/scripts/reload_services $lock"|at -M now 2>/dev/null
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
@@ -88,6 +88,11 @@ table.tablesorter.indexer thead tr>th+th{width:auto;text-align:left}
|
|||||||
table.tablesorter.indexer thead tr>th+th+th{width:14%}
|
table.tablesorter.indexer thead tr>th+th+th{width:14%}
|
||||||
table.tablesorter.indexer tfoot td{padding-top:10px;font-size:1.1rem}
|
table.tablesorter.indexer tfoot td{padding-top:10px;font-size:1.1rem}
|
||||||
table.tablesorter.indexer tfoot tr{border-bottom:none}
|
table.tablesorter.indexer tfoot tr{border-bottom:none}
|
||||||
|
table.t1.tablesorter thead th{color:#606e7f;background-color:#e4e2e4}
|
||||||
|
table.t1.tablesorter tbody tr.alt-row{background-color:#e4e2e4}
|
||||||
|
table.t1.tablesorter tbody tr.normal-row{solid #f3f0f4}
|
||||||
|
div.tablesorter-header-inner {color:#606e7f;background-color:#e4e2e4;}
|
||||||
|
input.t1.search{color:#606e7f;background-color:#e4e2e4}
|
||||||
span.select ul{display:none;list-style-type:none;margin:0 0 2px 0;padding:0}
|
span.select ul{display:none;list-style-type:none;margin:0 0 2px 0;padding:0}
|
||||||
span.select ul.unused{display:block}
|
span.select ul.unused{display:block}
|
||||||
span.select ul li.nosort{font-weight:bold}
|
span.select ul li.nosort{font-weight:bold}
|
||||||
|
|||||||
@@ -88,6 +88,9 @@ table.tablesorter.indexer thead th,table.tablesorter.indexer tbody td,table.tabl
|
|||||||
table.tablesorter.indexer thead tr>th+th{width:auto;text-align:left}
|
table.tablesorter.indexer thead tr>th+th{width:auto;text-align:left}
|
||||||
table.tablesorter.indexer thead tr>th+th+th{width:14%}
|
table.tablesorter.indexer thead tr>th+th+th{width:14%}
|
||||||
table.tablesorter.indexer tfoot td{padding-top:10px;font-size:1.1rem}
|
table.tablesorter.indexer tfoot td{padding-top:10px;font-size:1.1rem}
|
||||||
|
table.t1.tablesorter tbody tr.alt-row{background-color:#212121}
|
||||||
|
table.t1.tablesorter tbody tr.normal-row{background-color:#1c1b1b}
|
||||||
|
input.t1.search{color:#f2f2f2;background-color:#1c1b1b}
|
||||||
span.select ul{display:none;list-style-type:none;margin:0 0 2px 0;padding:0}
|
span.select ul{display:none;list-style-type:none;margin:0 0 2px 0;padding:0}
|
||||||
span.select ul.unused{display:block}
|
span.select ul.unused{display:block}
|
||||||
span.select ul li.nosort{font-weight:bold}
|
span.select ul li.nosort{font-weight:bold}
|
||||||
|
|||||||
@@ -88,6 +88,11 @@ table.tablesorter.indexer thead tr>th+th{width:auto;text-align:left}
|
|||||||
table.tablesorter.indexer thead tr>th+th+th{width:14%}
|
table.tablesorter.indexer thead tr>th+th+th{width:14%}
|
||||||
table.tablesorter.indexer tfoot td{padding-top:10px;font-size:1.1rem}
|
table.tablesorter.indexer tfoot td{padding-top:10px;font-size:1.1rem}
|
||||||
table.tablesorter.indexer tfoot tr{border-bottom:none}
|
table.tablesorter.indexer tfoot tr{border-bottom:none}
|
||||||
|
table.t1.tablesorter thead th{color:#606e7f;background-color:#1b1d1b}
|
||||||
|
table.t1.tablesorter tbody tr.alt-row{solid #0c0f0b}
|
||||||
|
table.t1.tablesorter tbody tr.normal-row{background-color:#1b1d1b}
|
||||||
|
div.tablesorter-header-inner {color:#606e7f;background-color:#1b1d1b;}
|
||||||
|
input.t1.search{color:#606e7f;background-color:#1b1d1b}
|
||||||
span.select ul{display:none;list-style-type:none;margin:0 0 2px 0;padding:0}
|
span.select ul{display:none;list-style-type:none;margin:0 0 2px 0;padding:0}
|
||||||
span.select ul.unused{display:block}
|
span.select ul.unused{display:block}
|
||||||
span.select ul li.nosort{font-weight:bold}
|
span.select ul li.nosort{font-weight:bold}
|
||||||
|
|||||||
@@ -88,6 +88,9 @@ table.tablesorter.indexer thead th,table.tablesorter.indexer tbody td,table.tabl
|
|||||||
table.tablesorter.indexer thead tr>th+th{width:auto;text-align:left}
|
table.tablesorter.indexer thead tr>th+th{width:auto;text-align:left}
|
||||||
table.tablesorter.indexer thead tr>th+th+th{width:14%}
|
table.tablesorter.indexer thead tr>th+th+th{width:14%}
|
||||||
table.tablesorter.indexer tfoot td{padding-top:10px;font-size:1.1rem}
|
table.tablesorter.indexer tfoot td{padding-top:10px;font-size:1.1rem}
|
||||||
|
table.t1.tablesorter tbody tr.alt-row{background-color:#ededed}
|
||||||
|
table.t1.tablesorter tbody tr.normal-row{background-color:#f2f2f2}
|
||||||
|
input.t1.search{color:#1c1b1b;background-color:#f2f2f2}
|
||||||
span.select ul{display:none;list-style-type:none;margin:0 0 2px 0;padding:0}
|
span.select ul{display:none;list-style-type:none;margin:0 0 2px 0;padding:0}
|
||||||
span.select ul.unused{display:block}
|
span.select ul.unused{display:block}
|
||||||
span.select ul li.nosort{font-weight:bold}
|
span.select ul li.nosort{font-weight:bold}
|
||||||
|
|||||||
+16
-13
@@ -1,13 +1,16 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
#
|
#
|
||||||
# rc.4 This file is executed by init(8) when the system is being
|
# script: rc.4
|
||||||
# initialized for run level 4 (XDM)
|
|
||||||
#
|
#
|
||||||
# Version: @(#)/etc/rc.d/rc.4 2.00 02/17/93
|
# This file is executed by init(8) when the system is being initialized for run level 4 (XDM)
|
||||||
#
|
#
|
||||||
# Author: Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
|
# Version: 2.00 02/17/93
|
||||||
# At least 47% rewritten by: Patrick J. Volkerding <volkerdi@slackware.com>
|
|
||||||
#
|
#
|
||||||
|
# Author: Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
|
||||||
|
# At least 47% rewritten by: Patrick J. Volkerding <volkerdi@slackware.com>
|
||||||
|
#
|
||||||
|
# LimeTech - modified for Unraid OS
|
||||||
|
# Bergware - modified for Unraid OS, October 2023
|
||||||
|
|
||||||
# Tell the viewers what's going to happen...
|
# Tell the viewers what's going to happen...
|
||||||
echo "Starting up X11 session manager..."
|
echo "Starting up X11 session manager..."
|
||||||
@@ -15,39 +18,39 @@ echo "Starting up X11 session manager..."
|
|||||||
# If you'd like to start something different or in a different order than
|
# If you'd like to start something different or in a different order than
|
||||||
# the options below, create your own startup script /etc/rc.d/rc.4.local
|
# the options below, create your own startup script /etc/rc.d/rc.4.local
|
||||||
# and make it executable and it will be used instead:
|
# and make it executable and it will be used instead:
|
||||||
if [ -x /etc/rc.d/rc.4.local ]; then
|
if [[ -x /etc/rc.d/rc.4.local ]]; then
|
||||||
exec /bin/bash /etc/rc.d/rc.4.local
|
exec /bin/bash /etc/rc.d/rc.4.local
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Try to use GNOME's gdm session manager. This comes first because if
|
# Try to use GNOME's gdm session manager. This comes first because if
|
||||||
# gdm is on the machine then the user probably installed it and wants
|
# gdm is on the machine then the user probably installed it and wants
|
||||||
# to use it by default:
|
# to use it by default:
|
||||||
if [ -x /usr/bin/gdm ]; then
|
if [[ -x /usr/bin/gdm ]]; then
|
||||||
exec /usr/bin/gdm
|
exec /usr/bin/gdm
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Someone thought that gdm looked prettier in /usr/sbin,
|
# Someone thought that gdm looked prettier in /usr/sbin,
|
||||||
# so look there, too:
|
# so look there, too:
|
||||||
if [ -x /usr/sbin/gdm ]; then
|
if [[ -x /usr/sbin/gdm ]]; then
|
||||||
exec /usr/sbin/gdm
|
exec /usr/sbin/gdm
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Not there? OK, try to use KDE's kdm session manager:
|
# Not there? OK, try to use KDE's kdm session manager:
|
||||||
if [ -x /opt/kde/bin/kdm ]; then
|
if [[ -x /opt/kde/bin/kdm ]]; then
|
||||||
exec /opt/kde/bin/kdm -nodaemon
|
exec /opt/kde/bin/kdm -nodaemon
|
||||||
elif [ -x /usr/bin/kdm ]; then
|
elif [[ -x /usr/bin/kdm ]]; then
|
||||||
exec /usr/bin/kdm -nodaemon
|
exec /usr/bin/kdm -nodaemon
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Look for SDDM as well:
|
# Look for SDDM as well:
|
||||||
if [ -x /usr/bin/sddm ]; then
|
if [[ -x /usr/bin/sddm ]]; then
|
||||||
exec /usr/bin/sddm
|
exec /usr/bin/sddm
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If all you have is XDM, I guess it will have to do:
|
# If all you have is XDM, I guess it will have to do:
|
||||||
if [ -x /usr/bin/xdm ]; then
|
if [[ -x /usr/bin/xdm ]]; then
|
||||||
exec /usr/bin/xdm -nodaemon
|
exec /usr/bin/xdm -nodaemon
|
||||||
elif [ -x /usr/X11R6/bin/xdm ]; then
|
elif [[ -x /usr/X11R6/bin/xdm ]]; then
|
||||||
exec /usr/X11R6/bin/xdm -nodaemon
|
exec /usr/X11R6/bin/xdm -nodaemon
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
+8
-4
@@ -1,9 +1,13 @@
|
|||||||
#! /bin/sh
|
#!/bin/bash
|
||||||
#
|
#
|
||||||
# rc.4.local This file is executed by rc.4
|
# script: rc.4.local
|
||||||
#
|
#
|
||||||
|
# This file is executed by rc.4
|
||||||
|
#
|
||||||
|
# LimeTech - modified for Unraid OS
|
||||||
|
# Bergware - modified for Unraid OS, October 2023
|
||||||
|
|
||||||
# Try to use SLiM login manager:
|
# Try to use SLiM login manager
|
||||||
if [ -x /usr/bin/slim ]; then
|
if [[ -x /usr/bin/slim ]]; then
|
||||||
exec /usr/bin/slim
|
exec /usr/bin/slim
|
||||||
fi
|
fi
|
||||||
|
|||||||
+108
-105
@@ -1,41 +1,45 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
#
|
#
|
||||||
# rc.6 This file is executed by init when it goes into runlevel
|
# script: rc.6
|
||||||
# 0 (halt) or runlevel 6 (reboot). It kills all processes,
|
|
||||||
# unmounts file systems and then either halts or reboots.
|
|
||||||
#
|
#
|
||||||
# Version: @(#)/etc/rc.d/rc.6 15.0 Wed Nov 10 21:19:42 UTC 2021
|
# This file is executed by init when it goes into runlevel 0 (halt) or runlevel 6 (reboot).
|
||||||
|
# It kills all processes, unmounts file systems and then either halts or reboots.
|
||||||
#
|
#
|
||||||
# Author: Miquel van Smoorenburg <miquels@drinkel.nl.mugnet.org>
|
# Version: 2.47 Sat Jan 13 13:37:26 PST 2001
|
||||||
# Modified by: Patrick J. Volkerding, <volkerdi@slackware.com>
|
|
||||||
#
|
#
|
||||||
# limetech - modified for Unraid OS
|
# Author: Miquel van Smoorenburg <miquels@drinkel.nl.mugnet.org>
|
||||||
|
# Modified by: Patrick J. Volkerding, <volkerdi@slackware.com>
|
||||||
|
#
|
||||||
|
# LimeTech - modified for Unraid OS
|
||||||
|
# Bergware - modified for Unraid OS, October 2023
|
||||||
|
|
||||||
# Set the path.
|
# Set the path.
|
||||||
PATH=/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin
|
PATH=/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin
|
||||||
|
|
||||||
|
# run & log functions
|
||||||
|
. /etc/rc.d/rc.runlog
|
||||||
|
|
||||||
# If there are SystemV init scripts for this runlevel, run them.
|
# If there are SystemV init scripts for this runlevel, run them.
|
||||||
if [ -x /etc/rc.d/rc.sysvinit ]; then
|
if [[ -x /etc/rc.d/rc.sysvinit ]]; then
|
||||||
/etc/rc.d/rc.sysvinit
|
/etc/rc.d/rc.sysvinit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Set linefeed mode to avoid staircase effect.
|
# Set linefeed mode to avoid staircase effect.
|
||||||
/bin/stty onlcr
|
/bin/stty onlcr
|
||||||
|
|
||||||
echo "Running shutdown script $0:"
|
log "Running shutdown script $0:"
|
||||||
|
|
||||||
# Find out how we were called.
|
# Find out how we were called.
|
||||||
case "$0" in
|
case "$0" in
|
||||||
*0)
|
*0)
|
||||||
shutdown_command="halt"
|
SHUTDOWN_COMMAND="halt"
|
||||||
;;
|
;;
|
||||||
*6)
|
*6)
|
||||||
shutdown_command=reboot
|
SHUTDOWN_COMMAND="reboot"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "$0: call me as \"rc.0\" or \"rc.6\" please!"
|
/bin/echo "$0: call me as \"rc.0\" or \"rc.6\" please!"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Restart init. This prevents init from hanging on to file handles for removed
|
# Restart init. This prevents init from hanging on to file handles for removed
|
||||||
@@ -44,195 +48,194 @@ esac
|
|||||||
|
|
||||||
# Save the system time to the hardware clock using hwclock --systohc.
|
# Save the system time to the hardware clock using hwclock --systohc.
|
||||||
# This will also create or update the timestamps in /etc/adjtime.
|
# This will also create or update the timestamps in /etc/adjtime.
|
||||||
if [ -x /sbin/hwclock ]; then
|
if [[ -x /sbin/hwclock ]]; then
|
||||||
# Check for a broken motherboard RTC clock (where ioports for rtc are
|
# Check for a broken motherboard RTC clock (where ioports for rtc are
|
||||||
# unknown) to prevent hwclock causing a hang:
|
# unknown) to prevent hwclock causing a hang:
|
||||||
if ! grep -q " : rtc" /proc/ioports ; then
|
if ! /bin/grep -q " : rtc" /proc/ioports; then
|
||||||
CLOCK_OPT="--directisa"
|
CLOCK_OPT="--directisa"
|
||||||
fi
|
fi
|
||||||
if [ /etc/adjtime -nt /etc/hardwareclock ]; then
|
if [[ /etc/adjtime -nt /etc/hardwareclock ]]; then
|
||||||
if grep -q "^LOCAL" /etc/adjtime ; then
|
if /bin/grep -q "^LOCAL" /etc/adjtime; then
|
||||||
echo "Saving system time to the hardware clock (localtime)."
|
log "Saving system time to the hardware clock (localtime)."
|
||||||
else
|
else
|
||||||
echo "Saving system time to the hardware clock (UTC)."
|
log "Saving system time to the hardware clock (UTC)."
|
||||||
fi
|
fi
|
||||||
/sbin/hwclock $CLOCK_OPT --systohc
|
run /sbin/hwclock $CLOCK_OPT --systohc
|
||||||
elif grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then
|
elif /bin/grep -q "^UTC" /etc/hardwareclock 2>/dev/null; then
|
||||||
echo "Saving system time to the hardware clock (UTC)."
|
log "Saving system time to the hardware clock (UTC)."
|
||||||
if [ ! -r /etc/adjtime ]; then
|
if [[ ! -r /etc/adjtime ]]; then
|
||||||
echo "Creating system time correction file /etc/adjtime."
|
log "Creating system time correction file /etc/adjtime."
|
||||||
fi
|
fi
|
||||||
/sbin/hwclock $CLOCK_OPT --utc --systohc
|
run /sbin/hwclock $CLOCK_OPT --utc --systohc
|
||||||
else
|
else
|
||||||
echo "Saving system time to the hardware clock (localtime)."
|
log "Saving system time to the hardware clock (localtime)."
|
||||||
if [ ! -r /etc/adjtime ]; then
|
if [[ ! -r /etc/adjtime ]]; then
|
||||||
echo "Creating system time correction file /etc/adjtime."
|
log "Creating system time correction file /etc/adjtime."
|
||||||
fi
|
fi
|
||||||
/sbin/hwclock $CLOCK_OPT --localtime --systohc
|
run /sbin/hwclock $CLOCK_OPT --localtime --systohc
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Run any local shutdown scripts:
|
# Run any local shutdown scripts:
|
||||||
if [ -x /etc/rc.d/rc.local_shutdown ]; then
|
if [[ -x /etc/rc.d/rc.local_shutdown ]]; then
|
||||||
/etc/rc.d/rc.local_shutdown stop
|
/etc/rc.d/rc.local_shutdown stop
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Stop mcelog
|
# Stop mcelog
|
||||||
if [ -x /etc/rc.d/rc.mcelog ]; then
|
if [[ -x /etc/rc.d/rc.mcelog ]]; then
|
||||||
/etc/rc.d/rc.mcelog stop
|
/etc/rc.d/rc.mcelog stop
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Stop the Samba server:
|
# Stop the Samba server:
|
||||||
if [ -x /etc/rc.d/rc.samba ]; then
|
if [[ -x /etc/rc.d/rc.samba ]]; then
|
||||||
/etc/rc.d/rc.samba stop
|
/etc/rc.d/rc.samba stop
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Stop avahi:
|
# Stop avahi:
|
||||||
if [ -x /etc/rc.d/rc.avahidaemon ]; then
|
if [[ -x /etc/rc.d/rc.avahidaemon ]]; then
|
||||||
/etc/rc.d/rc.avahidaemon stop
|
/etc/rc.d/rc.avahidaemon stop
|
||||||
/etc/rc.d/rc.avahidnsconfd stop
|
/etc/rc.d/rc.avahidnsconfd stop
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Shut down WireGuard
|
# Shut down WireGuard
|
||||||
if [ -x /etc/rc.d/rc.wireguard ]; then
|
if [[ -x /etc/rc.d/rc.wireguard ]]; then
|
||||||
/etc/rc.d/rc.wireguard stop
|
/etc/rc.d/rc.wireguard stop
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Shut down OpenLDAP:
|
# Shut down OpenLDAP:
|
||||||
if [ -x /etc/rc.d/rc.openldap ]; then
|
if [[ -x /etc/rc.d/rc.openldap ]]; then
|
||||||
/etc/rc.d/rc.openldap stop
|
/etc/rc.d/rc.openldap stop
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Shut down the SASL authentication daemon:
|
# Shut down the SASL authentication daemon:
|
||||||
if [ -x /etc/rc.d/rc.saslauthd ]; then
|
if [[ -x /etc/rc.d/rc.saslauthd ]]; then
|
||||||
/etc/rc.d/rc.saslauthd stop
|
/etc/rc.d/rc.saslauthd stop
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Stop the MySQL database:
|
# Stop the MySQL database:
|
||||||
if [ -x /etc/rc.d/rc.mysqld -a -r /var/run/mysql/mysql.pid ]; then
|
if [[ -x /etc/rc.d/rc.mysqld && -r /var/run/mysql/mysql.pid ]]; then
|
||||||
/etc/rc.d/rc.mysqld stop
|
/etc/rc.d/rc.mysqld stop
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Shut down the NFS server:
|
# Shut down the NFS server:
|
||||||
if [ -x /etc/rc.d/rc.nfsd ]; then
|
if [[ -x /etc/rc.d/rc.nfsd ]]; then
|
||||||
/etc/rc.d/rc.nfsd stop
|
/etc/rc.d/rc.nfsd stop
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Shut down the SSH server:
|
# Shut down the SSH server:
|
||||||
if [ -x /etc/rc.d/rc.sshd ]; then
|
if [[ -x /etc/rc.d/rc.sshd ]]; then
|
||||||
/etc/rc.d/rc.sshd stop
|
/etc/rc.d/rc.sshd stop
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Stop the Network Time Protocol daemon:
|
# Stop the Network Time Protocol daemon:
|
||||||
if [ -x /etc/rc.d/rc.ntpd ]; then
|
if [[ -x /etc/rc.d/rc.ntpd ]]; then
|
||||||
/etc/rc.d/rc.ntpd stop
|
/etc/rc.d/rc.ntpd stop
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Kill any processes (typically gam) that would otherwise prevent
|
# Kill any processes (typically gam) that would otherwise prevent
|
||||||
# unmounting NFS volumes:
|
# unmounting NFS volumes:
|
||||||
unset FUSER_DELAY
|
unset FUSER_DELAY
|
||||||
for dir in $(/bin/mount | grep -e 'type nfs ' -e 'type nfs4 ' | sed -e 's|.* on ||g' | cut -d ' ' -f 1) ; do
|
for DIR in $(/bin/mount | /bin/grep -e 'type nfs ' -e 'type nfs4 ' | /bin/sed -e 's|.* on ||g' | /bin/cut -d ' ' -f 1); do
|
||||||
echo "Killing processes holding NFS mount $dir open..."
|
log "Killing processes holding NFS mount $DIR open..."
|
||||||
# Background this to prevent fuser from also blocking shutdown:
|
# Background this to prevent fuser from also blocking shutdown:
|
||||||
/usr/bin/fuser -k -M -m "$dir" &
|
run /usr/bin/fuser -k -M -m "$DIR" &
|
||||||
FUSER_DELAY=5
|
FUSER_DELAY=5
|
||||||
done
|
done
|
||||||
# If fuser was run, let it have some delay:
|
# If fuser was run, let it have some delay:
|
||||||
if [ ! -z "$FUSER_DELAY" ]; then
|
if [[ -n $FUSER_DELAY ]]; then
|
||||||
sleep $FUSER_DELAY
|
/bin/sleep $FUSER_DELAY
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Unmount any NFS, SMB, or CIFS filesystems:
|
# Unmount any NFS, SMB, or CIFS filesystems:
|
||||||
echo "Unmounting remote filesystems:"
|
log "Unmounting remote filesystems:"
|
||||||
/bin/umount -v -a -l -f -r -t nfs,nfs4,smbfs,cifs | tr -d ' ' | grep successfully | sed "s/:successfullyunmounted/ has been successfully unmounted./g"
|
/bin/umount -v -a -l -f -r -t nfs,nfs4,smbfs,cifs | /bin/tr -d ' ' | /bin/grep successfully | /bin/sed "s/:successfullyunmounted/ has been successfully unmounted./g" | log
|
||||||
# Update PATH hashes:
|
# Update PATH hashes:
|
||||||
hash -r
|
hash -r
|
||||||
|
|
||||||
# Stop D-Bus:
|
# Stop D-Bus:
|
||||||
if [ -x /etc/rc.d/rc.messagebus ]; then
|
if [[ -x /etc/rc.d/rc.messagebus ]]; then
|
||||||
/etc/rc.d/rc.messagebus stop
|
/etc/rc.d/rc.messagebus stop
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Bring down the networking system, but first make sure that this
|
# Bring down the networking system, but first make sure that this
|
||||||
# isn't a diskless client with the / partition mounted via NFS:
|
# isn't a diskless client with the / partition mounted via NFS:
|
||||||
if ! /bin/mount | /bin/grep -q -e 'on / type nfs' -e 'on / type nfs4' ; then
|
if ! /bin/mount | /bin/grep -q -e 'on / type nfs' -e 'on / type nfs4'; then
|
||||||
if [ -x /etc/rc.d/rc.inet1 ]; then
|
if [[ -x /etc/rc.d/rc.inet1 ]]; then
|
||||||
/etc/rc.d/rc.inet1 stop
|
/etc/rc.d/rc.inet1 stop
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# In case dhcpcd might have been manually started on the command line,
|
# In case dhcpcd might have been manually started on the command line,
|
||||||
# look for the .pid file, and shut dhcpcd down if it's found:
|
# look for the .pid file, and shut dhcpcd down if it's found:
|
||||||
if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then
|
if /bin/ls /etc/dhcpc/*.pid &>/dev/null; then
|
||||||
/sbin/dhcpcd -k 1> /dev/null 2> /dev/null
|
/sbin/dhcpcd -k &>/dev/null
|
||||||
# A little time for /etc/resolv.conf and/or other files to
|
# A little time for /etc/resolv.conf and/or other files to
|
||||||
# restore themselves.
|
# restore themselves.
|
||||||
sleep 2
|
/bin/sleep 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Turn off process accounting:
|
# Turn off process accounting:
|
||||||
if [ -x /sbin/accton -a -r /var/log/pacct ]; then
|
if [[ -x /sbin/accton && -r /var/log/pacct ]]; then
|
||||||
/sbin/accton off
|
/sbin/accton off
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Terminate acpid before syslog:
|
# Terminate acpid before syslog:
|
||||||
if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit
|
if [[ -x /etc/rc.d/rc.acpid && -r /var/run/acpid.pid ]]; then # quit
|
||||||
/etc/rc.d/rc.acpid stop
|
/etc/rc.d/rc.acpid stop
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Stop udev:
|
# Stop udev:
|
||||||
if [ -x /etc/rc.d/rc.udev ]; then
|
if [[ -x /etc/rc.d/rc.udev ]]; then
|
||||||
/etc/rc.d/rc.udev force-stop
|
/etc/rc.d/rc.udev force-stop
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Kill all remaining processes.
|
# Kill all remaining processes.
|
||||||
OMITPIDS="$(for p in $(pgrep mdmon); do echo -o $p; done)" # Don't kill mdmon
|
OMITPIDS="$(for P in $(/usr/bin/pgrep mdmon); do /bin/echo -o $P; done)" # Don't kill mdmon
|
||||||
if [ ! "$1" = "fast" ]; then
|
if [[ $1 != fast ]]; then
|
||||||
echo "Sending all processes the SIGTERM signal."
|
log "Sending all processes the SIGTERM signal."
|
||||||
/sbin/killall5 -15 $OMITPIDS
|
run /sbin/killall5 -15 $OMITPIDS
|
||||||
/bin/sleep 5
|
/bin/sleep 5
|
||||||
echo "Sending all processes the SIGKILL signal."
|
log "Sending all processes the SIGKILL signal."
|
||||||
/sbin/killall5 -9 $OMITPIDS
|
run /sbin/killall5 -9 $OMITPIDS
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# limetech - let's keep this on the USB flash
|
# limetech - let's keep this on the USB flash
|
||||||
# Carry a random seed between reboots.
|
# Carry a random seed between reboots.
|
||||||
/usr/sbin/seedrng
|
/usr/sbin/seedrng
|
||||||
cp /var/lib/seedrng/seed.credit /boot/config/random-seed 2>/dev/null
|
/bin/cp /var/lib/seedrng/seed.credit /boot/config/random-seed 2>/dev/null
|
||||||
|
|
||||||
# Before unmounting file systems write a reboot or halt record to wtmp.
|
# Before unmounting file systems write a reboot or halt record to wtmp.
|
||||||
$shutdown_command -w
|
/sbin/$SHUTDOWN_COMMAND -w
|
||||||
|
|
||||||
# Turn off swap:
|
# Turn off swap:
|
||||||
if [ ! "$(cat /proc/swaps | wc -l)" = "1" ]; then
|
if [[ ! $(/bin/cat /proc/swaps | /bin/wc -l) == 1 ]]; then
|
||||||
echo "Turning off swap."
|
log "Turning off swap."
|
||||||
/sbin/swapoff -a
|
run /sbin/swapoff -a
|
||||||
/bin/sync
|
run /bin/sync
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Unmount local file systems:
|
# Unmount local file systems:
|
||||||
# limetech - but not /, /lib, /usr or /boot (yet)
|
# limetech - but not /, /lib, /usr or /boot (yet)
|
||||||
echo "Unmounting local file systems:"
|
log "Unmounting local file systems:"
|
||||||
EXCLUDE_TYPES=("proc" "sysfs" "tmpfs" "devtmpfs" "devpts" "nfsd")
|
EXCLUDE_TYPES=("proc" "sysfs" "tmpfs" "devtmpfs" "devpts" "nfsd")
|
||||||
EXCLUDE_PATHS=("/" "/lib" "/usr" "/boot")
|
EXCLUDE_PATHS=("/" "/lib" "/usr" "/boot")
|
||||||
MOUNTS=$(cat /proc/mounts)
|
while IFS= read -r LINE; do
|
||||||
while IFS= read -r line; do
|
MOUNT_TYPE=$(/bin/echo "$LINE" | awk '{print $3}')
|
||||||
mount_type=$(echo "$line" | awk '{print $3}')
|
MOUNT_PATH=$(/bin/echo "$LINE" | awk '{print $2}')
|
||||||
mount_path=$(echo "$line" | awk '{print $2}')
|
[[ " ${EXCLUDE_TYPES[@]} " =~ " $MOUNT_TYPE " ]] && continue
|
||||||
[[ " ${EXCLUDE_TYPES[@]} " =~ " ${mount_type} " ]] && continue
|
[[ " ${EXCLUDE_PATHS[@]} " =~ " $MOUNT_PATH " ]] && continue
|
||||||
[[ " ${EXCLUDE_PATHS[@]} " =~ " ${mount_path} " ]] && continue
|
run /bin/umount -v "$MOUNT_PATH"
|
||||||
/sbin/umount -v "$mount_path"
|
done <<< "$(/bin/cat /proc/mounts)"
|
||||||
done <<< "$MOUNTS"
|
|
||||||
|
|
||||||
# limetech - shut down the unraid driver if started
|
# limetech - shut down the unraid driver if started
|
||||||
if /bin/grep -qs 'mdState=STARTED' /proc/mdstat ; then
|
if /bin/grep -qs 'mdState=STARTED' /proc/mdstat; then
|
||||||
echo "Stopping md/unraid driver:"
|
log "Stopping md/unraid driver:"
|
||||||
echo "stop" > /proc/mdcmd
|
/bin/echo "stop" >/proc/mdcmd
|
||||||
if /bin/grep -qs 'mdState=STOPPED' /proc/mdstat ; then
|
if /bin/grep -qs 'mdState=STOPPED' /proc/mdstat; then
|
||||||
echo "Clean shutdown"
|
log "Clean shutdown"
|
||||||
/bin/rm -f /boot/config/forcesync
|
/bin/rm -f /boot/config/forcesync
|
||||||
else
|
else
|
||||||
echo "Unclean shutdown - Cannot stop md/unraid driver"
|
log "Unclean shutdown - Cannot stop md/unraid driver"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -240,11 +243,11 @@ fi
|
|||||||
/bin/sync
|
/bin/sync
|
||||||
|
|
||||||
# now remount /boot read-only
|
# now remount /boot read-only
|
||||||
echo "Remounting /boot read-only:"
|
log "Remounting /boot read-only:"
|
||||||
/sbin/mount -v -o remount,ro /boot
|
run /bin/mount -v -o remount,ro /boot
|
||||||
|
|
||||||
echo "Remounting root filesystem read-only:"
|
log "Remounting root filesystem read-only:"
|
||||||
/bin/mount -v -n -o remount,ro /
|
run /bin/mount -v -n -o remount,ro /
|
||||||
|
|
||||||
# sleep 3 fixes problems with some hard drives that don't
|
# sleep 3 fixes problems with some hard drives that don't
|
||||||
# otherwise finish syncing before reboot or poweroff
|
# otherwise finish syncing before reboot or poweroff
|
||||||
@@ -253,16 +256,15 @@ echo "Remounting root filesystem read-only:"
|
|||||||
# This is to ensure all processes have completed on SMP machines:
|
# This is to ensure all processes have completed on SMP machines:
|
||||||
wait
|
wait
|
||||||
|
|
||||||
if [ -x /sbin/genpowerd ]; then
|
if [[ -x /sbin/genpowerd ]]; then
|
||||||
# See if this is a powerfail situation:
|
# See if this is a powerfail situation:
|
||||||
if grep -E -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then
|
if /bin/grep -Eq "FAIL|SCRAM" /etc/upsstatus 2>/dev/null; then
|
||||||
# Signal UPS to shut off the inverter:
|
# Signal UPS to shut off the inverter:
|
||||||
/sbin/genpowerd -k
|
run /sbin/genpowerd -k
|
||||||
if [ ! $? = 0 ]; then
|
if [[ $? != 0 ]]; then
|
||||||
echo
|
log "There was an error signaling the UPS."
|
||||||
echo "There was an error signaling the UPS."
|
log "Perhaps you need to edit /etc/genpowerd.conf to configure"
|
||||||
echo "Perhaps you need to edit /etc/genpowerd.conf to configure"
|
log "the serial line and UPS type."
|
||||||
echo "the serial line and UPS type."
|
|
||||||
# Wasting 15 seconds of precious power:
|
# Wasting 15 seconds of precious power:
|
||||||
/bin/sleep 15
|
/bin/sleep 15
|
||||||
fi
|
fi
|
||||||
@@ -270,9 +272,10 @@ if [ -x /sbin/genpowerd ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.
|
# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.
|
||||||
if [ "$shutdown_command" = "reboot" ]; then
|
if [[ $SHUTDOWN_COMMAND == reboot ]]; then
|
||||||
echo "Rebooting."
|
log "Rebooting."
|
||||||
/sbin/reboot
|
run /sbin/reboot
|
||||||
else
|
else
|
||||||
/sbin/poweroff
|
log "Powering off."
|
||||||
|
run /sbin/poweroff
|
||||||
fi
|
fi
|
||||||
|
|||||||
+47
-55
@@ -1,126 +1,118 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
#
|
#
|
||||||
# rc.K This file is executed by init when it goes into runlevel
|
# script: rc.K
|
||||||
# 1, which is the administrative state. It kills all
|
|
||||||
# daemons and then puts the system into single user mode.
|
|
||||||
# Note that the file systems are kept mounted.
|
|
||||||
#
|
#
|
||||||
# Version: @(#)/etc/rc.d/rc.K 3.1415 Sat Jan 13 13:37:26 PST 2001
|
# This file is executed by init when it goes into runlevel 1, which is the administrative state.
|
||||||
|
# It kills all daemons and then puts the system into single user mode.
|
||||||
|
# Note that the file systems are kept mounted.
|
||||||
#
|
#
|
||||||
# Author: Miquel van Smoorenburg <miquels@drinkel.nl.mugnet.org>
|
# Version: 3.1415 Sat Jan 13 13:37:26 PST 2001
|
||||||
# Modified by: Patrick J. Volkerding <volkerdi@slackware.com>
|
|
||||||
#
|
#
|
||||||
|
# Author: Miquel van Smoorenburg <miquels@drinkel.nl.mugnet.org>
|
||||||
|
# Modified by: Patrick J. Volkerding <volkerdi@slackware.com>
|
||||||
|
#
|
||||||
|
# LimeTech - modified for Unraid OS
|
||||||
|
# Bergware - modified for Unraid OS, October 2023
|
||||||
|
|
||||||
# Set the path.
|
# Set the path.
|
||||||
PATH=/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin
|
PATH=/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin
|
||||||
|
|
||||||
|
# run & log functions
|
||||||
|
. /etc/rc.d/rc.runlog
|
||||||
|
|
||||||
# Load a custom screen font if the user has an rc.font script.
|
# Load a custom screen font if the user has an rc.font script.
|
||||||
if [ -x /etc/rc.d/rc.font ]; then
|
if [[ -x /etc/rc.d/rc.font ]]; then
|
||||||
/etc/rc.d/rc.font
|
/etc/rc.d/rc.font
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Load any needed keyboard mappings:
|
# Load any needed keyboard mappings:
|
||||||
if [ -x /etc/rc.d/rc.keymap ]; then
|
if [[ -x /etc/rc.d/rc.keymap ]]; then
|
||||||
/etc/rc.d/rc.keymap
|
/etc/rc.d/rc.keymap
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If there are SystemV init scripts for this runlevel, run them.
|
# If there are SystemV init scripts for this runlevel, run them.
|
||||||
if [ -x /etc/rc.d/rc.sysvinit ]; then
|
if [[ -x /etc/rc.d/rc.sysvinit ]]; then
|
||||||
/etc/rc.d/rc.sysvinit
|
/etc/rc.d/rc.sysvinit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Try to turn off quota:
|
# Try to turn off quota:
|
||||||
if grep -q quota /etc/fstab ; then
|
if grep -q quota /etc/fstab ; then
|
||||||
if [ -x /sbin/quotaoff ]; then
|
if [[ -x /sbin/quotaoff ]]; then
|
||||||
echo "Turning off filesystem quotas."
|
log "Turning off filesystem quotas."
|
||||||
/sbin/quotaoff -a
|
run quotaoff -a
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Try to turn off accounting:
|
# Try to turn off accounting:
|
||||||
if [ -x /sbin/accton -a -r /var/log/pacct ]; then
|
if [[ -x /sbin/accton && -r /var/log/pacct ]]; then
|
||||||
/sbin/accton off
|
accton off
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Run any local shutdown scripts:
|
# Run any local shutdown scripts:
|
||||||
if [ -x /etc/rc.d/rc.local_shutdown ]; then
|
if [[ -x /etc/rc.d/rc.local_shutdown ]]; then
|
||||||
/etc/rc.d/rc.local_shutdown stop
|
/etc/rc.d/rc.local_shutdown stop
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Stop the Apache web server:
|
# Stop the Apache web server:
|
||||||
if [ -x /etc/rc.d/rc.httpd ]; then
|
if [[ -x /etc/rc.d/rc.httpd ]]; then
|
||||||
/etc/rc.d/rc.httpd stop
|
/etc/rc.d/rc.httpd stop
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Stop the Samba server:
|
# Stop the Samba server:
|
||||||
if [ -x /etc/rc.d/rc.samba ]; then
|
if [[ -x /etc/rc.d/rc.samba ]]; then
|
||||||
/etc/rc.d/rc.samba stop
|
/etc/rc.d/rc.samba stop
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Shut down the NFS server:
|
# Shut down the NFS server:
|
||||||
if [ -x /etc/rc.d/rc.nfsd ]; then
|
if [[ -x /etc/rc.d/rc.nfsd ]]; then
|
||||||
/etc/rc.d/rc.nfsd stop
|
/etc/rc.d/rc.nfsd stop
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Kill any processes (typically gam) that would otherwise prevent
|
# Kill any processes (typically gam) that would otherwise prevent
|
||||||
# unmounting NFS volumes:
|
# unmounting NFS volumes:
|
||||||
unset FUSER_DELAY
|
unset FUSER_DELAY
|
||||||
for dir in $(/bin/mount | grep -e 'type nfs ' -e 'type nfs4 ' | sed -e 's|.* on ||g' | cut -d ' ' -f 1) ; do
|
for DIR in $(mount | grep -e 'type nfs ' -e 'type nfs4 ' | sed -e 's|.* on ||g' | cut -d ' ' -f 1); do
|
||||||
echo "Killing processes holding NFS mount $dir open..."
|
log "Killing processes holding NFS mount $DIR open..."
|
||||||
# Background this to prevent fuser from also blocking shutdown:
|
# Background this to prevent fuser from also blocking shutdown:
|
||||||
/usr/bin/fuser -k -M -m "$dir" &
|
run /usr/bin/fuser -k -M -m "$DIR" &
|
||||||
FUSER_DELAY=5
|
FUSER_DELAY=5
|
||||||
done
|
done
|
||||||
# If fuser was run, let it have some delay:
|
# If fuser was run, let it have some delay:
|
||||||
if [ ! -z "$FUSER_DELAY" ]; then
|
if [[ -n "$FUSER_DELAY" ]]; then
|
||||||
sleep $FUSER_DELAY
|
sleep $FUSER_DELAY
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Unmount any NFS, SMB, or CIFS filesystems:
|
# Unmount any NFS, SMB, or CIFS filesystems:
|
||||||
echo "Unmounting remote filesystems:"
|
log "Unmounting remote filesystems:"
|
||||||
/bin/umount -v -a -l -f -r -t nfs,nfs4,smbfs,cifs | tr -d ' ' | grep successfully | sed "s/:successfullyunmounted/ has been successfully unmounted./g"
|
run umount -v -a -l -f -r -t nfs,nfs4,smbfs,cifs | tr -d ' ' | grep successfully | sed "s/:successfullyunmounted/ has been successfully unmounted./g"
|
||||||
|
|
||||||
# Shut down PCMCIA devices:
|
# Shut down PCMCIA devices:
|
||||||
if [ -x /etc/rc.d/rc.pcmcia ] ; then
|
if [[ -x /etc/rc.d/rc.pcmcia ]]; then
|
||||||
/etc/rc.d/rc.pcmcia stop
|
/etc/rc.d/rc.pcmcia stop
|
||||||
# The cards might need a little extra time here to deactivate:
|
# The cards might need a little extra time here to deactivate:
|
||||||
sleep 5
|
sleep 5
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Terminate acpid before syslog:
|
# Terminate acpid before syslog:
|
||||||
if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit
|
if [[ -x /etc/rc.d/rc.acpid && -r /var/run/acpid.pid ]]; then # quit
|
||||||
/etc/rc.d/rc.acpid stop
|
/etc/rc.d/rc.acpid stop
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Kill all processes.
|
# Kill all processes.
|
||||||
OMITPIDS="$(for p in $(pgrep mdmon); do echo -o $p; done)" # Don't kill mdmon
|
OMITPIDS="$(for P in $(pgrep mdmon); do echo -o $P; done)" # Don't kill mdmon
|
||||||
echo
|
log "Sending all processes the SIGHUP signal."
|
||||||
echo "Sending all processes the SIGHUP signal."
|
run killall5 -1 $OMITPIDS
|
||||||
killall5 -1 $OMITPIDS
|
log "Waiting for processes to hang up"
|
||||||
echo -n "Waiting for processes to hang up"
|
for LOOP in {1..5}; do sleep 1; done
|
||||||
for loop in 0 1 2 3 4 5 ; do
|
log "Sending all processes the SIGTERM signal."
|
||||||
sleep 1
|
run killall5 -15 $OMITPIDS
|
||||||
echo -n "."
|
log "Waiting for processes to terminate"
|
||||||
done
|
for LOOP in {1..5}; do sleep 1; done
|
||||||
echo
|
|
||||||
echo "Sending all processes the SIGTERM signal."
|
|
||||||
killall5 -15 $OMITPIDS
|
|
||||||
echo -n "Waiting for processes to terminate"
|
|
||||||
for loop in 0 1 2 3 4 5 ; do
|
|
||||||
sleep 1
|
|
||||||
echo -n "."
|
|
||||||
done
|
|
||||||
echo
|
|
||||||
echo "Sending all processes the SIGKILL signal."
|
echo "Sending all processes the SIGKILL signal."
|
||||||
killall5 -9 $OMITPIDS
|
run killall5 -9 $OMITPIDS
|
||||||
echo -n "Waiting for processes to exit"
|
log "Waiting for processes to exit"
|
||||||
for loop in 0 1 2 3 4 5 ; do
|
for LOOP in {1..5}; do sleep 1; done
|
||||||
sleep 1
|
|
||||||
echo -n "."
|
|
||||||
done
|
|
||||||
echo
|
|
||||||
|
|
||||||
# Now go to the single user level
|
# Now go to the single user level
|
||||||
echo "Going to single user mode..."
|
log "Going to single user mode..."
|
||||||
/sbin/telinit -t 1 1
|
run telinit -t 1 1
|
||||||
|
|
||||||
|
|||||||
+81
-81
@@ -1,39 +1,43 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
#
|
#
|
||||||
# rc.M This file is executed by init(8) when the system is being
|
# script: rc.M
|
||||||
# initialized for one of the "multi user" run levels (i.e.
|
|
||||||
# levels 1 through 6). It usually does mounting of file
|
|
||||||
# systems et al.
|
|
||||||
#
|
#
|
||||||
# Version: @(#)/etc/rc.d/rc.M 15.0 Fri Nov 12 18:51:28 UTC 2021
|
# This file is executed by init(8) when the system is being initialized for one of the "multi user" run levels (i.e. levels 1 through 6).
|
||||||
|
# It usually does mounting of file systems et al.
|
||||||
#
|
#
|
||||||
# Author: Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
|
# Version: 15.0 Fri Nov 12 18:51:28 UTC 2021
|
||||||
# Heavily modified by Patrick Volkerding <volkerdi@slackware.com>
|
|
||||||
#
|
#
|
||||||
# LimeTech - Modified for Unraid OS
|
# Author: Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
|
||||||
|
# Heavily modified by Patrick Volkerding <volkerdi@slackware.com>
|
||||||
|
#
|
||||||
|
# LimeTech - modified for Unraid OS
|
||||||
|
# Bergware - modified for Unraid OS, October 2023
|
||||||
|
|
||||||
|
# run & log functions
|
||||||
|
. /etc/rc.d/rc.runlog
|
||||||
|
|
||||||
# Tell the viewers what's going to happen.
|
# Tell the viewers what's going to happen.
|
||||||
echo "Going multiuser..."
|
log "Going multiuser..."
|
||||||
|
|
||||||
# Update all the shared library links:
|
# Update all the shared library links:
|
||||||
if [ -x /sbin/ldconfig ]; then
|
if [[ -x /sbin/ldconfig ]]; then
|
||||||
echo "Updating shared library links: /sbin/ldconfig &"
|
log "Updating shared library links..."
|
||||||
/sbin/ldconfig &
|
run ldconfig &
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Call the setterm init script to set screen blanking and power management
|
# Call the setterm init script to set screen blanking and power management
|
||||||
# defaults:
|
# defaults:
|
||||||
if [ -x /etc/rc.d/rc.setterm ]; then
|
if [[ -x /etc/rc.d/rc.setterm ]]; then
|
||||||
/etc/rc.d/rc.setterm
|
/etc/rc.d/rc.setterm
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Set the hostname:
|
# Set the hostname:
|
||||||
/bin/hostname $(cat /etc/HOSTNAME)
|
hostname $(cat /etc/HOSTNAME)
|
||||||
|
|
||||||
# Set the permissions on /var/log/dmesg according to whether the kernel
|
# Set the permissions on /var/log/dmesg according to whether the kernel
|
||||||
# permits non-root users to access kernel dmesg information:
|
# permits non-root users to access kernel dmesg information:
|
||||||
if [ -r /proc/sys/kernel/dmesg_restrict ]; then
|
if [[ -r /proc/sys/kernel/dmesg_restrict ]]; then
|
||||||
if [ $(cat /proc/sys/kernel/dmesg_restrict) = 1 ]; then
|
if [[ $(cat /proc/sys/kernel/dmesg_restrict) == 1 ]]; then
|
||||||
touch /var/log/dmesg
|
touch /var/log/dmesg
|
||||||
chmod 640 /var/log/dmesg
|
chmod 640 /var/log/dmesg
|
||||||
fi
|
fi
|
||||||
@@ -42,135 +46,131 @@ else
|
|||||||
chmod 644 /var/log/dmesg
|
chmod 644 /var/log/dmesg
|
||||||
fi
|
fi
|
||||||
# Save the contents of 'dmesg':
|
# Save the contents of 'dmesg':
|
||||||
/bin/dmesg -s 65536 > /var/log/dmesg
|
dmesg -s 65536 > /var/log/dmesg
|
||||||
|
|
||||||
# Start the system logger.
|
# Start the system logger.
|
||||||
if [ -x /etc/rc.d/rc.rsyslogd ]; then
|
if [[ -x /etc/rc.d/rc.rsyslogd ]]; then
|
||||||
/etc/rc.d/rc.rsyslogd start
|
/etc/rc.d/rc.rsyslogd start
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Update the X font indexes:
|
# Update the X font indexes:
|
||||||
if [ -x /usr/bin/fc-cache ]; then
|
if [[ -x /usr/bin/fc-cache ]]; then
|
||||||
echo "Updating X font indexes: /usr/bin/fc-cache -f &"
|
log "Updating X font indexes..."
|
||||||
/usr/bin/fc-cache -f &
|
run /usr/bin/fc-cache -f &
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Run rc.udev again. This will start udev if it is not already running
|
# Run rc.udev again. This will start udev if it is not already running
|
||||||
# (for example, upon return from runlevel 1), otherwise it will trigger it
|
# (for example, upon return from runlevel 1), otherwise it will trigger it
|
||||||
# to look for device changes and to generate persistent rules if needed.
|
# to look for device changes and to generate persistent rules if needed.
|
||||||
if grep -wq sysfs /proc/mounts && grep -q devtmpfs /proc/filesystems ; then
|
if grep -wq sysfs /proc/mounts && grep -q devtmpfs /proc/filesystems; then
|
||||||
if ! grep -wq nohotplug /proc/cmdline ; then
|
if ! grep -wq nohotplug /proc/cmdline; then
|
||||||
if [ -x /etc/rc.d/rc.udev ]; then
|
if [[ -x /etc/rc.d/rc.udev ]]; then
|
||||||
/etc/rc.d/rc.udev start
|
/etc/rc.d/rc.udev start
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Initialize the networking hardware.
|
# Initialize the networking hardware.
|
||||||
if [ -x /etc/rc.d/rc.inet1 ]; then
|
if [[ -x /etc/rc.d/rc.inet1 ]]; then
|
||||||
/etc/rc.d/rc.inet1
|
/etc/rc.d/rc.inet1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Start D-Bus:
|
# Start D-Bus:
|
||||||
if [ -x /etc/rc.d/rc.messagebus ]; then
|
if [[ -x /etc/rc.d/rc.messagebus ]]; then
|
||||||
/etc/rc.d/rc.messagebus start
|
/etc/rc.d/rc.messagebus start
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Start the session/seat daemon:
|
# Start the session/seat daemon:
|
||||||
if [ -x /etc/rc.d/rc.elogind -a -x /bin/loginctl ]; then
|
if [[ -x /etc/rc.d/rc.elogind && -x /bin/loginctl ]]; then
|
||||||
/etc/rc.d/rc.elogind start
|
/etc/rc.d/rc.elogind start
|
||||||
elif [ -x /etc/rc.d/rc.consolekit -a -x /usr/sbin/console-kit-daemon ]; then
|
elif [[ -x /etc/rc.d/rc.consolekit && -x /usr/sbin/console-kit-daemon ]]; then
|
||||||
/etc/rc.d/rc.consolekit start
|
/etc/rc.d/rc.consolekit start
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Start Bluetooth:
|
# Start Bluetooth:
|
||||||
if [ -x /etc/rc.d/rc.bluetooth ]; then
|
if [[ -x /etc/rc.d/rc.bluetooth ]]; then
|
||||||
/etc/rc.d/rc.bluetooth start
|
/etc/rc.d/rc.bluetooth start
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Start networking daemons:
|
# Start networking daemons:
|
||||||
if [ -x /etc/rc.d/rc.inet2 ]; then
|
if [[ -x /etc/rc.d/rc.inet2 ]]; then
|
||||||
/etc/rc.d/rc.inet2
|
/etc/rc.d/rc.inet2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Mount any additional filesystem types that haven't already been mounted:
|
# Mount any additional filesystem types that haven't already been mounted:
|
||||||
mount -a -v 2> /dev/null | grep -v -e "already mounted" -e "ignored" | cut -f 1 -d : | tr -d ' ' | while read dev ; do mount | grep "${dev} " ; done
|
mount -a -v 2>/dev/null | grep -v -e "already mounted" -e "ignored" | cut -f 1 -d : | tr -d ' ' | while read DEV; do mount | grep "$DEV "; done
|
||||||
|
|
||||||
# Start the Network Time Protocol daemon:
|
# Start the Network Time Protocol daemon:
|
||||||
if [ -x /etc/rc.d/rc.ntpd ]; then
|
if [[ -x /etc/rc.d/rc.ntpd ]]; then
|
||||||
/etc/rc.d/rc.ntpd start
|
/etc/rc.d/rc.ntpd start
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Remove stale locks and junk files (must be done after mount -a!)
|
# Remove stale locks and junk files (must be done after mount -a!)
|
||||||
/bin/rm -f /var/lock/* /var/spool/uucp/LCK..* /tmp/.X*lock /tmp/.X11-unix/* 2> /dev/null
|
rm -f /var/lock/* /var/spool/uucp/LCK..* /tmp/.X*lock /tmp/.X11-unix/* 2>/dev/null
|
||||||
|
|
||||||
# Ensure basic filesystem permissions sanity.
|
# Ensure basic filesystem permissions sanity.
|
||||||
chmod 755 / 2> /dev/null
|
chmod 755 / 2>/dev/null
|
||||||
chmod 1777 /tmp /var/tmp
|
chmod 1777 /tmp /var/tmp
|
||||||
|
|
||||||
# Start ACPI daemon.
|
# Start ACPI daemon.
|
||||||
if [ -x /etc/rc.d/rc.acpid ]; then
|
if [[ -x /etc/rc.d/rc.acpid ]]; then
|
||||||
/etc/rc.d/rc.acpid start
|
/etc/rc.d/rc.acpid start
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Enable CPU frequency scaling:
|
# Enable CPU frequency scaling:
|
||||||
if [ -x /etc/rc.d/rc.cpufreq ]; then
|
if [[ -x /etc/rc.d/rc.cpufreq ]]; then
|
||||||
/etc/rc.d/rc.cpufreq start
|
/etc/rc.d/rc.cpufreq start
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Update any existing icon cache files:
|
# Update any existing icon cache files:
|
||||||
if find /usr/share/icons -maxdepth 2 2> /dev/null | grep -q icon-theme.cache ; then
|
if find /usr/share/icons -maxdepth 2 2>/dev/null | grep -q icon-theme.cache; then
|
||||||
for theme_dir in /usr/share/icons/* ; do
|
for THEME_DIR in /usr/share/icons/*; do
|
||||||
if [ -r ${theme_dir}/icon-theme.cache ]; then
|
if [[ -r $THEME_DIR/icon-theme.cache ]]; then
|
||||||
echo "Updating icon-theme.cache in ${theme_dir}..."
|
log "Updating icon-theme.cache in $THEME_DIR..."
|
||||||
/usr/bin/gtk-update-icon-cache -t -f ${theme_dir} 1> /dev/null 2> /dev/null &
|
run /usr/bin/gtk-update-icon-cache -t -f $THEME_DIR &
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
# This would be a large file and probably shouldn't be there.
|
# This would be a large file and probably shouldn't be there.
|
||||||
if [ -r /usr/share/icons/icon-theme.cache ]; then
|
if [[ -r /usr/share/icons/icon-theme.cache ]]; then
|
||||||
echo "Deleting icon-theme.cache in /usr/share/icons..."
|
log "Deleting icon-theme.cache in /usr/share/icons..."
|
||||||
#/usr/bin/gtk-update-icon-cache -t -f /usr/share/icons 1> /dev/null 2> /dev/null &
|
#/usr/bin/gtk-update-icon-cache -t -f /usr/share/icons &>/dev/null &
|
||||||
rm -f /usr/share/icons/icon-theme.cache
|
run rm -f /usr/share/icons/icon-theme.cache
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Update mime database:
|
# Update mime database:
|
||||||
if [ -x /usr/bin/update-mime-database -a -d /usr/share/mime ]; then
|
if [[ -x /usr/bin/update-mime-database && -d /usr/share/mime ]]; then
|
||||||
echo "Updating MIME database: /usr/bin/update-mime-database /usr/share/mime &"
|
log "Updating MIME database..."
|
||||||
/usr/bin/update-mime-database /usr/share/mime 1> /dev/null 2> /dev/null &
|
run /usr/bin/update-mime-database /usr/share/mime &
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# These GTK+/pango files need to be kept up to date for
|
# These GTK+/pango files need to be kept up to date for
|
||||||
# proper input method, pixbuf loaders, and font support.
|
# proper input method, pixbuf loaders, and font support.
|
||||||
if [ -x /usr/bin/update-gtk-immodules ]; then
|
if [[ -x /usr/bin/update-gtk-immodules ]]; then
|
||||||
echo "Updating gtk.immodules:"
|
log "Updating gtk.immodules..."
|
||||||
echo " /usr/bin/update-gtk-immodules &"
|
run /usr/bin/update-gtk-immodules &
|
||||||
/usr/bin/update-gtk-immodules > /dev/null 2>&1 &
|
|
||||||
fi
|
fi
|
||||||
if [ -x /usr/bin/update-gdk-pixbuf-loaders ]; then
|
if [[ -x /usr/bin/update-gdk-pixbuf-loaders ]]; then
|
||||||
echo "Updating gdk-pixbuf.loaders:"
|
log "Updating gdk-pixbuf.loaders..."
|
||||||
echo " /usr/bin/update-gdk-pixbuf-loaders &"
|
HOME=/root run /usr/bin/update-gdk-pixbuf-loaders &
|
||||||
HOME=/root /usr/bin/update-gdk-pixbuf-loaders > /dev/null 2>&1 &
|
|
||||||
fi
|
fi
|
||||||
if [ -x /usr/bin/update-pango-querymodules ]; then
|
if [[ -x /usr/bin/update-pango-querymodules ]]; then
|
||||||
echo "Updating pango.modules:"
|
log "Updating pango.modules..."
|
||||||
echo " /usr/bin/update-pango-querymodules &"
|
run /usr/bin/update-pango-querymodules &
|
||||||
/usr/bin/update-pango-querymodules > /dev/null 2>&1 &
|
|
||||||
fi
|
fi
|
||||||
if [ -x /usr/bin/glib-compile-schemas ]; then
|
if [[ -x /usr/bin/glib-compile-schemas ]]; then
|
||||||
echo "Compiling GSettings XML schema files:"
|
log "Compiling GSettings XML schema files..."
|
||||||
echo " /usr/bin/glib-compile-schemas /usr/share/glib-2.0/schemas &"
|
run /usr/bin/glib-compile-schemas /usr/share/glib-2.0/schemas &
|
||||||
/usr/bin/glib-compile-schemas /usr/share/glib-2.0/schemas >/dev/null 2>&1 &
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Start dnsmasq, a simple DHCP/DNS server:
|
# Start dnsmasq, a simple DHCP/DNS server:
|
||||||
if [ -x /etc/rc.d/rc.dnsmasq ]; then
|
if [[ -x /etc/rc.d/rc.dnsmasq ]]; then
|
||||||
/etc/rc.d/rc.dnsmasq start
|
/etc/rc.d/rc.dnsmasq start
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Start smartd, which monitors the status of S.M.A.R.T. compatible
|
# Start smartd, which monitors the status of S.M.A.R.T. compatible
|
||||||
# hard drives and reports any problems:
|
# hard drives and reports any problems:
|
||||||
if [ -x /etc/rc.d/rc.smartd ]; then
|
if [[ -x /etc/rc.d/rc.smartd ]]; then
|
||||||
/etc/rc.d/rc.smartd start
|
/etc/rc.d/rc.smartd start
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -179,76 +179,76 @@ fi
|
|||||||
# create the file /var/log/pacct (touch /var/log/pacct). By default, process
|
# create the file /var/log/pacct (touch /var/log/pacct). By default, process
|
||||||
# accounting is not enabled (since /var/log/pacct does not exist). This is
|
# accounting is not enabled (since /var/log/pacct does not exist). This is
|
||||||
# because the log file can get VERY large.
|
# because the log file can get VERY large.
|
||||||
if [ -x /sbin/accton -a -r /var/log/pacct ]; then
|
if [[ -x /sbin/accton && -r /var/log/pacct ]]; then
|
||||||
chmod 640 /var/log/pacct
|
chmod 640 /var/log/pacct
|
||||||
/sbin/accton /var/log/pacct
|
accton /var/log/pacct
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Start crond (Dillon's crond):
|
# Start crond (Dillon's crond):
|
||||||
if [ -x /etc/rc.d/rc.crond ]; then
|
if [[ -x /etc/rc.d/rc.crond ]]; then
|
||||||
/etc/rc.d/rc.crond start
|
/etc/rc.d/rc.crond start
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Start atd (manages jobs scheduled with 'at'):
|
# Start atd (manages jobs scheduled with 'at'):
|
||||||
if [ -x /etc/rc.d/rc.atd ]; then
|
if [[ -x /etc/rc.d/rc.atd ]]; then
|
||||||
/etc/rc.d/rc.atd start
|
/etc/rc.d/rc.atd start
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Load a custom screen font if the user has an rc.font script.
|
# Load a custom screen font if the user has an rc.font script.
|
||||||
if [ -x /etc/rc.d/rc.font ]; then
|
if [[ -x /etc/rc.d/rc.font ]]; then
|
||||||
/etc/rc.d/rc.font
|
/etc/rc.d/rc.font
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Load a custom keymap if the user has an rc.keymap script.
|
# Load a custom keymap if the user has an rc.keymap script.
|
||||||
if [ -x /etc/rc.d/rc.keymap ]; then
|
if [[ -x /etc/rc.d/rc.keymap ]]; then
|
||||||
/etc/rc.d/rc.keymap
|
/etc/rc.d/rc.keymap
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Start the MariaDB database:
|
# Start the MariaDB database:
|
||||||
if [ -x /etc/rc.d/rc.mysqld ]; then
|
if [[ -x /etc/rc.d/rc.mysqld ]]; then
|
||||||
/etc/rc.d/rc.mysqld start
|
/etc/rc.d/rc.mysqld start
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Start the SASL authentication server. This provides SASL
|
# Start the SASL authentication server. This provides SASL
|
||||||
# authentication services for sendmail/postfix:
|
# authentication services for sendmail/postfix:
|
||||||
if [ -x /etc/rc.d/rc.saslauthd ]; then
|
if [[ -x /etc/rc.d/rc.saslauthd ]]; then
|
||||||
/etc/rc.d/rc.saslauthd start
|
/etc/rc.d/rc.saslauthd start
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Start OpenLDAP:
|
# Start OpenLDAP:
|
||||||
if [ -x /etc/rc.d/rc.openldap ]; then
|
if [[ -x /etc/rc.d/rc.openldap ]]; then
|
||||||
/etc/rc.d/rc.openldap start
|
/etc/rc.d/rc.openldap start
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Start WireGuard
|
# Start WireGuard
|
||||||
if [ -x /etc/rc.d/rc.wireguard ]; then
|
if [[ -x /etc/rc.d/rc.wireguard ]]; then
|
||||||
/etc/rc.d/rc.wireguard start
|
/etc/rc.d/rc.wireguard start
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Start avahi:
|
# Start avahi:
|
||||||
if [ -x /etc/rc.d/rc.avahidaemon ]; then
|
if [[ -x /etc/rc.d/rc.avahidaemon ]]; then
|
||||||
/etc/rc.d/rc.avahidaemon start
|
/etc/rc.d/rc.avahidaemon start
|
||||||
/etc/rc.d/rc.avahidnsconfd start
|
/etc/rc.d/rc.avahidnsconfd start
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Start Samba (a file/print server for Windows machines).
|
# Start Samba (a file/print server for Windows machines).
|
||||||
# Samba can be started in /etc/inetd.conf instead.
|
# Samba can be started in /etc/inetd.conf instead.
|
||||||
if [ -x /etc/rc.d/rc.samba ]; then
|
if [[ -x /etc/rc.d/rc.samba ]]; then
|
||||||
/etc/rc.d/rc.samba start
|
/etc/rc.d/rc.samba start
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Start mcelog
|
# Start mcelog
|
||||||
if [ -x /etc/rc.d/rc.mcelog ]; then
|
if [[ -x /etc/rc.d/rc.mcelog ]]; then
|
||||||
/etc/rc.d/rc.mcelog start
|
/etc/rc.d/rc.mcelog start
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If there are SystemV init scripts for this runlevel, run them.
|
# If there are SystemV init scripts for this runlevel, run them.
|
||||||
if [ -x /etc/rc.d/rc.sysvinit ]; then
|
if [[ -x /etc/rc.d/rc.sysvinit ]]; then
|
||||||
/etc/rc.d/rc.sysvinit
|
/etc/rc.d/rc.sysvinit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Start the local setup procedure.
|
# Start the local setup procedure.
|
||||||
if [ -x /etc/rc.d/rc.local ]; then
|
if [[ -x /etc/rc.d/rc.local ]]; then
|
||||||
/etc/rc.d/rc.local
|
/etc/rc.d/rc.local
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
+57
-50
@@ -1,21 +1,24 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
#
|
#
|
||||||
# /etc/rc.d/rc.S: System initialization script.
|
# script: rc.S
|
||||||
#
|
#
|
||||||
# Mostly written by: Patrick J. Volkerding, <volkerdi@slackware.com>
|
# System initialization script.
|
||||||
# LimeTech - Modified for Unraid OS
|
# Mostly written by: Patrick J. Volkerding, <volkerdi@slackware.com>
|
||||||
#
|
#
|
||||||
|
# LimeTech - modified for Unraid OS
|
||||||
|
# Bergware - modified for Unraid OS, October 2023
|
||||||
|
|
||||||
|
# Set the path.
|
||||||
PATH=/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin
|
PATH=/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin
|
||||||
|
|
||||||
# Mount /proc if it is not already mounted:
|
# Mount /proc if it is not already mounted:
|
||||||
if [ ! -d /proc/sys ]; then
|
if [[ ! -d /proc/sys ]]; then
|
||||||
/sbin/mount -v proc /proc -n -t proc 2> /dev/null
|
/sbin/mount -v proc /proc -n -t proc 2>/dev/null
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Mount /sys if it is not already mounted:
|
# Mount /sys if it is not already mounted:
|
||||||
if [ ! -d /sys/kernel ]; then
|
if [[ ! -d /sys/kernel ]]; then
|
||||||
/sbin/mount -v sysfs /sys -n -t sysfs 2> /dev/null
|
/sbin/mount -v sysfs /sys -n -t sysfs 2>/dev/null
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# The efivarfs filesystem is used for reading and writing EFI variables, such
|
# The efivarfs filesystem is used for reading and writing EFI variables, such
|
||||||
@@ -23,20 +26,20 @@ fi
|
|||||||
# the /sys/firmware/efi/efivars directory. To modify this behavior, edit the
|
# the /sys/firmware/efi/efivars directory. To modify this behavior, edit the
|
||||||
# file: /etc/default/efivarfs
|
# file: /etc/default/efivarfs
|
||||||
# Only try to mount if this directory exists (so the kernel supports efivarfs):
|
# Only try to mount if this directory exists (so the kernel supports efivarfs):
|
||||||
if [ -d /sys/firmware/efi/efivars ]; then
|
if [[ -d /sys/firmware/efi/efivars ]]; then
|
||||||
# Only try to mount if efivarfs is not already mounted:
|
# Only try to mount if efivarfs is not already mounted:
|
||||||
if ! /sbin/mount | /bin/grep -wq efivarfs ; then
|
if ! /sbin/mount | /bin/grep -wq efivarfs; then
|
||||||
# Mount according to /etc/default/efivarfs:
|
# Mount according to /etc/default/efivarfs:
|
||||||
if [ -r /etc/default/efivarfs ]; then
|
if [[ -r /etc/default/efivarfs ]]; then
|
||||||
. /etc/default/efivarfs
|
. /etc/default/efivarfs
|
||||||
else # default
|
else # default
|
||||||
EFIVARFS=rw
|
EFIVARFS="rw"
|
||||||
fi
|
fi
|
||||||
case "$EFIVARFS" in
|
case "$EFIVARFS" in
|
||||||
'rw')
|
'rw')
|
||||||
/sbin/mount -o rw -t efivarfs none /sys/firmware/efi/efivars
|
/sbin/mount -o rw -t efivarfs none /sys/firmware/efi/efivars
|
||||||
;;
|
;;
|
||||||
'ro')
|
'ro')
|
||||||
/sbin/mount -o ro -t efivarfs none /sys/firmware/efi/efivars
|
/sbin/mount -o ro -t efivarfs none /sys/firmware/efi/efivars
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
@@ -45,71 +48,74 @@ fi
|
|||||||
|
|
||||||
# If /run exists, mount a tmpfs on it (unless the
|
# If /run exists, mount a tmpfs on it (unless the
|
||||||
# initrd has already done so):
|
# initrd has already done so):
|
||||||
if [ -d /run ]; then
|
if [[ -d /run ]]; then
|
||||||
if ! /bin/grep -wq "tmpfs /run tmpfs" /proc/mounts ; then
|
if ! /bin/grep -wq "tmpfs /run tmpfs" /proc/mounts; then
|
||||||
/sbin/mount -v -n -t tmpfs tmpfs /run -o mode=0755,size=32M,nodev,nosuid,noexec
|
/sbin/mount -v -n -t tmpfs tmpfs /run -o mode=0755,size=32M,nodev,nosuid,noexec
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# limetech - lets mount debugfs
|
# LimeTech - lets mount debugfs
|
||||||
/sbin/mount -v -t debugfs none /sys/kernel/debug
|
/sbin/mount -v -t debugfs none /sys/kernel/debug
|
||||||
|
|
||||||
# limetech - determine if the 'unraidlabel' kernel append parameter was
|
# LimeTech - determine if the 'unraidlabel' kernel append parameter was
|
||||||
# provided to override which device is mounted for /boot (default: UNRAID)
|
# provided to override which device is mounted for /boot (default: UNRAID)
|
||||||
UNRAIDLABEL="UNRAID"
|
UNRAIDLABEL="UNRAID"
|
||||||
UNRAIDROOT=
|
UNRAIDROOT=
|
||||||
set -- $(cat /proc/cmdline)
|
set -- $(cat /proc/cmdline)
|
||||||
for x in "$@"; do
|
for x in "$@"; do
|
||||||
case "$x" in
|
case "$x" in
|
||||||
unraidlabel=*)
|
unraidlabel=*)
|
||||||
UNRAIDLABEL="${x#unraidlabel=}"
|
UNRAIDLABEL="${x#unraidlabel=}"
|
||||||
;;
|
;;
|
||||||
root=*)
|
root=*)
|
||||||
UNRAIDROOT="${x#root=}"
|
UNRAIDROOT="${x#root=}"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
# limetech - poll for device with $UNRAIDLABEL present, with 30-sec timeout
|
# LimeTech - poll for device with $UNRAIDLABEL present, with 30-sec timeout
|
||||||
# this serves to synchronize this script with USB subsystem
|
# this serves to synchronize this script with USB subsystem
|
||||||
abort() {
|
abort() {
|
||||||
read -p "$1 - press ENTER key to reboot ..."
|
read -p "$1 - press ENTER key to reboot..."
|
||||||
echo
|
/bin/echo
|
||||||
/sbin/reboot
|
/sbin/reboot
|
||||||
}
|
}
|
||||||
|
|
||||||
find_device() {
|
find_device() {
|
||||||
# find which USB flash device/partition has the indicated label
|
# find which USB flash device/partition has the indicated label
|
||||||
local i
|
local i
|
||||||
for i in {1..30} ; do
|
for i in {1..30}; do
|
||||||
DEVICE=$(/sbin/blkid -L $UNRAIDLABEL)
|
DEVICE=$(/sbin/blkid -L $UNRAIDLABEL)
|
||||||
[[ -z $DEVICE ]] && sleep 1 || return 0
|
[[ -z $DEVICE ]] && /bin/sleep 1 || return 0
|
||||||
done
|
done
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
echo -n "waiting up to 30 sec for device with label $UNRAIDLABEL to come online ... "
|
|
||||||
find_device && echo "found $DEVICE" || abort "not found"
|
|
||||||
|
|
||||||
echo "Checking $DEVICE ..."
|
/bin/echo -n "waiting up to 30 sec for device with label $UNRAIDLABEL to come online ... "
|
||||||
|
find_device && /bin/echo "found $DEVICE" || abort "not found"
|
||||||
|
|
||||||
|
/bin/echo "Checking $DEVICE ..."
|
||||||
/sbin/fsck.fat -a -w $DEVICE 2>/dev/null
|
/sbin/fsck.fat -a -w $DEVICE 2>/dev/null
|
||||||
|
|
||||||
/sbin/mount -v -t vfat -o auto,rw,flush,noatime,nodiratime,dmask=77,fmask=177,shortname=mixed $DEVICE /boot || abort "cannot mount $DEVICE"
|
/sbin/mount -v -t vfat -o auto,rw,flush,noatime,nodiratime,dmask=77,fmask=177,shortname=mixed $DEVICE /boot || abort "cannot mount $DEVICE"
|
||||||
|
|
||||||
# check initial files used to boot
|
# check initial files used to boot
|
||||||
bzcheck () {
|
bzcheck(){
|
||||||
local BZFILE=$1
|
local BZFILE=$1
|
||||||
if [[ -f /boot/config/skipbzcheck ]]; then
|
if [[ -f /boot/config/skipbzcheck ]]; then
|
||||||
echo "Skipping $BZFILE checksum verification"
|
/bin/echo "Skipping $BZFILE checksum verification"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
echo "Verifying $BZFILE checksum ..."
|
/bin/echo "Verifying $BZFILE checksum ..."
|
||||||
[[ ! -f "/boot/$BZFILE" ]] && abort "$BZFILE not present"
|
[[ -f "/boot/$BZFILE" ]] || abort "$BZFILE not present"
|
||||||
local BZFILECHK="$BZFILE.sha256"
|
local BZFILECHK="$BZFILE.sha256"
|
||||||
[[ ! -f "/boot/$BZFILECHK" ]] && abort "$BZFILECHK not present"
|
[[ -f "/boot/$BZFILECHK" ]] || abort "$BZFILECHK not present"
|
||||||
local SUM1=$(/bin/sha256sum /boot/$BZFILE)
|
local HASH1=$(/bin/sha256sum /boot/$BZFILE)
|
||||||
local SUM2=$(/bin/cat /boot/$BZFILECHK)
|
local HASH2=$(/bin/cat /boot/$BZFILECHK)
|
||||||
[[ "${SUM1:0:63}" != "${SUM2:0:63}" ]] && abort "$BZFILE checksum error"
|
[[ ${HASH1:0:64} != ${HASH2:0:64} ]] && abort "$BZFILE checksum error"
|
||||||
}
|
}
|
||||||
bzmount () {
|
|
||||||
|
bzmount(){
|
||||||
local BZFILE=$1
|
local BZFILE=$1
|
||||||
local MNTDIR=$2
|
local MNTDIR=$2
|
||||||
bzcheck $BZFILE
|
bzcheck $BZFILE
|
||||||
@@ -120,6 +126,7 @@ bzmount () {
|
|||||||
/bin/mkdir -p /var/local/overlay-work/$MNTDIR
|
/bin/mkdir -p /var/local/overlay-work/$MNTDIR
|
||||||
/sbin/mount -v -t overlay overlay -o lowerdir=/$MNTDIR,upperdir=/var/local/overlay/$MNTDIR,workdir=/var/local/overlay-work/$MNTDIR /$MNTDIR
|
/sbin/mount -v -t overlay overlay -o lowerdir=/$MNTDIR,upperdir=/var/local/overlay/$MNTDIR,workdir=/var/local/overlay-work/$MNTDIR /$MNTDIR
|
||||||
}
|
}
|
||||||
|
|
||||||
if [[ $UNRAIDROOT == "" ]]; then
|
if [[ $UNRAIDROOT == "" ]]; then
|
||||||
bzcheck "bzimage"
|
bzcheck "bzimage"
|
||||||
bzcheck "bzroot"
|
bzcheck "bzroot"
|
||||||
@@ -129,20 +136,20 @@ if [[ $UNRAIDROOT == "" ]]; then
|
|||||||
bzmount "bzfirmware" "usr"
|
bzmount "bzfirmware" "usr"
|
||||||
|
|
||||||
# now that /usr is mounted make /etc/rc.d a symlink
|
# now that /usr is mounted make /etc/rc.d a symlink
|
||||||
/bin/rm -r /etc/rc.d
|
/bin/rm -rf /etc/rc.d
|
||||||
/bin/ln -s /usr/local/etc/rc.d /etc
|
/bin/ln -sf /usr/local/etc/rc.d /etc
|
||||||
|
|
||||||
# move /var/log to a tmpfs
|
# move /var/log to a tmpfs
|
||||||
/bin/mv /var/log/* /var/empty
|
/bin/mv -f /var/log/* /var/empty
|
||||||
/sbin/mount -t tmpfs -o size=128m,mode=0755 tmpfs /var/log
|
/sbin/mount -t tmpfs -o size=128m,mode=0755 tmpfs /var/log
|
||||||
/bin/mv /var/empty/* /var/log
|
/bin/mv -f /var/empty/* /var/log
|
||||||
else
|
else
|
||||||
echo "Checking root filesystem"
|
/bin/echo "Checking root filesystem"
|
||||||
/sbin/fsck -C -a $UNRAIDROOT
|
/sbin/fsck -C -a $UNRAIDROOT
|
||||||
RETVAL=$?
|
RETVAL=$?
|
||||||
[[ $RETVAL -ge 2 ]] && abort "fsck failed with return value $RETVAL"
|
[[ $RETVAL -ge 2 ]] && abort "fsck failed with return value $RETVAL"
|
||||||
# Remount the root filesystem in read-write mode
|
# Remount the root filesystem in read-write mode
|
||||||
echo "Remounting $UNRAIDROOT with read-write enabled."
|
/bin/echo "Remounting $UNRAIDROOT with read-write enabled."
|
||||||
/sbin/mount -w -v -n -o remount /
|
/sbin/mount -w -v -n -o remount /
|
||||||
RETVAL=$?
|
RETVAL=$?
|
||||||
[[ $RETVAL -gt 0 ]] && abort "failed to remount $UNRAIDROOT r/w with return value $RETVAL"
|
[[ $RETVAL -gt 0 ]] && abort "failed to remount $UNRAIDROOT r/w with return value $RETVAL"
|
||||||
@@ -150,7 +157,7 @@ fi
|
|||||||
|
|
||||||
# invoke testing hook
|
# invoke testing hook
|
||||||
if [[ -f /boot/config/rc.S.extra ]]; then
|
if [[ -f /boot/config/rc.S.extra ]]; then
|
||||||
source /boot/config/rc.S.extra
|
. /boot/config/rc.S.extra
|
||||||
fi
|
fi
|
||||||
# and continue in separate script
|
# and continue in separate script
|
||||||
source /etc/rc.d/rc.S.cont
|
. /etc/rc.d/rc.S.cont
|
||||||
|
|||||||
+118
-114
@@ -1,19 +1,23 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
#
|
#
|
||||||
# /etc/rc.d/rc.S: System initialization script (continuation)
|
# script: rc.S.cont
|
||||||
#
|
#
|
||||||
# Mostly written by: Patrick J. Volkerding, <volkerdi@slackware.com>
|
# System initialization script (continuation)
|
||||||
# LimeTech - Modified for Unraid OS
|
|
||||||
#
|
|
||||||
|
|
||||||
# source'ed by rc.S
|
# source'ed by rc.S
|
||||||
|
# Mostly written by: Patrick J. Volkerding, <volkerdi@slackware.com>
|
||||||
|
#
|
||||||
|
# LimeTech - modified for Unraid OS
|
||||||
|
# Bergware - modified for Unraid OS, October 2023
|
||||||
|
|
||||||
# limetech - bind selected devices to vfio-pci
|
# run & log functions
|
||||||
/usr/local/sbin/vfio-pci 1> /var/log/vfio-pci 2> /var/log/vfio-pci-errors
|
. /etc/rc.d/rc.runlog
|
||||||
|
|
||||||
# Run the kernel module script. This updates the module dependencies and
|
# LimeTech - bind selected devices to vfio-pci
|
||||||
|
/usr/local/sbin/vfio-pci 1>/var/log/vfio-pci 2>/var/log/vfio-pci-errors
|
||||||
|
|
||||||
|
# Run the kernel module script. This updates the module dependencies and
|
||||||
# also supports manually loading kernel modules through rc.modules.local.
|
# also supports manually loading kernel modules through rc.modules.local.
|
||||||
if [ -x /etc/rc.d/rc.modules ]; then
|
if [[ -x /etc/rc.d/rc.modules ]]; then
|
||||||
/etc/rc.d/rc.modules
|
/etc/rc.d/rc.modules
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -25,59 +29,59 @@ fi
|
|||||||
# device nodes that you need in the /dev directory. Even USB and IEEE1394
|
# device nodes that you need in the /dev directory. Even USB and IEEE1394
|
||||||
# devices will need to have the modules loaded by hand if udev is not used.
|
# devices will need to have the modules loaded by hand if udev is not used.
|
||||||
# So use it. :-)
|
# So use it. :-)
|
||||||
if grep -wq sysfs /proc/mounts && grep -q devtmpfs /proc/filesystems ; then
|
if /bin/grep -wq sysfs /proc/mounts && /bin/grep -q devtmpfs /proc/filesystems; then
|
||||||
if ! grep -wq nohotplug /proc/cmdline ; then
|
if ! /bin/grep -wq nohotplug /proc/cmdline; then
|
||||||
if [ -x /etc/rc.d/rc.udev ]; then
|
if [[ -x /etc/rc.d/rc.udev ]]; then
|
||||||
/etc/rc.d/rc.udev start
|
/etc/rc.d/rc.udev start
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Mount Control Groups filesystem interface:
|
# Mount Control Groups filesystem interface:
|
||||||
if grep -wq cgroup /proc/filesystems ; then
|
if /bin/grep -wq cgroup /proc/filesystems; then
|
||||||
# Christoph H. - Check if unraidcgroup1 is passed over in command line
|
# Christoph H. - Check if unraidcgroup1 is passed over in command line
|
||||||
if grep -wq unraidcgroup1 /proc/cmdline ; then
|
if /bin/grep -wq unraidcgroup1 /proc/cmdline; then
|
||||||
if [ -d /sys/fs/cgroup ]; then
|
if [[ -d /sys/fs/cgroup ]]; then
|
||||||
# See linux-*/Documentation/cgroups/cgroups.txt (section 1.6)
|
# See linux-*/Documentation/cgroups/cgroups.txt (section 1.6)
|
||||||
# Check if we have some tools to autodetect the available cgroup controllers
|
# Check if we have some tools to autodetect the available cgroup controllers
|
||||||
if [ -x /bin/cut -a -x /bin/tail ]; then
|
if [[ -x /bin/cut && -x /bin/tail ]]; then
|
||||||
# Mount a tmpfs as the cgroup filesystem root
|
# Mount a tmpfs as the cgroup filesystem root
|
||||||
mount -t tmpfs -o mode=0755,size=8M cgroup_root /sys/fs/cgroup
|
/sbin/mount -t tmpfs -o mode=0755,size=8M cgroup_root /sys/fs/cgroup
|
||||||
# Autodetect available controllers and mount them in subfolders
|
# Autodetect available controllers and mount them in subfolders
|
||||||
controllers="$(/bin/cut -f 1 /proc/cgroups | /bin/tail -n +2)"
|
CONTROLLERS="$(cut -f 1 /proc/cgroups | tail -n +2)"
|
||||||
for i in $controllers; do
|
for i in $CONTROLLERS; do
|
||||||
mkdir /sys/fs/cgroup/$i
|
/bin/mkdir /sys/fs/cgroup/$i
|
||||||
mount -t cgroup -o $i $i /sys/fs/cgroup/$i
|
/sbin/mount -t cgroup -o $i $i /sys/fs/cgroup/$i
|
||||||
done
|
done
|
||||||
unset i controllers
|
unset i CONTROLLERS
|
||||||
# Eric S. figured out this needs to go here...
|
# Eric S. figured out this needs to go here...
|
||||||
echo 1 > /sys/fs/cgroup/memory/memory.use_hierarchy
|
/bin/echo 1 >/sys/fs/cgroup/memory/memory.use_hierarchy
|
||||||
else
|
else
|
||||||
# We can't use autodetection so fall back mounting them all together
|
# We can't use autodetection so fall back mounting them all together
|
||||||
mount -t cgroup cgroup /sys/fs/cgroup
|
/sbin/mount -t cgroup cgroup /sys/fs/cgroup
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
mkdir -p /dev/cgroup
|
/bin/mkdir -p /dev/cgroup
|
||||||
mount -t cgroup cgroup /dev/cgroup
|
/sbin/mount -t cgroup cgroup /dev/cgroup
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
if [ -d /sys/fs/cgroup ]; then
|
if [[ -d /sys/fs/cgroup ]]; then
|
||||||
# See https://docs.kernel.org/admin-guide/cgroup-v2.html (section Mounting)
|
# See https://docs.kernel.org/admin-guide/cgroup-v2.html (section Mounting)
|
||||||
# Mount a tmpfs as the cgroup2 filesystem root
|
# Mount a tmpfs as the cgroup2 filesystem root
|
||||||
mount -t tmpfs -o mode=0755,size=8M cgroup_root /sys/fs/cgroup
|
/sbin/mount -t tmpfs -o mode=0755,size=8M cgroup_root /sys/fs/cgroup
|
||||||
mount -t cgroup2 none /sys/fs/cgroup
|
/sbin/mount -t cgroup2 none /sys/fs/cgroup
|
||||||
else
|
else
|
||||||
mkdir -p /dev/cgroup
|
/bin/mkdir -p /dev/cgroup
|
||||||
mount -t cgroup2 none /dev/cgroup
|
/sbin/mount -t cgroup2 none /dev/cgroup
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Huge page support:
|
# Huge page support:
|
||||||
mount /hugetlbfs
|
/sbin/mount /hugetlbfs
|
||||||
|
|
||||||
# Enable swapping:
|
# Enable swapping:
|
||||||
/sbin/swapon -a 2> /dev/null
|
/sbin/swapon -a 2>/dev/null
|
||||||
|
|
||||||
# Set the tick and frequency for the system clock.
|
# Set the tick and frequency for the system clock.
|
||||||
# Default values are: TICK=10000 and FREQ=0
|
# Default values are: TICK=10000 and FREQ=0
|
||||||
@@ -85,97 +89,97 @@ TICK=10000
|
|||||||
FREQ=0
|
FREQ=0
|
||||||
# If there's a /etc/default/adjtimex config file, source it to override
|
# If there's a /etc/default/adjtimex config file, source it to override
|
||||||
# the default TICK and FREQ:
|
# the default TICK and FREQ:
|
||||||
if [ -r /etc/default/adjtimex ]; then
|
if [[ -r /etc/default/adjtimex ]]; then
|
||||||
. /etc/default/adjtimex
|
. /etc/default/adjtimex
|
||||||
fi
|
fi
|
||||||
if /sbin/adjtimex --tick $TICK --frequency $FREQ; then
|
if adjtimex --tick $TICK --frequency $FREQ; then
|
||||||
echo "Setting the system clock rate: /sbin/adjtimex --tick $TICK --frequency $FREQ"
|
log "Setting the system clock rate: adjtimex --tick $TICK --frequency $FREQ"
|
||||||
else
|
else
|
||||||
echo "Failed to set system clock with adjtimex, possibly invalid parameters? (TICK=$TICK FREQ=$FREQ)"
|
log "Failed to set system clock with adjtimex, possibly invalid parameters? (TICK=$TICK FREQ=$FREQ)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Set the system time from the hardware clock using hwclock --hctosys.
|
# Set the system time from the hardware clock using hwclock --hctosys.
|
||||||
if [ -x /sbin/hwclock ]; then
|
if [[ -x /sbin/hwclock ]]; then
|
||||||
# Check for a broken motherboard RTC clock (where ioports for rtc are
|
# Check for a broken motherboard RTC clock (where ioports for rtc are
|
||||||
# unknown) to prevent hwclock causing a hang:
|
# unknown) to prevent hwclock causing a hang:
|
||||||
if ! grep -q " : rtc" /proc/ioports ; then
|
if ! /bin/grep -q " : rtc" /proc/ioports ; then
|
||||||
CLOCK_OPT="--directisa"
|
CLOCK_OPT="--directisa"
|
||||||
fi
|
fi
|
||||||
if [ /etc/adjtime -nt /etc/hardwareclock ]; then
|
if [[ /etc/adjtime -nt /etc/hardwareclock ]]; then
|
||||||
if grep -q "^LOCAL" /etc/adjtime ; then
|
if /bin/grep -q "^LOCAL" /etc/adjtime; then
|
||||||
echo -n "Setting system time from the hardware clock (localtime): "
|
log "Setting system time from the hardware clock (localtime)..."
|
||||||
else
|
else
|
||||||
echo -n "Setting system time from the hardware clock (UTC): "
|
log "Setting system time from the hardware clock (UTC)..."
|
||||||
fi
|
fi
|
||||||
/sbin/hwclock $CLOCK_OPT --hctosys
|
run /sbin/hwclock $CLOCK_OPT --hctosys
|
||||||
elif grep -wq "^localtime" /etc/hardwareclock 2> /dev/null ; then
|
elif /bin/grep -wq "^localtime" /etc/hardwareclock 2>/dev/null; then
|
||||||
echo -n "Setting system time from the hardware clock (localtime): "
|
log "Setting system time from the hardware clock (localtime)..."
|
||||||
/sbin/hwclock $CLOCK_OPT --localtime --hctosys
|
run /sbin/hwclock $CLOCK_OPT --localtime --hctosys
|
||||||
else
|
else
|
||||||
echo -n "Setting system time from the hardware clock (UTC): "
|
log "Setting system time from the hardware clock (UTC)..."
|
||||||
/sbin/hwclock $CLOCK_OPT --utc --hctosys
|
run /sbin/hwclock $CLOCK_OPT --utc --hctosys
|
||||||
fi
|
fi
|
||||||
date
|
/bin/date
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Configure ISA Plug-and-Play devices:
|
# Configure ISA Plug-and-Play devices:
|
||||||
if [ -r /etc/isapnp.conf ]; then
|
if [[ -r /etc/isapnp.conf ]]; then
|
||||||
if [ -x /sbin/isapnp ]; then
|
if [[ -x /sbin/isapnp ]]; then
|
||||||
/sbin/isapnp /etc/isapnp.conf
|
/sbin/isapnp /etc/isapnp.conf
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Configure kernel parameters:
|
# Configure kernel parameters:
|
||||||
if [ -x /sbin/sysctl -a -r /etc/sysctl.conf ]; then
|
if [[ -x /sbin/sysctl && -r /etc/sysctl.conf ]]; then
|
||||||
echo "Configuring kernel parameters: /sbin/sysctl -e --system"
|
log "Configuring kernel parameters..."
|
||||||
/sbin/sysctl -e --system
|
run /sbin/sysctl -e --system
|
||||||
elif [ -x /sbin/sysctl ]; then
|
elif [[ -x /sbin/sysctl ]]; then
|
||||||
echo "Configuring kernel parameters: /sbin/sysctl -e --system"
|
log "Configuring kernel parameters..."
|
||||||
# Don't say "Applying /etc/sysctl.conf" or complain if the file doesn't exist
|
# Don't say "Applying /etc/sysctl.conf" or complain if the file doesn't exist
|
||||||
/sbin/sysctl -e --system 2> /dev/null | grep -v "Applying /etc/sysctl.conf"
|
/sbin/sysctl -e --system | /bin/grep -v "Applying /etc/sysctl.conf" | log
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Clean up some temporary files:
|
# Clean up some temporary files:
|
||||||
rm -f /etc/nologin /etc/dhcpc/*.pid /etc/forcefsck /etc/fastboot \
|
/bin/rm -f /etc/nologin /etc/dhcpc/*.pid /etc/forcefsck /etc/fastboot \
|
||||||
/var/state/saslauthd/saslauthd.pid /tmp/.Xauth* 1> /dev/null 2> /dev/null
|
/var/state/saslauthd/saslauthd.pid /tmp/.Xauth* &>/dev/null
|
||||||
rm -rf /tmp/{kde-[a-zA-Z]*,ksocket-[a-zA-Z]*,hsperfdata_[a-zA-Z]*,plugtmp*}
|
/bin/rm -rf /tmp/{kde-[a-zA-Z]*,ksocket-[a-zA-Z]*,hsperfdata_[a-zA-Z]*,plugtmp*}
|
||||||
if [ -d /var/lib/pkgtools/setup/tmp ]; then
|
if [[ -d /var/lib/pkgtools/setup/tmp ]]; then
|
||||||
( cd /var/lib/pkgtools/setup/tmp && rm -rf * )
|
( cd /var/lib/pkgtools/setup/tmp && /bin/rm -rf * )
|
||||||
elif [ -d /var/log/setup/tmp ]; then
|
elif [[ -d /var/log/setup/tmp ]]; then
|
||||||
( cd /var/log/setup/tmp && rm -rf * )
|
( cd /var/log/setup/tmp && /bin/rm -rf * )
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Clear /var/lock/subsys:
|
# Clear /var/lock/subsys:
|
||||||
if [ -d /var/lock/subsys ]; then
|
if [[ -d /var/lock/subsys ]]; then
|
||||||
rm -f /var/lock/subsys/*
|
/bin/rm -f /var/lock/subsys/*
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Start libcgroup services:
|
# Start libcgroup services:
|
||||||
if [ -x /etc/rc.d/rc.cgconfig -a -x /etc/rc.d/rc.cgred -a -d /sys/fs/cgroup ]; then
|
if [[ -x /etc/rc.d/rc.cgconfig && -x /etc/rc.d/rc.cgred && -d /sys/fs/cgroup ]]; then
|
||||||
/etc/rc.d/rc.cgconfig start ; echo " /usr/sbin/cgconfigparser -l /etc/cgconfig.conf"
|
/etc/rc.d/rc.cgconfig start
|
||||||
/etc/rc.d/rc.cgred start
|
/etc/rc.d/rc.cgred start
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Create /tmp/{.ICE-unix,.X11-unix} if they are not present:
|
# Create /tmp/{.ICE-unix,.X11-unix} if they are not present:
|
||||||
if [ ! -e /tmp/.ICE-unix ]; then
|
if [[ ! -e /tmp/.ICE-unix ]]; then
|
||||||
mkdir -p /tmp/.ICE-unix
|
/bin/mkdir -p /tmp/.ICE-unix
|
||||||
chmod 1777 /tmp/.ICE-unix
|
/bin/chmod 1777 /tmp/.ICE-unix
|
||||||
fi
|
fi
|
||||||
if [ ! -e /tmp/.X11-unix ]; then
|
if [[ ! -e /tmp/.X11-unix ]]; then
|
||||||
mkdir -p /tmp/.X11-unix
|
/bin/mkdir -p /tmp/.X11-unix
|
||||||
chmod 1777 /tmp/.X11-unix
|
/bin/chmod 1777 /tmp/.X11-unix
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Create a fresh utmp file:
|
# Create a fresh utmp file:
|
||||||
touch /var/run/utmp
|
/bin/touch /var/run/utmp
|
||||||
chown root:utmp /var/run/utmp
|
/bin/chown root:utmp /var/run/utmp
|
||||||
chmod 664 /var/run/utmp
|
/bin/chmod 664 /var/run/utmp
|
||||||
|
|
||||||
# In case pam_faillock(8) is being used, create the tally directory:
|
# In case pam_faillock(8) is being used, create the tally directory:
|
||||||
mkdir -p /var/run/faillock
|
/bin/mkdir -p /var/run/faillock
|
||||||
|
|
||||||
# If there are SystemV init scripts for this runlevel, run them.
|
# If there are SystemV init scripts for this runlevel, run them.
|
||||||
if [ -x /etc/rc.d/rc.sysvinit ]; then
|
if [[ -x /etc/rc.d/rc.sysvinit ]]; then
|
||||||
/etc/rc.d/rc.sysvinit
|
/etc/rc.d/rc.sysvinit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -183,61 +187,61 @@ fi
|
|||||||
# CAREFUL! This can make some systems hang if the rc.serial script isn't
|
# CAREFUL! This can make some systems hang if the rc.serial script isn't
|
||||||
# set up correctly. If this happens, you may have to edit the file from a
|
# set up correctly. If this happens, you may have to edit the file from a
|
||||||
# boot disk, and/or set it as non-executable:
|
# boot disk, and/or set it as non-executable:
|
||||||
if [ -x /etc/rc.d/rc.serial ]; then
|
if [[ -x /etc/rc.d/rc.serial ]]; then
|
||||||
/etc/rc.d/rc.serial start
|
/etc/rc.d/rc.serial start
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# limetech - let's keep this on the USB flash
|
# LimeTech - let's keep this on the USB flash
|
||||||
## Carry an entropy pool between reboots to improve randomness.
|
## Carry an entropy pool between reboots to improve randomness.
|
||||||
mkdir -p /var/lib/seedrng
|
/bin/mkdir -p /var/lib/seedrng
|
||||||
chmod 600 /var/lib/seedrng
|
/bin/chmod 600 /var/lib/seedrng
|
||||||
cp /boot/config/random-seed /var/lib/seedrng/seed.no-credit 2>/dev/null
|
/bin/cp /boot/config/random-seed /var/lib/seedrng/seed.no-credit 2>/dev/null
|
||||||
/usr/sbin/seedrng
|
/usr/sbin/seedrng
|
||||||
|
|
||||||
# limetech - restore hostname from ident.cfg file on flash and ensure hostname is
|
# LimeTech - restore hostname from ident.cfg file on flash and ensure hostname is
|
||||||
# defined as localhost alias in /etc/hosts (this lets wins name resolution work)
|
# defined as localhost alias in /etc/hosts (this lets wins name resolution work)
|
||||||
NAME="Tower"
|
NAME="Tower"
|
||||||
timeZone="America/Los_Angeles"
|
TIMEZONE="America/Los_Angeles"
|
||||||
if [ -r /boot/config/ident.cfg ]; then
|
if [[ -r /boot/config/ident.cfg ]]; then
|
||||||
source <(/usr/bin/fromdos < /boot/config/ident.cfg)
|
. <(/usr/bin/fromdos </boot/config/ident.cfg)
|
||||||
NAME=${NAME//[^a-zA-Z\-\.0-9]/\-}
|
NAME=${NAME//[^a-zA-Z\-\.0-9]/\-}
|
||||||
fi
|
fi
|
||||||
echo "$NAME" >/etc/HOSTNAME
|
/bin/echo "$NAME" >/etc/HOSTNAME
|
||||||
echo "# Generated" >/etc/hosts
|
/bin/echo "# Generated" >/etc/hosts
|
||||||
echo "127.0.0.1 $NAME localhost" >>/etc/hosts
|
/bin/echo "127.0.0.1 $NAME localhost" >>/etc/hosts
|
||||||
echo "54.149.176.35 keys.lime-technology.com" >>/etc/hosts
|
/bin/echo "54.149.176.35 keys.lime-technology.com" >>/etc/hosts
|
||||||
|
|
||||||
# limetech - restore the configured timezone
|
# LimeTech - restore the configured timezone
|
||||||
if [ "$timeZone" = "custom" ]; then
|
if [[ $TIMEZONE == custom ]]; then
|
||||||
ln -sf /boot/config/timezone /etc/localtime
|
/bin/ln -sf /boot/config/timezone /etc/localtime
|
||||||
else
|
else
|
||||||
ln -sf /usr/share/zoneinfo/$timeZone /etc/localtime
|
/bin/ln -sf /usr/share/zoneinfo/$TIMEZONE /etc/localtime
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# limetech - restore password files stored on flash
|
# LimeTech - restore password files stored on flash
|
||||||
if [ -r /boot/config/passwd ]; then
|
if [[ -r /boot/config/passwd ]]; then
|
||||||
while IFS=: read -r username password userid groupid comment homedir cmdshell ; do
|
while IFS=: read -r USERNAME PASSWORD USERID GROUPID COMMENT HOMEDIR CMDSHELL; do
|
||||||
if [[ $username = root ]]; then
|
if [[ $USERNAME == root ]]; then
|
||||||
sed -i "s|^root:.*|root:x:0:0:$comment:/root:/bin/bash|" /etc/passwd
|
/bin/sed -i "s|^root:.*|root:x:0:0:$COMMENT:/root:/bin/bash|" /etc/passwd
|
||||||
fi
|
fi
|
||||||
if (( userid >= 1000 )); then
|
if (( USERID >= 1000 )); then
|
||||||
echo "$username:x:$userid:$groupid:$comment:/:/bin/false" >> /etc/passwd
|
/bin/echo "$USERNAME:x:$USERID:$GROUPID:$COMMENT:/:/bin/false" >> /etc/passwd
|
||||||
fi
|
fi
|
||||||
done < /boot/config/passwd
|
done </boot/config/passwd
|
||||||
if [ -r /boot/config/shadow ]; then
|
if [[ -r /boot/config/shadow ]]; then
|
||||||
cp /boot/config/shadow /etc
|
/bin/cp -f /boot/config/shadow /etc
|
||||||
chmod 600 /etc/shadow
|
/bin/chmod 600 /etc/shadow
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
/usr/sbin/pwconv
|
/usr/sbin/pwconv
|
||||||
if [ -r /boot/config/smbpasswd ]; then
|
if [[ -r /boot/config/smbpasswd ]]; then
|
||||||
cp /boot/config/smbpasswd /var/lib/samba/private
|
/bin/cp -f /boot/config/smbpasswd /var/lib/samba/private
|
||||||
fi
|
fi
|
||||||
if [ -r /boot/config/secrets.tdb ]; then
|
if [[ -r /boot/config/secrets.tdb ]]; then
|
||||||
cp /boot/config/secrets.tdb /var/lib/samba/private
|
/bin/cp -f /boot/config/secrets.tdb /var/lib/samba/private
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# limetech - restore custom rsyslog.conf config file from flash if present
|
# LimeTech - restore custom rsyslog.conf config file from flash if present
|
||||||
if [ -r /boot/config/rsyslog.conf ]; then
|
if [[ -r /boot/config/rsyslog.conf ]]; then
|
||||||
/usr/bin/fromdos </boot/config/rsyslog.conf >/etc/rsyslog.conf
|
/usr/bin/fromdos </boot/config/rsyslog.conf >/etc/rsyslog.conf
|
||||||
fi
|
fi
|
||||||
|
|||||||
+30
-12
@@ -1,25 +1,41 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# script: rc.acpid
|
||||||
|
#
|
||||||
# Start/stop/restart acpid.
|
# Start/stop/restart acpid.
|
||||||
|
#
|
||||||
|
# LimeTech - modified for Unraid OS
|
||||||
|
# Bergware - modified for Unraid OS, October 2023
|
||||||
|
|
||||||
# Start acpid:
|
DAEMON="ACPI daemon"
|
||||||
acpid_start() {
|
|
||||||
if [ -x /usr/sbin/acpid -a -d /proc/acpi ]; then
|
# run & log functions
|
||||||
echo "Starting ACPI daemon: /usr/sbin/acpid"
|
. /etc/rc.d/rc.runlog
|
||||||
/usr/sbin/acpid
|
|
||||||
|
acpid_start(){
|
||||||
|
log "Starting $DAEMON..."
|
||||||
|
local REPLY
|
||||||
|
if [[ -x /usr/sbin/acpid && -d /proc/acpi ]]; then
|
||||||
|
run /usr/sbin/acpid
|
||||||
|
REPLY="Started"
|
||||||
|
else
|
||||||
|
REPLY="Failed"
|
||||||
fi
|
fi
|
||||||
|
log "$DAEMON... $REPLY."
|
||||||
}
|
}
|
||||||
|
|
||||||
# Stop acpid:
|
acpid_stop(){
|
||||||
acpid_stop() {
|
log "Stopping $DAEMON..."
|
||||||
if [ -r /var/run/acpid.pid ]; then
|
if [[ -r /var/run/acpid.pid ]]; then
|
||||||
kill $(cat /var/run/acpid.pid)
|
kill $(cat /var/run/acpid.pid)
|
||||||
else
|
else
|
||||||
killall acpid
|
killall acpid
|
||||||
fi
|
fi
|
||||||
|
log "$DAEMON... Stopped."
|
||||||
}
|
}
|
||||||
|
|
||||||
# Restart acpid:
|
acpid_restart(){
|
||||||
acpid_restart() {
|
log "Restarting $DAEMON..."
|
||||||
acpid_stop
|
acpid_stop
|
||||||
sleep 1
|
sleep 1
|
||||||
acpid_start
|
acpid_start
|
||||||
@@ -36,5 +52,7 @@ case "$1" in
|
|||||||
acpid_restart
|
acpid_restart
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "usage $0 start|stop|restart"
|
echo "Usage: $BASENAME start|stop|restart"
|
||||||
|
exit 1
|
||||||
esac
|
esac
|
||||||
|
exit 0
|
||||||
|
|||||||
+48
-17
@@ -1,39 +1,70 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
# /etc/rc.d/rc.atd - start/stop the at daemon
|
#
|
||||||
|
# script: rc.atd
|
||||||
|
#
|
||||||
|
# start/stop the at daemon
|
||||||
|
#
|
||||||
|
# LimeTech - modified for Unraid OS
|
||||||
|
# Bergware - modified for Unraid OS, October 2023
|
||||||
|
|
||||||
|
DAEMON="AT daemon"
|
||||||
|
CROND="/usr/sbin/atd"
|
||||||
|
|
||||||
|
# run & log functions
|
||||||
|
. /etc/rc.d/rc.runlog
|
||||||
|
|
||||||
# To change the default options, edit /etc/default/atd.
|
# To change the default options, edit /etc/default/atd.
|
||||||
if [ -r /etc/default/atd ]; then
|
if [[ -r /etc/default/atd ]]; then
|
||||||
. /etc/default/atd
|
. /etc/default/atd
|
||||||
fi
|
fi
|
||||||
|
|
||||||
start_atd() {
|
atd_running(){
|
||||||
if ! /usr/bin/pgrep --ns $$ --euid daemon -f "^/usr/sbin/atd" 1> /dev/null 2> /dev/null ; then
|
pgrep --ns $$ --euid daemon -f "^$CROND" &>/dev/null
|
||||||
echo "Starting atd: /usr/sbin/atd $ATD_OPTS"
|
}
|
||||||
/usr/sbin/atd $ATD_OPTS
|
|
||||||
|
atd_start(){
|
||||||
|
log "Starting $DAEMON..."
|
||||||
|
local REPLY
|
||||||
|
if atd_running; then
|
||||||
|
REPLY="Already started"
|
||||||
|
else
|
||||||
|
run /usr/sbin/atd $ATD_OPTS
|
||||||
|
if atd_running; then REPLY="Started"; else REPLY="Failed"; fi
|
||||||
fi
|
fi
|
||||||
|
log "$DAEMON... $REPLY."
|
||||||
}
|
}
|
||||||
|
|
||||||
stop_atd() {
|
atd_stop(){
|
||||||
echo "Stopping atd."
|
log "Stopping $DAEMON..."
|
||||||
/usr/bin/pkill --ns $$ --euid daemon -f "^/usr/sbin/atd" 2> /dev/null
|
local REPLY
|
||||||
|
if ! atd_running; then
|
||||||
|
REPLY="Already stopped"
|
||||||
|
else
|
||||||
|
run pkill --ns $$ --euid daemon -f "^$CROND"
|
||||||
|
if ! atd_running; then REPLY="Stopped"; else REPLY="Failed"; fi
|
||||||
|
fi
|
||||||
|
log "$DAEMON... $REPLY."
|
||||||
}
|
}
|
||||||
|
|
||||||
restart_atd() {
|
atd_restart(){
|
||||||
stop_atd
|
log "Restarting $DAEMON..."
|
||||||
|
atd_stop
|
||||||
sleep 1
|
sleep 1
|
||||||
start_atd
|
atd_start
|
||||||
}
|
}
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
'start')
|
'start')
|
||||||
start_atd
|
atd_start
|
||||||
;;
|
;;
|
||||||
'stop')
|
'stop')
|
||||||
stop_atd
|
atd_stop
|
||||||
;;
|
;;
|
||||||
'restart')
|
'restart')
|
||||||
restart_atd
|
atd_restart
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "usage $0 start|stop|restart"
|
echo "Usage: $BASENAME start|stop|restart"
|
||||||
|
exit 1
|
||||||
esac
|
esac
|
||||||
|
exit 0
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ avahid_running(){
|
|||||||
|
|
||||||
avahid_start(){
|
avahid_start(){
|
||||||
log "Starting $DAEMON..."
|
log "Starting $DAEMON..."
|
||||||
|
local REPLY
|
||||||
if avahid_running; then
|
if avahid_running; then
|
||||||
REPLY="Already started"
|
REPLY="Already started"
|
||||||
else
|
else
|
||||||
@@ -75,6 +76,7 @@ avahid_start(){
|
|||||||
|
|
||||||
avahid_stop(){
|
avahid_stop(){
|
||||||
log "Stopping $DAEMON..."
|
log "Stopping $DAEMON..."
|
||||||
|
local REPLY
|
||||||
if ! avahid_running; then
|
if ! avahid_running; then
|
||||||
REPLY="Already stopped"
|
REPLY="Already stopped"
|
||||||
else
|
else
|
||||||
|
|||||||
+52
-37
@@ -1,5 +1,8 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# script: rc.avahi-dnsconfd
|
||||||
|
#
|
||||||
|
# Start/stop/restart the avahi dnsconfd daemon
|
||||||
# This file is part of avahi.
|
# This file is part of avahi.
|
||||||
#
|
#
|
||||||
# avahi is free software; you can redistribute it and/or modify it
|
# avahi is free software; you can redistribute it and/or modify it
|
||||||
@@ -14,50 +17,65 @@
|
|||||||
#
|
#
|
||||||
# You should have received a copy of the GNU Lesser General Public
|
# You should have received a copy of the GNU Lesser General Public
|
||||||
# License along with avahi; if not, write to the Free Software
|
# License along with avahi; if not, write to the Free Software
|
||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||||
# USA.
|
#
|
||||||
|
# LimeTech - modified for Unraid OS
|
||||||
|
# Bergware - modified for Unraid OS, October 2023
|
||||||
|
|
||||||
# Start/stop/restart the avahi dnsconfd daemon:
|
DAEMON="Avahi mDNS/DNS-SD DNS server daemon"
|
||||||
|
AVAHI="/usr/sbin/avahi-dnsconfd"
|
||||||
|
|
||||||
PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
# run & log functions
|
||||||
DESC="Avahi mDNS/DNS-SD DNS Server Configuration Daemon"
|
. /etc/rc.d/rc.runlog
|
||||||
NAME="avahi-dnsconfd"
|
|
||||||
DAEMON="/usr/sbin/$NAME"
|
|
||||||
|
|
||||||
avahidns_start()
|
avahidns_running(){
|
||||||
{
|
$AVAHI -c
|
||||||
echo "Starting $DESC: $DAEMON -D"
|
[[ $? == 0 ]]
|
||||||
$DAEMON -D
|
|
||||||
}
|
}
|
||||||
|
|
||||||
avahidns_status()
|
avahidns_start(){
|
||||||
{
|
log "Starting $DAEMON..."
|
||||||
$DAEMON -c
|
local REPLY
|
||||||
[ $? = 0 ]
|
if avahidns_running; then
|
||||||
|
REPLY="Already started"
|
||||||
|
else
|
||||||
|
run $AVAHI -D
|
||||||
|
if avahidns_running; then REPLY="Started"; else REPLY="Failed"; fi
|
||||||
|
fi
|
||||||
|
log "$DAEMON... $REPLY."
|
||||||
}
|
}
|
||||||
|
|
||||||
avahidns_stop()
|
avahidns_stop(){
|
||||||
{
|
log "Stopping $DAEMON..."
|
||||||
echo -en "Stopping $DESC: "
|
local REPLY
|
||||||
$DAEMON -c
|
if ! avahidns_running; then
|
||||||
[ $? != 0 ]
|
REPLY="Already stopped"
|
||||||
echo "stopped";
|
else
|
||||||
$DAEMON -k 2>/dev/null
|
run $AVAHI -k
|
||||||
|
if ! avahidns_running; then REPLY="Stopped"; else REPLY="Failed"; fi
|
||||||
|
fi
|
||||||
|
log "$DAEMON... $REPLY."
|
||||||
}
|
}
|
||||||
|
|
||||||
avahidns_restart()
|
avahidns_restart(){
|
||||||
{
|
log "Restarting $DAEMON..."
|
||||||
avahidns_stop
|
avahidns_stop
|
||||||
|
sleep 1
|
||||||
avahidns_start
|
avahidns_start
|
||||||
}
|
}
|
||||||
|
|
||||||
|
avahidns_status(){
|
||||||
|
if avahidns_running; then
|
||||||
|
echo "$DAEMON is currently running."
|
||||||
|
else
|
||||||
|
echo "$DAEMON is not running."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
'start')
|
'start')
|
||||||
if ( ! avahidns_status ); then
|
avahidns_start
|
||||||
avahidns_start
|
|
||||||
else
|
|
||||||
echo "$DESC is already running (will not start it twice)."
|
|
||||||
fi
|
|
||||||
;;
|
;;
|
||||||
'stop')
|
'stop')
|
||||||
avahidns_stop
|
avahidns_stop
|
||||||
@@ -66,13 +84,10 @@ case "$1" in
|
|||||||
avahidns_restart
|
avahidns_restart
|
||||||
;;
|
;;
|
||||||
'status')
|
'status')
|
||||||
if ( avahidns_status ); then
|
avahidns_status
|
||||||
echo "$DESC is currently running"
|
|
||||||
else
|
|
||||||
echo "$DESC is not running."
|
|
||||||
fi
|
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "usage $0 start|stop|status|restart"
|
echo "Usage: $BASENAME start|stop|restart|status"
|
||||||
|
exit 1
|
||||||
esac
|
esac
|
||||||
|
exit 0
|
||||||
|
|||||||
+42
-32
@@ -1,50 +1,59 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
#
|
#
|
||||||
# rc.cpufreq: Settings for CPU frequency and voltage scaling in the kernel.
|
# script: rc.cpufreq
|
||||||
# For more information, see the kernel documentation in
|
#
|
||||||
# /usr/src/linux/Documentation/cpu-freq/
|
# Settings for CPU frequency and voltage scaling in the kernel.
|
||||||
|
# For more information, see the kernel documentation in
|
||||||
|
# /usr/src/linux/Documentation/cpu-freq/
|
||||||
|
#
|
||||||
# Default CPU scaling governor to try. Some possible choices are:
|
# Default CPU scaling governor to try. Some possible choices are:
|
||||||
# performance: The CPUfreq governor "performance" sets the CPU statically
|
# performance: The CPUfreq governor "performance" sets the CPU statically
|
||||||
# to the highest frequency within the borders of scaling_min_freq
|
# to the highest frequency within the borders of scaling_min_freq
|
||||||
# and scaling_max_freq.
|
# and scaling_max_freq.
|
||||||
# powersave: The CPUfreq governor "powersave" sets the CPU statically to the
|
# powersave: The CPUfreq governor "powersave" sets the CPU statically to the
|
||||||
# lowest frequency within the borders of scaling_min_freq and
|
# lowest frequency within the borders of scaling_min_freq and
|
||||||
# scaling_max_freq.
|
# scaling_max_freq.
|
||||||
# userspace: The CPUfreq governor "userspace" allows the user, or any
|
# userspace: The CPUfreq governor "userspace" allows the user, or any
|
||||||
# userspace program running with UID "root", to set the CPU to a
|
# userspace program running with UID "root", to set the CPU to a
|
||||||
# specific frequency by making a sysfs file "scaling_setspeed"
|
# specific frequency by making a sysfs file "scaling_setspeed"
|
||||||
# available in the CPU-device directory.
|
# available in the CPU-device directory.
|
||||||
# ondemand: The CPUfreq governor "ondemand" sets the CPU depending on the
|
# ondemand: The CPUfreq governor "ondemand" sets the CPU depending on the
|
||||||
# current usage.
|
# current usage.
|
||||||
# conservative: The CPUfreq governor "conservative", much like the "ondemand"
|
# conservative: The CPUfreq governor "conservative", much like the "ondemand"
|
||||||
# governor, sets the CPU depending on the current usage. It
|
# governor, sets the CPU depending on the current usage. It
|
||||||
# differs in behaviour in that it gracefully increases and
|
# differs in behaviour in that it gracefully increases and
|
||||||
# decreases the CPU speed rather than jumping to max speed the
|
# decreases the CPU speed rather than jumping to max speed the
|
||||||
# moment there is any load on the CPU.
|
# moment there is any load on the CPU.
|
||||||
# schedutil: The CPUfreq governor "schedutil" aims at better integration with
|
# schedutil: The CPUfreq governor "schedutil" aims at better integration with
|
||||||
# the Linux kernel scheduler. Load estimation is achieved through
|
# the Linux kernel scheduler. Load estimation is achieved through
|
||||||
# the scheduler's Per-Entity Load Tracking (PELT) mechanism, which
|
# the scheduler's Per-Entity Load Tracking (PELT) mechanism, which
|
||||||
# also provides information about the recent load.
|
# also provides information about the recent load.
|
||||||
SCALING_GOVERNOR=ondemand
|
#
|
||||||
|
# LimeTech - modified for Unraid OS
|
||||||
|
# Bergware - modified for Unraid OS, October 2023
|
||||||
|
|
||||||
|
SCALING_GOVERNOR="ondemand"
|
||||||
|
SYSTEM="/sys/devices/system/cpu"
|
||||||
|
|
||||||
|
# run & log functions
|
||||||
|
. /etc/rc.d/rc.runlog
|
||||||
|
|
||||||
# For CPUs using intel_pstate, always use the performance governor. This also
|
# For CPUs using intel_pstate, always use the performance governor. This also
|
||||||
# provides power savings on Intel processors while avoiding the ramp-up lag
|
# provides power savings on Intel processors while avoiding the ramp-up lag
|
||||||
# present when using the powersave governor (which is the default if ondemand
|
# present when using the powersave governor (which is the default if ondemand
|
||||||
# is requested on these machines):
|
# is requested on these machines):
|
||||||
if [ "$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_driver 2> /dev/null)" = "intel_pstate" ]; then
|
if [[ $(cat $SYSTEM/cpu0/cpufreq/scaling_driver 2>/dev/null) == intel_pstate ]]; then
|
||||||
SCALING_GOVERNOR="performance"
|
SCALING_GOVERNOR="performance"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# To force a particular option without having to edit this file, uncomment the
|
# To force a particular option without having to edit this file, uncomment the
|
||||||
# line in /etc/default/cpufreq and edit it to select the desired option:
|
# line in /etc/default/cpufreq and edit it to select the desired option:
|
||||||
if [ -r /etc/default/cpufreq ]; then
|
if [[ -r /etc/default/cpufreq ]]; then
|
||||||
. /etc/default/cpufreq
|
. /etc/default/cpufreq
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If rc.cpufreq is given an option, use it for the CPU scaling governor instead:
|
# If rc.cpufreq is given an option, use it for the CPU scaling governor instead:
|
||||||
if [ ! -z "$1" -a "$1" != "start" ]; then
|
if [[ -n $1 && $1 != start ]]; then
|
||||||
SCALING_GOVERNOR=$1
|
SCALING_GOVERNOR=$1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -56,11 +65,12 @@ fi
|
|||||||
# by the architecture, processor, or underlying CPUFreq driver. For example,
|
# by the architecture, processor, or underlying CPUFreq driver. For example,
|
||||||
# processors that use the Intel P-state driver will only be able to set
|
# processors that use the Intel P-state driver will only be able to set
|
||||||
# performance or powersave here.
|
# performance or powersave here.
|
||||||
echo $SCALING_GOVERNOR | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor 1> /dev/null 2> /dev/null
|
echo $SCALING_GOVERNOR | tee $SYSTEM/cpu*/cpufreq/scaling_governor &>/dev/null
|
||||||
|
|
||||||
# Report what CPU scaling governor is in use after applying the setting:
|
# Report what CPU scaling governor is in use after applying the setting:
|
||||||
if [ -r /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor ]; then
|
if [[ -r $SYSTEM/cpu0/cpufreq/scaling_governor ]]; then
|
||||||
echo "Enabled CPU frequency scaling governor: $(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor)"
|
log "Enabled CPU frequency scaling governor: $(cat $SYSTEM/cpu0/cpufreq/scaling_governor)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
unset SCALING_GOVERNOR
|
unset SCALING_GOVERNOR
|
||||||
|
exit 0
|
||||||
|
|||||||
+49
-19
@@ -1,40 +1,70 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
# /etc/rc.d/rc.crond - start/stop the cron daemon
|
#
|
||||||
|
# script: rc.crond
|
||||||
|
#
|
||||||
|
# Start/stop the cron daemon
|
||||||
|
#
|
||||||
|
# LimeTech - modified for Unraid OS
|
||||||
|
# Bergware - modified for Unraid OS, October 2023
|
||||||
|
|
||||||
|
DAEMON="Cron daemon"
|
||||||
|
CONF="/etc/default/crond"
|
||||||
|
CROND="/usr/sbin/crond"
|
||||||
|
|
||||||
|
# run & log functions
|
||||||
|
. /etc/rc.d/rc.runlog
|
||||||
|
|
||||||
# To change the default options, edit /etc/default/crond.
|
# To change the default options, edit /etc/default/crond.
|
||||||
if [ -r /etc/default/crond ]; then
|
[[ -r $CONF ]] && . $CONF
|
||||||
. /etc/default/crond
|
|
||||||
fi
|
|
||||||
|
|
||||||
start_crond() {
|
crond_running(){
|
||||||
if ! /usr/bin/pgrep --ns $$ --euid root -f "^/usr/sbin/crond" 1> /dev/null 2> /dev/null ; then
|
pgrep --ns $$ --euid root -f "^$CROND" &>/dev/null
|
||||||
echo "Starting crond: /usr/sbin/crond $CROND_OPTS"
|
}
|
||||||
|
|
||||||
|
crond_start(){
|
||||||
|
log "Starting $DAEMON..."
|
||||||
|
local REPLY
|
||||||
|
if crond_running; then
|
||||||
|
REPLY="Already started"
|
||||||
|
else
|
||||||
mkdir -p /run/cron
|
mkdir -p /run/cron
|
||||||
/usr/sbin/crond $CROND_OPTS
|
run $CROND $CROND_OPTS
|
||||||
|
if crond_running; then REPLY="Started"; else REPLY="Failed"; fi
|
||||||
fi
|
fi
|
||||||
|
log "$DAEMON... $REPLY."
|
||||||
}
|
}
|
||||||
|
|
||||||
stop_crond() {
|
crond_stop(){
|
||||||
echo "Stopping crond."
|
log "Stopping $DAEMON..."
|
||||||
/usr/bin/pkill --ns $$ --euid root -f "^/usr/sbin/crond" 2> /dev/null
|
local REPLY
|
||||||
|
if ! crond_running; then
|
||||||
|
REPLY="Already stopped"
|
||||||
|
else
|
||||||
|
run pkill --ns $$ --euid root -f "^$CROND"
|
||||||
|
if ! crond_running; then REPLY="Stopped"; else REPLY="Failed"; fi
|
||||||
|
fi
|
||||||
|
log "$DAEMON... $REPLY."
|
||||||
}
|
}
|
||||||
|
|
||||||
restart_crond() {
|
crond_restart(){
|
||||||
stop_crond
|
log "Restarting $DAEMON..."
|
||||||
|
crond_stop
|
||||||
sleep 1
|
sleep 1
|
||||||
start_crond
|
crond_start
|
||||||
}
|
}
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
'start')
|
'start')
|
||||||
start_crond
|
crond_start
|
||||||
;;
|
;;
|
||||||
'stop')
|
'stop')
|
||||||
stop_crond
|
crond_stop
|
||||||
;;
|
;;
|
||||||
'restart')
|
'restart')
|
||||||
restart_crond
|
crond_restart
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "usage $0 start|stop|restart"
|
echo "Usage: $BASENAME start|stop|restart"
|
||||||
|
exit 1
|
||||||
esac
|
esac
|
||||||
|
exit 0
|
||||||
|
|||||||
+44
-20
@@ -1,28 +1,50 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
# Start/stop/restart dnsmasq (a small DNS/DHCP server):
|
#
|
||||||
|
# script: rc.dnsmasq
|
||||||
|
#
|
||||||
|
# Start/stop/restart dnsmasq (a small DNS/DHCP server)
|
||||||
|
#
|
||||||
|
# LimeTech - modified for Unraid OS
|
||||||
|
# Bergware - modified for Unraid OS, October 2023
|
||||||
|
|
||||||
# Start dnsmasq:
|
DAEMON="DNSmasq daemon"
|
||||||
dnsmasq_start() {
|
PIDFILE="/var/run/dnsmasq.pid"
|
||||||
if [ -x /usr/sbin/dnsmasq ]; then
|
|
||||||
echo "Starting dnsmasq: /usr/sbin/dnsmasq"
|
# run & log functions
|
||||||
/usr/sbin/dnsmasq
|
. /etc/rc.d/rc.runlog
|
||||||
fi
|
|
||||||
|
dnsmasq_running(){
|
||||||
|
pgrep -l -F $PIDFILE 2>/dev/null | grep -q dnsmasq
|
||||||
}
|
}
|
||||||
|
|
||||||
# Stop dnsmasq:
|
dnsmasq_start(){
|
||||||
dnsmasq_stop() {
|
log "Starting $DAEMON..."
|
||||||
# Try to use the .pid file first:
|
local REPLY
|
||||||
if pgrep -l -F /var/run/dnsmasq.pid 2> /dev/null | grep -q dnsmasq ; then
|
if [[ -x /usr/sbin/dnsmasq ]]; then
|
||||||
echo "Stopping dnsmasq."
|
run /usr/sbin/dnsmasq
|
||||||
pkill -F /var/run/dnsmasq.pid 2> /dev/null
|
if dnsmasq_running; then REPLY="Started"; else REPLY="Failed"; fi
|
||||||
else # kill any dnsmasq processes in this namespace:
|
else
|
||||||
echo "Stopping dnsmasq."
|
REPLY="Missing executable"
|
||||||
killall --ns $$ dnsmasq 2> /dev/null
|
|
||||||
fi
|
fi
|
||||||
|
log "$DAEMON... $REPLY."
|
||||||
}
|
}
|
||||||
|
|
||||||
# Restart dnsmasq:
|
dnsmasq_stop(){
|
||||||
dnsmasq_restart() {
|
log "Stopping $DAEMON..."
|
||||||
|
local REPLY
|
||||||
|
if dnsmasq_running; then
|
||||||
|
# try to use the .pid file first
|
||||||
|
pkill -F $PIDFILE 2>/dev/null
|
||||||
|
else
|
||||||
|
# kill any dnsmasq processes in this namespace:
|
||||||
|
killall --ns $$ dnsmasq 2>/dev/null
|
||||||
|
fi
|
||||||
|
if ! dnsmasq_running; then REPLY="Stopped"; else REPLY="Failed"; fi
|
||||||
|
log "$DAEMON... $REPLY."
|
||||||
|
}
|
||||||
|
|
||||||
|
dnsmasq_restart(){
|
||||||
|
log "Restarting $DAEMON..."
|
||||||
dnsmasq_stop
|
dnsmasq_stop
|
||||||
sleep 1
|
sleep 1
|
||||||
dnsmasq_start
|
dnsmasq_start
|
||||||
@@ -39,5 +61,7 @@ case "$1" in
|
|||||||
dnsmasq_restart
|
dnsmasq_restart
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "usage rc.dnsmasq: start|stop|restart"
|
echo "Usage: $BASENAME start|stop|restart"
|
||||||
|
exit 1
|
||||||
esac
|
esac
|
||||||
|
exit 0
|
||||||
|
|||||||
+4
-2
@@ -521,6 +521,7 @@ docker_container_stop(){
|
|||||||
|
|
||||||
docker_service_start(){
|
docker_service_start(){
|
||||||
log "Starting $DAEMON..."
|
log "Starting $DAEMON..."
|
||||||
|
local REPLY
|
||||||
[[ -x $DOCKER ]] && REPLY= || REPLY="Failed"
|
[[ -x $DOCKER ]] && REPLY= || REPLY="Failed"
|
||||||
if [[ -z $REPLY ]]; then
|
if [[ -z $REPLY ]]; then
|
||||||
if ! mountpoint $DOCKER_ROOT &>/dev/null; then
|
if ! mountpoint $DOCKER_ROOT &>/dev/null; then
|
||||||
@@ -545,6 +546,7 @@ docker_service_start(){
|
|||||||
|
|
||||||
docker_service_stop(){
|
docker_service_stop(){
|
||||||
log "Stopping $DAEMON..."
|
log "Stopping $DAEMON..."
|
||||||
|
local REPLY
|
||||||
# If there is no PID file, ignore this request...
|
# If there is no PID file, ignore this request...
|
||||||
if [[ -r $DOCKER_PIDFILE ]]; then
|
if [[ -r $DOCKER_PIDFILE ]]; then
|
||||||
# Try to stop dockerd gracefully
|
# Try to stop dockerd gracefully
|
||||||
@@ -596,7 +598,7 @@ case "$1" in
|
|||||||
'start')
|
'start')
|
||||||
docker_service_start
|
docker_service_start
|
||||||
docker_network_start
|
docker_network_start
|
||||||
docker_container_start 1>/dev/null 2>/dev/null &
|
docker_container_start &>/dev/null &
|
||||||
disown
|
disown
|
||||||
;;
|
;;
|
||||||
'stop')
|
'stop')
|
||||||
@@ -615,7 +617,7 @@ case "$1" in
|
|||||||
sleep 1
|
sleep 1
|
||||||
docker_service_start
|
docker_service_start
|
||||||
docker_network_start
|
docker_network_start
|
||||||
docker_container_start 1>/dev/null 2>/dev/null &
|
docker_container_start &>/dev/null &
|
||||||
disown
|
disown
|
||||||
;;
|
;;
|
||||||
'status')
|
'status')
|
||||||
|
|||||||
+71
-49
@@ -1,66 +1,88 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
#
|
#
|
||||||
# /etc/rc.d/rc.elogind
|
# script: rc.elogind
|
||||||
# Initializes the elogind service on Slackware.
|
#
|
||||||
# There is no need to explicitly start a daemon; this will be taken
|
# Initializes the elogind service on Slackware.
|
||||||
# care of automatically by dbus when that starts.
|
# There is no need to explicitly start a daemon; this will be taken
|
||||||
|
# care of automatically by dbus when that starts.
|
||||||
#
|
#
|
||||||
# Author:
|
# Author:
|
||||||
# Eric Hameleers <alien@slackware.com> 2016
|
# Eric Hameleers <alien@slackware.com> 2016
|
||||||
# Widya Walesa 2020
|
# Widya Walesa 2020
|
||||||
#
|
#
|
||||||
# Description:
|
# Description:
|
||||||
# We use elogind (standalone subset extracted from systemd) instead of
|
# We use elogind (standalone subset extracted from systemd) instead of
|
||||||
# systemd itself; so we need to initialize a systemd-like state.
|
# systemd itself; so we need to initialize a systemd-like state.
|
||||||
#
|
#
|
||||||
# Note:
|
# Note:
|
||||||
# Slackware has a tmpfs mounted on /run (see rc.S).
|
# Slackware has a tmpfs mounted on /run (see rc.S).
|
||||||
#
|
#
|
||||||
|
# LimeTech - modified for Unraid OS
|
||||||
|
# Bergware - modified for Unraid OS, October 2023
|
||||||
|
|
||||||
start_elogind() {
|
DAEMON="Elogin daemon"
|
||||||
if [ -x /lib64/elogind/elogind ]; then
|
ELOGIND="/lib64/elogind/elogind"
|
||||||
if [ ! -d /run/user ]; then
|
PIDFILE="/run/elogind.pid"
|
||||||
mkdir -p /run/user
|
|
||||||
fi
|
# run & log functions
|
||||||
if [ ! -d /run/systemd ]; then
|
. /etc/rc.d/rc.runlog
|
||||||
mkdir -p /run/elogind /sys/fs/cgroup/elogind
|
|
||||||
( cd /run; rm -rf systemd; ln -sf elogind systemd; )
|
elogind_running(){
|
||||||
# limetech - eliminate warning about not being able to create symlink
|
pgrep -l -F $PIDFILE 2>/dev/null | grep -q elogind
|
||||||
# ( cd /sys/fs/cgroup; rm -rf systemd; ln -sf elogind systemd; )
|
|
||||||
fi
|
|
||||||
if pgrep -l -F /run/elogind.pid 2>/dev/null | grep -q elogind; then
|
|
||||||
echo "Elogind is already running"
|
|
||||||
else
|
|
||||||
echo -n "Starting elogind: "
|
|
||||||
rm -f /run/elogind.pid
|
|
||||||
/lib64/elogind/elogind --daemon
|
|
||||||
echo "/lib64/elogind/elogind --daemon"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
stop_elogind() {
|
elogind_start(){
|
||||||
if pgrep -l -F /run/elogind.pid 2>/dev/null | grep -q elogind; then
|
log "Starting $DAEMON..."
|
||||||
echo -n "Stopping elogind: "
|
local REPLY
|
||||||
pkill -F /run/elogind.pid 2>/dev/null
|
[[ -x $ELOGIND ]] || exit 1
|
||||||
echo "DONE"
|
[[ -d /run/user ]] || mkdir -p /run/user
|
||||||
else
|
if [[ ! -d /run/systemd ]]; then
|
||||||
echo "Elogind is not running"
|
mkdir -p /run/elogind /sys/fs/cgroup/elogind
|
||||||
|
( cd /run; rm -rf systemd; ln -sf elogind systemd; )
|
||||||
|
# LimeTech - eliminate warning about not being able to create symlink
|
||||||
|
# ( cd /sys/fs/cgroup; rm -rf systemd; ln -sf elogind systemd; )
|
||||||
fi
|
fi
|
||||||
|
if elogind_running; then
|
||||||
|
REPLY="Already started"
|
||||||
|
else
|
||||||
|
rm -f $PIDFILE
|
||||||
|
run $ELOGIND --daemon
|
||||||
|
if elogind_running; then REPLY="Started"; else REPLY="Failed"; fi
|
||||||
|
fi
|
||||||
|
log "$DAEMON... $REPLY."
|
||||||
|
}
|
||||||
|
|
||||||
|
elogind_stop(){
|
||||||
|
log "Stopping $DAEMON..."
|
||||||
|
local REPLY
|
||||||
|
if ! elogind_running; then
|
||||||
|
REPLY="Already stopped"
|
||||||
|
else
|
||||||
|
pkill -F $PIDFILE 2>/dev/null
|
||||||
|
if ! elogind_running; then REPLY="Stopped"; else REPLY="Failed"; fi
|
||||||
|
fi
|
||||||
|
log "$DAEMON... $REPLY."
|
||||||
|
}
|
||||||
|
|
||||||
|
elogind_restart(){
|
||||||
|
log "Restarting $DAEMON..."
|
||||||
|
elogind_stop
|
||||||
|
sleep 1
|
||||||
|
elogind_start
|
||||||
}
|
}
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
'start')
|
||||||
start_elogind
|
elogind_start
|
||||||
;;
|
;;
|
||||||
stop)
|
'stop')
|
||||||
stop_elogind
|
elogind_stop
|
||||||
;;
|
;;
|
||||||
restart)
|
'restart')
|
||||||
stop_elogind
|
elogind_restart
|
||||||
sleep 1
|
;;
|
||||||
start_elogind
|
*)
|
||||||
;;
|
echo "Usage: $BASENAME start|stop|restart"
|
||||||
*)
|
exit 1
|
||||||
echo "Usage: $0 start|stop|restart"
|
|
||||||
esac
|
esac
|
||||||
|
exit 0
|
||||||
|
|||||||
@@ -31,8 +31,11 @@ else
|
|||||||
IPADDR=
|
IPADDR=
|
||||||
NETMASK=
|
NETMASK=
|
||||||
GATEWAY=
|
GATEWAY=
|
||||||
|
PROTOCOL=ipv4
|
||||||
USE_DHCP=yes
|
USE_DHCP=yes
|
||||||
|
USE_DHCP6=yes
|
||||||
DHCP_KEEPRESOLV=no
|
DHCP_KEEPRESOLV=no
|
||||||
|
DHCP6_KEEPRESOLV=no
|
||||||
BONDING=yes
|
BONDING=yes
|
||||||
BRIDGING=yes
|
BRIDGING=yes
|
||||||
fi
|
fi
|
||||||
@@ -130,5 +133,5 @@ else
|
|||||||
fi
|
fi
|
||||||
SYSNICS=1
|
SYSNICS=1
|
||||||
MAXNICS=$SYSNICS
|
MAXNICS=$SYSNICS
|
||||||
make_cfg "# Generated settings:" $SETTINGS IFNAME USE_DHCP DHCP_KEEPRESOLV# SYSNICS#
|
make_cfg "# Generated settings:" IFNAME DHCP_KEEPRESOLV# DHCP6_KEEPRESOLV# $SETTINGS PROTOCOL USE_DHCP USE_DHCP6 SYSNICS#
|
||||||
fi
|
fi
|
||||||
|
|||||||
+3
-3
@@ -57,7 +57,7 @@ if [[ -x /etc/rc.d/rc.kpropd ]]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Mount remote (NFS) filesystems:
|
# Mount remote (NFS) filesystems:
|
||||||
if cat /etc/fstab | grep -v '^#' | grep -w nfs 1>/dev/null 2>/dev/null; then
|
if cat /etc/fstab | grep -v '^#' | grep -w nfs &>/dev/null; then
|
||||||
# Start rpc.portmap, /sbin/rpc.lockd, and /sbin/rpc.statd if we find NFS
|
# Start rpc.portmap, /sbin/rpc.lockd, and /sbin/rpc.statd if we find NFS
|
||||||
# volumes defined in /etc/fstab since these will need to be running in order
|
# volumes defined in /etc/fstab since these will need to be running in order
|
||||||
# to mount them. If they are not running, attempting to mount an NFS
|
# to mount them. If they are not running, attempting to mount an NFS
|
||||||
@@ -87,7 +87,7 @@ fi
|
|||||||
|
|
||||||
# Mount remote CIFS filesystems. Note that where possible, using CIFS is
|
# Mount remote CIFS filesystems. Note that where possible, using CIFS is
|
||||||
# preferred over SMBFS. SMBFS is no longer actively maintained.
|
# preferred over SMBFS. SMBFS is no longer actively maintained.
|
||||||
if cat /etc/fstab | grep -v '^#' | grep -w cifs 1>/dev/null 2>/dev/null; then
|
if cat /etc/fstab | grep -v '^#' | grep -w cifs &>/dev/null; then
|
||||||
log "Mounting remote CIFS file systems."
|
log "Mounting remote CIFS file systems."
|
||||||
run /sbin/mount -a -t cifs
|
run /sbin/mount -a -t cifs
|
||||||
# Show the mounted volumes:
|
# Show the mounted volumes:
|
||||||
@@ -95,7 +95,7 @@ if cat /etc/fstab | grep -v '^#' | grep -w cifs 1>/dev/null 2>/dev/null; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Mount remote SMB filesystems:
|
# Mount remote SMB filesystems:
|
||||||
if cat /etc/fstab | grep -v '^#' | grep -w smbfs 1>/dev/null 2>/dev/null; then
|
if cat /etc/fstab | grep -v '^#' | grep -w smbfs &>/dev/null; then
|
||||||
log "Mounting remote SMBFS file systems."
|
log "Mounting remote SMBFS file systems."
|
||||||
run /sbin/mount -a -t smbfs
|
run /sbin/mount -a -t smbfs
|
||||||
# Show the mounted volumes:
|
# Show the mounted volumes:
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ DAEMON="Internet daemon"
|
|||||||
|
|
||||||
inetd_start() {
|
inetd_start() {
|
||||||
log "Starting $DAEMON..."
|
log "Starting $DAEMON..."
|
||||||
|
local REPLY
|
||||||
if [[ -x /usr/sbin/inetd ]]; then
|
if [[ -x /usr/sbin/inetd ]]; then
|
||||||
run /usr/sbin/inetd
|
run /usr/sbin/inetd
|
||||||
REPLY="Started"
|
REPLY="Started"
|
||||||
|
|||||||
+44
-34
@@ -1,5 +1,8 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
# /etc/rc.d/rc.ip_forward: start/stop IP packet forwarding
|
#
|
||||||
|
# script: rc.ip_forward
|
||||||
|
#
|
||||||
|
# start/stop IP packet forwarding
|
||||||
#
|
#
|
||||||
# If you intend to run your Linux box as a router, i.e. as a
|
# If you intend to run your Linux box as a router, i.e. as a
|
||||||
# computer that forwards and redistributes network packets, you
|
# computer that forwards and redistributes network packets, you
|
||||||
@@ -10,29 +13,37 @@
|
|||||||
#
|
#
|
||||||
# To disable IP packet forwarding at boot time, make this
|
# To disable IP packet forwarding at boot time, make this
|
||||||
# script non-executable: chmod 644 /etc/rc.d/rc.ip_forward
|
# script non-executable: chmod 644 /etc/rc.d/rc.ip_forward
|
||||||
|
#
|
||||||
|
# LimeTech - modified for Unraid OS
|
||||||
|
# Bergware - modified for Unraid OS, October 2023
|
||||||
|
|
||||||
# Start IP packet forwarding:
|
SYSTEM="/proc/sys/net"
|
||||||
ip_forward_start() {
|
SYSCTL="/etc/sysctl.conf"
|
||||||
if [ -f /proc/sys/net/ipv4/ip_forward ]; then
|
|
||||||
echo "Activating IPv4 packet forwarding."
|
# run & log functions
|
||||||
echo 1 > /proc/sys/net/ipv4/ip_forward
|
. /etc/rc.d/rc.runlog
|
||||||
|
|
||||||
|
ip_forward_start(){
|
||||||
|
if [[ -f $SYSTEM/ipv4/ip_forward ]]; then
|
||||||
|
log "Activating IPv4 packet forwarding."
|
||||||
|
echo 1 >$SYSTEM/ipv4/ip_forward
|
||||||
# Changing /proc/sys/net/ipv4/ip_forward results in resetting all
|
# Changing /proc/sys/net/ipv4/ip_forward results in resetting all
|
||||||
# non-default ipv4 parameters for the interface as mentioned in
|
# non-default ipv4 parameters for the interface as mentioned in
|
||||||
# /usr/src/linux/Documentation/networking/ip-sysctl.txt. So, we
|
# /usr/src/linux/Documentation/networking/ip-sysctl.txt. So, we
|
||||||
# will reapply any ipv4 sysctl parameters now:
|
# will reapply any ipv4 sysctl parameters now:
|
||||||
if [ -r /etc/sysctl.conf ]; then
|
if [[ -r $SYSCTL ]]; then
|
||||||
/bin/grep ipv4 /etc/sysctl.conf | sysctl -p - 1> /dev/null 2> /dev/null
|
grep ipv4 $SYSCTL | sysctl -p - &>/dev/null
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [ -f /proc/sys/net/ipv6/conf/all/forwarding ]; then
|
if [[ -f $SYSTEM/ipv6/conf/all/forwarding ]]; then
|
||||||
echo "Activating IPv6 packet forwarding."
|
log "Activating IPv6 packet forwarding."
|
||||||
echo 1 > /proc/sys/net/ipv6/conf/all/forwarding
|
echo 1 >$SYSTEM/ipv6/conf/all/forwarding
|
||||||
# Changing /proc/sys/net/ipv6/conf/all/forwarding results in resetting
|
# Changing /proc/sys/net/ipv6/conf/all/forwarding results in resetting
|
||||||
# all non-default ipv6 parameters for the interface as mentioned in
|
# all non-default ipv6 parameters for the interface as mentioned in
|
||||||
# /usr/src/linux/Documentation/networking/ip-sysctl.txt. So, we
|
# /usr/src/linux/Documentation/networking/ip-sysctl.txt. So, we
|
||||||
# will reapply any ipv6 sysctl parameters now:
|
# will reapply any ipv6 sysctl parameters now:
|
||||||
if [ -r /etc/sysctl.conf ]; then
|
if [[ -r $SYSCTL ]]; then
|
||||||
/bin/grep ipv6 /etc/sysctl.conf | sysctl -p - 1> /dev/null 2> /dev/null
|
grep ipv6 $SYSCTL | sysctl -p - &>/dev/null
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
# When using IPv4 packet forwarding, you will also get the
|
# When using IPv4 packet forwarding, you will also get the
|
||||||
@@ -45,40 +56,38 @@ ip_forward_start() {
|
|||||||
# from that host to you) or if you operate a non-routing host
|
# from that host to you) or if you operate a non-routing host
|
||||||
# which has several IP addresses on different interfaces. To
|
# which has several IP addresses on different interfaces. To
|
||||||
# turn rp_filter off, uncomment the lines below:
|
# turn rp_filter off, uncomment the lines below:
|
||||||
#if [ -r /proc/sys/net/ipv4/conf/all/rp_filter ]; then
|
# if [ -r $SYSTEM/ipv4/conf/all/rp_filter ]; then
|
||||||
# echo "Disabling rp_filter."
|
# log "Disabling rp_filter."
|
||||||
# echo 0 > /proc/sys/net/ipv4/conf/all/rp_filter
|
# echo 0 >$SYSTEM/ipv4/conf/all/rp_filter
|
||||||
#fi
|
# fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Stop IP packet forwarding:
|
ip_forward_stop(){
|
||||||
ip_forward_stop() {
|
if [[ -f $SYSTEM/ipv4/ip_forward ]]; then
|
||||||
if [ -f /proc/sys/net/ipv4/ip_forward ]; then
|
log "Disabling IPv4 packet forwarding."
|
||||||
echo "Disabling IPv4 packet forwarding."
|
echo 0 >$SYSTEM/ipv4/ip_forward
|
||||||
echo 0 > /proc/sys/net/ipv4/ip_forward
|
|
||||||
# Changing /proc/sys/net/ipv4/ip_forward results in resetting all
|
# Changing /proc/sys/net/ipv4/ip_forward results in resetting all
|
||||||
# non-default ipv4 parameters for the interface as mentioned in
|
# non-default ipv4 parameters for the interface as mentioned in
|
||||||
# /usr/src/linux/Documentation/networking/ip-sysctl.txt. So, we
|
# /usr/src/linux/Documentation/networking/ip-sysctl.txt. So, we
|
||||||
# will reapply any ipv4 sysctl parameters now:
|
# will reapply any ipv4 sysctl parameters now:
|
||||||
if [ -r /etc/sysctl.conf ]; then
|
if [[ -r $SYSCTL ]]; then
|
||||||
/bin/grep ipv4 /etc/sysctl.conf | sysctl -p - 1> /dev/null 2> /dev/null
|
grep ipv4 $SYSCTL | sysctl -p - &>/dev/null
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [ -f /proc/sys/net/ipv6/conf/all/forwarding ]; then
|
if [[ -f $SYSTEM/ipv6/conf/all/forwarding ]]; then
|
||||||
echo "Disabling IPv6 packet forwarding."
|
log "Disabling IPv6 packet forwarding."
|
||||||
echo 0 > /proc/sys/net/ipv6/conf/all/forwarding
|
echo 0 >$SYSTEM/ipv6/conf/all/forwarding
|
||||||
# Changing /proc/sys/net/ipv6/conf/all/forwarding results in resetting
|
# Changing /proc/sys/net/ipv6/conf/all/forwarding results in resetting
|
||||||
# all non-default ipv6 parameters for the interface as mentioned in
|
# all non-default ipv6 parameters for the interface as mentioned in
|
||||||
# /usr/src/linux/Documentation/networking/ip-sysctl.txt. So, we
|
# /usr/src/linux/Documentation/networking/ip-sysctl.txt. So, we
|
||||||
# will reapply any ipv6 sysctl parameters now:
|
# will reapply any ipv6 sysctl parameters now:
|
||||||
if [ -r /etc/sysctl.conf ]; then
|
if [[ -r $SYSCTL ]]; then
|
||||||
/bin/grep ipv6 /etc/sysctl.conf | sysctl -p - 1> /dev/null 2> /dev/null
|
grep ipv6 $SYSCTL | sysctl -p - &>/dev/null
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Restart IP packet forwarding:
|
ip_forward_restart(){
|
||||||
ip_forward_restart() {
|
|
||||||
ip_forward_stop
|
ip_forward_stop
|
||||||
sleep 1
|
sleep 1
|
||||||
ip_forward_start
|
ip_forward_start
|
||||||
@@ -95,6 +104,7 @@ case "$1" in
|
|||||||
ip_forward_restart
|
ip_forward_restart
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "usage $0 start|stop|restart"
|
echo "Usage: $BASENAME start|stop|restart|status"
|
||||||
|
exit 1
|
||||||
esac
|
esac
|
||||||
|
exit 0
|
||||||
|
|||||||
@@ -191,7 +191,7 @@ check(){
|
|||||||
BIND=(); IPV4=no; IPV6=no; FAMILY=any;
|
BIND=(); IPV4=no; IPV6=no; FAMILY=any;
|
||||||
# active IPV4 interfaces (including wireguard)
|
# active IPV4 interfaces (including wireguard)
|
||||||
NETS=()
|
NETS=()
|
||||||
while IFS='\n' read -r NET; do
|
while IFS=$'\n' read -r NET; do
|
||||||
NET=($NET)
|
NET=($NET)
|
||||||
# exclude wireguard tunnels for ntp
|
# exclude wireguard tunnels for ntp
|
||||||
[[ ${NET:0:2} == wg && $CALLER == ntp ]] && continue
|
[[ ${NET:0:2} == wg && $CALLER == ntp ]] && continue
|
||||||
|
|||||||
+6
-6
@@ -75,7 +75,7 @@ stop_running_machines(){
|
|||||||
# resume paused VMs
|
# resume paused VMs
|
||||||
for UUID in $(vmlist paused); do
|
for UUID in $(vmlist paused); do
|
||||||
log "Resuming VM: ${NAMES[$UUID]}"
|
log "Resuming VM: ${NAMES[$UUID]}"
|
||||||
virsh resume $UUID 1>/dev/null 2>/dev/null
|
virsh resume $UUID &>/dev/null
|
||||||
done
|
done
|
||||||
# wait until VMs are resumed
|
# wait until VMs are resumed
|
||||||
waitfor paused
|
waitfor paused
|
||||||
@@ -83,7 +83,7 @@ stop_running_machines(){
|
|||||||
if [[ $HOSTSHUTDOWN == hibernate ]]; then
|
if [[ $HOSTSHUTDOWN == hibernate ]]; then
|
||||||
for UUID in $(vmlist running); do
|
for UUID in $(vmlist running); do
|
||||||
log "Suspending VM: ${NAMES[$UUID]}"
|
log "Suspending VM: ${NAMES[$UUID]}"
|
||||||
virsh dompmsuspend $UUID disk 1>/dev/null 2>/dev/null
|
virsh dompmsuspend $UUID disk &>/dev/null
|
||||||
done
|
done
|
||||||
# wait until VMs are suspended
|
# wait until VMs are suspended
|
||||||
waitfor running
|
waitfor running
|
||||||
@@ -92,7 +92,7 @@ stop_running_machines(){
|
|||||||
# graceful shutdown of running VMs
|
# graceful shutdown of running VMs
|
||||||
for UUID in $(vmlist running); do
|
for UUID in $(vmlist running); do
|
||||||
log "Shutting down VM: ${NAMES[$UUID]}"
|
log "Shutting down VM: ${NAMES[$UUID]}"
|
||||||
virsh shutdown $UUID 1>/dev/null 2>/dev/null
|
virsh shutdown $UUID &>/dev/null
|
||||||
done
|
done
|
||||||
# wait until VMs are stopped
|
# wait until VMs are stopped
|
||||||
waitfor running
|
waitfor running
|
||||||
@@ -103,7 +103,7 @@ stop_running_machines(){
|
|||||||
# check explicitely for suspended VMs
|
# check explicitely for suspended VMs
|
||||||
if [[ $STATE == pmsuspended ]]; then
|
if [[ $STATE == pmsuspended ]]; then
|
||||||
log "Stopping suspended VM: ${NAMES[${UUID[$i]}]}"
|
log "Stopping suspended VM: ${NAMES[${UUID[$i]}]}"
|
||||||
virsh destroy ${UUID[$i]} --graceful 1>/dev/null 2>/dev/null
|
virsh destroy ${UUID[$i]} --graceful &>/dev/null
|
||||||
fi
|
fi
|
||||||
((I++))
|
((I++))
|
||||||
done <<< $(vmstate)
|
done <<< $(vmstate)
|
||||||
@@ -113,7 +113,7 @@ stop_running_machines(){
|
|||||||
# forced shutdown of rogue VMs
|
# forced shutdown of rogue VMs
|
||||||
for UUID in $(vmlist running paused other); do
|
for UUID in $(vmlist running paused other); do
|
||||||
log "Forced shutting down VM: ${NAMES[$UUID]}"
|
log "Forced shutting down VM: ${NAMES[$UUID]}"
|
||||||
virsh destroy $UUID 1>/dev/null 2>/dev/null
|
virsh destroy $UUID &>/dev/null
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -217,7 +217,7 @@ libvirtd_start(){
|
|||||||
mkdir -p /etc/libvirt/qemu/swtpm/tpm-states
|
mkdir -p /etc/libvirt/qemu/swtpm/tpm-states
|
||||||
# setup snapshot persistance.
|
# setup snapshot persistance.
|
||||||
mkdir -p /etc/libvirt/qemu/snapshot/
|
mkdir -p /etc/libvirt/qemu/snapshot/
|
||||||
rm -r /var/lib/libvirt/qemu/snapshot/
|
rm -r /var/lib/libvirt/qemu/snapshot/*
|
||||||
ln -fs /etc/libvirt/qemu/snapshot/ /var/lib/libvirt/qemu/
|
ln -fs /etc/libvirt/qemu/snapshot/ /var/lib/libvirt/qemu/
|
||||||
# create directory for pid file
|
# create directory for pid file
|
||||||
mkdir -p $(dirname $LIBVIRTD_PIDFILE)
|
mkdir -p $(dirname $LIBVIRTD_PIDFILE)
|
||||||
|
|||||||
+2
-12
@@ -22,16 +22,6 @@
|
|||||||
# reclaim 1.6M of microcode files that are no longer needed
|
# reclaim 1.6M of microcode files that are no longer needed
|
||||||
rm -rf /kernel
|
rm -rf /kernel
|
||||||
|
|
||||||
# Start WireGuard
|
|
||||||
if [[ -x /etc/rc.d/rc.wireguard ]]; then
|
|
||||||
/etc/rc.d/rc.wireguard start
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Start mcelog
|
|
||||||
if [[ -x /etc/rc.d/rc.mcelog ]]; then
|
|
||||||
/etc/rc.d/rc.mcelog start
|
|
||||||
fi
|
|
||||||
|
|
||||||
# For Docker: mark submounts under /mnt "shared"
|
# For Docker: mark submounts under /mnt "shared"
|
||||||
/sbin/mount --bind --make-rshared /mnt /mnt
|
/sbin/mount --bind --make-rshared /mnt /mnt
|
||||||
# and grant access to graphics device nodes
|
# and grant access to graphics device nodes
|
||||||
@@ -51,7 +41,7 @@ mkdir -p $CONFIG/ssl/certs
|
|||||||
|
|
||||||
# upgrade network configuration (if needed) and (re)generates our welcome text
|
# upgrade network configuration (if needed) and (re)generates our welcome text
|
||||||
if [[ -x /usr/local/sbin/create_network_ini ]]; then
|
if [[ -x /usr/local/sbin/create_network_ini ]]; then
|
||||||
/usr/local/sbin/create_network_ini init 1>/dev/null 2>/dev/null &
|
/usr/local/sbin/create_network_ini init &>/dev/null &
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Needed by dynamix
|
# Needed by dynamix
|
||||||
@@ -141,7 +131,7 @@ else
|
|||||||
# Install any extra packages
|
# Install any extra packages
|
||||||
if [[ -d /boot/extra ]]; then
|
if [[ -d /boot/extra ]]; then
|
||||||
log "Installing /boot/extra packages"
|
log "Installing /boot/extra packages"
|
||||||
( cd /boot/extra ; find -maxdepth 1 -type f -exec sh -c 'upgradepkg --terse --install-new "$1" | log' -- "{}" \; )
|
( export -f log; find /boot/extra -maxdepth 1 -type f -exec sh -c 'upgradepkg --terse --install-new "$1" | log' -- "{}" \; )
|
||||||
fi
|
fi
|
||||||
# Install plugins
|
# Install plugins
|
||||||
log "Installing plugins"
|
log "Installing plugins"
|
||||||
|
|||||||
+6
-3
@@ -1,11 +1,14 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
#
|
#
|
||||||
|
# script: rc.loop
|
||||||
|
#
|
||||||
# Load the loop device kernel module.
|
# Load the loop device kernel module.
|
||||||
#
|
#
|
||||||
|
# LimeTech - modified for Unraid OS
|
||||||
|
# Bergware - modified for Unraid OS, October 2023
|
||||||
|
|
||||||
if modinfo loop 1> /dev/null 2> /dev/null ; then
|
if modinfo loop &>/dev/null; then
|
||||||
if ! lsmod | grep -wq "^loop" ; then
|
if ! lsmod | grep -wq "^loop"; then
|
||||||
modprobe loop
|
modprobe loop
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
+111
-75
@@ -1,23 +1,28 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
#
|
#
|
||||||
|
# script: rc.mcelog
|
||||||
|
#
|
||||||
# Startup script for mcelog
|
# Startup script for mcelog
|
||||||
#
|
#
|
||||||
# limetech - modified for Unraid OS: don't start if cpu not supported
|
# Provides: mcelog
|
||||||
# because ERROR message written to system log worries users
|
# Default-Start: 3 5
|
||||||
#
|
# Default-Stop: 0 1 2 6
|
||||||
### BEGIN INIT INFO
|
# Short-Description: mcelog hardware error logging
|
||||||
# Provides: mcelog
|
# Description: Start the mcelog hardware error logging.
|
||||||
# Default-Start: 3 5
|
# This logs and handles CPU hardware errors on x86 systems.
|
||||||
# Default-Stop: 0 1 2 6
|
#
|
||||||
# Short-Description: mcelog hardware error logging
|
# LimeTech - don't start if cpu not supported because ERROR message written to system log worries users
|
||||||
# Description: Start the mcelog hardware error logging.
|
# Bergware - modified for Unraid OS, October 2023
|
||||||
# This logs and handles CPU hardware errors on x86 systems.
|
|
||||||
### END INIT INFO
|
DAEMON="MCElog daemon"
|
||||||
|
|
||||||
|
# run & log functions
|
||||||
|
. /etc/rc.d/rc.runlog
|
||||||
|
|
||||||
# mcelog mode
|
# mcelog mode
|
||||||
# valid values: daemon, trigger, cron
|
# valid values: daemon, trigger, cron
|
||||||
# Recommended value daemon
|
# Recommended value daemon
|
||||||
MCELOG_MODE=daemon
|
MCELOG_MODE="daemon"
|
||||||
|
|
||||||
# additional options to pass to the daemon
|
# additional options to pass to the daemon
|
||||||
# this only works in daemon mode
|
# this only works in daemon mode
|
||||||
@@ -26,70 +31,101 @@ MCELOG_MODE=daemon
|
|||||||
MCELOG_OPTIONS=""
|
MCELOG_OPTIONS=""
|
||||||
|
|
||||||
# private settings
|
# private settings
|
||||||
MCELOG=${MCELOG:-/usr/sbin/mcelog}
|
MCELOG="${MCELOG:-/usr/sbin/mcelog}"
|
||||||
TRIGGER=/sys/devices/system/machinecheck/machinecheck0/trigger
|
TRIGGER="/sys/devices/system/machinecheck/machinecheck0/trigger"
|
||||||
[ ! -x $MCELOG ] && ( echo "mcelog not found" ; exit 1 )
|
|
||||||
[ ! -r /dev/mcelog ] && ( echo "/dev/mcelog not active" ; exit 0 )
|
|
||||||
|
|
||||||
case "$MCELOG_MODE" in
|
[[ -x $MCELOG ]] || ( echo "mcelog not found"; exit 1 )
|
||||||
daemon)
|
[[ -r /dev/mcelog ]] || ( echo "/dev/mcelog not active"; exit 0 )
|
||||||
;;
|
|
||||||
trigger)
|
|
||||||
;;
|
mcelog_running(){
|
||||||
cron)
|
ps axc | grep -q ' mcelog'
|
||||||
echo "mcelog not started"
|
}
|
||||||
exit 0
|
|
||||||
;;
|
mcelog_start(){
|
||||||
*)
|
log "Starting $DAEMON..."
|
||||||
echo "Unknown mcelog mode $MCELOG_MODE. Valid daemon/trigger/cron"
|
local REPLY
|
||||||
exit 1
|
if [[ $MCELOG_MODE == daemon ]]; then
|
||||||
esac
|
if mcelog_running; then
|
||||||
|
REPLY="Already started"
|
||||||
|
else
|
||||||
|
# ignorance is bliss I guess
|
||||||
|
$MCELOG --is-cpu-supported &>/dev/null
|
||||||
|
$MCELOG --daemon $MCELOG_OPTIONS
|
||||||
|
if mcelog_running; then REPLY="Started"; else REPLY="Failed"; fi
|
||||||
|
fi
|
||||||
|
elif [[ -f $TRIGGER ]]; then
|
||||||
|
echo $MCELOG > $TRIGGER
|
||||||
|
REPLY="Triggered"
|
||||||
|
else
|
||||||
|
REPLY="No machine check capability"
|
||||||
|
fi
|
||||||
|
log "$DAEMON... $REPLY."
|
||||||
|
}
|
||||||
|
|
||||||
|
mcelog_stop(){
|
||||||
|
log "Stopping $DAEMON..."
|
||||||
|
local REPLY
|
||||||
|
if [[ $MCELOG_MODE == daemon ]]; then
|
||||||
|
if ! mcelog_running; then
|
||||||
|
REPLY="Already stopped"
|
||||||
|
else
|
||||||
|
killall -TERM $MCELOG
|
||||||
|
if ! mcelog_running; then REPLY="Stopped"; else REPLY="Failed"; fi
|
||||||
|
fi
|
||||||
|
elif [[ $MCELOG_MODE == trigger && -f $TRIGGER ]]; then
|
||||||
|
echo > $TRIGGER
|
||||||
|
REPLY="Triggered"
|
||||||
|
else
|
||||||
|
REPLY="Already stopped"
|
||||||
|
fi
|
||||||
|
log "$DAEMON... $REPLY."
|
||||||
|
}
|
||||||
|
|
||||||
|
mcelog_restart(){
|
||||||
|
log "Restarting $DAEMON..."
|
||||||
|
mcelog_stop
|
||||||
|
sleep 1
|
||||||
|
mcelog_start
|
||||||
|
}
|
||||||
|
|
||||||
|
mcelog_status(){
|
||||||
|
if mcelog_running; then
|
||||||
|
echo "$DAEMON is currently running."
|
||||||
|
else
|
||||||
|
echo "$DAEMON is not running."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
'start')
|
||||||
if [ "$MCELOG_MODE" = "daemon" ] ; then
|
mcelog_start
|
||||||
# ignorance is bliss I guess
|
;;
|
||||||
$MCELOG --is-cpu-supported &> /dev/null || exit 1
|
'stop')
|
||||||
echo "Starting mcelog daemon: $MCELOG --daemon $MCELOG_OPTIONS"
|
mcelog_stop
|
||||||
$MCELOG --daemon $MCELOG_OPTIONS
|
;;
|
||||||
elif [ -f "$TRIGGER" ] ; then
|
'restart')
|
||||||
echo $MCELOG > "$TRIGGER"
|
mcelog_restart
|
||||||
else
|
;;
|
||||||
echo No machine check capability
|
'try-restart')
|
||||||
fi
|
if mcelog_running; then
|
||||||
;;
|
mcelog_restart
|
||||||
stop)
|
fi
|
||||||
if [ "$MCELOG_MODE" = "daemon" ] ; then
|
;;
|
||||||
echo "Stopping mcelog daemon: killall -TERM $MCELOG"
|
'reload')
|
||||||
killall -TERM $MCELOG
|
if mcelog_running; then
|
||||||
elif [ "$MCELOG_MODE" = "trigger" -a -f "$TRIGGER" ]; then
|
mcelog_restart
|
||||||
echo "" > "$TRIGGER"
|
fi
|
||||||
else
|
;;
|
||||||
echo mcelog not running
|
'force-reload')
|
||||||
fi
|
mcelog_restart
|
||||||
;;
|
;;
|
||||||
try-restart)
|
'status')
|
||||||
$0 status > /dev/null && $0 restart
|
mcelog_status
|
||||||
;;
|
;;
|
||||||
restart)
|
|
||||||
$0 stop
|
|
||||||
$0 start
|
|
||||||
;;
|
|
||||||
reload)
|
|
||||||
$0 try-restart
|
|
||||||
;;
|
|
||||||
force-reload)
|
|
||||||
$0 try-restart
|
|
||||||
;;
|
|
||||||
status)
|
|
||||||
if [ "$MCELOG_MODE" = "daemon" ] ; then
|
|
||||||
echo "Checking for mcelog:"
|
|
||||||
ps ax | grep -v grep | grep $MCELOG | cut -f 1 -d ' '
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
*)
|
*)
|
||||||
echo "Usage: $0 {start|stop|try-restart|restart|status|force-reload|reload}"
|
echo "Usage: $BASENAME start|stop|restart|try-restart|reload|force-reload|status"
|
||||||
exit 1
|
exit 1
|
||||||
esac
|
esac
|
||||||
|
exit 0
|
||||||
|
|
||||||
|
|||||||
+73
-48
@@ -1,81 +1,106 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
#
|
#
|
||||||
# messagebus: The D-BUS systemwide message bus
|
# script: rc.messagebus
|
||||||
#
|
#
|
||||||
# description: This is a daemon which broadcasts notifications of system events \
|
# messagebus: The D-BUS systemwide message bus
|
||||||
# and other messages. See http://www.freedesktop.org/software/dbus/
|
#
|
||||||
|
# description: This is a daemon which broadcasts notifications of system events \
|
||||||
|
# and other messages. See http://www.freedesktop.org/software/dbus/
|
||||||
#
|
#
|
||||||
# processname: dbus-daemon
|
# processname: dbus-daemon
|
||||||
|
|
||||||
# This is a modified version of the rc.messagebus script distributed with the
|
# This is a modified version of the rc.messagebus script distributed with the
|
||||||
# dbus sources. Thanks to Don Tanner of the GWare <http://gware.org> Project
|
# dbus sources. Thanks to Don Tanner of the GWare <http://gware.org> Project
|
||||||
# for most of the work involved --Robby Workman <rworkman@slackware.com>
|
# for most of the work involved --Robby Workman <rworkman@slackware.com>
|
||||||
|
#
|
||||||
|
# LimeTech - modified for Unraid OS
|
||||||
|
# Bergware - modified for Unraid OS, October 2023
|
||||||
|
|
||||||
|
DAEMON="System Message Bus"
|
||||||
|
PIDFILE="/var/run/dbus/dbus.pid"
|
||||||
|
|
||||||
PIDFILE=/var/run/dbus/dbus.pid
|
# run & log functions
|
||||||
|
. /etc/rc.d/rc.runlog
|
||||||
|
|
||||||
start() {
|
dbus_running(){
|
||||||
mkdir -p $(dirname $PIDFILE)
|
ps -u messagebus -c | grep -wq dbus-daemon
|
||||||
if ! ps -u messagebus -c | grep -wq dbus-daemon; then
|
}
|
||||||
|
|
||||||
|
dbus_start(){
|
||||||
|
log "Starting $DAEMON..."
|
||||||
|
local REPLY
|
||||||
|
if dbus_running; then
|
||||||
|
REPLY="Already started"
|
||||||
|
else
|
||||||
|
mkdir -p $(dirname $PIDFILE)
|
||||||
rm -f $(dirname $PIDFILE)/*
|
rm -f $(dirname $PIDFILE)/*
|
||||||
if [ -x /usr/bin/dbus-uuidgen -a -x /usr/bin/dbus-daemon ] ; then
|
if [[ -x /usr/bin/dbus-uuidgen && -x /usr/bin/dbus-daemon ]]; then
|
||||||
echo "Starting system message bus: /usr/bin/dbus-uuidgen --ensure ; /usr/bin/dbus-daemon --system"
|
run /usr/bin/dbus-uuidgen --ensure
|
||||||
/usr/bin/dbus-uuidgen --ensure
|
run /usr/bin/dbus-daemon --system
|
||||||
/usr/bin/dbus-daemon --system 1> /dev/null
|
|
||||||
fi
|
fi
|
||||||
|
if dbus_running; then REPLY="Started"; else REPLY="Failed"; fi
|
||||||
fi
|
fi
|
||||||
|
log "$DAEMON... $REPLY."
|
||||||
}
|
}
|
||||||
|
|
||||||
stop() {
|
dbus_stop(){
|
||||||
if [ -e "$PIDFILE" ]; then
|
log "Stopping $DAEMON..."
|
||||||
echo "Stopping system message bus..."
|
local REPLY
|
||||||
pid=$(cat $PIDFILE)
|
if ! dbus_running; then
|
||||||
kill $pid 1> /dev/null 2> /dev/null
|
REPLY="Already stopped"
|
||||||
|
else
|
||||||
|
run kill $(cat $PIDFILE 2>/dev/null)
|
||||||
# Just in case:
|
# Just in case:
|
||||||
killall dbus-daemon 1> /dev/null 2> /dev/null
|
run killall dbus-daemon
|
||||||
rm -f $PIDFILE
|
rm -f $PIDFILE
|
||||||
|
if ! dbus_running; then REPLY="Stopped"; else REPLY="Failed"; fi
|
||||||
fi
|
fi
|
||||||
|
log "$DAEMON... $REPLY."
|
||||||
}
|
}
|
||||||
|
|
||||||
reload() {
|
dbus_reload(){
|
||||||
echo "Reloading system message bus configuration..."
|
log "Reloading $DAEMON..."
|
||||||
if [ -e "$PIDFILE" ]; then
|
if [[ -e $PIDFILE ]]; then
|
||||||
pid=$(cat $PIDFILE)
|
pid=$(cat $PIDFILE)
|
||||||
kill -HUP $pid
|
run kill -HUP $pid
|
||||||
else
|
else
|
||||||
killall -HUP dbus-daemon
|
run killall -HUP dbus-daemon
|
||||||
fi
|
fi
|
||||||
|
log "$DAEMON... Reloaded."
|
||||||
}
|
}
|
||||||
|
|
||||||
status() {
|
dbus_status(){
|
||||||
if ps -u messagebus -c | grep -wq dbus-daemon; then
|
if dbus_running; then
|
||||||
echo "System dbus-daemon is running."
|
echo "$DAEMON is currently running."
|
||||||
else
|
else
|
||||||
echo "System dbus-daemon is stopped."
|
echo "$DAEMON is not running."
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# See how we were called.
|
# See how we were called.
|
||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
'start')
|
||||||
start
|
dbus_start
|
||||||
;;
|
;;
|
||||||
stop)
|
'stop')
|
||||||
stop
|
dbus_stop
|
||||||
;;
|
;;
|
||||||
restart)
|
'restart')
|
||||||
stop
|
dbus_stop
|
||||||
start
|
sleep 1
|
||||||
echo "You may need to restart your Window Manager to reconnect to the system dbus."
|
dbus_start
|
||||||
;;
|
log "You may need to restart your Window Manager to reconnect to the system dbus."
|
||||||
reload)
|
;;
|
||||||
reload
|
'reload')
|
||||||
;;
|
dbus_reload
|
||||||
status)
|
;;
|
||||||
status
|
'status')
|
||||||
;;
|
dbus_status
|
||||||
*)
|
;;
|
||||||
echo $"Usage: $0 {start|stop|restart|reload|status}"
|
*)
|
||||||
;;
|
echo "Usage: $BASENAME start|stop|restart|reload|status"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
|
exit 0
|
||||||
|
|||||||
+26
-22
@@ -1,32 +1,37 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
#
|
||||||
# /etc/rc.d/rc.modules
|
# script: rc.modules
|
||||||
|
#
|
||||||
|
# LimeTech - modified for Unraid OS
|
||||||
|
# Bergware - modified for Unraid OS, October 2023
|
||||||
|
|
||||||
# Determine the version of the running kernel:
|
# Determine the version of the running kernel:
|
||||||
RELEASE=$(uname -r)
|
RELEASE=$(uname -r)
|
||||||
|
|
||||||
# limetech - install third-party modules
|
# run & log functions
|
||||||
echo "Installing third-party drivers:"
|
. /etc/rc.d/rc.runlog
|
||||||
find /boot/config/plugins/*/packages/${RELEASE%%-*}/ -maxdepth 1 -type f 2>/dev/null | while read -r PKG
|
|
||||||
do
|
# LimeTech - install third-party modules
|
||||||
|
log "Installing third-party drivers..."
|
||||||
|
find /boot/config/plugins/*/packages/${RELEASE%%-*}/ -maxdepth 1 -type f 2>/dev/null | while read -r PKG; do
|
||||||
if [[ $PKG == *"-$RELEASE-"*.t?z ]]; then
|
if [[ $PKG == *"-$RELEASE-"*.t?z ]]; then
|
||||||
if [[ -f $PKG.md5 ]]; then
|
if [[ -f $PKG.md5 ]]; then
|
||||||
SUM1=$(/usr/bin/md5sum $PKG)
|
HASH1=$(md5sum $PKG)
|
||||||
SUM2=$(/usr/bin/cat $PKG.md5)
|
HASH2=$(cat $PKG.md5)
|
||||||
if [[ "${SUM1:0:31}" != "${SUM2:0:31}" ]]; then
|
if [[ ${HASH1:0:32} != ${HASH2:0:32} ]]; then
|
||||||
echo "$PKG md5 error"
|
log "Package $PKG has MD5 error, not installing"
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [[ -f $PKG.sha256 ]]; then
|
if [[ -f $PKG.sha256 ]]; then
|
||||||
SUM1=$(/usr/bin/sha256sum $PKG)
|
HASH1=$(sha256sum $PKG)
|
||||||
SUM2=$(/usr/bin/cat $PKG.sha256)
|
HASH2=$(cat $PKG.sha256)
|
||||||
if [[ "${SUM1:0:63}" != "${SUM2:0:63}" ]]; then
|
if [[ ${HASH1:0:64} != ${HASH2:0:64} ]]; then
|
||||||
echo "$PKG sha256 error"
|
log "Package $PKG has SHA256 error, not installing"
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
echo "installing $PKG"
|
log "Installing package: $PKG"
|
||||||
/sbin/installpkg $PKG
|
/sbin/installpkg $PKG
|
||||||
# force creating new modules.dep
|
# force creating new modules.dep
|
||||||
rm -f /lib/modules/$RELEASE/modules.dep
|
rm -f /lib/modules/$RELEASE/modules.dep
|
||||||
@@ -34,23 +39,22 @@ do
|
|||||||
done
|
done
|
||||||
|
|
||||||
# Update kernel module dependencies:
|
# Update kernel module dependencies:
|
||||||
if [ -e "/lib/modules/$RELEASE/modules.dep" ]; then
|
if [[ -e /lib/modules/$RELEASE/modules.dep ]]; then
|
||||||
echo "Updating module dependency list for $RELEASE: /sbin/depmod --quick"
|
log "Updating module dependency list for $RELEASE: /sbin/depmod --quick"
|
||||||
/sbin/depmod --quick
|
/sbin/depmod --quick
|
||||||
else
|
else
|
||||||
echo "Creating module dependency list for $RELEASE: /sbin/depmod --all"
|
log "Creating module dependency list for $RELEASE: /sbin/depmod --all"
|
||||||
/sbin/depmod --all
|
/sbin/depmod --all
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Run any rc.modules-$(uname -r) file that exists (this is used
|
# Run any rc.modules-$(uname -r) file that exists (this is used
|
||||||
# if you have specific modules which should only be loaded for
|
# if you have specific modules which should only be loaded for
|
||||||
# specific kernel versions):
|
# specific kernel versions):
|
||||||
if [ -x "/etc/rc.d/rc.modules-$RELEASE" ]; then
|
if [[ -x /etc/rc.d/rc.modules-$RELEASE ]]; then
|
||||||
/etc/rc.d/rc.modules-$RELEASE
|
/etc/rc.d/rc.modules-$RELEASE
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Run a local (sysadmin-version) of rc.modules if it exists:
|
# Run a local (sysadmin-version) of rc.modules if it exists:
|
||||||
if [ -x "/etc/rc.d/rc.modules.local" ]; then
|
if [[ -x /etc/rc.d/rc.modules.local ]]; then
|
||||||
/etc/rc.d/rc.modules.local
|
/etc/rc.d/rc.modules.local
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
+3
-1
@@ -42,6 +42,7 @@ nfsd_running(){
|
|||||||
|
|
||||||
nfsd_start(){
|
nfsd_start(){
|
||||||
log "Starting $DAEMON..."
|
log "Starting $DAEMON..."
|
||||||
|
local REPLY
|
||||||
if nfsd_running; then
|
if nfsd_running; then
|
||||||
REPLY="Already started"
|
REPLY="Already started"
|
||||||
else
|
else
|
||||||
@@ -98,6 +99,7 @@ nfsd_start(){
|
|||||||
|
|
||||||
nfsd_stop(){
|
nfsd_stop(){
|
||||||
log "Stopping $DAEMON..."
|
log "Stopping $DAEMON..."
|
||||||
|
local REPLY
|
||||||
if ! nfsd_running; then
|
if ! nfsd_running; then
|
||||||
REPLY="Already stopped"
|
REPLY="Already stopped"
|
||||||
else
|
else
|
||||||
@@ -121,7 +123,7 @@ nfsd_restart(){
|
|||||||
|
|
||||||
nfsd_reload(){
|
nfsd_reload(){
|
||||||
# restart without info
|
# restart without info
|
||||||
nfsd_restart 1>/dev/null 2>/dev/null
|
nfsd_restart &>/dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
nfsd_update(){
|
nfsd_update(){
|
||||||
|
|||||||
+13
-4
@@ -9,8 +9,8 @@
|
|||||||
# Bergware - modified for Unraid OS, October 2023
|
# Bergware - modified for Unraid OS, October 2023
|
||||||
|
|
||||||
# reference:
|
# reference:
|
||||||
# LANNAME 'tower'
|
# LANNAME 'tower'
|
||||||
# LANMDNS 'tower.local'
|
# LANMDNS 'tower.local'
|
||||||
# LANFQDN 'lan-ip.hash.myunraid.net' (wildcard cert)
|
# LANFQDN 'lan-ip.hash.myunraid.net' (wildcard cert)
|
||||||
# LANFQDN 'hash.unraid.net' (legacy cert)
|
# LANFQDN 'hash.unraid.net' (legacy cert)
|
||||||
# WANFQDN 'wan-ip.hash.myunraid.net' (wildcard cert)
|
# WANFQDN 'wan-ip.hash.myunraid.net' (wildcard cert)
|
||||||
@@ -607,8 +607,9 @@ nginx_check(){
|
|||||||
|
|
||||||
nginx_start(){
|
nginx_start(){
|
||||||
log "Starting $DAEMON..."
|
log "Starting $DAEMON..."
|
||||||
|
local REPLY
|
||||||
if nginx_running; then
|
if nginx_running; then
|
||||||
REPLY="Already running"
|
REPLY="Already started"
|
||||||
elif [[ ! -r $CONF ]]; then
|
elif [[ ! -r $CONF ]]; then
|
||||||
# sanity checks, no config file, exit
|
# sanity checks, no config file, exit
|
||||||
log "$CONF does not exist, aborting."
|
log "$CONF does not exist, aborting."
|
||||||
@@ -629,19 +630,27 @@ nginx_start(){
|
|||||||
|
|
||||||
nginx_stop(){
|
nginx_stop(){
|
||||||
log "Stopping $DAEMON gracefully..."
|
log "Stopping $DAEMON gracefully..."
|
||||||
|
local REPLY
|
||||||
if ! nginx_running; then
|
if ! nginx_running; then
|
||||||
REPLY="Already stopped"
|
REPLY="Already stopped"
|
||||||
else
|
else
|
||||||
unraid_api_control stop
|
unraid_api_control stop
|
||||||
kill -QUIT $(cat $PID)
|
kill -QUIT $(cat $PID)
|
||||||
nginx_waitfor_shutdown
|
nginx_waitfor_shutdown
|
||||||
if ! nginx_running; then REPLY="Stopped"; else REPLY="Failed"; fi
|
if ! nginx_running; then
|
||||||
|
REPLY="Stopped"
|
||||||
|
else
|
||||||
|
pkill -f $NGINX
|
||||||
|
nginx_waitfor_shutdown
|
||||||
|
if ! nginx_running; then REPLY="Killed"; else REPLY="Failed"; fi
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
log "$DAEMON... $REPLY."
|
log "$DAEMON... $REPLY."
|
||||||
}
|
}
|
||||||
|
|
||||||
nginx_stop_forced(){
|
nginx_stop_forced(){
|
||||||
log "Stopping $DAEMON forcibly..."
|
log "Stopping $DAEMON forcibly..."
|
||||||
|
local REPLY
|
||||||
if ! nginx_running; then
|
if ! nginx_running; then
|
||||||
REPLY="Already stopped"
|
REPLY="Already stopped"
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ ntpd_build(){
|
|||||||
|
|
||||||
ntpd_start(){
|
ntpd_start(){
|
||||||
log "Starting $DAEMON..."
|
log "Starting $DAEMON..."
|
||||||
|
local REPLY
|
||||||
# read Unraid settings
|
# read Unraid settings
|
||||||
[[ -r $IDENT ]] && . <(fromdos <$IDENT)
|
[[ -r $IDENT ]] && . <(fromdos <$IDENT)
|
||||||
# if ntp not enabled, don't start ntp
|
# if ntp not enabled, don't start ntp
|
||||||
@@ -66,6 +67,7 @@ ntpd_start(){
|
|||||||
|
|
||||||
ntpd_stop(){
|
ntpd_stop(){
|
||||||
log "Stopping $DAEMON..."
|
log "Stopping $DAEMON..."
|
||||||
|
local REPLY
|
||||||
if ! ntpd_running; then
|
if ! ntpd_running; then
|
||||||
REPLY="Already stopped"
|
REPLY="Already stopped"
|
||||||
else
|
else
|
||||||
|
|||||||
+109
-136
@@ -1,8 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
#
|
#
|
||||||
# LimeTech - Modified for Unraid OS
|
# script: rc.php-fpm
|
||||||
|
#
|
||||||
### BEGIN INIT INFO
|
|
||||||
# Provides: php-fpm
|
# Provides: php-fpm
|
||||||
# Required-Start: $remote_fs $network
|
# Required-Start: $remote_fs $network
|
||||||
# Required-Stop: $remote_fs $network
|
# Required-Stop: $remote_fs $network
|
||||||
@@ -10,150 +9,124 @@
|
|||||||
# Default-Stop: 0 1 6
|
# Default-Stop: 0 1 6
|
||||||
# Short-Description: starts php-fpm
|
# Short-Description: starts php-fpm
|
||||||
# Description: starts the PHP FastCGI Process Manager daemon
|
# Description: starts the PHP FastCGI Process Manager daemon
|
||||||
### END INIT INFO
|
#
|
||||||
|
# LimeTech - modified for Unraid OS
|
||||||
|
# Bergware - modified for Unraid OS, October 2023
|
||||||
|
|
||||||
prefix=/usr
|
DAEMON="PHP-fpm daemon"
|
||||||
exec_prefix=${prefix}
|
PHP_FPM_BIN="/usr/sbin/php-fpm"
|
||||||
|
PHP_FPM_CONF="/etc/php-fpm.conf"
|
||||||
|
PHP_FPM_PID="/var/run/php-fpm.pid"
|
||||||
|
|
||||||
php_fpm_BIN=${exec_prefix}/sbin/php-fpm
|
# run & log functions
|
||||||
php_fpm_CONF=/etc/php-fpm.conf
|
. /etc/rc.d/rc.runlog
|
||||||
php_fpm_PID=/var/run/php-fpm.pid
|
|
||||||
|
|
||||||
|
# LimeTech - need --allow-to-run-as-root
|
||||||
|
PHP_OPTS="--fpm-config $PHP_FPM_CONF --pid $PHP_FPM_PID --allow-to-run-as-root"
|
||||||
|
|
||||||
# limetech - need --allow-to-run-as-root
|
php_fpm_waitfor(){
|
||||||
php_opts="--fpm-config $php_fpm_CONF --pid $php_fpm_PID --allow-to-run-as-root"
|
local TIMER=35
|
||||||
|
while [[ $TIMER -gt 0 ]]; do
|
||||||
|
case "$1" in
|
||||||
|
'created') [[ -f $2 ]] && return 0 ;;
|
||||||
|
'removed') [[ -f $2 ]] || return 0 ;;
|
||||||
|
esac
|
||||||
|
((TIMER--))
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
php_fpm_start(){
|
||||||
|
log "Starting $DAEMON..."
|
||||||
|
local REPLY
|
||||||
|
run $PHP_FPM_BIN --daemonize $PHP_OPTS
|
||||||
|
if [[ $? -eq 0 ]]; then
|
||||||
|
if php_fpm_waitfor created $PHP_FPM_PID; then REPLY="Started"; else REPLY="Failed"; fi
|
||||||
|
else
|
||||||
|
REPLY="Already started"
|
||||||
|
fi
|
||||||
|
log "$DAEMON... $REPLY."
|
||||||
|
}
|
||||||
|
|
||||||
wait_for_pid () {
|
php_fpm_stop(){
|
||||||
try=0
|
log "Stopping $DAEMON..."
|
||||||
|
local REPLY
|
||||||
|
if [[ -r $PHP_FPM_PID ]]; then
|
||||||
|
run kill -QUIT $(cat $PHP_FPM_PID)
|
||||||
|
if php_fpm_waitfor removed $PHP_FPM_PID; then REPLY="Stopped"; else REPLY="Failed"; fi
|
||||||
|
else
|
||||||
|
REPLY="Already stopped"
|
||||||
|
fi
|
||||||
|
log "$DAEMON... $REPLY."
|
||||||
|
}
|
||||||
|
|
||||||
while test $try -lt 35 ; do
|
php_fpm_restart(){
|
||||||
|
log "Restarting $DAEMON..."
|
||||||
|
php_fpm_stop
|
||||||
|
sleep 1
|
||||||
|
php_fpm_start
|
||||||
|
}
|
||||||
|
|
||||||
case "$1" in
|
php_fpm_reload(){
|
||||||
'created')
|
log "Reloading $DAEMON..."
|
||||||
if [ -f "$2" ] ; then
|
if [[ ! -r $PHP_FPM_PID ]]; then
|
||||||
try=''
|
log "$DAEMON... Warning, no pid file found."
|
||||||
break
|
exit 1
|
||||||
fi
|
fi
|
||||||
;;
|
kill -USR2 $(cat $PHP_FPM_PID)
|
||||||
|
log "$DAEMON... Reloaded."
|
||||||
|
}
|
||||||
|
|
||||||
'removed')
|
php_fpm_force_quit(){
|
||||||
if [ ! -f "$2" ] ; then
|
log "Terminating $DAEMON..."
|
||||||
try=''
|
if [[ ! -r $PHP_FPM_PID ]]; then
|
||||||
break
|
log "$DAEMON... Warning, no pid file found."
|
||||||
fi
|
exit 1
|
||||||
;;
|
fi
|
||||||
esac
|
kill -TERM $(cat $PHP_FPM_PID)
|
||||||
|
php_fpm_waitfor removed $PHP_FPM_PID
|
||||||
echo -n .
|
log "$DAEMON... $REPLY."
|
||||||
try=`expr $try + 1`
|
}
|
||||||
sleep 1
|
|
||||||
|
|
||||||
done
|
|
||||||
|
|
||||||
|
php_fpm_status(){
|
||||||
|
if [[ ! -r $PHP_FPM_PID ]]; then
|
||||||
|
echo "$DAEMON is not running."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
PID=$(cat $PHP_FPM_PID)
|
||||||
|
if ps -p $PID | grep -q $PID; then
|
||||||
|
echo "$DAEMON is currently running."
|
||||||
|
else
|
||||||
|
echo "$DAEMON is dead but PID file exists"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
'start')
|
||||||
echo -n "Starting php-fpm "
|
php_fpm_start
|
||||||
|
;;
|
||||||
$php_fpm_BIN --daemonize $php_opts
|
'stop')
|
||||||
|
php_fpm_stop
|
||||||
if [ "$?" != 0 ] ; then
|
;;
|
||||||
echo " failed"
|
'restart')
|
||||||
exit 1
|
php_fpm_restart
|
||||||
fi
|
;;
|
||||||
|
'reload')
|
||||||
wait_for_pid created $php_fpm_PID
|
php_fpm_reload
|
||||||
|
;;
|
||||||
if [ -n "$try" ] ; then
|
'force-quit')
|
||||||
echo " failed"
|
php_fpm_force_quit
|
||||||
exit 1
|
;;
|
||||||
else
|
'configtest')
|
||||||
echo " done"
|
$PHP_FPM_BIN -t
|
||||||
fi
|
;;
|
||||||
;;
|
'status')
|
||||||
|
php_fpm_status
|
||||||
stop)
|
;;
|
||||||
echo -n "Gracefully shutting down php-fpm "
|
*)
|
||||||
|
echo "Usage: $BASENAME start|stop|restart|reload|force-quit|configtest|status"
|
||||||
if [ ! -r $php_fpm_PID ] ; then
|
exit 1
|
||||||
echo "warning, no pid file found - php-fpm is not running ?"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
kill -QUIT `cat $php_fpm_PID`
|
|
||||||
|
|
||||||
wait_for_pid removed $php_fpm_PID
|
|
||||||
|
|
||||||
if [ -n "$try" ] ; then
|
|
||||||
echo " failed. Use force-quit"
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
echo " done"
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
|
|
||||||
status)
|
|
||||||
if [ ! -r $php_fpm_PID ] ; then
|
|
||||||
echo "php-fpm is stopped"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
PID=`cat $php_fpm_PID`
|
|
||||||
if ps -p $PID | grep -q $PID; then
|
|
||||||
echo "php-fpm (pid $PID) is running..."
|
|
||||||
else
|
|
||||||
echo "php-fpm dead but pid file exists"
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
|
|
||||||
force-quit)
|
|
||||||
echo -n "Terminating php-fpm "
|
|
||||||
|
|
||||||
if [ ! -r $php_fpm_PID ] ; then
|
|
||||||
echo "warning, no pid file found - php-fpm is not running ?"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
kill -TERM `cat $php_fpm_PID`
|
|
||||||
|
|
||||||
wait_for_pid removed $php_fpm_PID
|
|
||||||
|
|
||||||
if [ -n "$try" ] ; then
|
|
||||||
echo " failed"
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
echo " done"
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
|
|
||||||
restart)
|
|
||||||
$0 stop
|
|
||||||
$0 start
|
|
||||||
;;
|
|
||||||
|
|
||||||
reload)
|
|
||||||
|
|
||||||
echo -n "Reload service php-fpm "
|
|
||||||
|
|
||||||
if [ ! -r $php_fpm_PID ] ; then
|
|
||||||
echo "warning, no pid file found - php-fpm is not running ?"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
kill -USR2 `cat $php_fpm_PID`
|
|
||||||
|
|
||||||
echo " done"
|
|
||||||
;;
|
|
||||||
|
|
||||||
configtest)
|
|
||||||
$php_fpm_BIN -t
|
|
||||||
;;
|
|
||||||
|
|
||||||
*)
|
|
||||||
echo "Usage: $0 {start|stop|force-quit|restart|reload|status|configtest}"
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
|
|
||||||
esac
|
esac
|
||||||
|
exit 0
|
||||||
|
|||||||
+3
-1
@@ -36,6 +36,7 @@ rpc_running(){
|
|||||||
|
|
||||||
rpc_start(){
|
rpc_start(){
|
||||||
log "Starting $DAEMON..."
|
log "Starting $DAEMON..."
|
||||||
|
local REPLY
|
||||||
if rpc_running; then
|
if rpc_running; then
|
||||||
REPLY="Already started"
|
REPLY="Already started"
|
||||||
else
|
else
|
||||||
@@ -74,6 +75,7 @@ rpc_start(){
|
|||||||
|
|
||||||
rpc_stop(){
|
rpc_stop(){
|
||||||
log "Stopping $DAEMON..."
|
log "Stopping $DAEMON..."
|
||||||
|
local REPLY
|
||||||
if ! rpc_running; then
|
if ! rpc_running; then
|
||||||
REPLY="Already stopped"
|
REPLY="Already stopped"
|
||||||
else
|
else
|
||||||
@@ -98,7 +100,7 @@ rpc_restart(){
|
|||||||
|
|
||||||
rpc_reload(){
|
rpc_reload(){
|
||||||
# restart without info
|
# restart without info
|
||||||
rpc_restart 1>/dev/null 2>/dev/null
|
rpc_restart &>/dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
rpc_update(){
|
rpc_update(){
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ create_xconsole(){
|
|||||||
|
|
||||||
rsyslogd_start(){
|
rsyslogd_start(){
|
||||||
log "Starting $DAEMON..."
|
log "Starting $DAEMON..."
|
||||||
|
local REPLY
|
||||||
if [[ -x /usr/sbin/rsyslogd ]]; then
|
if [[ -x /usr/sbin/rsyslogd ]]; then
|
||||||
run /usr/sbin/rsyslogd -i $PIDFILE
|
run /usr/sbin/rsyslogd -i $PIDFILE
|
||||||
REPLY="Started"
|
REPLY="Started"
|
||||||
|
|||||||
+8
-11
@@ -10,19 +10,16 @@ BASENAME=$(basename "$0")
|
|||||||
|
|
||||||
run(){
|
run(){
|
||||||
# log command to syslog
|
# log command to syslog
|
||||||
logger -t $BASENAME -- "$*"
|
/usr/bin/logger -t $BASENAME -- "$*"
|
||||||
# run command - dismiss all output
|
# run command - dismiss all output
|
||||||
$* 1>/dev/null 2>/dev/null
|
$* &>/dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
log(){
|
log(){
|
||||||
if [[ ! -t 0 ]]; then
|
# log message to syslog
|
||||||
# log message to syslog
|
while IFS=$'\n' read -r LINE; do
|
||||||
while IFS='\n' read -r LINE; do
|
/usr/bin/logger -t $BASENAME -- "$LINE"
|
||||||
logger -t $BASENAME -- "$LINE"
|
done <<< ${1:-$(</dev/stdin)}
|
||||||
done <<< ${1:-$(</dev/stdin)}
|
# echo message to console
|
||||||
else
|
[[ -t 1 && -n $1 ]] && /bin/echo "$BASENAME: $1"
|
||||||
# echo message to console
|
|
||||||
[[ -n $1 ]] && echo "$1"
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -113,6 +113,7 @@ samba_settings(){
|
|||||||
|
|
||||||
samba_start(){
|
samba_start(){
|
||||||
log "Starting $DAEMON..."
|
log "Starting $DAEMON..."
|
||||||
|
local REPLY
|
||||||
if samba_running; then
|
if samba_running; then
|
||||||
REPLY="Already started"
|
REPLY="Already started"
|
||||||
else
|
else
|
||||||
@@ -139,6 +140,7 @@ samba_start(){
|
|||||||
|
|
||||||
samba_stop(){
|
samba_stop(){
|
||||||
log "Stopping $DAEMON..."
|
log "Stopping $DAEMON..."
|
||||||
|
local REPLY
|
||||||
if ! samba_running; then
|
if ! samba_running; then
|
||||||
REPLY="Already stopped"
|
REPLY="Already stopped"
|
||||||
else
|
else
|
||||||
|
|||||||
+91
-98
@@ -1,7 +1,8 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
#
|
#
|
||||||
# /etc/rc.serial
|
# script: rc.serial
|
||||||
# Initializes the serial ports on your system
|
#
|
||||||
|
# Initializes the serial ports on your system
|
||||||
#
|
#
|
||||||
# chkconfig: 2345 50 75
|
# chkconfig: 2345 50 75
|
||||||
# description: This initializes the settings of the serial port
|
# description: This initializes the settings of the serial port
|
||||||
@@ -9,126 +10,118 @@
|
|||||||
# FILE_VERSION: 19981128
|
# FILE_VERSION: 19981128
|
||||||
#
|
#
|
||||||
# Distributed with setserial and the serial driver. We need to use the
|
# Distributed with setserial and the serial driver. We need to use the
|
||||||
# FILE_VERSION field to assure that we don't overwrite a newer rc.serial
|
# FILE_VERSION field to assure that we don't overwrite a newer rc.serial
|
||||||
# file with a newer one.
|
# file with a newer one.
|
||||||
#
|
#
|
||||||
# XXXX For now, the autosave feature doesn't work if you are
|
# XXXX For now, the autosave feature doesn't work if you are
|
||||||
# using the multiport feature; it doesn't save the multiport configuration
|
# using the multiport feature; it doesn't save the multiport configuration
|
||||||
# (for now). Autosave also doesn't work for the hayes devices.
|
# (for now). Autosave also doesn't work for the hayes devices.
|
||||||
#
|
#
|
||||||
# LimeTech - Modified for Unraid OS
|
# LimeTech - modified for Unraid OS
|
||||||
|
# Bergware - modified for Unraid OS, October 2023
|
||||||
|
|
||||||
RCLOCKFILE=/var/lock/subsys/serial
|
# Set the path.
|
||||||
DIRS="/lib/modules/`uname -r`/misc /lib/modules /usr/lib/modules ."
|
|
||||||
PATH=/bin:/sbin:/usr/bin
|
PATH=/bin:/sbin:/usr/bin
|
||||||
DRIVER=serial
|
|
||||||
DRIVER_NAME=serial
|
RCLOCKFILE="/var/lock/subsys/serial"
|
||||||
|
DIRS="/lib/modules/`uname -r`/misc /lib/modules /usr/lib/modules ."
|
||||||
|
DRIVER="serial"
|
||||||
|
DRIVER_NAME="serial"
|
||||||
MODULE_REGEXP="serial\b"
|
MODULE_REGEXP="serial\b"
|
||||||
|
SERIAL="/etc/serial.conf"
|
||||||
ALLDEVS="/dev/ttyS?"
|
ALLDEVS="/dev/ttyS?"
|
||||||
if /bin/ls /dev/ttyS?? >& /dev/null ; then
|
|
||||||
ALLDEVS="$ALLDEVS /dev/ttyS??"
|
|
||||||
fi
|
|
||||||
|
|
||||||
SETSERIAL=""
|
SETSERIAL=""
|
||||||
if test -x /bin/setserial ; then
|
|
||||||
SETSERIAL=/bin/setserial
|
|
||||||
elif test -x /sbin/setserial ; then
|
|
||||||
SETSERIAL=/sbin/setserial
|
|
||||||
fi
|
|
||||||
|
|
||||||
#
|
|
||||||
# See if the serial driver is loaded
|
|
||||||
#
|
|
||||||
LOADED=""
|
LOADED=""
|
||||||
if test -f /proc/devices; then
|
|
||||||
if grep -q " ttyS$" /proc/devices ; then
|
# run & log functions
|
||||||
LOADED="yes"
|
. /etc/rc.d/rc.runlog
|
||||||
else
|
|
||||||
LOADED="no"
|
if ls /dev/ttyS?? >& /dev/null; then
|
||||||
fi
|
ALLDEVS="$ALLDEVS /dev/ttyS??"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -x /bin/setserial ]]; then
|
||||||
|
SETSERIAL=/bin/setserial
|
||||||
|
elif [[ -x /sbin/setserial ]]; then
|
||||||
|
SETSERIAL=/sbin/setserial
|
||||||
|
fi
|
||||||
|
|
||||||
|
# See if the serial driver is loaded
|
||||||
|
if [[ -f /proc/devices ]]; then
|
||||||
|
if grep -q " ttyS$" /proc/devices; then
|
||||||
|
LOADED="yes"
|
||||||
|
else
|
||||||
|
LOADED="no"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#
|
|
||||||
# Find the serial driver
|
# Find the serial driver
|
||||||
#
|
for i in $DIRS; do
|
||||||
for i in $DIRS
|
if [[ -z $MODULE && -f $i/$DRIVER.o ]]; then
|
||||||
do
|
MODULE=$i/$DRIVER.o
|
||||||
if test -z "$MODULE" -a -f $i/$DRIVER.o ; then
|
fi
|
||||||
MODULE=$i/$DRIVER.o
|
|
||||||
fi
|
|
||||||
done
|
done
|
||||||
|
[[ -f /proc/modules ]] || MODULE=""
|
||||||
|
|
||||||
if ! test -f /proc/modules ; then
|
|
||||||
MODULE=""
|
|
||||||
fi
|
|
||||||
|
|
||||||
#
|
|
||||||
# Handle System V init conventions...
|
# Handle System V init conventions...
|
||||||
#
|
case "$1" in
|
||||||
case $1 in
|
'start')
|
||||||
start)
|
action="start"
|
||||||
action="start";
|
;;
|
||||||
;;
|
'stop')
|
||||||
stop)
|
action="stop"
|
||||||
action="stop";
|
;;
|
||||||
;;
|
|
||||||
*)
|
*)
|
||||||
action="start";
|
action="start"
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if test $action = stop ; then
|
if [[ $action == stop ]]; then
|
||||||
if test -n ${SETSERIAL} -a "$LOADED" != "no" -a \
|
if [[ -n $SETSERIAL && $LOADED != no && "$(head -1 $SERIAL)X" == "###AUTOSAVE###X" ]]; then
|
||||||
`head -1 /etc/serial.conf`X = "###AUTOSAVE###X" ; then
|
log "Saving state of serial devices."
|
||||||
echo -n "Saving state of serial devices... "
|
grep "^#" $SERIAL >/etc/.serial.conf.new
|
||||||
grep "^#" /etc/serial.conf > /etc/.serial.conf.new
|
$SETSERIAL -G -g $ALLDEVS >>/etc/.serial.conf.new
|
||||||
${SETSERIAL} -G -g ${ALLDEVS} >> /etc/.serial.conf.new
|
mv $SERIAL /etc/.serial.conf.old
|
||||||
mv /etc/serial.conf /etc/.serial.conf.old
|
mv /etc/.serial.conf.new $SERIAL
|
||||||
mv /etc/.serial.conf.new /etc/serial.conf
|
fi
|
||||||
echo "done."
|
if [[ -n $MODULE ]]; then
|
||||||
fi
|
MODULE=$(grep $MODULE_REGEXP /proc/modules | awk '{print $1}')
|
||||||
if test -n "$MODULE" ; then
|
if [[ -z $MODULE ]]; then
|
||||||
module=`grep $MODULE_REGEXP /proc/modules | awk '{print $1}'`
|
log "The $DRIVER_NAME driver is not loaded."
|
||||||
if test -z "$module" ; then
|
rm -f $RCLOCKFILE
|
||||||
echo "The $DRIVER_NAME driver is not loaded."
|
exit 0
|
||||||
rm -f ${RCLOCKFILE}
|
fi
|
||||||
exit 0
|
if ! rmmod $MODULE; then
|
||||||
fi
|
log "The $DRIVER_NAME driver could NOT be unloaded."
|
||||||
if rmmod $module ; then :; else
|
exit 1
|
||||||
echo "The $DRIVER_NAME driver could NOT be unloaded."
|
fi
|
||||||
exit 1;
|
log "The $DRIVER_NAME driver has been unloaded."
|
||||||
fi
|
fi
|
||||||
echo "The $DRIVER_NAME driver has been unloaded."
|
rm -f $RCLOCKFILE
|
||||||
fi
|
exit 0
|
||||||
rm -f ${RCLOCKFILE}
|
|
||||||
exit 0
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#
|
|
||||||
# If not stop, it must be a start....
|
# If not stop, it must be a start....
|
||||||
#
|
if [[ -n $MODULE && $LOADED != yes ]]; then
|
||||||
|
if insmod -f $MODULE $DRIVER_ARG; then
|
||||||
if test -n "$MODULE" -a "$LOADED" != "yes" ; then
|
true
|
||||||
if insmod -f $MODULE $DRIVER_ARG ; then
|
else
|
||||||
true
|
log "Couldn't load $DRIVER_NAME driver."
|
||||||
else
|
exit 1
|
||||||
echo "Couldn't load $DRIVER_NAME driver."
|
fi
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test -f /etc/serial.conf ; then
|
if [[ -f $SERIAL ]]; then
|
||||||
if test -n ${SETSERIAL} ; then
|
if [[ -n $SETSERIAL ]]; then
|
||||||
grep -v ^# < /etc/serial.conf | while read device args
|
grep -v ^# <$SERIAL | while read DEVICE ARGS; do
|
||||||
do
|
if [[ -n $DEVICE && -n $ARGS ]]; then
|
||||||
if [ ! "$device" = "" -a ! "$args" = "" ]; then
|
$SETSERIAL -z $DEVICE $ARGS
|
||||||
${SETSERIAL} -z $device $args
|
fi
|
||||||
fi
|
done
|
||||||
done
|
fi
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
echo "###AUTOSAVE###" > /etc/serial.conf
|
echo "###AUTOSAVE###" >$SERIAL
|
||||||
fi
|
fi
|
||||||
|
|
||||||
touch ${RCLOCKFILE}
|
touch $RCLOCKFILE
|
||||||
${SETSERIAL} -bg ${ALLDEVS}
|
$SETSERIAL -bg $ALLDEVS
|
||||||
|
exit 0
|
||||||
|
|||||||
+9
-6
@@ -1,13 +1,16 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# script: rc.setterm
|
||||||
#
|
#
|
||||||
# This file provides the command line for the setterm utility to set the
|
# This file provides the command line for the setterm utility to set the
|
||||||
# terminal attributes (primarily used for screen blanking and power
|
# terminal attributes (primarily used for screen blanking and power management).
|
||||||
# management).
|
#
|
||||||
|
# LimeTech - modified for Unraid OS
|
||||||
|
# Bergware - modified for Unraid OS, October 2023
|
||||||
|
|
||||||
# Screen blanks after 15 minutes idle time, and powers down in one hour
|
# Screen blanks after 15 minutes idle time, and powers down in one hour
|
||||||
# if the kernel supports APM or ACPI power management (default setting):
|
# if the kernel supports APM or ACPI power management (default setting):
|
||||||
/bin/setterm -blank 15 -powersave powerdown -powerdown 60
|
setterm -blank 15 -powersave powerdown -powerdown 60
|
||||||
|
|
||||||
# Screen does not blank or use power management features:
|
# Screen does not blank or use power management features:
|
||||||
#/bin/setterm -blank 0 -powersave off -powerdown 0
|
# setterm -blank 0 -powersave off -powerdown 0
|
||||||
|
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ sshd_build(){
|
|||||||
|
|
||||||
sshd_start(){
|
sshd_start(){
|
||||||
log "Starting $DAEMON..."
|
log "Starting $DAEMON..."
|
||||||
|
local REPLY
|
||||||
if sshd_running; then
|
if sshd_running; then
|
||||||
REPLY="Already started"
|
REPLY="Already started"
|
||||||
else
|
else
|
||||||
@@ -60,6 +61,7 @@ sshd_start(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
sshd_stop(){
|
sshd_stop(){
|
||||||
|
local REPLY
|
||||||
if ! sshd_running; then
|
if ! sshd_running; then
|
||||||
REPLY="Already stopped"
|
REPLY="Already stopped"
|
||||||
else
|
else
|
||||||
|
|||||||
+29
-24
@@ -1,25 +1,30 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
#
|
#
|
||||||
# rc.sysvinit This file provides basic compatibility with SystemV style
|
# script: rc.sysvinit
|
||||||
# startup scripts. The SystemV style init system places
|
|
||||||
# start/stop scripts for each runlevel into directories such as
|
|
||||||
# /etc/rc.d/rc3.d/ (for runlevel 3) instead of starting them
|
|
||||||
# from /etc/rc.d/rc.M. This makes for a lot more init scripts,
|
|
||||||
# and a more complicated execution path to follow through if
|
|
||||||
# something goes wrong. For this reason, Slackware has always
|
|
||||||
# used the traditional BSD style init script layout.
|
|
||||||
#
|
#
|
||||||
# However, many binary packages exist that install SystemV
|
# This file provides basic compatibility with SystemV style
|
||||||
# init scripts. With rc.sysvinit in place, most well-written
|
# startup scripts. The SystemV style init system places
|
||||||
# startup scripts will work. This is primarily intended to
|
# start/stop scripts for each runlevel into directories such as
|
||||||
# support commercial software, though, and probably shouldn't
|
# /etc/rc.d/rc3.d/ (for runlevel 3) instead of starting them
|
||||||
# be considered bug free.
|
# from /etc/rc.d/rc.M. This makes for a lot more init scripts,
|
||||||
|
# and a more complicated execution path to follow through if
|
||||||
|
# something goes wrong. For this reason, Slackware has always
|
||||||
|
# used the traditional BSD style init script layout.
|
||||||
#
|
#
|
||||||
# Written by Patrick Volkerding <volkerdi@slackware.com>, 1999
|
# However, many binary packages exist that install SystemV
|
||||||
# from an example by Miquel van Smoorenburg <miquels@cistron.nl>.
|
# init scripts. With rc.sysvinit in place, most well-written
|
||||||
|
# startup scripts will work. This is primarily intended to
|
||||||
|
# support commercial software, though, and probably shouldn't
|
||||||
|
# be considered bug free.
|
||||||
|
#
|
||||||
|
# Written by Patrick Volkerding <volkerdi@slackware.com>, 1999
|
||||||
|
# from an example by Miquel van Smoorenburg <miquels@cistron.nl>.
|
||||||
|
#
|
||||||
|
# LimeTech - modified for Unraid OS
|
||||||
|
# Bergware - modified for Unraid OS, October 2023
|
||||||
|
|
||||||
# Run an init script:
|
# Run an init script:
|
||||||
startup() {
|
startup(){
|
||||||
case "$1" in
|
case "$1" in
|
||||||
*.sh)
|
*.sh)
|
||||||
sh "$@"
|
sh "$@"
|
||||||
@@ -33,7 +38,7 @@ startup() {
|
|||||||
# Set onlcr to avoid staircase effect.
|
# Set onlcr to avoid staircase effect.
|
||||||
stty onlcr 0>&1
|
stty onlcr 0>&1
|
||||||
|
|
||||||
if [ "$runlevel" = "" ]; then
|
if [[ -z $runlevel ]]; then
|
||||||
runlevel=$RUNLEVEL
|
runlevel=$RUNLEVEL
|
||||||
export runlevel
|
export runlevel
|
||||||
prevlevel=$PREVLEVEL
|
prevlevel=$PREVLEVEL
|
||||||
@@ -41,16 +46,16 @@ if [ "$runlevel" = "" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Run kill scripts:
|
# Run kill scripts:
|
||||||
for script in /etc/rc.d/rc$runlevel.d/K* ; do
|
for SCRIPT in /etc/rc.d/rc$runlevel.d/K*; do
|
||||||
if [ -x $script ]; then
|
if [[ -x $SCRIPT ]]; then
|
||||||
startup $script stop
|
startup $SCRIPT stop
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# Now do the startup scripts:
|
# Now do the startup scripts:
|
||||||
for script in /etc/rc.d/rc$runlevel.d/S* ; do
|
for SCRIPT in /etc/rc.d/rc$runlevel.d/S*; do
|
||||||
if [ -x $script ]; then
|
if [[ -x $SCRIPT ]]; then
|
||||||
startup $script start
|
startup $SCRIPT start
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
exit 0
|
||||||
|
|||||||
+70
-85
@@ -1,28 +1,34 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# script: rc.udev
|
||||||
|
#
|
||||||
# This is a script to initialize udev, which populates the /dev
|
# This is a script to initialize udev, which populates the /dev
|
||||||
# directory with device nodes, scans for devices, loads the
|
# directory with device nodes, scans for devices, loads the
|
||||||
# appropriate kernel modules, and configures the devices.
|
# appropriate kernel modules, and configures the devices.
|
||||||
|
#
|
||||||
|
# LimeTech - modified for Unraid OS
|
||||||
|
# Bergware - modified for Unraid OS, October 2023
|
||||||
|
|
||||||
# limetech - modified for Unraid OS
|
# Set the path.
|
||||||
# bergware - added persistent network assignment
|
PATH=/sbin:/bin
|
||||||
|
|
||||||
PATH="/sbin:/bin"
|
# run & log functions
|
||||||
|
. /etc/rc.d/rc.runlog
|
||||||
|
|
||||||
check_mounted() {
|
check_mounted(){
|
||||||
grep -E -q "^[^[:space:]]+ $1 $2" /proc/mounts
|
grep -Eq "^[^[:space:]]+ $1 $2" /proc/mounts
|
||||||
return $?
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mount_devpts() {
|
mount_devpts(){
|
||||||
if ! check_mounted /dev/pts devpts; then
|
if ! check_mounted /dev/pts devpts; then
|
||||||
mkdir /dev/pts 2> /dev/null
|
mkdir /dev/pts 2>/dev/null
|
||||||
mount -n -o mode=0620,gid=5 -t devpts devpts /dev/pts
|
mount -n -o mode=0620,gid=5 -t devpts devpts /dev/pts
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
mount_devshm() {
|
mount_devshm(){
|
||||||
if ! check_mounted /dev/shm tmpfs; then
|
if ! check_mounted /dev/shm tmpfs; then
|
||||||
mkdir /dev/shm 2> /dev/null
|
mkdir /dev/shm 2>/dev/null
|
||||||
mount /dev/shm
|
mount /dev/shm
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -31,47 +37,39 @@ case "$1" in
|
|||||||
'start')
|
'start')
|
||||||
# Sanity check #1, udev requires that the kernel support tmpfs:
|
# Sanity check #1, udev requires that the kernel support tmpfs:
|
||||||
if ! grep -wq tmpfs /proc/filesystems; then
|
if ! grep -wq tmpfs /proc/filesystems; then
|
||||||
echo "Sorry, but you need tmpfs support in the kernel to use udev."
|
log "Sorry, but you need tmpfs support in the kernel to use udev."
|
||||||
echo
|
log "FATAL: Refusing to run /etc/rc.d/rc.udev."
|
||||||
echo "FATAL: Refusing to run /etc/rc.d/rc.udev."
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Sanity check #2, make sure that a 2.6.x kernel is new enough:
|
# Sanity check #2, make sure that a 2.6.x kernel is new enough:
|
||||||
if [[ "$(uname -r | cut -f 1,2 -d .)" = "2.6" ]]; then
|
if [[ $(uname -r | cut -f 1,2 -d .) == 2.6 ]]; then
|
||||||
if [ "$(uname -r | cut -f 3 -d . | sed 's/[^[:digit:]].*//')" -lt "32" ]; then
|
if [[ $(uname -r | cut -f 3 -d . | sed 's/[^[:digit:]].*//') -lt 32 ]]; then
|
||||||
echo "Sorry, but you need a 2.6.32+ kernel to use this udev."
|
log "Sorry, but you need a 2.6.32+ kernel to use this udev."
|
||||||
echo "Your kernel version is only $(uname -r)."
|
log "Your kernel version is only $(uname -r)."
|
||||||
echo
|
log "FATAL: Refusing to run /etc/rc.d/rc.udev."
|
||||||
echo "FATAL: Refusing to run /etc/rc.d/rc.udev."
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Sanity check #3, make sure the udev package was not removed. If udevd
|
# Sanity check #3, make sure the udev package was not removed. If udevd
|
||||||
# is not there, this will also shut off this script to prevent further
|
# is not there, this will also shut off this script to prevent further
|
||||||
# problems:
|
# problems:
|
||||||
if [[ ! -x /sbin/udevd ]]; then
|
if [[ ! -x /sbin/udevd ]]; then
|
||||||
chmod 0644 /etc/rc.d/rc.udev
|
chmod 0644 /etc/rc.d/rc.udev
|
||||||
echo "No udevd daemon found."
|
log "No udevd daemon found."
|
||||||
echo "Turning off udev: chmod 644 /etc/rc.d/rc.udev"
|
log "Turning off udev: chmod 644 /etc/rc.d/rc.udev"
|
||||||
echo "FATAL: Refusing to run /etc/rc.d/rc.udev."
|
log "FATAL: Refusing to run /etc/rc.d/rc.udev."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Disable hotplug helper since udevd listens to netlink:
|
# Disable hotplug helper since udevd listens to netlink:
|
||||||
if [[ -e /proc/sys/kernel/hotplug ]]; then
|
if [[ -e /proc/sys/kernel/hotplug ]]; then
|
||||||
echo "" > /proc/sys/kernel/hotplug
|
echo >/proc/sys/kernel/hotplug
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if grep -qw devtmpfs /proc/filesystems; then
|
if grep -qw devtmpfs /proc/filesystems; then
|
||||||
if ! check_mounted /dev devtmpfs; then
|
if ! check_mounted /dev devtmpfs; then
|
||||||
# umount shm if needed
|
# umount shm if needed
|
||||||
check_mounted /dev/shm tmpfs && umount -l /dev/shm
|
check_mounted /dev/shm tmpfs && umount -l /dev/shm
|
||||||
|
|
||||||
# Umount pts if needed, we will remount it later:
|
# Umount pts if needed, we will remount it later:
|
||||||
check_mounted /dev/pts devpts && umount -l /dev/pts
|
check_mounted /dev/pts devpts && umount -l /dev/pts
|
||||||
|
|
||||||
# Mount tmpfs on /dev:
|
# Mount tmpfs on /dev:
|
||||||
mount -n -t devtmpfs -o size=8M devtmpfs /dev
|
mount -n -t devtmpfs -o size=8M devtmpfs /dev
|
||||||
fi
|
fi
|
||||||
@@ -80,24 +78,20 @@ case "$1" in
|
|||||||
if ! check_mounted /dev tmpfs; then
|
if ! check_mounted /dev tmpfs; then
|
||||||
# umount shm if needed
|
# umount shm if needed
|
||||||
check_mounted /dev/shm tmpfs && umount -l /dev/shm
|
check_mounted /dev/shm tmpfs && umount -l /dev/shm
|
||||||
|
|
||||||
# Umount pts if needed, we will remount it later:
|
# Umount pts if needed, we will remount it later:
|
||||||
check_mounted /dev/pts devpts && umount -l /dev/pts
|
check_mounted /dev/pts devpts && umount -l /dev/pts
|
||||||
|
|
||||||
# Mount tmpfs on /dev:
|
# Mount tmpfs on /dev:
|
||||||
# the -n is because we don't want /dev umounted when
|
# the -n is because we don't want /dev umounted when
|
||||||
# someone (rc.[06]) calls umount -a
|
# someone (rc.[06]) calls umount -a
|
||||||
mount -n -o mode=0755 -t tmpfs -o size=8M tmpfs /dev
|
mount -n -o mode=0755 -t tmpfs -o size=8M tmpfs /dev
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Mount devpts
|
# Mount devpts
|
||||||
mount_devpts
|
mount_devpts
|
||||||
mount_devshm
|
mount_devshm
|
||||||
|
if ! pidof udevd &>/dev/null; then # start udevd
|
||||||
if ! /sbin/pidof udevd 1>/dev/null 2>/dev/null; then # start udevd
|
log "Creating static nodes in /dev."
|
||||||
echo "Creating static nodes in /dev."
|
run kmod static-nodes -f tmpfiles --output /run/static-nodes
|
||||||
kmod static-nodes -f tmpfiles --output /run/static-nodes
|
|
||||||
grep "^d " /run/static-nodes | while read line; do
|
grep "^d " /run/static-nodes | while read line; do
|
||||||
mkdir -p -m $(echo $line | cut -f 3 -d ' ') $(echo $line | cut -f 2 -d ' ')
|
mkdir -p -m $(echo $line | cut -f 3 -d ' ') $(echo $line | cut -f 2 -d ' ')
|
||||||
done
|
done
|
||||||
@@ -106,33 +100,33 @@ case "$1" in
|
|||||||
$(echo $line | cut -f 2 -d ' ') \
|
$(echo $line | cut -f 2 -d ' ') \
|
||||||
$(echo $line | cut -b1 ) \
|
$(echo $line | cut -b1 ) \
|
||||||
$(echo $line | cut -f 7 -d ' ' | cut -f 1 -d :) \
|
$(echo $line | cut -f 7 -d ' ' | cut -f 1 -d :) \
|
||||||
$(echo $line | cut -f 7 -d ' ' | cut -f 2 -d :) 2> /dev/null
|
$(echo $line | cut -f 7 -d ' ' | cut -f 2 -d :) 2>/dev/null
|
||||||
done
|
done
|
||||||
rm -f /run/static-nodes
|
rm -f /run/static-nodes
|
||||||
# Add any system defined additional device nodes:
|
# Add any system defined additional device nodes:
|
||||||
cp --preserve=all --recursive --update /lib/udev/devices/* /dev 2> /dev/null
|
cp --preserve=all --recursive --update /lib/udev/devices/* /dev 2>/dev/null
|
||||||
# Add any locally defined additional device nodes:
|
# Add any locally defined additional device nodes:
|
||||||
cp --preserve=all --recursive --update /etc/udev/devices/* /dev 2> /dev/null
|
cp --preserve=all --recursive --update /etc/udev/devices/* /dev 2>/dev/null
|
||||||
echo "Starting udevd: /sbin/udevd --daemon"
|
log "Starting udevd: /sbin/udevd --daemon"
|
||||||
/sbin/udevd --daemon
|
run udevd --daemon
|
||||||
# Since udev is just now being started we want to use add events:
|
# Since udev is just now being started we want to use add events:
|
||||||
echo "Triggering udev events: /sbin/udevadm trigger --action=add"
|
log "Triggering udev events: /sbin/udevadm trigger --action=add"
|
||||||
# Call udevtrigger and udevsettle to do the device configuration:
|
# Call udevtrigger and udevsettle to do the device configuration:
|
||||||
/sbin/udevadm trigger --type=subsystems --action=add
|
run udevadm trigger --type=subsystems --action=add
|
||||||
/sbin/udevadm trigger --type=devices --action=add
|
run udevadm trigger --type=devices --action=add
|
||||||
else # trigger changes for already running udevd
|
else # trigger changes for already running udevd
|
||||||
# bergware - set file references
|
# Bergware - set file references
|
||||||
RAM=/etc/udev/rules.d/70-persistent-net.rules
|
RAM=/etc/udev/rules.d/70-persistent-net.rules
|
||||||
ROM=/boot/config/network-rules.cfg
|
ROM=/boot/config/network-rules.cfg
|
||||||
MAC='ATTR{address}=="\K..:..:..:..:..:..'
|
MAC='ATTR{address}=="\K..:..:..:..:..:..'
|
||||||
# If the persistent network rules file does not exist, trigger an add event:
|
# If the persistent network rules file does not exist, trigger an add event:
|
||||||
if [[ ! -r $RAM ]]; then
|
if [[ ! -r $RAM ]]; then
|
||||||
# Test that we can actually write to the directory first:
|
# Test that we can actually write to the directory first:
|
||||||
if touch /etc/udev/rules.d/testfile 2> /dev/null; then
|
if touch /etc/udev/rules.d/testfile 2>/dev/null; then
|
||||||
rm -f /etc/udev/rules.d/testfile
|
rm -f /etc/udev/rules.d/testfile
|
||||||
# This should add persistent net rules:
|
# This should add persistent net rules:
|
||||||
echo "Triggering udev to write persistent rules to /etc/udev/rules.d/"
|
log "Triggering udev to write persistent rules to /etc/udev/rules.d/"
|
||||||
/sbin/udevadm trigger --type=devices --action=add
|
run udevadm trigger --type=devices --action=add
|
||||||
sleep 3
|
sleep 3
|
||||||
# Create the files if they don't exist at this point.
|
# Create the files if they don't exist at this point.
|
||||||
# If a machine does not have a network device or an optical
|
# If a machine does not have a network device or an optical
|
||||||
@@ -142,86 +136,77 @@ case "$1" in
|
|||||||
touch $RAM
|
touch $RAM
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
# Bergware - start of code
|
||||||
# bergware - start of code
|
|
||||||
if [[ -f $ROM ]]; then
|
if [[ -f $ROM ]]; then
|
||||||
NEW=$(grep -Po $MAC $RAM | sort)
|
NEW=$(grep -Po $MAC $RAM | sort)
|
||||||
# bergware - set persistent rules of existing interfaces
|
# Bergware - set persistent rules of existing interfaces
|
||||||
grep -B2 "$NEW" $ROM | /usr/bin/fromdos >$RAM
|
grep -B2 "$NEW" $ROM | /usr/bin/fromdos >$RAM
|
||||||
/sbin/udevadm control --reload
|
udevadm control --reload
|
||||||
# bergware - find the unique drivers currently in use by the interface(s)
|
# Bergware - find the unique drivers currently in use by the interface(s)
|
||||||
DRIVERS=
|
DRIVERS=
|
||||||
for PORT in $(ls --indicator-style=none /sys/class/net | grep -P '^eth\d+$'); do
|
for PORT in $(ls --indicator-style=none /sys/class/net | grep -P '^eth\d+$'); do
|
||||||
DRIVER=$(/usr/sbin/ethtool -i $PORT | grep -Po '^driver: \K\S+')
|
DRIVER=$(/usr/sbin/ethtool -i $PORT | grep -Po '^driver: \K\S+')
|
||||||
[[ $DRIVERS != *$DRIVER* ]] && DRIVERS="$DRIVERS $DRIVER"
|
[[ $DRIVERS != *$DRIVER* ]] && DRIVERS="$DRIVERS $DRIVER"
|
||||||
done
|
done
|
||||||
# bergware - delete existing interfaces and recreate them using the updated udev rules
|
# Bergware - delete existing interfaces and recreate them using the updated udev rules
|
||||||
modprobe -r $DRIVERS
|
modprobe -r $DRIVERS
|
||||||
modprobe -a $DRIVERS
|
modprobe -a $DRIVERS
|
||||||
# bergware - check for changes and save them
|
# Bergware - check for changes and save them
|
||||||
if [[ $NEW != $(grep -Po $MAC $ROM | sort) ]]; then
|
if [[ $NEW != $(grep -Po $MAC $ROM | sort) ]]; then
|
||||||
# bergware - copy to flash only when more than one interface is present
|
# Bergware - copy to flash only when more than one interface is present
|
||||||
[[ $(echo "$NEW" | wc -l) -gt 1 ]] && /usr/bin/todos <$RAM >$ROM || rm -f $ROM
|
[[ $(echo "$NEW" | wc -l) -gt 1 ]] && /usr/bin/todos <$RAM >$ROM || rm -f $ROM
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
# bergware - remove leading remarks in file
|
# Bergware - remove leading remarks in file
|
||||||
sed -i '/^# This/,/^$/d' $RAM
|
sed -i '/^# This/,/^$/d' $RAM
|
||||||
# bergware - copy to flash only when more than one interface is present
|
# Bergware - copy to flash only when more than one interface is present
|
||||||
[[ $(grep -Pc 'NAME="eth\d+"' $RAM) -gt 1 ]] && /usr/bin/todos <$RAM >$ROM || rm -f $ROM
|
[[ $(grep -Pc 'NAME="eth\d+"' $RAM) -gt 1 ]] && /usr/bin/todos <$RAM >$ROM || rm -f $ROM
|
||||||
fi
|
fi
|
||||||
# bergware - end of code
|
# Bergware - end of code
|
||||||
|
|
||||||
# Update the hardware database index (/etc/udev/hwdb.bin), if possible:
|
# Update the hardware database index (/etc/udev/hwdb.bin), if possible:
|
||||||
if touch /etc/udev/testfile 2> /dev/null; then
|
if touch /etc/udev/testfile 2>/dev/null; then
|
||||||
rm -f /etc/udev/testfile
|
rm -f /etc/udev/testfile
|
||||||
echo "Updating hardware database index: /sbin/udevadm hwdb --update"
|
log "Updating hardware database index: udevadm hwdb --update"
|
||||||
/sbin/udevadm hwdb --update
|
run udevadm hwdb --update
|
||||||
fi
|
fi
|
||||||
# Since udevd is running, most of the time we only need change events:
|
# Since udevd is running, most of the time we only need change events:
|
||||||
echo "Triggering udev events: /sbin/udevadm trigger --action=change"
|
log "Triggering udev events: udevadm trigger --action=change"
|
||||||
/sbin/udevadm trigger --type=subsystems --action=change
|
run udevadm trigger --type=subsystems --action=change
|
||||||
/sbin/udevadm trigger --type=devices --action=change
|
run udevadm trigger --type=devices --action=change
|
||||||
fi
|
fi
|
||||||
/sbin/udevadm settle --timeout=120
|
udevadm settle --timeout=120
|
||||||
;;
|
;;
|
||||||
|
|
||||||
'stop')
|
'stop')
|
||||||
echo "Stopping udevd is STRONGLY discouraged and not supported."
|
log "Stopping udevd is STRONGLY discouraged and not supported."
|
||||||
echo "If you are sure you want to do this, use 'force-stop' instead."
|
log "If you are sure you want to do this, use 'force-stop' instead."
|
||||||
;;
|
;;
|
||||||
|
|
||||||
'restart')
|
'restart')
|
||||||
echo "Restarting udevd is STRONGLY discouraged and not supported."
|
log "Restarting udevd is STRONGLY discouraged and not supported."
|
||||||
echo "If you are sure you want to do this, use 'force-restart' instead."
|
log "If you are sure you want to do this, use 'force-restart' instead."
|
||||||
;;
|
;;
|
||||||
|
|
||||||
'reload')
|
'reload')
|
||||||
echo "Reloading udev rules"
|
log "Reloading udev rules"
|
||||||
udevadm control --reload
|
udevadm control --reload
|
||||||
;;
|
;;
|
||||||
|
|
||||||
'force-stop')
|
'force-stop')
|
||||||
echo "Stopping udevd"
|
log "Stopping udevd"
|
||||||
udevadm control --exit
|
udevadm control --exit
|
||||||
killall udevd 2>/dev/null
|
killall udevd 2>/dev/null
|
||||||
;;
|
;;
|
||||||
|
|
||||||
'force-restart')
|
'force-restart')
|
||||||
echo "Restarting udevd"
|
log "Restarting udevd"
|
||||||
udevadm control --exit
|
udevadm control --exit
|
||||||
sleep 3
|
sleep 3
|
||||||
udevd --daemon
|
udevd --daemon
|
||||||
;;
|
;;
|
||||||
|
|
||||||
'force-reload')
|
'force-reload')
|
||||||
echo "Updating all available device nodes in /dev"
|
log "Updating all available device nodes in /dev"
|
||||||
udevadm control --reload
|
udevadm control --reload
|
||||||
rm -rf /dev/.udev /dev/disk
|
rm -rf /dev/.udev /dev/disk
|
||||||
cp --preserve=all --recursive --update /lib/udev/devices/* /dev 2> /dev/null
|
cp --preserve=all --recursive --update /lib/udev/devices/* /dev 2>/dev/null
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
echo "Usage: $0 {start|stop|restart|reload|force-stop|force-restart|force-reload}"
|
echo "Usage: $BASENAME start|stop|restart|reload|force-stop|force-restart|force-reload"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
|
exit 0
|
||||||
|
|||||||
+50
-18
@@ -1,6 +1,6 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
#
|
#
|
||||||
# /etc/rc.d/rc.wsdd2
|
# script: rc.wsdd2
|
||||||
#
|
#
|
||||||
# start/stop/restart the wsdd2 daemon.
|
# start/stop/restart the wsdd2 daemon.
|
||||||
#
|
#
|
||||||
@@ -8,40 +8,72 @@
|
|||||||
# file is executable, and add the following entry to rc.local
|
# file is executable, and add the following entry to rc.local
|
||||||
# after the samba test (uncommented)
|
# after the samba test (uncommented)
|
||||||
|
|
||||||
# if [ -x /etc/rc.d/rc.wsdd2 ]; then
|
# LimeTech - modified for Unraid OS
|
||||||
|
# Bergware - modified for Unraid OS, October 2023
|
||||||
|
|
||||||
|
DAEMON="WSDD daemon"
|
||||||
|
|
||||||
|
# run & log functions
|
||||||
|
. /etc/rc.d/rc.runlog
|
||||||
|
|
||||||
|
# if [[ -x /etc/rc.d/rc.wsdd2 ]]; then
|
||||||
# /etc/rc.d/rc.wsdd2 start
|
# /etc/rc.d/rc.wsdd2 start
|
||||||
# fi
|
# fi
|
||||||
|
|
||||||
# you may also add the following entry to rc.local_shutdown
|
# you may also add the following entry to rc.local_shutdown
|
||||||
# (uncommented)
|
# (uncommented)
|
||||||
|
|
||||||
# if [ -x /etc/rc.d/rc.wsdd2 ]; then
|
# if [[ -x /etc/rc.d/rc.wsdd2 ]]; then
|
||||||
# /etc/rc.d/rc.wsdd2 stop
|
# /etc/rc.d/rc.wsdd2 stop
|
||||||
# fi
|
# fi
|
||||||
|
|
||||||
wsdd2_start() {
|
wsdd2_running(){
|
||||||
if [ -r /etc/samba/smb.conf -a -x /etc/rc.d/rc.samba -a -x /usr/sbin/wsdd2 ]; then
|
ps axc | grep -q ' wsdd2'
|
||||||
echo "Starting wsdd2: /usr/bin/wsdd2 -d"
|
|
||||||
/usr/sbin/wsdd2 -d
|
|
||||||
elif [ ! -r /etc/samba/smb.conf ]; then
|
|
||||||
echo "ERROR: samba not configured, so wsdd2 has no service to advertise"
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
wsdd2_stop() {
|
|
||||||
#check something is running before trying to kill it.
|
wsdd2_start(){
|
||||||
if [ "x`ps -A|grep ' wsdd2'|wc -l`" != "x0" ]; then
|
log "Starting $DAEMON..."
|
||||||
|
local REPLY
|
||||||
|
if [[ -r /etc/samba/smb.conf && -x /etc/rc.d/rc.samba && -x /usr/sbin/wsdd2 ]]; then
|
||||||
|
if wsdd2_running; then
|
||||||
|
REPLY="Already started"
|
||||||
|
else
|
||||||
|
run /usr/sbin/wsdd2 -d
|
||||||
|
if wsdd2_running; then REPLY="Started"; else REPLY="Failed"; fi
|
||||||
|
fi
|
||||||
|
elif [[ ! -r /etc/samba/smb.conf ]]; then
|
||||||
|
log "ERROR: samba not configured, $DAEMON has no service to advertise"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
REPLY="Not started"
|
||||||
|
fi
|
||||||
|
log "$DAEMON... $REPLY."
|
||||||
|
}
|
||||||
|
|
||||||
|
wsdd2_stop(){
|
||||||
|
log "Stopping $DAEMON..."
|
||||||
|
local REPLY
|
||||||
|
# check something is running before trying to kill it.
|
||||||
|
if ! wsdd2_running; then
|
||||||
|
REPLY="Already stopped"
|
||||||
|
else
|
||||||
killall wsdd2
|
killall wsdd2
|
||||||
|
if ! wsdd2_running; then REPLY="Stopped"; else REPLY="Failed"; fi
|
||||||
fi
|
fi
|
||||||
|
log "$DAEMON... $REPLY."
|
||||||
}
|
}
|
||||||
wsdd2_restart() {
|
|
||||||
|
wsdd2_restart(){
|
||||||
|
log "Restarting $DAEMON..."
|
||||||
wsdd2_stop
|
wsdd2_stop
|
||||||
sleep 1
|
sleep 1
|
||||||
wsdd2_start
|
wsdd2_start
|
||||||
}
|
}
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
'start')
|
'start')
|
||||||
#we don't want to run this more than once,
|
# we don't want to run this more than once,
|
||||||
#so kill off any instance already running
|
# so kill off any instance already running
|
||||||
wsdd2_stop
|
wsdd2_stop
|
||||||
wsdd2_start
|
wsdd2_start
|
||||||
;;
|
;;
|
||||||
@@ -55,4 +87,4 @@ case "$1" in
|
|||||||
# default is start
|
# default is start
|
||||||
wsdd2_start
|
wsdd2_start
|
||||||
esac
|
esac
|
||||||
|
exit 0
|
||||||
|
|||||||
@@ -225,7 +225,7 @@ done
|
|||||||
# atomically update file
|
# atomically update file
|
||||||
mv $INI ${INI%.*}
|
mv $INI ${INI%.*}
|
||||||
|
|
||||||
log "hook services: interface=${interface:-$1}, reason=$reason, protocol=$protocol"
|
log "interface=${interface:-$1}, reason=$reason, protocol=$protocol"
|
||||||
# delayed execution
|
# delayed execution
|
||||||
/usr/local/emhttp/webGui/scripts/update_services 30
|
/usr/local/emhttp/webGui/scripts/update_services 30
|
||||||
|
|
||||||
|
|||||||
+41
-32
@@ -1,55 +1,64 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
#
|
||||||
# Start emhttpd. The nginx components are started during emhttpd initialization.
|
# script: emhttp
|
||||||
|
#
|
||||||
|
# Start emhttpd. The nginx components are started during emhttpd initialization.
|
||||||
|
#
|
||||||
# Usage:
|
# Usage:
|
||||||
# emhttp [OPER]
|
# emhttp [OPER]
|
||||||
|
#
|
||||||
# OPER is start or stop. Default is start.
|
# OPER is start or stop. Default is start.
|
||||||
|
#
|
||||||
# The protocol schemes and ports recognized by nginx are defined by these variables
|
# The protocol schemes and ports recognized by nginx are defined by these variables
|
||||||
# in the file /boot/config/ident.cfg:
|
# in the file /boot/config/ident.cfg:
|
||||||
# USE_SSL="no"|"yes"|"only"|"auto" default: "auto"
|
# USE_SSL="no"|"yes"|"only"|"auto" default: "auto"
|
||||||
# PORT=<http listening port number> default: 80
|
# PORT=<http listening port number> default: 80
|
||||||
# PORTSSL=<https listening port number> default: 443
|
# PORTSSL=<https listening port number> default: 443
|
||||||
# Refer to /etc/rc.d/rc.nginx
|
# Refer to /etc/rc.d/rc.nginx
|
||||||
|
#
|
||||||
# Backward-compatibility Usage:
|
# Backward-compatibility Usage:
|
||||||
# emhttp [-r] [-p port[,sslport]] [OPER]
|
# emhttp [-r] [-p port[,sslport]] [OPER]
|
||||||
|
#
|
||||||
|
# The -r and -p options are deprecated and no longer function. They are simply accepted and dropped.
|
||||||
|
#
|
||||||
|
# LimeTech - modified for Unraid OS
|
||||||
|
# Bergware - modified for Unraid OS, October 2023
|
||||||
|
|
||||||
# The -r and -p options are deprecated and no longer function. They are simply
|
# run & log functions
|
||||||
# accepted and dropped.
|
. /etc/rc.d/rc.runlog
|
||||||
|
|
||||||
while getopts ":p:r" opt; do
|
while getopts ":p:r" OPT; do
|
||||||
case $opt in
|
case $OPT in
|
||||||
p ) ;;
|
p) ;;
|
||||||
r ) ;;
|
r) ;;
|
||||||
* ) echo "unknown option $opt"
|
*) echo "unknown option $OPT"
|
||||||
exit 1
|
exit 1
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
shift $((OPTIND-1))
|
shift $((OPTIND-1))
|
||||||
|
|
||||||
[[ "$1" ]] && OPER=$1 || OPER="start"
|
case "${1:-start}" in
|
||||||
|
'start')
|
||||||
if [[ "$OPER" = "stop" ]]; then
|
log "Starting emhttpd..."
|
||||||
|
# verify emhttpd not already started
|
||||||
|
if [[ -n $(pgrep emhttpd) ]]; then
|
||||||
|
log "emhttpd already started."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
# start emhttpd
|
||||||
|
/usr/local/bin/emhttpd
|
||||||
|
;;
|
||||||
|
'stop')
|
||||||
|
log "Stopping web services..."
|
||||||
/etc/rc.d/rc.nginx stop
|
/etc/rc.d/rc.nginx stop
|
||||||
/etc/rc.d/rc.php-fpm stop
|
/etc/rc.d/rc.php-fpm stop
|
||||||
echo "Stopping emhttpd"
|
log "Stopping emhttpd..."
|
||||||
pkill emhttpd
|
pkill emhttpd
|
||||||
rmmod md-mod
|
rmmod md-mod
|
||||||
exit
|
log "All services... Stopped."
|
||||||
elif [[ "$OPER" != "start" ]]; then
|
;;
|
||||||
echo "unknown operation: $1"
|
*)
|
||||||
|
echo "Unknown operation: $1"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
esac
|
||||||
|
exit 0
|
||||||
# verify emhttpd not already started
|
|
||||||
if [[ ! -z $(pgrep emhttpd) ]]; then
|
|
||||||
echo "emhttpd is already started"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# start emhttpd
|
|
||||||
logger "Starting emhttpd"
|
|
||||||
/usr/local/bin/emhttpd
|
|
||||||
|
|||||||
+1
-4
@@ -5,9 +5,6 @@ disk_load=/var/local/emhttp/diskload.ini # disk load statistics
|
|||||||
nginx=/var/run/nginx.socket # nginx local access
|
nginx=/var/run/nginx.socket # nginx local access
|
||||||
status=http://localhost/pub/session?buffer_length=1 # nchan information about GUI subscribers
|
status=http://localhost/pub/session?buffer_length=1 # nchan information about GUI subscribers
|
||||||
|
|
||||||
# run & log functions
|
|
||||||
. /etc/rc.d/rc.runlog
|
|
||||||
|
|
||||||
while :; do
|
while :; do
|
||||||
# only act when GUI registered nchan processes are running
|
# only act when GUI registered nchan processes are running
|
||||||
if [[ -e $nchan_pid ]]; then
|
if [[ -e $nchan_pid ]]; then
|
||||||
@@ -18,7 +15,7 @@ while :; do
|
|||||||
# steady state?
|
# steady state?
|
||||||
subs=$(curl --unix-socket $nginx $status 2>/dev/null|grep -Pom1 'subscribers: \K\d+')
|
subs=$(curl --unix-socket $nginx $status 2>/dev/null|grep -Pom1 'subscribers: \K\d+')
|
||||||
if [[ -z $subs || $subs -eq 0 ]]; then
|
if [[ -z $subs || $subs -eq 0 ]]; then
|
||||||
log "Stop running nchan processes"
|
logger -t monitor_nchan -- "Stop running nchan processes"
|
||||||
# kill GUI registered nchan processes
|
# kill GUI registered nchan processes
|
||||||
while IFS=$'\n' read -r running; do
|
while IFS=$'\n' read -r running; do
|
||||||
pkill -f $docroot/${running/:stop/}
|
pkill -f $docroot/${running/:stop/}
|
||||||
|
|||||||
Reference in New Issue
Block a user