Merge pull request #1439 from bergware/master

Miscellaneous updates and fixes
This commit is contained in:
tom mortensen
2023-10-06 08:58:32 -07:00
committed by GitHub
55 changed files with 1588 additions and 1385 deletions

View File

@@ -314,7 +314,7 @@ if ($method == 'install') {
copy($xml_file, $lang_file);
symlink($lang_file, $link_file);
write("language: $lang language pack installed\n");
logger("language: $lang language pack installed");
logger("$lang language pack installed");
// run hook scripts for post processing
post_hooks();
done(0);
@@ -396,7 +396,7 @@ if ($method == 'update') {
copy($xml_file, $lang_file);
symlink($lang_file, $link_file);
write("language: $lang language pack updated\n");
logger("language: $lang language pack updated");
logger("$lang language pack updated");
// run hook scripts for post processing
post_hooks();
done(0);
@@ -423,7 +423,7 @@ if ($method == 'remove') {
done(1);
}
write("language: $lang language pack removed\n");
logger("language: $lang language pack removed");
logger("$lang language pack removed");
// run hook scripts for post processing
post_hooks();
done(0);

View File

@@ -382,12 +382,12 @@ function plugin($method, $plugin_file, &$error) {
// If file already exists, check the SHA256/MD5 (if supplied)
if (file_exists($name)) {
if ($file->SHA256) {
logger("plugin: checking: $name - SHA256");
logger("checking: $name - SHA256");
if (hash_file('sha256', $name) != $file->SHA256) {
unlink($name);
}
} elseif ($file->MD5) {
logger("plugin: checking: $name - MD5");
logger("checking: $name - MD5");
if (md5_file($name) != $file->MD5) {
unlink($name);
}
@@ -396,12 +396,12 @@ function plugin($method, $plugin_file, &$error) {
// If file already exists, do not overwrite
//
if (file_exists($name)) {
logger("plugin: skipping: $name already exists");
logger("skipping: $name already exists");
} elseif ($file->LOCAL) {
// Create the file
//
// 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)) {
$error = "unable to copy LOCAL file: $name";
@unlink($name);
@@ -409,10 +409,10 @@ function plugin($method, $plugin_file, &$error) {
}
} elseif ($file->INLINE) {
// 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;
if ($file->attributes()->Type == 'base64') {
logger("plugin: decoding: $name as base64");
logger("decoding: $name as base64");
$contents = base64_decode($contents);
if ($contents === false) {
$error = "unable to decode inline base64: $name";
@@ -426,20 +426,20 @@ function plugin($method, $plugin_file, &$error) {
}
} elseif ($file->URL) {
// 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) ) {
@unlink($name);
return false;
}
if ($file->SHA256) {
logger("plugin: checking: $name - SHA256");
logger("checking: $name - SHA256");
if (hash_file('sha256', $name) != $file->SHA256) {
$error = "bad file SHA256: $name";
unlink($name);
return false;
}
} elseif ($file->MD5) {
logger("plugin: checking: $name - MD5");
logger("checking: $name - MD5");
if (md5_file($name) != $file->MD5) {
$error = "bad file MD5: $name";
unlink($name);
@@ -452,7 +452,7 @@ function plugin($method, $plugin_file, &$error) {
if ($file->attributes()->Mode) {
// if file has 'Mode' attribute, apply it
$mode = $file->attributes()->Mode;
logger("plugin: setting: $name - mode to $mode");
logger("setting: $name - mode to $mode");
if (!chmod($name, octdec($mode))) {
$error = "chmod failure: $name";
return false;
@@ -464,13 +464,13 @@ function plugin($method, $plugin_file, &$error) {
if ($file->attributes()->Run) {
$command = $file->attributes()->Run;
if ($name) {
logger(escapeshellarg("plugin: running: $command $name"));
logger("running: $command $name");
$retval = run("$command $name");
} elseif ($file->LOCAL) {
logger(escapeshellarg("plugin: running: $command $file->LOCAL"));
logger("running: $command $file->LOCAL");
$retval = run("$command $file->LOCAL");
} elseif ($file->INLINE) {
logger("plugin: running: 'anonymous'");
logger("running: 'anonymous'");
$name = '/tmp/inline.sh';
file_put_contents($name, $file->INLINE);
$retval = run("$command $name");
@@ -718,7 +718,7 @@ if ($method == 'install') {
if ($target != $plugin_file) copy($plugin_file, $target);
symlink($target, $symlink);
write("plugin: $plugin installed\n");
logger("plugin: $plugin installed");
logger("$plugin installed");
} else {
write("script: $plugin executed\n");
logger("script: $plugin executed");
@@ -835,7 +835,7 @@ if ($method == 'update') {
copy($plugin_file, $target);
symlink($target, $symlink);
write("plugin: $plugin updated\n");
logger("plugin: $plugin updated");
logger("$plugin updated");
// run hook scripts for post processing
post_hooks();
done(0);
@@ -867,7 +867,7 @@ if ($method == 'remove') {
// remove the plugin file
move($installed_plugin_file, "$boot-removed");
write("plugin: $plugin removed\n");
logger("plugin: $plugin removed");
logger("$plugin removed");
exec("/usr/local/sbin/update_cron");
// run hook scripts for post processing
post_hooks();

View File

@@ -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.libvirt status >/dev/null",$dummy,$libvirtd);
$domain_cfg = parse_ini_file("/boot/config/domain.cfg");
$dockerd = $dockerd==0;
$libvirtd = $libvirtd==0;
$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];
function selectsnapshot(uuid, name ,snaps, opt, getlist){
var root = <?= '"'.$domain_cfg["MEDIADIR"].'"';?>;
var match= ".iso";
var box = $("#dialogWindow2");
box.html($("#templatesnapshot"+opt).html());
var height = 200;
const Capopt = opt.charAt(0).toUpperCase() + opt.slice(1) ;
var optiontext = Capopt + " Snapshot" ;
box.find('#VMName').html(name) ;
box.find('#targetsnap').val(snaps) ;
box.find('#targetsnapl').html(snaps) ;
const Capopt = opt.charAt(0).toUpperCase() + opt.slice(1);
var optiontext = Capopt + " Snapshot";
box.find('#VMName').html(name);
box.find('#targetsnap').val(snaps);
box.find('#targetsnapl').html(snaps);
if (getlist) {
var only = 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');
var only = (opt == "remove") ? 0 : 1;
$.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({
title: "_("+optiontext+ ")_",
resizable: false,
@@ -848,34 +840,29 @@ function selectsnapshot(uuid, name ,snaps, opt, getlist){
modal: true,
show: {effect:'fade', duration:250},
hide: {effect:'fade', duration:250},
buttons: {
"_(Proceed)_": function(){
var target = box.find('#targetsnap');
if (target.length) {
target = target.val();
if (!target ) {errorTarget(); return;}
if (!target) {errorTarget(); return;}
} else target = '';
var remove = 'yes'
var keep = 'yes'
var removemeta = 'yes'
var free = 'yes'
var desc = ''
var remove = 'yes';
var removemeta = 'yes';
var keep = 'yes';
var free = 'yes';
var desc = '';
box.find('#targetsnap').prop('disabled',true);
if (opt == "revert") {
const x = box.find('#targetsnaprmv').prop('checked') ;
if (x) remove = 'yes' ; else remove = 'no' ;
x = box.find('#targetsnaprmvmeta').prop('checked') ;
if (x) removemeta = 'yes' ; else removemeta = 'no' ;
x = box.find('#targetsnapkeep').prop('checked') ;
if (x) keep = 'yes' ; else keep = 'no' ;
remove = box.find('#targetsnaprmv').prop('checked') ? 'yes' : 'no';
removemeta = box.find('#targetsnaprmvmeta').prop('checked') ? 'yes' : 'no';
keep = box.find('#targetsnapkeep').prop('checked') ? 'yes' : 'no';
}
if (opt == "create") {
const x = box.find('#targetsnapfspc').prop('checked') ;
if (x) free = 'yes' ; else free = 'no' ;
var desc = box.find("#targetsnapdesc").prop('value') ;
if (opt == "create") {
free = box.find('#targetsnapfspc').prop('checked') ? 'yes' : 'no';
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');
},
"_(Cancel)_": function(){
@@ -1583,7 +1570,6 @@ $(function() {
$('.ui-button-text').css({'padding':'0px 5px'});
}
function VMClone(uuid, name){
//var root = <?= '"'.$domain_cfg["MEDIADIR"].'"';?>;
var match= ".iso";
var box = $("#dialogWindow");
@@ -1603,24 +1589,19 @@ function VMClone(uuid, name){
show: {effect:'fade', duration:250},
hide: {effect:'fade', duration:250},
buttons: {
"_(Clone)_" : function(){
"_(Clone)_": function(){
var target = box.find('#target');
if (target.length) {
target = target.val();
//if (!target ) {errorTarget(); return;}
} else target = '';
var clone = box.find("#target").prop('value') ;
x = box.find('#Start').prop('checked') ;
if (x) start = 'yes' ; else start = 'no' ;
x = box.find('#Edit').prop('checked') ;
if (x) edit = 'yes' ; else edit = 'no' ;
x = box.find('#Overwrite').prop('checked') ;
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") ;
var clone = box.find("#target").prop('value');
var start = box.find('#Start').prop('checked') ? 'yes' : 'no';
var edit = box.find('#Edit').prop('checked') ? 'yes' : 'no';
var overwrite = box.find('#Overwrite').prop('checked') ? 'yes' : 'no';
var free = box.find('#Free').prop('checked') ? 'yes' : '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}));
openVMAction((scripturl),"VM Clone", "dynamix.vm.manager", "loadlist");
box.dialog('close');
},
"_(Cancel)_": function(){

View File

@@ -14,59 +14,20 @@ Tag="server"
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*/
global $var ;
$theme = $display['theme'] ;
?>
<style>
table.t1{margin-top:0; border-collapse: collapse; border-spacing: 0;}
table tr td{padding:0 0 3px 0;margin:0}
table tr td.thin{line-height:8px;height:8px}
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+td{width:auto ; 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+td{text-align:left;}
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;?>
table.t1 tr td{padding:0 0 3px 0;margin:0}
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+td{width:1%;white-space:nowrap}
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+td{text-align:left}
.t1.tablesorter .filtered{display:none}
</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">
function showDrivers(options, init = false) {
@@ -75,36 +36,32 @@ function showDrivers(options, init = false) {
$('#driversearch').prop('disabled', true);
$('#select').prop('disabled', true);
$('#rebuild').prop('disabled', true);
$.post('/webGui/include/SysDrivers.php',{table:'t1load',option:"all"},function(data){
clearTimeout(timers.refresh);
$("#t1").trigger("destroy");
$("#t1").trigger("destroy");
$('#t1').html(data.html);
$('#t1').tablesorter({
sortList:[[0,0]],
sortAppend:[[0,0]],
widgets: ['stickyHeaders','filter', 'zebra'],
widgetOptions: {
// on black and white, offset is height of #menu
// on azure and gray, offset is height of #header
stickyHeaders_offset: ( $('#menu').height() < 50 ) ? $('#menu').height() : $('#header').height(),
filter_columnFilters: false,
zebra : [ "normal-row", "alt-row" ]
}
sortList:[[0,0]],
sortAppend:[[0,0]],
widgets: ['stickyHeaders','filter', 'zebra'],
widgetOptions: {
// on black and white, offset is height of #menu
// on azure and gray, offset is height of #header
stickyHeaders_offset: ( $('#menu').height() < 50 ) ? $('#menu').height() : $('#header').height(),
filter_columnFilters: false,
zebra : [ "normal-row", "alt-row" ]
}
});
$('div.spinner.fixed').hide('slow');
$('#driversearch').prop('disabled', false);
$('#select').prop('disabled', false);
$('#rebuild').prop('disabled', data.init);
},"json");
} else {
filter = [];
filterDrivers() ;
filterDrivers() ;
}
}
}
function filterDrivers() {
var totalColumns = $('#t1')[0].config.columns;
@@ -124,7 +81,7 @@ function showDriversupdate() {
$('#rebuild').prop('disabled', false);
showDrivers("all",true) ;
$('div.spinner.fixed').hide('slow');
}) ;
});
}
function textedit(module) {
@@ -132,11 +89,9 @@ function textedit(module) {
$('#text'+module).prop('disabled', false);
$('#save'+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;});
}
@@ -146,7 +101,7 @@ function textsave(module,remove = false) {
$('#save'+module).attr('hidden', true);
var x = (remove) ? "" : document.getElementById("text" + module).value;
$.post('/webGui/include/SysDrivers.php',{table:'update',module:module,conf:x},function(data){
if(data) {
if (data) {
formHasUnsavedChanges=false;
$('#text'+module).val(data.modprobe) ;
$('#status'+module).html(data.state) ;
@@ -159,24 +114,22 @@ function textsave(module,remove = false) {
if (data.supportpage == 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>" ;
}
}
}
}
}
$('#t1').trigger("updateCell",[document.getElementById('text'+module), false, null]);
$('#t1').trigger("updateCell",[document.getElementById('status'+module), false, null]);
var message = "_(System Drivers)_: _(A reboot is required to apply changes)_";
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>");
showDrivers("all",true) ;
</script>
:sysdrivers_intro_help:
<form autocomplete="off" onsubmit="return false;"><span><input class="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>
<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>
<input type="button" value="_(Done)_" onclick="done()"><input type="button" id="rebuild" value="_(Rebuild Modules)_" onclick="showDriversupdate()">

View File

@@ -139,7 +139,7 @@ $dnsserver = _var($$ethX,'DNS_SERVER1');
$link = iflink($ethX);
$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";
$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";
@@ -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";
$postUpZ6 = "ip6tables -A WIREGUARD_DROP_<WG> -s <source> -j ACCEPT;ip6tables -A WIREGUARD_DROP_<WG> -j RETURN";
$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";
$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";

View File

@@ -6,7 +6,7 @@ while IFS='\n' read -r net; do
[[ -n $net4 ]] && nets+=("$net4 = $net;")
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%/*}
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;")

View File

@@ -4,7 +4,7 @@ lock=/tmp/atlock.tmp
# run & log functions
. /etc/rc.d/rc.runlog
log "${1:-1}s"
log "delay = ${1:-1}s"
rm -f $lock
echo "sleep ${1:-1};/usr/local/emhttp/webGui/scripts/reload_services $lock"|at -M now 2>/dev/null
exit 0

View File

@@ -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 tfoot td{padding-top:10px;font-size:1.1rem}
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.unused{display:block}
span.select ul li.nosort{font-weight:bold}

View File

@@ -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+th{width:14%}
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.unused{display:block}
span.select ul li.nosort{font-weight:bold}

View File

@@ -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 tfoot td{padding-top:10px;font-size:1.1rem}
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.unused{display:block}
span.select ul li.nosort{font-weight:bold}

View File

@@ -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+th{width:14%}
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.unused{display:block}
span.select ul li.nosort{font-weight:bold}

View File

@@ -1,13 +1,16 @@
#!/bin/bash
#
# rc.4 This file is executed by init(8) when the system is being
# initialized for run level 4 (XDM)
# script: rc.4
#
# 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>
# At least 47% rewritten by: Patrick J. Volkerding <volkerdi@slackware.com>
# Version: 2.00 02/17/93
#
# 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...
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
# the options below, create your own startup script /etc/rc.d/rc.4.local
# 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
fi
# 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
# to use it by default:
if [ -x /usr/bin/gdm ]; then
if [[ -x /usr/bin/gdm ]]; then
exec /usr/bin/gdm
fi
# Someone thought that gdm looked prettier in /usr/sbin,
# so look there, too:
if [ -x /usr/sbin/gdm ]; then
if [[ -x /usr/sbin/gdm ]]; then
exec /usr/sbin/gdm
fi
# 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
elif [ -x /usr/bin/kdm ]; then
elif [[ -x /usr/bin/kdm ]]; then
exec /usr/bin/kdm -nodaemon
fi
# Look for SDDM as well:
if [ -x /usr/bin/sddm ]; then
if [[ -x /usr/bin/sddm ]]; then
exec /usr/bin/sddm
fi
# 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
elif [ -x /usr/X11R6/bin/xdm ]; then
elif [[ -x /usr/X11R6/bin/xdm ]]; then
exec /usr/X11R6/bin/xdm -nodaemon
fi

View File

@@ -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:
if [ -x /usr/bin/slim ]; then
# Try to use SLiM login manager
if [[ -x /usr/bin/slim ]]; then
exec /usr/bin/slim
fi

View File

@@ -1,41 +1,45 @@
#!/bin/bash
#
# rc.6 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.
# script: rc.6
#
# 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>
# Modified by: Patrick J. Volkerding, <volkerdi@slackware.com>
# Version: 2.47 Sat Jan 13 13:37:26 PST 2001
#
# 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.
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 [ -x /etc/rc.d/rc.sysvinit ]; then
if [[ -x /etc/rc.d/rc.sysvinit ]]; then
/etc/rc.d/rc.sysvinit
fi
# Set linefeed mode to avoid staircase effect.
/bin/stty onlcr
echo "Running shutdown script $0:"
log "Running shutdown script $0:"
# Find out how we were called.
case "$0" in
*0)
shutdown_command="halt"
;;
*6)
shutdown_command=reboot
;;
*)
echo "$0: call me as \"rc.0\" or \"rc.6\" please!"
exit 1
;;
*0)
SHUTDOWN_COMMAND="halt"
;;
*6)
SHUTDOWN_COMMAND="reboot"
;;
*)
/bin/echo "$0: call me as \"rc.0\" or \"rc.6\" please!"
exit 1
esac
# 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.
# 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
# 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"
fi
if [ /etc/adjtime -nt /etc/hardwareclock ]; then
if grep -q "^LOCAL" /etc/adjtime ; then
echo "Saving system time to the hardware clock (localtime)."
if [[ /etc/adjtime -nt /etc/hardwareclock ]]; then
if /bin/grep -q "^LOCAL" /etc/adjtime; then
log "Saving system time to the hardware clock (localtime)."
else
echo "Saving system time to the hardware clock (UTC)."
log "Saving system time to the hardware clock (UTC)."
fi
/sbin/hwclock $CLOCK_OPT --systohc
elif grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then
echo "Saving system time to the hardware clock (UTC)."
if [ ! -r /etc/adjtime ]; then
echo "Creating system time correction file /etc/adjtime."
run /sbin/hwclock $CLOCK_OPT --systohc
elif /bin/grep -q "^UTC" /etc/hardwareclock 2>/dev/null; then
log "Saving system time to the hardware clock (UTC)."
if [[ ! -r /etc/adjtime ]]; then
log "Creating system time correction file /etc/adjtime."
fi
/sbin/hwclock $CLOCK_OPT --utc --systohc
run /sbin/hwclock $CLOCK_OPT --utc --systohc
else
echo "Saving system time to the hardware clock (localtime)."
if [ ! -r /etc/adjtime ]; then
echo "Creating system time correction file /etc/adjtime."
log "Saving system time to the hardware clock (localtime)."
if [[ ! -r /etc/adjtime ]]; then
log "Creating system time correction file /etc/adjtime."
fi
/sbin/hwclock $CLOCK_OPT --localtime --systohc
run /sbin/hwclock $CLOCK_OPT --localtime --systohc
fi
fi
# 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
fi
# Stop mcelog
if [ -x /etc/rc.d/rc.mcelog ]; then
if [[ -x /etc/rc.d/rc.mcelog ]]; then
/etc/rc.d/rc.mcelog stop
fi
# 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
fi
# 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.avahidnsconfd stop
fi
# 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
fi
# 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
fi
# 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
fi
# 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
fi
# 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
fi
# 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
fi
# 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
fi
# Kill any processes (typically gam) that would otherwise prevent
# unmounting NFS volumes:
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
echo "Killing processes holding NFS mount $dir open..."
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
log "Killing processes holding NFS mount $DIR open..."
# 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
done
# If fuser was run, let it have some delay:
if [ ! -z "$FUSER_DELAY" ]; then
sleep $FUSER_DELAY
if [[ -n $FUSER_DELAY ]]; then
/bin/sleep $FUSER_DELAY
fi
# Unmount any NFS, SMB, or CIFS filesystems:
echo "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"
log "Unmounting remote filesystems:"
/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:
hash -r
# 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
fi
# Bring down the networking system, but first make sure that this
# 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 [ -x /etc/rc.d/rc.inet1 ]; then
if ! /bin/mount | /bin/grep -q -e 'on / type nfs' -e 'on / type nfs4'; then
if [[ -x /etc/rc.d/rc.inet1 ]]; then
/etc/rc.d/rc.inet1 stop
fi
fi
# 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:
if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then
/sbin/dhcpcd -k 1> /dev/null 2> /dev/null
if /bin/ls /etc/dhcpc/*.pid &>/dev/null; then
/sbin/dhcpcd -k &>/dev/null
# A little time for /etc/resolv.conf and/or other files to
# restore themselves.
sleep 2
/bin/sleep 2
fi
# 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
fi
# 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
fi
# 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
fi
# Kill all remaining processes.
OMITPIDS="$(for p in $(pgrep mdmon); do echo -o $p; done)" # Don't kill mdmon
if [ ! "$1" = "fast" ]; then
echo "Sending all processes the SIGTERM signal."
/sbin/killall5 -15 $OMITPIDS
OMITPIDS="$(for P in $(/usr/bin/pgrep mdmon); do /bin/echo -o $P; done)" # Don't kill mdmon
if [[ $1 != fast ]]; then
log "Sending all processes the SIGTERM signal."
run /sbin/killall5 -15 $OMITPIDS
/bin/sleep 5
echo "Sending all processes the SIGKILL signal."
/sbin/killall5 -9 $OMITPIDS
log "Sending all processes the SIGKILL signal."
run /sbin/killall5 -9 $OMITPIDS
fi
# limetech - let's keep this on the USB flash
# Carry a random seed between reboots.
/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.
$shutdown_command -w
/sbin/$SHUTDOWN_COMMAND -w
# Turn off swap:
if [ ! "$(cat /proc/swaps | wc -l)" = "1" ]; then
echo "Turning off swap."
/sbin/swapoff -a
/bin/sync
if [[ ! $(/bin/cat /proc/swaps | /bin/wc -l) == 1 ]]; then
log "Turning off swap."
run /sbin/swapoff -a
run /bin/sync
fi
# Unmount local file systems:
# 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_PATHS=("/" "/lib" "/usr" "/boot")
MOUNTS=$(cat /proc/mounts)
while IFS= read -r line; do
mount_type=$(echo "$line" | awk '{print $3}')
mount_path=$(echo "$line" | awk '{print $2}')
[[ " ${EXCLUDE_TYPES[@]} " =~ " ${mount_type} " ]] && continue
[[ " ${EXCLUDE_PATHS[@]} " =~ " ${mount_path} " ]] && continue
/sbin/umount -v "$mount_path"
done <<< "$MOUNTS"
while IFS= read -r LINE; do
MOUNT_TYPE=$(/bin/echo "$LINE" | awk '{print $3}')
MOUNT_PATH=$(/bin/echo "$LINE" | awk '{print $2}')
[[ " ${EXCLUDE_TYPES[@]} " =~ " $MOUNT_TYPE " ]] && continue
[[ " ${EXCLUDE_PATHS[@]} " =~ " $MOUNT_PATH " ]] && continue
run /bin/umount -v "$MOUNT_PATH"
done <<< "$(/bin/cat /proc/mounts)"
# limetech - shut down the unraid driver if started
if /bin/grep -qs 'mdState=STARTED' /proc/mdstat ; then
echo "Stopping md/unraid driver:"
echo "stop" > /proc/mdcmd
if /bin/grep -qs 'mdState=STOPPED' /proc/mdstat ; then
echo "Clean shutdown"
if /bin/grep -qs 'mdState=STARTED' /proc/mdstat; then
log "Stopping md/unraid driver:"
/bin/echo "stop" >/proc/mdcmd
if /bin/grep -qs 'mdState=STOPPED' /proc/mdstat; then
log "Clean shutdown"
/bin/rm -f /boot/config/forcesync
else
echo "Unclean shutdown - Cannot stop md/unraid driver"
log "Unclean shutdown - Cannot stop md/unraid driver"
fi
fi
@@ -240,11 +243,11 @@ fi
/bin/sync
# now remount /boot read-only
echo "Remounting /boot read-only:"
/sbin/mount -v -o remount,ro /boot
log "Remounting /boot read-only:"
run /bin/mount -v -o remount,ro /boot
echo "Remounting root filesystem read-only:"
/bin/mount -v -n -o remount,ro /
log "Remounting root filesystem read-only:"
run /bin/mount -v -n -o remount,ro /
# sleep 3 fixes problems with some hard drives that don't
# 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:
wait
if [ -x /sbin/genpowerd ]; then
if [[ -x /sbin/genpowerd ]]; then
# 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:
/sbin/genpowerd -k
if [ ! $? = 0 ]; then
echo
echo "There was an error signaling the UPS."
echo "Perhaps you need to edit /etc/genpowerd.conf to configure"
echo "the serial line and UPS type."
run /sbin/genpowerd -k
if [[ $? != 0 ]]; then
log "There was an error signaling the UPS."
log "Perhaps you need to edit /etc/genpowerd.conf to configure"
log "the serial line and UPS type."
# Wasting 15 seconds of precious power:
/bin/sleep 15
fi
@@ -270,9 +272,10 @@ if [ -x /sbin/genpowerd ]; then
fi
# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.
if [ "$shutdown_command" = "reboot" ]; then
echo "Rebooting."
/sbin/reboot
if [[ $SHUTDOWN_COMMAND == reboot ]]; then
log "Rebooting."
run /sbin/reboot
else
/sbin/poweroff
log "Powering off."
run /sbin/poweroff
fi

View File

@@ -1,126 +1,118 @@
#!/bin/bash
#
# rc.K 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.
# script: rc.K
#
# 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>
# Modified by: Patrick J. Volkerding <volkerdi@slackware.com>
# Version: 3.1415 Sat Jan 13 13:37:26 PST 2001
#
# 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.
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.
if [ -x /etc/rc.d/rc.font ]; then
if [[ -x /etc/rc.d/rc.font ]]; then
/etc/rc.d/rc.font
fi
# 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
fi
# 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
fi
# Try to turn off quota:
if grep -q quota /etc/fstab ; then
if [ -x /sbin/quotaoff ]; then
echo "Turning off filesystem quotas."
/sbin/quotaoff -a
if [[ -x /sbin/quotaoff ]]; then
log "Turning off filesystem quotas."
run quotaoff -a
fi
fi
# Try to turn off accounting:
if [ -x /sbin/accton -a -r /var/log/pacct ]; then
/sbin/accton off
if [[ -x /sbin/accton && -r /var/log/pacct ]]; then
accton off
fi
# 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
fi
# 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
fi
# 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
fi
# 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
fi
# Kill any processes (typically gam) that would otherwise prevent
# unmounting NFS volumes:
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
echo "Killing processes holding NFS mount $dir open..."
for DIR in $(mount | grep -e 'type nfs ' -e 'type nfs4 ' | sed -e 's|.* on ||g' | cut -d ' ' -f 1); do
log "Killing processes holding NFS mount $DIR open..."
# 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
done
# If fuser was run, let it have some delay:
if [ ! -z "$FUSER_DELAY" ]; then
if [[ -n "$FUSER_DELAY" ]]; then
sleep $FUSER_DELAY
fi
# Unmount any NFS, SMB, or CIFS filesystems:
echo "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"
log "Unmounting remote filesystems:"
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:
if [ -x /etc/rc.d/rc.pcmcia ] ; then
if [[ -x /etc/rc.d/rc.pcmcia ]]; then
/etc/rc.d/rc.pcmcia stop
# The cards might need a little extra time here to deactivate:
sleep 5
fi
# 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
fi
# Kill all processes.
OMITPIDS="$(for p in $(pgrep mdmon); do echo -o $p; done)" # Don't kill mdmon
echo
echo "Sending all processes the SIGHUP signal."
killall5 -1 $OMITPIDS
echo -n "Waiting for processes to hang up"
for loop in 0 1 2 3 4 5 ; do
sleep 1
echo -n "."
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
OMITPIDS="$(for P in $(pgrep mdmon); do echo -o $P; done)" # Don't kill mdmon
log "Sending all processes the SIGHUP signal."
run killall5 -1 $OMITPIDS
log "Waiting for processes to hang up"
for LOOP in {1..5}; do sleep 1; done
log "Sending all processes the SIGTERM signal."
run killall5 -15 $OMITPIDS
log "Waiting for processes to terminate"
for LOOP in {1..5}; do sleep 1; done
echo "Sending all processes the SIGKILL signal."
killall5 -9 $OMITPIDS
echo -n "Waiting for processes to exit"
for loop in 0 1 2 3 4 5 ; do
sleep 1
echo -n "."
done
echo
run killall5 -9 $OMITPIDS
log "Waiting for processes to exit"
for LOOP in {1..5}; do sleep 1; done
# Now go to the single user level
echo "Going to single user mode..."
/sbin/telinit -t 1 1
log "Going to single user mode..."
run telinit -t 1 1

View File

@@ -1,39 +1,43 @@
#!/bin/bash
#
# rc.M 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.
# script: rc.M
#
# 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>
# Heavily modified by Patrick Volkerding <volkerdi@slackware.com>
# Version: 15.0 Fri Nov 12 18:51:28 UTC 2021
#
# 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.
echo "Going multiuser..."
log "Going multiuser..."
# Update all the shared library links:
if [ -x /sbin/ldconfig ]; then
echo "Updating shared library links: /sbin/ldconfig &"
/sbin/ldconfig &
if [[ -x /sbin/ldconfig ]]; then
log "Updating shared library links..."
run ldconfig &
fi
# Call the setterm init script to set screen blanking and power management
# defaults:
if [ -x /etc/rc.d/rc.setterm ]; then
if [[ -x /etc/rc.d/rc.setterm ]]; then
/etc/rc.d/rc.setterm
fi
# Set the hostname:
/bin/hostname $(cat /etc/HOSTNAME)
hostname $(cat /etc/HOSTNAME)
# Set the permissions on /var/log/dmesg according to whether the kernel
# permits non-root users to access kernel dmesg information:
if [ -r /proc/sys/kernel/dmesg_restrict ]; then
if [ $(cat /proc/sys/kernel/dmesg_restrict) = 1 ]; then
if [[ -r /proc/sys/kernel/dmesg_restrict ]]; then
if [[ $(cat /proc/sys/kernel/dmesg_restrict) == 1 ]]; then
touch /var/log/dmesg
chmod 640 /var/log/dmesg
fi
@@ -42,135 +46,131 @@ else
chmod 644 /var/log/dmesg
fi
# Save the contents of 'dmesg':
/bin/dmesg -s 65536 > /var/log/dmesg
dmesg -s 65536 > /var/log/dmesg
# 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
fi
# Update the X font indexes:
if [ -x /usr/bin/fc-cache ]; then
echo "Updating X font indexes: /usr/bin/fc-cache -f &"
/usr/bin/fc-cache -f &
if [[ -x /usr/bin/fc-cache ]]; then
log "Updating X font indexes..."
run /usr/bin/fc-cache -f &
fi
# 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
# 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 nohotplug /proc/cmdline ; then
if [ -x /etc/rc.d/rc.udev ]; then
if grep -wq sysfs /proc/mounts && grep -q devtmpfs /proc/filesystems; then
if ! grep -wq nohotplug /proc/cmdline; then
if [[ -x /etc/rc.d/rc.udev ]]; then
/etc/rc.d/rc.udev start
fi
fi
fi
# 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
fi
# 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
fi
# 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
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
fi
# Start Bluetooth:
if [ -x /etc/rc.d/rc.bluetooth ]; then
if [[ -x /etc/rc.d/rc.bluetooth ]]; then
/etc/rc.d/rc.bluetooth start
fi
# Start networking daemons:
if [ -x /etc/rc.d/rc.inet2 ]; then
if [[ -x /etc/rc.d/rc.inet2 ]]; then
/etc/rc.d/rc.inet2
fi
# 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:
if [ -x /etc/rc.d/rc.ntpd ]; then
if [[ -x /etc/rc.d/rc.ntpd ]]; then
/etc/rc.d/rc.ntpd start
fi
# 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.
chmod 755 / 2> /dev/null
chmod 755 / 2>/dev/null
chmod 1777 /tmp /var/tmp
# 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
fi
# 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
fi
# Update any existing icon cache files:
if find /usr/share/icons -maxdepth 2 2> /dev/null | grep -q icon-theme.cache ; then
for theme_dir in /usr/share/icons/* ; do
if [ -r ${theme_dir}/icon-theme.cache ]; then
echo "Updating icon-theme.cache in ${theme_dir}..."
/usr/bin/gtk-update-icon-cache -t -f ${theme_dir} 1> /dev/null 2> /dev/null &
if find /usr/share/icons -maxdepth 2 2>/dev/null | grep -q icon-theme.cache; then
for THEME_DIR in /usr/share/icons/*; do
if [[ -r $THEME_DIR/icon-theme.cache ]]; then
log "Updating icon-theme.cache in $THEME_DIR..."
run /usr/bin/gtk-update-icon-cache -t -f $THEME_DIR &
fi
done
# This would be a large file and probably shouldn't be there.
if [ -r /usr/share/icons/icon-theme.cache ]; then
echo "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 &
rm -f /usr/share/icons/icon-theme.cache
if [[ -r /usr/share/icons/icon-theme.cache ]]; then
log "Deleting icon-theme.cache in /usr/share/icons..."
#/usr/bin/gtk-update-icon-cache -t -f /usr/share/icons &>/dev/null &
run rm -f /usr/share/icons/icon-theme.cache
fi
fi
# Update mime database:
if [ -x /usr/bin/update-mime-database -a -d /usr/share/mime ]; then
echo "Updating MIME database: /usr/bin/update-mime-database /usr/share/mime &"
/usr/bin/update-mime-database /usr/share/mime 1> /dev/null 2> /dev/null &
if [[ -x /usr/bin/update-mime-database && -d /usr/share/mime ]]; then
log "Updating MIME database..."
run /usr/bin/update-mime-database /usr/share/mime &
fi
# These GTK+/pango files need to be kept up to date for
# proper input method, pixbuf loaders, and font support.
if [ -x /usr/bin/update-gtk-immodules ]; then
echo "Updating gtk.immodules:"
echo " /usr/bin/update-gtk-immodules &"
/usr/bin/update-gtk-immodules > /dev/null 2>&1 &
if [[ -x /usr/bin/update-gtk-immodules ]]; then
log "Updating gtk.immodules..."
run /usr/bin/update-gtk-immodules &
fi
if [ -x /usr/bin/update-gdk-pixbuf-loaders ]; then
echo "Updating gdk-pixbuf.loaders:"
echo " /usr/bin/update-gdk-pixbuf-loaders &"
HOME=/root /usr/bin/update-gdk-pixbuf-loaders > /dev/null 2>&1 &
if [[ -x /usr/bin/update-gdk-pixbuf-loaders ]]; then
log "Updating gdk-pixbuf.loaders..."
HOME=/root run /usr/bin/update-gdk-pixbuf-loaders &
fi
if [ -x /usr/bin/update-pango-querymodules ]; then
echo "Updating pango.modules:"
echo " /usr/bin/update-pango-querymodules &"
/usr/bin/update-pango-querymodules > /dev/null 2>&1 &
if [[ -x /usr/bin/update-pango-querymodules ]]; then
log "Updating pango.modules..."
run /usr/bin/update-pango-querymodules &
fi
if [ -x /usr/bin/glib-compile-schemas ]; then
echo "Compiling GSettings XML schema files:"
echo " /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 &
if [[ -x /usr/bin/glib-compile-schemas ]]; then
log "Compiling GSettings XML schema files..."
run /usr/bin/glib-compile-schemas /usr/share/glib-2.0/schemas &
fi
# 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
fi
# Start smartd, which monitors the status of S.M.A.R.T. compatible
# 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
fi
@@ -179,76 +179,76 @@ fi
# 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
# 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
/sbin/accton /var/log/pacct
accton /var/log/pacct
fi
# 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
fi
# 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
fi
# 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
fi
# 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
fi
# 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
fi
# Start the SASL authentication server. This provides SASL
# 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
fi
# Start OpenLDAP:
if [ -x /etc/rc.d/rc.openldap ]; then
if [[ -x /etc/rc.d/rc.openldap ]]; then
/etc/rc.d/rc.openldap start
fi
# Start WireGuard
if [ -x /etc/rc.d/rc.wireguard ]; then
if [[ -x /etc/rc.d/rc.wireguard ]]; then
/etc/rc.d/rc.wireguard start
fi
# 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.avahidnsconfd start
fi
# Start Samba (a file/print server for Windows machines).
# 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
fi
# Start mcelog
if [ -x /etc/rc.d/rc.mcelog ]; then
if [[ -x /etc/rc.d/rc.mcelog ]]; then
/etc/rc.d/rc.mcelog start
fi
# 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
fi
# 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
fi

View File

@@ -1,21 +1,24 @@
#!/bin/bash
#
# /etc/rc.d/rc.S: System initialization script.
# script: rc.S
#
# Mostly written by: Patrick J. Volkerding, <volkerdi@slackware.com>
# LimeTech - Modified for Unraid OS
# System initialization script.
# 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
# Mount /proc if it is not already mounted:
if [ ! -d /proc/sys ]; then
/sbin/mount -v proc /proc -n -t proc 2> /dev/null
if [[ ! -d /proc/sys ]]; then
/sbin/mount -v proc /proc -n -t proc 2>/dev/null
fi
# Mount /sys if it is not already mounted:
if [ ! -d /sys/kernel ]; then
/sbin/mount -v sysfs /sys -n -t sysfs 2> /dev/null
if [[ ! -d /sys/kernel ]]; then
/sbin/mount -v sysfs /sys -n -t sysfs 2>/dev/null
fi
# 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
# file: /etc/default/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:
if ! /sbin/mount | /bin/grep -wq efivarfs ; then
if ! /sbin/mount | /bin/grep -wq efivarfs; then
# Mount according to /etc/default/efivarfs:
if [ -r /etc/default/efivarfs ]; then
if [[ -r /etc/default/efivarfs ]]; then
. /etc/default/efivarfs
else # default
EFIVARFS=rw
EFIVARFS="rw"
fi
case "$EFIVARFS" in
'rw')
'rw')
/sbin/mount -o rw -t efivarfs none /sys/firmware/efi/efivars
;;
'ro')
'ro')
/sbin/mount -o ro -t efivarfs none /sys/firmware/efi/efivars
;;
esac
@@ -45,71 +48,74 @@ fi
# If /run exists, mount a tmpfs on it (unless the
# initrd has already done so):
if [ -d /run ]; then
if ! /bin/grep -wq "tmpfs /run tmpfs" /proc/mounts ; then
if [[ -d /run ]]; 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
fi
fi
# limetech - lets mount debugfs
# LimeTech - lets mount debugfs
/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)
UNRAIDLABEL="UNRAID"
UNRAIDROOT=
set -- $(cat /proc/cmdline)
for x in "$@"; do
case "$x" in
unraidlabel=*)
UNRAIDLABEL="${x#unraidlabel=}"
;;
root=*)
UNRAIDROOT="${x#root=}"
;;
esac
case "$x" in
unraidlabel=*)
UNRAIDLABEL="${x#unraidlabel=}"
;;
root=*)
UNRAIDROOT="${x#root=}"
;;
esac
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
abort() {
read -p "$1 - press ENTER key to reboot ..."
echo
read -p "$1 - press ENTER key to reboot..."
/bin/echo
/sbin/reboot
}
find_device() {
# find which USB flash device/partition has the indicated label
local i
for i in {1..30} ; do
for i in {1..30}; do
DEVICE=$(/sbin/blkid -L $UNRAIDLABEL)
[[ -z $DEVICE ]] && sleep 1 || return 0
[[ -z $DEVICE ]] && /bin/sleep 1 || return 0
done
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/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
bzcheck () {
bzcheck(){
local BZFILE=$1
if [[ -f /boot/config/skipbzcheck ]]; then
echo "Skipping $BZFILE checksum verification"
/bin/echo "Skipping $BZFILE checksum verification"
return
fi
echo "Verifying $BZFILE checksum ..."
[[ ! -f "/boot/$BZFILE" ]] && abort "$BZFILE not present"
/bin/echo "Verifying $BZFILE checksum ..."
[[ -f "/boot/$BZFILE" ]] || abort "$BZFILE not present"
local BZFILECHK="$BZFILE.sha256"
[[ ! -f "/boot/$BZFILECHK" ]] && abort "$BZFILECHK not present"
local SUM1=$(/bin/sha256sum /boot/$BZFILE)
local SUM2=$(/bin/cat /boot/$BZFILECHK)
[[ "${SUM1:0:63}" != "${SUM2:0:63}" ]] && abort "$BZFILE checksum error"
[[ -f "/boot/$BZFILECHK" ]] || abort "$BZFILECHK not present"
local HASH1=$(/bin/sha256sum /boot/$BZFILE)
local HASH2=$(/bin/cat /boot/$BZFILECHK)
[[ ${HASH1:0:64} != ${HASH2:0:64} ]] && abort "$BZFILE checksum error"
}
bzmount () {
bzmount(){
local BZFILE=$1
local MNTDIR=$2
bzcheck $BZFILE
@@ -120,6 +126,7 @@ bzmount () {
/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
}
if [[ $UNRAIDROOT == "" ]]; then
bzcheck "bzimage"
bzcheck "bzroot"
@@ -129,20 +136,20 @@ if [[ $UNRAIDROOT == "" ]]; then
bzmount "bzfirmware" "usr"
# now that /usr is mounted make /etc/rc.d a symlink
/bin/rm -r /etc/rc.d
/bin/ln -s /usr/local/etc/rc.d /etc
/bin/rm -rf /etc/rc.d
/bin/ln -sf /usr/local/etc/rc.d /etc
# 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
/bin/mv /var/empty/* /var/log
/bin/mv -f /var/empty/* /var/log
else
echo "Checking root filesystem"
/bin/echo "Checking root filesystem"
/sbin/fsck -C -a $UNRAIDROOT
RETVAL=$?
[[ $RETVAL -ge 2 ]] && abort "fsck failed with return value $RETVAL"
# 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 /
RETVAL=$?
[[ $RETVAL -gt 0 ]] && abort "failed to remount $UNRAIDROOT r/w with return value $RETVAL"
@@ -150,7 +157,7 @@ fi
# invoke testing hook
if [[ -f /boot/config/rc.S.extra ]]; then
source /boot/config/rc.S.extra
. /boot/config/rc.S.extra
fi
# and continue in separate script
source /etc/rc.d/rc.S.cont
. /etc/rc.d/rc.S.cont

View File

@@ -1,19 +1,23 @@
#!/bin/bash
#
# /etc/rc.d/rc.S: System initialization script (continuation)
# script: rc.S.cont
#
# Mostly written by: Patrick J. Volkerding, <volkerdi@slackware.com>
# LimeTech - Modified for Unraid OS
#
# System initialization script (continuation)
# 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
/usr/local/sbin/vfio-pci 1> /var/log/vfio-pci 2> /var/log/vfio-pci-errors
# run & log functions
. /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.
if [ -x /etc/rc.d/rc.modules ]; then
if [[ -x /etc/rc.d/rc.modules ]]; then
/etc/rc.d/rc.modules
fi
@@ -25,59 +29,59 @@ fi
# 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.
# So use it. :-)
if grep -wq sysfs /proc/mounts && grep -q devtmpfs /proc/filesystems ; then
if ! grep -wq nohotplug /proc/cmdline ; then
if [ -x /etc/rc.d/rc.udev ]; then
if /bin/grep -wq sysfs /proc/mounts && /bin/grep -q devtmpfs /proc/filesystems; then
if ! /bin/grep -wq nohotplug /proc/cmdline; then
if [[ -x /etc/rc.d/rc.udev ]]; then
/etc/rc.d/rc.udev start
fi
fi
fi
# 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
if grep -wq unraidcgroup1 /proc/cmdline ; then
if [ -d /sys/fs/cgroup ]; then
if /bin/grep -wq unraidcgroup1 /proc/cmdline; then
if [[ -d /sys/fs/cgroup ]]; then
# See linux-*/Documentation/cgroups/cgroups.txt (section 1.6)
# 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 -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
controllers="$(/bin/cut -f 1 /proc/cgroups | /bin/tail -n +2)"
for i in $controllers; do
mkdir /sys/fs/cgroup/$i
mount -t cgroup -o $i $i /sys/fs/cgroup/$i
CONTROLLERS="$(cut -f 1 /proc/cgroups | tail -n +2)"
for i in $CONTROLLERS; do
/bin/mkdir /sys/fs/cgroup/$i
/sbin/mount -t cgroup -o $i $i /sys/fs/cgroup/$i
done
unset i controllers
unset i CONTROLLERS
# 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
# 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
else
mkdir -p /dev/cgroup
mount -t cgroup cgroup /dev/cgroup
/bin/mkdir -p /dev/cgroup
/sbin/mount -t cgroup cgroup /dev/cgroup
fi
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)
# Mount a tmpfs as the cgroup2 filesystem root
mount -t tmpfs -o mode=0755,size=8M cgroup_root /sys/fs/cgroup
mount -t cgroup2 none /sys/fs/cgroup
/sbin/mount -t tmpfs -o mode=0755,size=8M cgroup_root /sys/fs/cgroup
/sbin/mount -t cgroup2 none /sys/fs/cgroup
else
mkdir -p /dev/cgroup
mount -t cgroup2 none /dev/cgroup
/bin/mkdir -p /dev/cgroup
/sbin/mount -t cgroup2 none /dev/cgroup
fi
fi
fi
# Huge page support:
mount /hugetlbfs
/sbin/mount /hugetlbfs
# Enable swapping:
/sbin/swapon -a 2> /dev/null
/sbin/swapon -a 2>/dev/null
# Set the tick and frequency for the system clock.
# Default values are: TICK=10000 and FREQ=0
@@ -85,97 +89,97 @@ TICK=10000
FREQ=0
# If there's a /etc/default/adjtimex config file, source it to override
# the default TICK and FREQ:
if [ -r /etc/default/adjtimex ]; then
if [[ -r /etc/default/adjtimex ]]; then
. /etc/default/adjtimex
fi
if /sbin/adjtimex --tick $TICK --frequency $FREQ; then
echo "Setting the system clock rate: /sbin/adjtimex --tick $TICK --frequency $FREQ"
if adjtimex --tick $TICK --frequency $FREQ; then
log "Setting the system clock rate: adjtimex --tick $TICK --frequency $FREQ"
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
# 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
# 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"
fi
if [ /etc/adjtime -nt /etc/hardwareclock ]; then
if grep -q "^LOCAL" /etc/adjtime ; then
echo -n "Setting system time from the hardware clock (localtime): "
if [[ /etc/adjtime -nt /etc/hardwareclock ]]; then
if /bin/grep -q "^LOCAL" /etc/adjtime; then
log "Setting system time from the hardware clock (localtime)..."
else
echo -n "Setting system time from the hardware clock (UTC): "
log "Setting system time from the hardware clock (UTC)..."
fi
/sbin/hwclock $CLOCK_OPT --hctosys
elif grep -wq "^localtime" /etc/hardwareclock 2> /dev/null ; then
echo -n "Setting system time from the hardware clock (localtime): "
/sbin/hwclock $CLOCK_OPT --localtime --hctosys
run /sbin/hwclock $CLOCK_OPT --hctosys
elif /bin/grep -wq "^localtime" /etc/hardwareclock 2>/dev/null; then
log "Setting system time from the hardware clock (localtime)..."
run /sbin/hwclock $CLOCK_OPT --localtime --hctosys
else
echo -n "Setting system time from the hardware clock (UTC): "
/sbin/hwclock $CLOCK_OPT --utc --hctosys
log "Setting system time from the hardware clock (UTC)..."
run /sbin/hwclock $CLOCK_OPT --utc --hctosys
fi
date
/bin/date
fi
# Configure ISA Plug-and-Play devices:
if [ -r /etc/isapnp.conf ]; then
if [ -x /sbin/isapnp ]; then
if [[ -r /etc/isapnp.conf ]]; then
if [[ -x /sbin/isapnp ]]; then
/sbin/isapnp /etc/isapnp.conf
fi
fi
# Configure kernel parameters:
if [ -x /sbin/sysctl -a -r /etc/sysctl.conf ]; then
echo "Configuring kernel parameters: /sbin/sysctl -e --system"
/sbin/sysctl -e --system
elif [ -x /sbin/sysctl ]; then
echo "Configuring kernel parameters: /sbin/sysctl -e --system"
if [[ -x /sbin/sysctl && -r /etc/sysctl.conf ]]; then
log "Configuring kernel parameters..."
run /sbin/sysctl -e --system
elif [[ -x /sbin/sysctl ]]; then
log "Configuring kernel parameters..."
# 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
# Clean up some temporary files:
rm -f /etc/nologin /etc/dhcpc/*.pid /etc/forcefsck /etc/fastboot \
/var/state/saslauthd/saslauthd.pid /tmp/.Xauth* 1> /dev/null 2> /dev/null
rm -rf /tmp/{kde-[a-zA-Z]*,ksocket-[a-zA-Z]*,hsperfdata_[a-zA-Z]*,plugtmp*}
if [ -d /var/lib/pkgtools/setup/tmp ]; then
( cd /var/lib/pkgtools/setup/tmp && rm -rf * )
elif [ -d /var/log/setup/tmp ]; then
( cd /var/log/setup/tmp && rm -rf * )
/bin/rm -f /etc/nologin /etc/dhcpc/*.pid /etc/forcefsck /etc/fastboot \
/var/state/saslauthd/saslauthd.pid /tmp/.Xauth* &>/dev/null
/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
( cd /var/lib/pkgtools/setup/tmp && /bin/rm -rf * )
elif [[ -d /var/log/setup/tmp ]]; then
( cd /var/log/setup/tmp && /bin/rm -rf * )
fi
# Clear /var/lock/subsys:
if [ -d /var/lock/subsys ]; then
rm -f /var/lock/subsys/*
if [[ -d /var/lock/subsys ]]; then
/bin/rm -f /var/lock/subsys/*
fi
# Start libcgroup services:
if [ -x /etc/rc.d/rc.cgconfig -a -x /etc/rc.d/rc.cgred -a -d /sys/fs/cgroup ]; then
/etc/rc.d/rc.cgconfig start ; echo " /usr/sbin/cgconfigparser -l /etc/cgconfig.conf"
if [[ -x /etc/rc.d/rc.cgconfig && -x /etc/rc.d/rc.cgred && -d /sys/fs/cgroup ]]; then
/etc/rc.d/rc.cgconfig start
/etc/rc.d/rc.cgred start
fi
# Create /tmp/{.ICE-unix,.X11-unix} if they are not present:
if [ ! -e /tmp/.ICE-unix ]; then
mkdir -p /tmp/.ICE-unix
chmod 1777 /tmp/.ICE-unix
if [[ ! -e /tmp/.ICE-unix ]]; then
/bin/mkdir -p /tmp/.ICE-unix
/bin/chmod 1777 /tmp/.ICE-unix
fi
if [ ! -e /tmp/.X11-unix ]; then
mkdir -p /tmp/.X11-unix
chmod 1777 /tmp/.X11-unix
if [[ ! -e /tmp/.X11-unix ]]; then
/bin/mkdir -p /tmp/.X11-unix
/bin/chmod 1777 /tmp/.X11-unix
fi
# Create a fresh utmp file:
touch /var/run/utmp
chown root:utmp /var/run/utmp
chmod 664 /var/run/utmp
/bin/touch /var/run/utmp
/bin/chown root:utmp /var/run/utmp
/bin/chmod 664 /var/run/utmp
# 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 [ -x /etc/rc.d/rc.sysvinit ]; then
if [[ -x /etc/rc.d/rc.sysvinit ]]; then
/etc/rc.d/rc.sysvinit
fi
@@ -183,61 +187,61 @@ fi
# 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
# 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
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.
mkdir -p /var/lib/seedrng
chmod 600 /var/lib/seedrng
cp /boot/config/random-seed /var/lib/seedrng/seed.no-credit 2>/dev/null
/bin/mkdir -p /var/lib/seedrng
/bin/chmod 600 /var/lib/seedrng
/bin/cp /boot/config/random-seed /var/lib/seedrng/seed.no-credit 2>/dev/null
/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)
NAME="Tower"
timeZone="America/Los_Angeles"
if [ -r /boot/config/ident.cfg ]; then
source <(/usr/bin/fromdos < /boot/config/ident.cfg)
TIMEZONE="America/Los_Angeles"
if [[ -r /boot/config/ident.cfg ]]; then
. <(/usr/bin/fromdos </boot/config/ident.cfg)
NAME=${NAME//[^a-zA-Z\-\.0-9]/\-}
fi
echo "$NAME" >/etc/HOSTNAME
echo "# Generated" >/etc/hosts
echo "127.0.0.1 $NAME localhost" >>/etc/hosts
echo "54.149.176.35 keys.lime-technology.com" >>/etc/hosts
/bin/echo "$NAME" >/etc/HOSTNAME
/bin/echo "# Generated" >/etc/hosts
/bin/echo "127.0.0.1 $NAME localhost" >>/etc/hosts
/bin/echo "54.149.176.35 keys.lime-technology.com" >>/etc/hosts
# limetech - restore the configured timezone
if [ "$timeZone" = "custom" ]; then
ln -sf /boot/config/timezone /etc/localtime
# LimeTech - restore the configured timezone
if [[ $TIMEZONE == custom ]]; then
/bin/ln -sf /boot/config/timezone /etc/localtime
else
ln -sf /usr/share/zoneinfo/$timeZone /etc/localtime
/bin/ln -sf /usr/share/zoneinfo/$TIMEZONE /etc/localtime
fi
# limetech - restore password files stored on flash
if [ -r /boot/config/passwd ]; then
while IFS=: read -r username password userid groupid comment homedir cmdshell ; do
if [[ $username = root ]]; then
sed -i "s|^root:.*|root:x:0:0:$comment:/root:/bin/bash|" /etc/passwd
# LimeTech - restore password files stored on flash
if [[ -r /boot/config/passwd ]]; then
while IFS=: read -r USERNAME PASSWORD USERID GROUPID COMMENT HOMEDIR CMDSHELL; do
if [[ $USERNAME == root ]]; then
/bin/sed -i "s|^root:.*|root:x:0:0:$COMMENT:/root:/bin/bash|" /etc/passwd
fi
if (( userid >= 1000 )); then
echo "$username:x:$userid:$groupid:$comment:/:/bin/false" >> /etc/passwd
if (( USERID >= 1000 )); then
/bin/echo "$USERNAME:x:$USERID:$GROUPID:$COMMENT:/:/bin/false" >> /etc/passwd
fi
done < /boot/config/passwd
if [ -r /boot/config/shadow ]; then
cp /boot/config/shadow /etc
chmod 600 /etc/shadow
done </boot/config/passwd
if [[ -r /boot/config/shadow ]]; then
/bin/cp -f /boot/config/shadow /etc
/bin/chmod 600 /etc/shadow
fi
fi
/usr/sbin/pwconv
if [ -r /boot/config/smbpasswd ]; then
cp /boot/config/smbpasswd /var/lib/samba/private
if [[ -r /boot/config/smbpasswd ]]; then
/bin/cp -f /boot/config/smbpasswd /var/lib/samba/private
fi
if [ -r /boot/config/secrets.tdb ]; then
cp /boot/config/secrets.tdb /var/lib/samba/private
if [[ -r /boot/config/secrets.tdb ]]; then
/bin/cp -f /boot/config/secrets.tdb /var/lib/samba/private
fi
# limetech - restore custom rsyslog.conf config file from flash if present
if [ -r /boot/config/rsyslog.conf ]; then
# LimeTech - restore custom rsyslog.conf config file from flash if present
if [[ -r /boot/config/rsyslog.conf ]]; then
/usr/bin/fromdos </boot/config/rsyslog.conf >/etc/rsyslog.conf
fi

View File

@@ -1,25 +1,41 @@
#!/bin/sh
#!/bin/bash
#
# script: rc.acpid
#
# Start/stop/restart acpid.
#
# LimeTech - modified for Unraid OS
# Bergware - modified for Unraid OS, October 2023
# Start acpid:
acpid_start() {
if [ -x /usr/sbin/acpid -a -d /proc/acpi ]; then
echo "Starting ACPI daemon: /usr/sbin/acpid"
/usr/sbin/acpid
DAEMON="ACPI daemon"
# run & log functions
. /etc/rc.d/rc.runlog
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
log "$DAEMON... $REPLY."
}
# Stop acpid:
acpid_stop() {
if [ -r /var/run/acpid.pid ]; then
acpid_stop(){
log "Stopping $DAEMON..."
if [[ -r /var/run/acpid.pid ]]; then
kill $(cat /var/run/acpid.pid)
else
killall acpid
fi
log "$DAEMON... Stopped."
}
# Restart acpid:
acpid_restart() {
acpid_restart(){
log "Restarting $DAEMON..."
acpid_stop
sleep 1
acpid_start
@@ -36,5 +52,7 @@ case "$1" in
acpid_restart
;;
*)
echo "usage $0 start|stop|restart"
echo "Usage: $BASENAME start|stop|restart"
exit 1
esac
exit 0

View File

@@ -1,39 +1,70 @@
#!/bin/sh
# /etc/rc.d/rc.atd - start/stop the at daemon
#!/bin/bash
#
# 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.
if [ -r /etc/default/atd ]; then
if [[ -r /etc/default/atd ]]; then
. /etc/default/atd
fi
start_atd() {
if ! /usr/bin/pgrep --ns $$ --euid daemon -f "^/usr/sbin/atd" 1> /dev/null 2> /dev/null ; then
echo "Starting atd: /usr/sbin/atd $ATD_OPTS"
/usr/sbin/atd $ATD_OPTS
atd_running(){
pgrep --ns $$ --euid daemon -f "^$CROND" &>/dev/null
}
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
log "$DAEMON... $REPLY."
}
stop_atd() {
echo "Stopping atd."
/usr/bin/pkill --ns $$ --euid daemon -f "^/usr/sbin/atd" 2> /dev/null
atd_stop(){
log "Stopping $DAEMON..."
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() {
stop_atd
atd_restart(){
log "Restarting $DAEMON..."
atd_stop
sleep 1
start_atd
atd_start
}
case "$1" in
'start')
start_atd
atd_start
;;
'stop')
stop_atd
atd_stop
;;
'restart')
restart_atd
atd_restart
;;
*)
echo "usage $0 start|stop|restart"
echo "Usage: $BASENAME start|stop|restart"
exit 1
esac
exit 0

View File

@@ -56,6 +56,7 @@ avahid_running(){
avahid_start(){
log "Starting $DAEMON..."
local REPLY
if avahid_running; then
REPLY="Already started"
else
@@ -75,6 +76,7 @@ avahid_start(){
avahid_stop(){
log "Stopping $DAEMON..."
local REPLY
if ! avahid_running; then
REPLY="Already stopped"
else

View File

@@ -1,5 +1,8 @@
#!/bin/bash
#
# script: rc.avahi-dnsconfd
#
# Start/stop/restart the avahi dnsconfd daemon
# This file is part of avahi.
#
# 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
# License along with avahi; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
# USA.
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, 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
DESC="Avahi mDNS/DNS-SD DNS Server Configuration Daemon"
NAME="avahi-dnsconfd"
DAEMON="/usr/sbin/$NAME"
# run & log functions
. /etc/rc.d/rc.runlog
avahidns_start()
{
echo "Starting $DESC: $DAEMON -D"
$DAEMON -D
avahidns_running(){
$AVAHI -c
[[ $? == 0 ]]
}
avahidns_status()
{
$DAEMON -c
[ $? = 0 ]
avahidns_start(){
log "Starting $DAEMON..."
local REPLY
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()
{
echo -en "Stopping $DESC: "
$DAEMON -c
[ $? != 0 ]
echo "stopped";
$DAEMON -k 2>/dev/null
avahidns_stop(){
log "Stopping $DAEMON..."
local REPLY
if ! avahidns_running; then
REPLY="Already stopped"
else
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
sleep 1
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
'start')
if ( ! avahidns_status ); then
avahidns_start
else
echo "$DESC is already running (will not start it twice)."
fi
avahidns_start
;;
'stop')
avahidns_stop
@@ -66,13 +84,10 @@ case "$1" in
avahidns_restart
;;
'status')
if ( avahidns_status ); then
echo "$DESC is currently running"
else
echo "$DESC is not running."
fi
avahidns_status
;;
*)
echo "usage $0 start|stop|status|restart"
echo "Usage: $BASENAME start|stop|restart|status"
exit 1
esac
exit 0

View File

@@ -1,50 +1,59 @@
#!/bin/bash
#
# rc.cpufreq: Settings for CPU frequency and voltage scaling in the kernel.
# For more information, see the kernel documentation in
# /usr/src/linux/Documentation/cpu-freq/
# script: rc.cpufreq
#
# 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:
# performance: The CPUfreq governor "performance" sets the CPU statically
# to the highest frequency within the borders of scaling_min_freq
# and scaling_max_freq.
# powersave: The CPUfreq governor "powersave" sets the CPU statically to the
# lowest frequency within the borders of scaling_min_freq and
# scaling_max_freq.
# userspace: The CPUfreq governor "userspace" allows the user, or any
# userspace program running with UID "root", to set the CPU to a
# specific frequency by making a sysfs file "scaling_setspeed"
# available in the CPU-device directory.
# ondemand: The CPUfreq governor "ondemand" sets the CPU depending on the
# current usage.
# conservative: The CPUfreq governor "conservative", much like the "ondemand"
# governor, sets the CPU depending on the current usage. It
# differs in behaviour in that it gracefully increases and
# decreases the CPU speed rather than jumping to max speed the
# moment there is any load on the CPU.
# schedutil: The CPUfreq governor "schedutil" aims at better integration with
# the Linux kernel scheduler. Load estimation is achieved through
# the scheduler's Per-Entity Load Tracking (PELT) mechanism, which
# also provides information about the recent load.
SCALING_GOVERNOR=ondemand
# to the highest frequency within the borders of scaling_min_freq
# and scaling_max_freq.
# powersave: The CPUfreq governor "powersave" sets the CPU statically to the
# lowest frequency within the borders of scaling_min_freq and
# scaling_max_freq.
# userspace: The CPUfreq governor "userspace" allows the user, or any
# userspace program running with UID "root", to set the CPU to a
# specific frequency by making a sysfs file "scaling_setspeed"
# available in the CPU-device directory.
# ondemand: The CPUfreq governor "ondemand" sets the CPU depending on the
# current usage.
# conservative: The CPUfreq governor "conservative", much like the "ondemand"
# governor, sets the CPU depending on the current usage. It
# differs in behaviour in that it gracefully increases and
# decreases the CPU speed rather than jumping to max speed the
# moment there is any load on the CPU.
# schedutil: The CPUfreq governor "schedutil" aims at better integration with
# the Linux kernel scheduler. Load estimation is achieved through
# the scheduler's Per-Entity Load Tracking (PELT) mechanism, which
# also provides information about the recent load.
#
# 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
# provides power savings on Intel processors while avoiding the ramp-up lag
# present when using the powersave governor (which is the default if ondemand
# 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"
fi
# 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:
if [ -r /etc/default/cpufreq ]; then
if [[ -r /etc/default/cpufreq ]]; then
. /etc/default/cpufreq
fi
# 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
fi
@@ -56,11 +65,12 @@ fi
# by the architecture, processor, or underlying CPUFreq driver. For example,
# processors that use the Intel P-state driver will only be able to set
# 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:
if [ -r /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor ]; then
echo "Enabled CPU frequency scaling governor: $(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor)"
if [[ -r $SYSTEM/cpu0/cpufreq/scaling_governor ]]; then
log "Enabled CPU frequency scaling governor: $(cat $SYSTEM/cpu0/cpufreq/scaling_governor)"
fi
unset SCALING_GOVERNOR
exit 0

View File

@@ -1,40 +1,70 @@
#!/bin/sh
# /etc/rc.d/rc.crond - start/stop the cron daemon
#!/bin/bash
#
# 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.
if [ -r /etc/default/crond ]; then
. /etc/default/crond
fi
[[ -r $CONF ]] && . $CONF
start_crond() {
if ! /usr/bin/pgrep --ns $$ --euid root -f "^/usr/sbin/crond" 1> /dev/null 2> /dev/null ; then
echo "Starting crond: /usr/sbin/crond $CROND_OPTS"
crond_running(){
pgrep --ns $$ --euid root -f "^$CROND" &>/dev/null
}
crond_start(){
log "Starting $DAEMON..."
local REPLY
if crond_running; then
REPLY="Already started"
else
mkdir -p /run/cron
/usr/sbin/crond $CROND_OPTS
run $CROND $CROND_OPTS
if crond_running; then REPLY="Started"; else REPLY="Failed"; fi
fi
log "$DAEMON... $REPLY."
}
stop_crond() {
echo "Stopping crond."
/usr/bin/pkill --ns $$ --euid root -f "^/usr/sbin/crond" 2> /dev/null
crond_stop(){
log "Stopping $DAEMON..."
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() {
stop_crond
crond_restart(){
log "Restarting $DAEMON..."
crond_stop
sleep 1
start_crond
crond_start
}
case "$1" in
'start')
start_crond
crond_start
;;
'stop')
stop_crond
crond_stop
;;
'restart')
restart_crond
crond_restart
;;
*)
echo "usage $0 start|stop|restart"
echo "Usage: $BASENAME start|stop|restart"
exit 1
esac
exit 0

View File

@@ -1,28 +1,50 @@
#!/bin/sh
# Start/stop/restart dnsmasq (a small DNS/DHCP server):
#!/bin/bash
#
# 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:
dnsmasq_start() {
if [ -x /usr/sbin/dnsmasq ]; then
echo "Starting dnsmasq: /usr/sbin/dnsmasq"
/usr/sbin/dnsmasq
fi
DAEMON="DNSmasq daemon"
PIDFILE="/var/run/dnsmasq.pid"
# run & log functions
. /etc/rc.d/rc.runlog
dnsmasq_running(){
pgrep -l -F $PIDFILE 2>/dev/null | grep -q dnsmasq
}
# Stop dnsmasq:
dnsmasq_stop() {
# Try to use the .pid file first:
if pgrep -l -F /var/run/dnsmasq.pid 2> /dev/null | grep -q dnsmasq ; then
echo "Stopping dnsmasq."
pkill -F /var/run/dnsmasq.pid 2> /dev/null
else # kill any dnsmasq processes in this namespace:
echo "Stopping dnsmasq."
killall --ns $$ dnsmasq 2> /dev/null
dnsmasq_start(){
log "Starting $DAEMON..."
local REPLY
if [[ -x /usr/sbin/dnsmasq ]]; then
run /usr/sbin/dnsmasq
if dnsmasq_running; then REPLY="Started"; else REPLY="Failed"; fi
else
REPLY="Missing executable"
fi
log "$DAEMON... $REPLY."
}
# Restart dnsmasq:
dnsmasq_restart() {
dnsmasq_stop(){
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
sleep 1
dnsmasq_start
@@ -39,5 +61,7 @@ case "$1" in
dnsmasq_restart
;;
*)
echo "usage rc.dnsmasq: start|stop|restart"
echo "Usage: $BASENAME start|stop|restart"
exit 1
esac
exit 0

View File

@@ -521,6 +521,7 @@ docker_container_stop(){
docker_service_start(){
log "Starting $DAEMON..."
local REPLY
[[ -x $DOCKER ]] && REPLY= || REPLY="Failed"
if [[ -z $REPLY ]]; then
if ! mountpoint $DOCKER_ROOT &>/dev/null; then
@@ -545,6 +546,7 @@ docker_service_start(){
docker_service_stop(){
log "Stopping $DAEMON..."
local REPLY
# If there is no PID file, ignore this request...
if [[ -r $DOCKER_PIDFILE ]]; then
# Try to stop dockerd gracefully
@@ -596,7 +598,7 @@ case "$1" in
'start')
docker_service_start
docker_network_start
docker_container_start 1>/dev/null 2>/dev/null &
docker_container_start &>/dev/null &
disown
;;
'stop')
@@ -615,7 +617,7 @@ case "$1" in
sleep 1
docker_service_start
docker_network_start
docker_container_start 1>/dev/null 2>/dev/null &
docker_container_start &>/dev/null &
disown
;;
'status')

View File

@@ -1,66 +1,88 @@
#!/bin/bash
#
# /etc/rc.d/rc.elogind
# Initializes the elogind service on Slackware.
# There is no need to explicitly start a daemon; this will be taken
# care of automatically by dbus when that starts.
# script: rc.elogind
#
# Initializes the elogind service on Slackware.
# There is no need to explicitly start a daemon; this will be taken
# care of automatically by dbus when that starts.
#
# Author:
# Eric Hameleers <alien@slackware.com> 2016
# Widya Walesa 2020
# Eric Hameleers <alien@slackware.com> 2016
# Widya Walesa 2020
#
# Description:
# We use elogind (standalone subset extracted from systemd) instead of
# systemd itself; so we need to initialize a systemd-like state.
# We use elogind (standalone subset extracted from systemd) instead of
# systemd itself; so we need to initialize a systemd-like state.
#
# 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() {
if [ -x /lib64/elogind/elogind ]; then
if [ ! -d /run/user ]; then
mkdir -p /run/user
fi
if [ ! -d /run/systemd ]; then
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
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
DAEMON="Elogin daemon"
ELOGIND="/lib64/elogind/elogind"
PIDFILE="/run/elogind.pid"
# run & log functions
. /etc/rc.d/rc.runlog
elogind_running(){
pgrep -l -F $PIDFILE 2>/dev/null | grep -q elogind
}
stop_elogind() {
if pgrep -l -F /run/elogind.pid 2>/dev/null | grep -q elogind; then
echo -n "Stopping elogind: "
pkill -F /run/elogind.pid 2>/dev/null
echo "DONE"
else
echo "Elogind is not running"
elogind_start(){
log "Starting $DAEMON..."
local REPLY
[[ -x $ELOGIND ]] || exit 1
[[ -d /run/user ]] || mkdir -p /run/user
if [[ ! -d /run/systemd ]]; then
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
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
start)
start_elogind
;;
stop)
stop_elogind
;;
restart)
stop_elogind
sleep 1
start_elogind
;;
*)
echo "Usage: $0 start|stop|restart"
'start')
elogind_start
;;
'stop')
elogind_stop
;;
'restart')
elogind_restart
;;
*)
echo "Usage: $BASENAME start|stop|restart"
exit 1
esac
exit 0

View File

@@ -31,8 +31,11 @@ else
IPADDR=
NETMASK=
GATEWAY=
PROTOCOL=ipv4
USE_DHCP=yes
USE_DHCP6=yes
DHCP_KEEPRESOLV=no
DHCP6_KEEPRESOLV=no
BONDING=yes
BRIDGING=yes
fi
@@ -130,5 +133,5 @@ else
fi
SYSNICS=1
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

View File

@@ -57,7 +57,7 @@ if [[ -x /etc/rc.d/rc.kpropd ]]; then
fi
# 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
# 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
@@ -87,7 +87,7 @@ fi
# Mount remote CIFS filesystems. Note that where possible, using CIFS is
# 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."
run /sbin/mount -a -t cifs
# 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
# 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."
run /sbin/mount -a -t smbfs
# Show the mounted volumes:

View File

@@ -14,6 +14,7 @@ DAEMON="Internet daemon"
inetd_start() {
log "Starting $DAEMON..."
local REPLY
if [[ -x /usr/sbin/inetd ]]; then
run /usr/sbin/inetd
REPLY="Started"

View File

@@ -1,5 +1,8 @@
#!/bin/sh
# /etc/rc.d/rc.ip_forward: start/stop IP packet forwarding
#!/bin/bash
#
# script: rc.ip_forward
#
# start/stop IP packet forwarding
#
# If you intend to run your Linux box as a router, i.e. as a
# computer that forwards and redistributes network packets, you
@@ -10,29 +13,37 @@
#
# To disable IP packet forwarding at boot time, make this
# 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:
ip_forward_start() {
if [ -f /proc/sys/net/ipv4/ip_forward ]; then
echo "Activating IPv4 packet forwarding."
echo 1 > /proc/sys/net/ipv4/ip_forward
SYSTEM="/proc/sys/net"
SYSCTL="/etc/sysctl.conf"
# run & log functions
. /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
# non-default ipv4 parameters for the interface as mentioned in
# /usr/src/linux/Documentation/networking/ip-sysctl.txt. So, we
# will reapply any ipv4 sysctl parameters now:
if [ -r /etc/sysctl.conf ]; then
/bin/grep ipv4 /etc/sysctl.conf | sysctl -p - 1> /dev/null 2> /dev/null
if [[ -r $SYSCTL ]]; then
grep ipv4 $SYSCTL | sysctl -p - &>/dev/null
fi
fi
if [ -f /proc/sys/net/ipv6/conf/all/forwarding ]; then
echo "Activating IPv6 packet forwarding."
echo 1 > /proc/sys/net/ipv6/conf/all/forwarding
if [[ -f $SYSTEM/ipv6/conf/all/forwarding ]]; then
log "Activating IPv6 packet forwarding."
echo 1 >$SYSTEM/ipv6/conf/all/forwarding
# Changing /proc/sys/net/ipv6/conf/all/forwarding results in resetting
# all non-default ipv6 parameters for the interface as mentioned in
# /usr/src/linux/Documentation/networking/ip-sysctl.txt. So, we
# will reapply any ipv6 sysctl parameters now:
if [ -r /etc/sysctl.conf ]; then
/bin/grep ipv6 /etc/sysctl.conf | sysctl -p - 1> /dev/null 2> /dev/null
if [[ -r $SYSCTL ]]; then
grep ipv6 $SYSCTL | sysctl -p - &>/dev/null
fi
fi
# 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
# which has several IP addresses on different interfaces. To
# turn rp_filter off, uncomment the lines below:
#if [ -r /proc/sys/net/ipv4/conf/all/rp_filter ]; then
# echo "Disabling rp_filter."
# echo 0 > /proc/sys/net/ipv4/conf/all/rp_filter
#fi
# if [ -r $SYSTEM/ipv4/conf/all/rp_filter ]; then
# log "Disabling rp_filter."
# echo 0 >$SYSTEM/ipv4/conf/all/rp_filter
# fi
}
# Stop IP packet forwarding:
ip_forward_stop() {
if [ -f /proc/sys/net/ipv4/ip_forward ]; then
echo "Disabling IPv4 packet forwarding."
echo 0 > /proc/sys/net/ipv4/ip_forward
ip_forward_stop(){
if [[ -f $SYSTEM/ipv4/ip_forward ]]; then
log "Disabling IPv4 packet forwarding."
echo 0 >$SYSTEM/ipv4/ip_forward
# Changing /proc/sys/net/ipv4/ip_forward results in resetting all
# non-default ipv4 parameters for the interface as mentioned in
# /usr/src/linux/Documentation/networking/ip-sysctl.txt. So, we
# will reapply any ipv4 sysctl parameters now:
if [ -r /etc/sysctl.conf ]; then
/bin/grep ipv4 /etc/sysctl.conf | sysctl -p - 1> /dev/null 2> /dev/null
if [[ -r $SYSCTL ]]; then
grep ipv4 $SYSCTL | sysctl -p - &>/dev/null
fi
fi
if [ -f /proc/sys/net/ipv6/conf/all/forwarding ]; then
echo "Disabling IPv6 packet forwarding."
echo 0 > /proc/sys/net/ipv6/conf/all/forwarding
if [[ -f $SYSTEM/ipv6/conf/all/forwarding ]]; then
log "Disabling IPv6 packet forwarding."
echo 0 >$SYSTEM/ipv6/conf/all/forwarding
# Changing /proc/sys/net/ipv6/conf/all/forwarding results in resetting
# all non-default ipv6 parameters for the interface as mentioned in
# /usr/src/linux/Documentation/networking/ip-sysctl.txt. So, we
# will reapply any ipv6 sysctl parameters now:
if [ -r /etc/sysctl.conf ]; then
/bin/grep ipv6 /etc/sysctl.conf | sysctl -p - 1> /dev/null 2> /dev/null
if [[ -r $SYSCTL ]]; then
grep ipv6 $SYSCTL | sysctl -p - &>/dev/null
fi
fi
}
# Restart IP packet forwarding:
ip_forward_restart() {
ip_forward_restart(){
ip_forward_stop
sleep 1
ip_forward_start
@@ -95,6 +104,7 @@ case "$1" in
ip_forward_restart
;;
*)
echo "usage $0 start|stop|restart"
echo "Usage: $BASENAME start|stop|restart|status"
exit 1
esac
exit 0

View File

@@ -191,7 +191,7 @@ check(){
BIND=(); IPV4=no; IPV6=no; FAMILY=any;
# active IPV4 interfaces (including wireguard)
NETS=()
while IFS='\n' read -r NET; do
while IFS=$'\n' read -r NET; do
NET=($NET)
# exclude wireguard tunnels for ntp
[[ ${NET:0:2} == wg && $CALLER == ntp ]] && continue

View File

@@ -75,7 +75,7 @@ stop_running_machines(){
# resume paused VMs
for UUID in $(vmlist paused); do
log "Resuming VM: ${NAMES[$UUID]}"
virsh resume $UUID 1>/dev/null 2>/dev/null
virsh resume $UUID &>/dev/null
done
# wait until VMs are resumed
waitfor paused
@@ -83,7 +83,7 @@ stop_running_machines(){
if [[ $HOSTSHUTDOWN == hibernate ]]; then
for UUID in $(vmlist running); do
log "Suspending VM: ${NAMES[$UUID]}"
virsh dompmsuspend $UUID disk 1>/dev/null 2>/dev/null
virsh dompmsuspend $UUID disk &>/dev/null
done
# wait until VMs are suspended
waitfor running
@@ -92,7 +92,7 @@ stop_running_machines(){
# graceful shutdown of running VMs
for UUID in $(vmlist running); do
log "Shutting down VM: ${NAMES[$UUID]}"
virsh shutdown $UUID 1>/dev/null 2>/dev/null
virsh shutdown $UUID &>/dev/null
done
# wait until VMs are stopped
waitfor running
@@ -103,7 +103,7 @@ stop_running_machines(){
# check explicitely for suspended VMs
if [[ $STATE == pmsuspended ]]; then
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
((I++))
done <<< $(vmstate)
@@ -113,7 +113,7 @@ stop_running_machines(){
# forced shutdown of rogue VMs
for UUID in $(vmlist running paused other); do
log "Forced shutting down VM: ${NAMES[$UUID]}"
virsh destroy $UUID 1>/dev/null 2>/dev/null
virsh destroy $UUID &>/dev/null
done
}
@@ -217,7 +217,7 @@ libvirtd_start(){
mkdir -p /etc/libvirt/qemu/swtpm/tpm-states
# setup snapshot persistance.
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/
# create directory for pid file
mkdir -p $(dirname $LIBVIRTD_PIDFILE)

View File

@@ -22,16 +22,6 @@
# reclaim 1.6M of microcode files that are no longer needed
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"
/sbin/mount --bind --make-rshared /mnt /mnt
# 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
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
# Needed by dynamix
@@ -141,7 +131,7 @@ else
# Install any extra packages
if [[ -d /boot/extra ]]; then
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
# Install plugins
log "Installing plugins"

View File

@@ -1,11 +1,14 @@
#!/bin/bash
#
# script: rc.loop
#
# 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 ! lsmod | grep -wq "^loop" ; then
if modinfo loop &>/dev/null; then
if ! lsmod | grep -wq "^loop"; then
modprobe loop
fi
fi

View File

@@ -1,23 +1,28 @@
#!/bin/bash
#
#
# script: rc.mcelog
#
# Startup script for mcelog
#
# limetech - modified for Unraid OS: don't start if cpu not supported
# because ERROR message written to system log worries users
#
### BEGIN INIT INFO
# Provides: mcelog
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Short-Description: mcelog hardware error logging
# Description: Start the mcelog hardware error logging.
# This logs and handles CPU hardware errors on x86 systems.
### END INIT INFO
# Provides: mcelog
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Short-Description: mcelog hardware error logging
# Description: Start the mcelog hardware error logging.
# This logs and handles CPU hardware errors on x86 systems.
#
# LimeTech - don't start if cpu not supported because ERROR message written to system log worries users
# Bergware - modified for Unraid OS, October 2023
DAEMON="MCElog daemon"
# run & log functions
. /etc/rc.d/rc.runlog
# mcelog mode
# valid values: daemon, trigger, cron
# Recommended value daemon
MCELOG_MODE=daemon
MCELOG_MODE="daemon"
# additional options to pass to the daemon
# this only works in daemon mode
@@ -26,70 +31,101 @@ MCELOG_MODE=daemon
MCELOG_OPTIONS=""
# private settings
MCELOG=${MCELOG:-/usr/sbin/mcelog}
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 )
MCELOG="${MCELOG:-/usr/sbin/mcelog}"
TRIGGER="/sys/devices/system/machinecheck/machinecheck0/trigger"
case "$MCELOG_MODE" in
daemon)
;;
trigger)
;;
cron)
echo "mcelog not started"
exit 0
;;
*)
echo "Unknown mcelog mode $MCELOG_MODE. Valid daemon/trigger/cron"
exit 1
esac
[[ -x $MCELOG ]] || ( echo "mcelog not found"; exit 1 )
[[ -r /dev/mcelog ]] || ( echo "/dev/mcelog not active"; exit 0 )
mcelog_running(){
ps axc | grep -q ' mcelog'
}
mcelog_start(){
log "Starting $DAEMON..."
local REPLY
if [[ $MCELOG_MODE == daemon ]]; then
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
start)
if [ "$MCELOG_MODE" = "daemon" ] ; then
# ignorance is bliss I guess
$MCELOG --is-cpu-supported &> /dev/null || exit 1
echo "Starting mcelog daemon: $MCELOG --daemon $MCELOG_OPTIONS"
$MCELOG --daemon $MCELOG_OPTIONS
elif [ -f "$TRIGGER" ] ; then
echo $MCELOG > "$TRIGGER"
else
echo No machine check capability
fi
;;
stop)
if [ "$MCELOG_MODE" = "daemon" ] ; then
echo "Stopping mcelog daemon: killall -TERM $MCELOG"
killall -TERM $MCELOG
elif [ "$MCELOG_MODE" = "trigger" -a -f "$TRIGGER" ]; then
echo "" > "$TRIGGER"
else
echo mcelog not running
fi
;;
try-restart)
$0 status > /dev/null && $0 restart
;;
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
;;
'start')
mcelog_start
;;
'stop')
mcelog_stop
;;
'restart')
mcelog_restart
;;
'try-restart')
if mcelog_running; then
mcelog_restart
fi
;;
'reload')
if mcelog_running; then
mcelog_restart
fi
;;
'force-reload')
mcelog_restart
;;
'status')
mcelog_status
;;
*)
echo "Usage: $0 {start|stop|try-restart|restart|status|force-reload|reload}"
exit 1
echo "Usage: $BASENAME start|stop|restart|try-restart|reload|force-reload|status"
exit 1
esac
exit 0

View File

@@ -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 \
# and other messages. See http://www.freedesktop.org/software/dbus/
# messagebus: The D-BUS systemwide message bus
#
# description: This is a daemon which broadcasts notifications of system events \
# and other messages. See http://www.freedesktop.org/software/dbus/
#
# processname: dbus-daemon
# 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
# 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() {
mkdir -p $(dirname $PIDFILE)
if ! ps -u messagebus -c | grep -wq dbus-daemon; then
dbus_running(){
ps -u messagebus -c | grep -wq dbus-daemon
}
dbus_start(){
log "Starting $DAEMON..."
local REPLY
if dbus_running; then
REPLY="Already started"
else
mkdir -p $(dirname $PIDFILE)
rm -f $(dirname $PIDFILE)/*
if [ -x /usr/bin/dbus-uuidgen -a -x /usr/bin/dbus-daemon ] ; then
echo "Starting system message bus: /usr/bin/dbus-uuidgen --ensure ; /usr/bin/dbus-daemon --system"
/usr/bin/dbus-uuidgen --ensure
/usr/bin/dbus-daemon --system 1> /dev/null
if [[ -x /usr/bin/dbus-uuidgen && -x /usr/bin/dbus-daemon ]]; then
run /usr/bin/dbus-uuidgen --ensure
run /usr/bin/dbus-daemon --system
fi
if dbus_running; then REPLY="Started"; else REPLY="Failed"; fi
fi
log "$DAEMON... $REPLY."
}
stop() {
if [ -e "$PIDFILE" ]; then
echo "Stopping system message bus..."
pid=$(cat $PIDFILE)
kill $pid 1> /dev/null 2> /dev/null
dbus_stop(){
log "Stopping $DAEMON..."
local REPLY
if ! dbus_running; then
REPLY="Already stopped"
else
run kill $(cat $PIDFILE 2>/dev/null)
# Just in case:
killall dbus-daemon 1> /dev/null 2> /dev/null
run killall dbus-daemon
rm -f $PIDFILE
if ! dbus_running; then REPLY="Stopped"; else REPLY="Failed"; fi
fi
log "$DAEMON... $REPLY."
}
reload() {
echo "Reloading system message bus configuration..."
if [ -e "$PIDFILE" ]; then
dbus_reload(){
log "Reloading $DAEMON..."
if [[ -e $PIDFILE ]]; then
pid=$(cat $PIDFILE)
kill -HUP $pid
run kill -HUP $pid
else
killall -HUP dbus-daemon
run killall -HUP dbus-daemon
fi
log "$DAEMON... Reloaded."
}
status() {
if ps -u messagebus -c | grep -wq dbus-daemon; then
echo "System dbus-daemon is running."
dbus_status(){
if dbus_running; then
echo "$DAEMON is currently running."
else
echo "System dbus-daemon is stopped."
echo "$DAEMON is not running."
exit 1
fi
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
echo "You may need to restart your Window Manager to reconnect to the system dbus."
;;
reload)
reload
;;
status)
status
;;
*)
echo $"Usage: $0 {start|stop|restart|reload|status}"
;;
'start')
dbus_start
;;
'stop')
dbus_stop
;;
'restart')
dbus_stop
sleep 1
dbus_start
log "You may need to restart your Window Manager to reconnect to the system dbus."
;;
'reload')
dbus_reload
;;
'status')
dbus_status
;;
*)
echo "Usage: $BASENAME start|stop|restart|reload|status"
exit 1
;;
esac
exit 0

View File

@@ -1,32 +1,37 @@
#!/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:
RELEASE=$(uname -r)
# limetech - install third-party modules
echo "Installing third-party drivers:"
find /boot/config/plugins/*/packages/${RELEASE%%-*}/ -maxdepth 1 -type f 2>/dev/null | while read -r PKG
do
# run & log functions
. /etc/rc.d/rc.runlog
# 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 [[ -f $PKG.md5 ]]; then
SUM1=$(/usr/bin/md5sum $PKG)
SUM2=$(/usr/bin/cat $PKG.md5)
if [[ "${SUM1:0:31}" != "${SUM2:0:31}" ]]; then
echo "$PKG md5 error"
HASH1=$(md5sum $PKG)
HASH2=$(cat $PKG.md5)
if [[ ${HASH1:0:32} != ${HASH2:0:32} ]]; then
log "Package $PKG has MD5 error, not installing"
continue
fi
fi
if [[ -f $PKG.sha256 ]]; then
SUM1=$(/usr/bin/sha256sum $PKG)
SUM2=$(/usr/bin/cat $PKG.sha256)
if [[ "${SUM1:0:63}" != "${SUM2:0:63}" ]]; then
echo "$PKG sha256 error"
HASH1=$(sha256sum $PKG)
HASH2=$(cat $PKG.sha256)
if [[ ${HASH1:0:64} != ${HASH2:0:64} ]]; then
log "Package $PKG has SHA256 error, not installing"
continue
fi
fi
echo "installing $PKG"
log "Installing package: $PKG"
/sbin/installpkg $PKG
# force creating new modules.dep
rm -f /lib/modules/$RELEASE/modules.dep
@@ -34,23 +39,22 @@ do
done
# Update kernel module dependencies:
if [ -e "/lib/modules/$RELEASE/modules.dep" ]; then
echo "Updating module dependency list for $RELEASE: /sbin/depmod --quick"
if [[ -e /lib/modules/$RELEASE/modules.dep ]]; then
log "Updating module dependency list for $RELEASE: /sbin/depmod --quick"
/sbin/depmod --quick
else
echo "Creating module dependency list for $RELEASE: /sbin/depmod --all"
else
log "Creating module dependency list for $RELEASE: /sbin/depmod --all"
/sbin/depmod --all
fi
# Run any rc.modules-$(uname -r) file that exists (this is used
# if you have specific modules which should only be loaded for
# 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
fi
# 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
fi

View File

@@ -42,6 +42,7 @@ nfsd_running(){
nfsd_start(){
log "Starting $DAEMON..."
local REPLY
if nfsd_running; then
REPLY="Already started"
else
@@ -98,6 +99,7 @@ nfsd_start(){
nfsd_stop(){
log "Stopping $DAEMON..."
local REPLY
if ! nfsd_running; then
REPLY="Already stopped"
else
@@ -121,7 +123,7 @@ nfsd_restart(){
nfsd_reload(){
# restart without info
nfsd_restart 1>/dev/null 2>/dev/null
nfsd_restart &>/dev/null
}
nfsd_update(){

View File

@@ -9,8 +9,8 @@
# Bergware - modified for Unraid OS, October 2023
# reference:
# LANNAME 'tower'
# LANMDNS 'tower.local'
# LANNAME 'tower'
# LANMDNS 'tower.local'
# LANFQDN 'lan-ip.hash.myunraid.net' (wildcard cert)
# LANFQDN 'hash.unraid.net' (legacy cert)
# WANFQDN 'wan-ip.hash.myunraid.net' (wildcard cert)
@@ -607,8 +607,9 @@ nginx_check(){
nginx_start(){
log "Starting $DAEMON..."
local REPLY
if nginx_running; then
REPLY="Already running"
REPLY="Already started"
elif [[ ! -r $CONF ]]; then
# sanity checks, no config file, exit
log "$CONF does not exist, aborting."
@@ -629,19 +630,27 @@ nginx_start(){
nginx_stop(){
log "Stopping $DAEMON gracefully..."
local REPLY
if ! nginx_running; then
REPLY="Already stopped"
else
unraid_api_control stop
kill -QUIT $(cat $PID)
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
log "$DAEMON... $REPLY."
}
nginx_stop_forced(){
log "Stopping $DAEMON forcibly..."
local REPLY
if ! nginx_running; then
REPLY="Already stopped"
else

View File

@@ -46,6 +46,7 @@ ntpd_build(){
ntpd_start(){
log "Starting $DAEMON..."
local REPLY
# read Unraid settings
[[ -r $IDENT ]] && . <(fromdos <$IDENT)
# if ntp not enabled, don't start ntp
@@ -66,6 +67,7 @@ ntpd_start(){
ntpd_stop(){
log "Stopping $DAEMON..."
local REPLY
if ! ntpd_running; then
REPLY="Already stopped"
else

View File

@@ -1,8 +1,7 @@
#!/bin/bash
#
# LimeTech - Modified for Unraid OS
### BEGIN INIT INFO
# script: rc.php-fpm
#
# Provides: php-fpm
# Required-Start: $remote_fs $network
# Required-Stop: $remote_fs $network
@@ -10,150 +9,124 @@
# Default-Stop: 0 1 6
# Short-Description: starts php-fpm
# 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
exec_prefix=${prefix}
DAEMON="PHP-fpm daemon"
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
php_fpm_CONF=/etc/php-fpm.conf
php_fpm_PID=/var/run/php-fpm.pid
# run & log functions
. /etc/rc.d/rc.runlog
# 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_opts="--fpm-config $php_fpm_CONF --pid $php_fpm_PID --allow-to-run-as-root"
php_fpm_waitfor(){
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 () {
try=0
php_fpm_stop(){
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
'created')
if [ -f "$2" ] ; then
try=''
break
fi
;;
php_fpm_reload(){
log "Reloading $DAEMON..."
if [[ ! -r $PHP_FPM_PID ]]; then
log "$DAEMON... Warning, no pid file found."
exit 1
fi
kill -USR2 $(cat $PHP_FPM_PID)
log "$DAEMON... Reloaded."
}
'removed')
if [ ! -f "$2" ] ; then
try=''
break
fi
;;
esac
echo -n .
try=`expr $try + 1`
sleep 1
done
php_fpm_force_quit(){
log "Terminating $DAEMON..."
if [[ ! -r $PHP_FPM_PID ]]; then
log "$DAEMON... Warning, no pid file found."
exit 1
fi
kill -TERM $(cat $PHP_FPM_PID)
php_fpm_waitfor removed $PHP_FPM_PID
log "$DAEMON... $REPLY."
}
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
start)
echo -n "Starting php-fpm "
$php_fpm_BIN --daemonize $php_opts
if [ "$?" != 0 ] ; then
echo " failed"
exit 1
fi
wait_for_pid created $php_fpm_PID
if [ -n "$try" ] ; then
echo " failed"
exit 1
else
echo " done"
fi
;;
stop)
echo -n "Gracefully shutting down php-fpm "
if [ ! -r $php_fpm_PID ] ; then
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
;;
'start')
php_fpm_start
;;
'stop')
php_fpm_stop
;;
'restart')
php_fpm_restart
;;
'reload')
php_fpm_reload
;;
'force-quit')
php_fpm_force_quit
;;
'configtest')
$PHP_FPM_BIN -t
;;
'status')
php_fpm_status
;;
*)
echo "Usage: $BASENAME start|stop|restart|reload|force-quit|configtest|status"
exit 1
esac
exit 0

View File

@@ -36,6 +36,7 @@ rpc_running(){
rpc_start(){
log "Starting $DAEMON..."
local REPLY
if rpc_running; then
REPLY="Already started"
else
@@ -74,6 +75,7 @@ rpc_start(){
rpc_stop(){
log "Stopping $DAEMON..."
local REPLY
if ! rpc_running; then
REPLY="Already stopped"
else
@@ -98,7 +100,7 @@ rpc_restart(){
rpc_reload(){
# restart without info
rpc_restart 1>/dev/null 2>/dev/null
rpc_restart &>/dev/null
}
rpc_update(){

View File

@@ -29,6 +29,7 @@ create_xconsole(){
rsyslogd_start(){
log "Starting $DAEMON..."
local REPLY
if [[ -x /usr/sbin/rsyslogd ]]; then
run /usr/sbin/rsyslogd -i $PIDFILE
REPLY="Started"

View File

@@ -10,19 +10,16 @@ BASENAME=$(basename "$0")
run(){
# log command to syslog
logger -t $BASENAME -- "$*"
/usr/bin/logger -t $BASENAME -- "$*"
# run command - dismiss all output
$* 1>/dev/null 2>/dev/null
$* &>/dev/null
}
log(){
if [[ ! -t 0 ]]; then
# log message to syslog
while IFS='\n' read -r LINE; do
logger -t $BASENAME -- "$LINE"
done <<< ${1:-$(</dev/stdin)}
else
# echo message to console
[[ -n $1 ]] && echo "$1"
fi
# log message to syslog
while IFS=$'\n' read -r LINE; do
/usr/bin/logger -t $BASENAME -- "$LINE"
done <<< ${1:-$(</dev/stdin)}
# echo message to console
[[ -t 1 && -n $1 ]] && /bin/echo "$BASENAME: $1"
}

View File

@@ -113,6 +113,7 @@ samba_settings(){
samba_start(){
log "Starting $DAEMON..."
local REPLY
if samba_running; then
REPLY="Already started"
else
@@ -139,6 +140,7 @@ samba_start(){
samba_stop(){
log "Stopping $DAEMON..."
local REPLY
if ! samba_running; then
REPLY="Already stopped"
else

View File

@@ -1,7 +1,8 @@
#!/bin/bash
#
# /etc/rc.serial
# Initializes the serial ports on your system
# script: rc.serial
#
# Initializes the serial ports on your system
#
# chkconfig: 2345 50 75
# description: This initializes the settings of the serial port
@@ -9,126 +10,118 @@
# FILE_VERSION: 19981128
#
# 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.
#
#
# XXXX For now, the autosave feature doesn't work if you are
# 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
DIRS="/lib/modules/`uname -r`/misc /lib/modules /usr/lib/modules ."
# Set the path.
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"
SERIAL="/etc/serial.conf"
ALLDEVS="/dev/ttyS?"
if /bin/ls /dev/ttyS?? >& /dev/null ; then
ALLDEVS="$ALLDEVS /dev/ttyS??"
fi
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=""
if test -f /proc/devices; then
if grep -q " ttyS$" /proc/devices ; then
LOADED="yes"
else
LOADED="no"
fi
# run & log functions
. /etc/rc.d/rc.runlog
if ls /dev/ttyS?? >& /dev/null; then
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
#
# Find the serial driver
#
for i in $DIRS
do
if test -z "$MODULE" -a -f $i/$DRIVER.o ; then
MODULE=$i/$DRIVER.o
fi
for i in $DIRS; do
if [[ -z $MODULE && -f $i/$DRIVER.o ]]; then
MODULE=$i/$DRIVER.o
fi
done
[[ -f /proc/modules ]] || MODULE=""
if ! test -f /proc/modules ; then
MODULE=""
fi
#
# Handle System V init conventions...
#
case $1 in
start)
action="start";
;;
stop)
action="stop";
;;
case "$1" in
'start')
action="start"
;;
'stop')
action="stop"
;;
*)
action="start";
action="start"
esac
if test $action = stop ; then
if test -n ${SETSERIAL} -a "$LOADED" != "no" -a \
`head -1 /etc/serial.conf`X = "###AUTOSAVE###X" ; then
echo -n "Saving state of serial devices... "
grep "^#" /etc/serial.conf > /etc/.serial.conf.new
${SETSERIAL} -G -g ${ALLDEVS} >> /etc/.serial.conf.new
mv /etc/serial.conf /etc/.serial.conf.old
mv /etc/.serial.conf.new /etc/serial.conf
echo "done."
fi
if test -n "$MODULE" ; then
module=`grep $MODULE_REGEXP /proc/modules | awk '{print $1}'`
if test -z "$module" ; then
echo "The $DRIVER_NAME driver is not loaded."
rm -f ${RCLOCKFILE}
exit 0
fi
if rmmod $module ; then :; else
echo "The $DRIVER_NAME driver could NOT be unloaded."
exit 1;
fi
echo "The $DRIVER_NAME driver has been unloaded."
fi
rm -f ${RCLOCKFILE}
exit 0
if [[ $action == stop ]]; then
if [[ -n $SETSERIAL && $LOADED != no && "$(head -1 $SERIAL)X" == "###AUTOSAVE###X" ]]; then
log "Saving state of serial devices."
grep "^#" $SERIAL >/etc/.serial.conf.new
$SETSERIAL -G -g $ALLDEVS >>/etc/.serial.conf.new
mv $SERIAL /etc/.serial.conf.old
mv /etc/.serial.conf.new $SERIAL
fi
if [[ -n $MODULE ]]; then
MODULE=$(grep $MODULE_REGEXP /proc/modules | awk '{print $1}')
if [[ -z $MODULE ]]; then
log "The $DRIVER_NAME driver is not loaded."
rm -f $RCLOCKFILE
exit 0
fi
if ! rmmod $MODULE; then
log "The $DRIVER_NAME driver could NOT be unloaded."
exit 1
fi
log "The $DRIVER_NAME driver has been unloaded."
fi
rm -f $RCLOCKFILE
exit 0
fi
#
# If not stop, it must be a start....
#
if test -n "$MODULE" -a "$LOADED" != "yes" ; then
if insmod -f $MODULE $DRIVER_ARG ; then
true
else
echo "Couldn't load $DRIVER_NAME driver."
exit 1
fi
if [[ -n $MODULE && $LOADED != yes ]]; then
if insmod -f $MODULE $DRIVER_ARG; then
true
else
log "Couldn't load $DRIVER_NAME driver."
exit 1
fi
fi
if test -f /etc/serial.conf ; then
if test -n ${SETSERIAL} ; then
grep -v ^# < /etc/serial.conf | while read device args
do
if [ ! "$device" = "" -a ! "$args" = "" ]; then
${SETSERIAL} -z $device $args
fi
done
fi
if [[ -f $SERIAL ]]; then
if [[ -n $SETSERIAL ]]; then
grep -v ^# <$SERIAL | while read DEVICE ARGS; do
if [[ -n $DEVICE && -n $ARGS ]]; then
$SETSERIAL -z $DEVICE $ARGS
fi
done
fi
else
echo "###AUTOSAVE###" > /etc/serial.conf
echo "###AUTOSAVE###" >$SERIAL
fi
touch ${RCLOCKFILE}
${SETSERIAL} -bg ${ALLDEVS}
touch $RCLOCKFILE
$SETSERIAL -bg $ALLDEVS
exit 0

View File

@@ -1,13 +1,16 @@
#!/bin/sh
#!/bin/bash
#
# script: rc.setterm
#
# This file provides the command line for the setterm utility to set the
# terminal attributes (primarily used for screen blanking and power
# management).
# terminal attributes (primarily used for screen blanking and power 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
# 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:
#/bin/setterm -blank 0 -powersave off -powerdown 0
# setterm -blank 0 -powersave off -powerdown 0

View File

@@ -39,6 +39,7 @@ sshd_build(){
sshd_start(){
log "Starting $DAEMON..."
local REPLY
if sshd_running; then
REPLY="Already started"
else
@@ -60,6 +61,7 @@ sshd_start(){
}
sshd_stop(){
local REPLY
if ! sshd_running; then
REPLY="Already stopped"
else

View File

@@ -1,25 +1,30 @@
#!/bin/bash
#
# rc.sysvinit This file provides basic compatibility with SystemV style
# 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.
# script: rc.sysvinit
#
# However, many binary packages exist that install SystemV
# 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.
# This file provides basic compatibility with SystemV style
# 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.
#
# Written by Patrick Volkerding <volkerdi@slackware.com>, 1999
# from an example by Miquel van Smoorenburg <miquels@cistron.nl>.
# However, many binary packages exist that install SystemV
# 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:
startup() {
startup(){
case "$1" in
*.sh)
sh "$@"
@@ -33,7 +38,7 @@ startup() {
# Set onlcr to avoid staircase effect.
stty onlcr 0>&1
if [ "$runlevel" = "" ]; then
if [[ -z $runlevel ]]; then
runlevel=$RUNLEVEL
export runlevel
prevlevel=$PREVLEVEL
@@ -41,16 +46,16 @@ if [ "$runlevel" = "" ]; then
fi
# Run kill scripts:
for script in /etc/rc.d/rc$runlevel.d/K* ; do
if [ -x $script ]; then
startup $script stop
for SCRIPT in /etc/rc.d/rc$runlevel.d/K*; do
if [[ -x $SCRIPT ]]; then
startup $SCRIPT stop
fi
done
# Now do the startup scripts:
for script in /etc/rc.d/rc$runlevel.d/S* ; do
if [ -x $script ]; then
startup $script start
for SCRIPT in /etc/rc.d/rc$runlevel.d/S*; do
if [[ -x $SCRIPT ]]; then
startup $SCRIPT start
fi
done
exit 0

View File

@@ -1,28 +1,34 @@
#!/bin/bash
#
# script: rc.udev
#
# This is a script to initialize udev, which populates the /dev
# directory with device nodes, scans for devices, loads the
# appropriate kernel modules, and configures the devices.
#
# LimeTech - modified for Unraid OS
# Bergware - modified for Unraid OS, October 2023
# limetech - modified for Unraid OS
# bergware - added persistent network assignment
# Set the path.
PATH=/sbin:/bin
PATH="/sbin:/bin"
# run & log functions
. /etc/rc.d/rc.runlog
check_mounted() {
grep -E -q "^[^[:space:]]+ $1 $2" /proc/mounts
return $?
check_mounted(){
grep -Eq "^[^[:space:]]+ $1 $2" /proc/mounts
}
mount_devpts() {
mount_devpts(){
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
fi
}
mount_devshm() {
mount_devshm(){
if ! check_mounted /dev/shm tmpfs; then
mkdir /dev/shm 2> /dev/null
mkdir /dev/shm 2>/dev/null
mount /dev/shm
fi
}
@@ -31,47 +37,39 @@ case "$1" in
'start')
# Sanity check #1, udev requires that the kernel support tmpfs:
if ! grep -wq tmpfs /proc/filesystems; then
echo "Sorry, but you need tmpfs support in the kernel to use udev."
echo
echo "FATAL: Refusing to run /etc/rc.d/rc.udev."
log "Sorry, but you need tmpfs support in the kernel to use udev."
log "FATAL: Refusing to run /etc/rc.d/rc.udev."
exit 1
fi
# 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 3 -d . | sed 's/[^[:digit:]].*//')" -lt "32" ]; then
echo "Sorry, but you need a 2.6.32+ kernel to use this udev."
echo "Your kernel version is only $(uname -r)."
echo
echo "FATAL: Refusing to run /etc/rc.d/rc.udev."
if [[ $(uname -r | cut -f 1,2 -d .) == 2.6 ]]; then
if [[ $(uname -r | cut -f 3 -d . | sed 's/[^[:digit:]].*//') -lt 32 ]]; then
log "Sorry, but you need a 2.6.32+ kernel to use this udev."
log "Your kernel version is only $(uname -r)."
log "FATAL: Refusing to run /etc/rc.d/rc.udev."
exit 1
fi
fi
# 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
# problems:
if [[ ! -x /sbin/udevd ]]; then
chmod 0644 /etc/rc.d/rc.udev
echo "No udevd daemon found."
echo "Turning off udev: chmod 644 /etc/rc.d/rc.udev"
echo "FATAL: Refusing to run /etc/rc.d/rc.udev."
log "No udevd daemon found."
log "Turning off udev: chmod 644 /etc/rc.d/rc.udev"
log "FATAL: Refusing to run /etc/rc.d/rc.udev."
exit 1
fi
# Disable hotplug helper since udevd listens to netlink:
if [[ -e /proc/sys/kernel/hotplug ]]; then
echo "" > /proc/sys/kernel/hotplug
echo >/proc/sys/kernel/hotplug
fi
if grep -qw devtmpfs /proc/filesystems; then
if ! check_mounted /dev devtmpfs; then
# umount shm if needed
check_mounted /dev/shm tmpfs && umount -l /dev/shm
# Umount pts if needed, we will remount it later:
check_mounted /dev/pts devpts && umount -l /dev/pts
# Mount tmpfs on /dev:
mount -n -t devtmpfs -o size=8M devtmpfs /dev
fi
@@ -80,24 +78,20 @@ case "$1" in
if ! check_mounted /dev tmpfs; then
# umount shm if needed
check_mounted /dev/shm tmpfs && umount -l /dev/shm
# Umount pts if needed, we will remount it later:
check_mounted /dev/pts devpts && umount -l /dev/pts
# Mount tmpfs on /dev:
# the -n is because we don't want /dev umounted when
# someone (rc.[06]) calls umount -a
mount -n -o mode=0755 -t tmpfs -o size=8M tmpfs /dev
fi
fi
# Mount devpts
mount_devpts
mount_devshm
if ! /sbin/pidof udevd 1>/dev/null 2>/dev/null; then # start udevd
echo "Creating static nodes in /dev."
kmod static-nodes -f tmpfiles --output /run/static-nodes
if ! pidof udevd &>/dev/null; then # start udevd
log "Creating static nodes in /dev."
run kmod static-nodes -f tmpfiles --output /run/static-nodes
grep "^d " /run/static-nodes | while read line; do
mkdir -p -m $(echo $line | cut -f 3 -d ' ') $(echo $line | cut -f 2 -d ' ')
done
@@ -106,33 +100,33 @@ case "$1" in
$(echo $line | cut -f 2 -d ' ') \
$(echo $line | cut -b1 ) \
$(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
rm -f /run/static-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:
cp --preserve=all --recursive --update /etc/udev/devices/* /dev 2> /dev/null
echo "Starting udevd: /sbin/udevd --daemon"
/sbin/udevd --daemon
cp --preserve=all --recursive --update /etc/udev/devices/* /dev 2>/dev/null
log "Starting udevd: /sbin/udevd --daemon"
run udevd --daemon
# 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:
/sbin/udevadm trigger --type=subsystems --action=add
/sbin/udevadm trigger --type=devices --action=add
run udevadm trigger --type=subsystems --action=add
run udevadm trigger --type=devices --action=add
else # trigger changes for already running udevd
# bergware - set file references
# Bergware - set file references
RAM=/etc/udev/rules.d/70-persistent-net.rules
ROM=/boot/config/network-rules.cfg
MAC='ATTR{address}=="\K..:..:..:..:..:..'
# If the persistent network rules file does not exist, trigger an add event:
if [[ ! -r $RAM ]]; then
# 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
# This should add persistent net rules:
echo "Triggering udev to write persistent rules to /etc/udev/rules.d/"
/sbin/udevadm trigger --type=devices --action=add
log "Triggering udev to write persistent rules to /etc/udev/rules.d/"
run udevadm trigger --type=devices --action=add
sleep 3
# Create the files if they don't exist at this point.
# If a machine does not have a network device or an optical
@@ -142,86 +136,77 @@ case "$1" in
touch $RAM
fi
fi
# bergware - start of code
# Bergware - start of code
if [[ -f $ROM ]]; then
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
/sbin/udevadm control --reload
# bergware - find the unique drivers currently in use by the interface(s)
udevadm control --reload
# Bergware - find the unique drivers currently in use by the interface(s)
DRIVERS=
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+')
[[ $DRIVERS != *$DRIVER* ]] && DRIVERS="$DRIVERS $DRIVER"
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 -a $DRIVERS
# bergware - check for changes and save them
# Bergware - check for changes and save them
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
fi
else
# bergware - remove leading remarks in file
# Bergware - remove leading remarks in file
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
fi
# bergware - end of code
# Bergware - end of code
# 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
echo "Updating hardware database index: /sbin/udevadm hwdb --update"
/sbin/udevadm hwdb --update
log "Updating hardware database index: udevadm hwdb --update"
run udevadm hwdb --update
fi
# Since udevd is running, most of the time we only need change events:
echo "Triggering udev events: /sbin/udevadm trigger --action=change"
/sbin/udevadm trigger --type=subsystems --action=change
/sbin/udevadm trigger --type=devices --action=change
log "Triggering udev events: udevadm trigger --action=change"
run udevadm trigger --type=subsystems --action=change
run udevadm trigger --type=devices --action=change
fi
/sbin/udevadm settle --timeout=120
udevadm settle --timeout=120
;;
'stop')
echo "Stopping udevd is STRONGLY discouraged and not supported."
echo "If you are sure you want to do this, use 'force-stop' instead."
log "Stopping udevd is STRONGLY discouraged and not supported."
log "If you are sure you want to do this, use 'force-stop' instead."
;;
'restart')
echo "Restarting udevd is STRONGLY discouraged and not supported."
echo "If you are sure you want to do this, use 'force-restart' instead."
log "Restarting udevd is STRONGLY discouraged and not supported."
log "If you are sure you want to do this, use 'force-restart' instead."
;;
'reload')
echo "Reloading udev rules"
log "Reloading udev rules"
udevadm control --reload
;;
'force-stop')
echo "Stopping udevd"
log "Stopping udevd"
udevadm control --exit
killall udevd 2>/dev/null
;;
'force-restart')
echo "Restarting udevd"
log "Restarting udevd"
udevadm control --exit
sleep 3
udevd --daemon
;;
'force-reload')
echo "Updating all available device nodes in /dev"
log "Updating all available device nodes in /dev"
udevadm control --reload
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
;;
esac
exit 0

View File

@@ -1,6 +1,6 @@
#!/bin/sh
#!/bin/bash
#
# /etc/rc.d/rc.wsdd2
# script: rc.wsdd2
#
# start/stop/restart the wsdd2 daemon.
#
@@ -8,40 +8,72 @@
# file is executable, and add the following entry to rc.local
# 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
# fi
# you may also add the following entry to rc.local_shutdown
# (uncommented)
# if [ -x /etc/rc.d/rc.wsdd2 ]; then
# if [[ -x /etc/rc.d/rc.wsdd2 ]]; then
# /etc/rc.d/rc.wsdd2 stop
# fi
wsdd2_start() {
if [ -r /etc/samba/smb.conf -a -x /etc/rc.d/rc.samba -a -x /usr/sbin/wsdd2 ]; then
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_running(){
ps axc | grep -q ' wsdd2'
}
wsdd2_stop() {
#check something is running before trying to kill it.
if [ "x`ps -A|grep ' wsdd2'|wc -l`" != "x0" ]; then
wsdd2_start(){
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
if ! wsdd2_running; then REPLY="Stopped"; else REPLY="Failed"; fi
fi
log "$DAEMON... $REPLY."
}
wsdd2_restart() {
wsdd2_restart(){
log "Restarting $DAEMON..."
wsdd2_stop
sleep 1
wsdd2_start
}
case "$1" in
'start')
#we don't want to run this more than once,
#so kill off any instance already running
# we don't want to run this more than once,
# so kill off any instance already running
wsdd2_stop
wsdd2_start
;;
@@ -55,4 +87,4 @@ case "$1" in
# default is start
wsdd2_start
esac
exit 0

View File

@@ -225,7 +225,7 @@ done
# atomically update file
mv $INI ${INI%.*}
log "hook services: interface=${interface:-$1}, reason=$reason, protocol=$protocol"
log "interface=${interface:-$1}, reason=$reason, protocol=$protocol"
# delayed execution
/usr/local/emhttp/webGui/scripts/update_services 30

View File

@@ -1,55 +1,64 @@
#!/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:
# emhttp [OPER]
#
# OPER is start or stop. Default is start.
#
# The protocol schemes and ports recognized by nginx are defined by these variables
# in the file /boot/config/ident.cfg:
# USE_SSL="no"|"yes"|"only"|"auto" default: "auto"
# PORT=<http listening port number> default: 80
# PORTSSL=<https listening port number> default: 443
# Refer to /etc/rc.d/rc.nginx
#
# Backward-compatibility Usage:
# 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
# accepted and dropped.
# run & log functions
. /etc/rc.d/rc.runlog
while getopts ":p:r" opt; do
case $opt in
p ) ;;
r ) ;;
* ) echo "unknown option $opt"
exit 1
while getopts ":p:r" OPT; do
case $OPT in
p) ;;
r) ;;
*) echo "unknown option $OPT"
exit 1
esac
done
shift $((OPTIND-1))
[[ "$1" ]] && OPER=$1 || OPER="start"
if [[ "$OPER" = "stop" ]]; then
case "${1:-start}" in
'start')
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.php-fpm stop
echo "Stopping emhttpd"
log "Stopping emhttpd..."
pkill emhttpd
rmmod md-mod
exit
elif [[ "$OPER" != "start" ]]; then
echo "unknown operation: $1"
log "All services... Stopped."
;;
*)
echo "Unknown operation: $1"
exit 1
fi
# 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
esac
exit 0

View File

@@ -5,9 +5,6 @@ disk_load=/var/local/emhttp/diskload.ini # disk load statistics
nginx=/var/run/nginx.socket # nginx local access
status=http://localhost/pub/session?buffer_length=1 # nchan information about GUI subscribers
# run & log functions
. /etc/rc.d/rc.runlog
while :; do
# only act when GUI registered nchan processes are running
if [[ -e $nchan_pid ]]; then
@@ -18,7 +15,7 @@ while :; do
# steady state?
subs=$(curl --unix-socket $nginx $status 2>/dev/null|grep -Pom1 'subscribers: \K\d+')
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
while IFS=$'\n' read -r running; do
pkill -f $docroot/${running/:stop/}