Merge pull request #56 from yakatz/beep

Option to disable startup/shutdown sounds
This commit is contained in:
Chris Buechler 2012-02-22 21:37:59 -08:00
commit a2263f0cd8
4 changed files with 48 additions and 0 deletions

View File

@ -927,6 +927,29 @@ function auto_login() {
conf_mount_ro();
}
function setup_beep() {
global $config;
if(isset($config['system']['disablebeep']))
$status = false;
else
$status = true;
$beep_file = "/etc/disable_beep";
conf_mount_rw();
if($status == false) {
touch($beep_file);
} else {
if (file_exists($beep_file)) {
unlink($beep_file);
}
}
conf_mount_ro();
}
function setup_serial_port($when="save", $path="") {
global $g, $config;
conf_mount_rw();

View File

@ -360,6 +360,9 @@ system_set_harddisk_standby();
/* lock down console if necessary */
auto_login();
/* disable beep.sh if configured */
setup_beep();
/* load graphing functions */
enable_rrd_graphing();

View File

@ -1,5 +1,9 @@
#!/bin/sh
if [ -f /etc/disable_beep ]; then
exit;
fi
# Standard note length
NOTELENGTH="25"

View File

@ -55,6 +55,7 @@ $pconfig['max_procs'] = ($config['system']['webgui']['max_procs']) ? $config['sy
$pconfig['ssl-certref'] = $config['system']['webgui']['ssl-certref'];
$pconfig['disablehttpredirect'] = isset($config['system']['webgui']['disablehttpredirect']);
$pconfig['disableconsolemenu'] = isset($config['system']['disableconsolemenu']);
$pconfig['disablebeep'] = isset($config['system']['disablebeep']);
$pconfig['noantilockout'] = isset($config['system']['webgui']['noantilockout']);
$pconfig['nodnsrebindcheck'] = isset($config['system']['webgui']['nodnsrebindcheck']);
$pconfig['nohttpreferercheck'] = isset($config['system']['webgui']['nohttpreferercheck']);
@ -141,6 +142,14 @@ if ($_POST) {
auto_login();
}
if($_POST['disablebeep'] == "yes") {
$config['system']['disablebeep'] = true;
setup_beep();
} else {
unset($config['system']['disablebeep']);
setup_beep();
}
if ($_POST['noantilockout'] == "yes")
$config['system']['webgui']['noantilockout'] = true;
else
@ -394,6 +403,15 @@ function prot_change() {
?>
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("Startup/Showtdown Sound"); ?></td>
<td width="78%" class="vtable">
<input name="disablebeep" type="checkbox" id="disablebeep" value="yes" <?php if ($pconfig['disablebeep']) echo "checked"; ?> />
<strong><?=gettext("Disable the startup/shutdown beep"); ?></strong>
<br/>
<span class="vexpl"><?=gettext("When this is checked, startup and shutdown sounds will no longer play."); ?></span>
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("Anti-lockout"); ?></td>
<td width="78%" class="vtable">