diff options
author | Scott Ullrich <sullrich@pfsense.org> | 2010-05-18 17:59:41 -0400 |
---|---|---|
committer | Scott Ullrich <sullrich@pfsense.org> | 2010-05-18 17:59:41 -0400 |
commit | fa83737d06c403f3d49c405052a1ec97fbf8146a (patch) | |
tree | dd657496f85335b785f09bcdf6c54ecb4184cdc5 /etc/inc | |
parent | 7188fc6db5548d66b24859e7252a1a17e2dac7d4 (diff) | |
download | pfsense-fa83737d06c403f3d49c405052a1ec97fbf8146a.zip pfsense-fa83737d06c403f3d49c405052a1ec97fbf8146a.tar.gz |
Only check g['platform'] for nanobsd
Diffstat (limited to 'etc/inc')
-rw-r--r-- | etc/inc/system.inc | 82 |
1 files changed, 3 insertions, 79 deletions
diff --git a/etc/inc/system.inc b/etc/inc/system.inc index 7756113..da34e66 100644 --- a/etc/inc/system.inc +++ b/etc/inc/system.inc @@ -1341,7 +1341,9 @@ function enable_watchdog() { } function system_check_reset_button() { - $specplatform = system_identify_specific_platform(); + global $g; + if(!$g['platform'] == "nanobsd") + return 0; if ($specplatform['name'] != "wrap" && $specplatform['name'] != "alix") return 0; @@ -1369,82 +1371,4 @@ EOD; return 0; } -/* attempt to identify the specific platform (for embedded systems) - Returns an array with two elements: - name => platform string (e.g. 'wrap', 'alix' etc.) - descr => human-readable description (e.g. "PC Engines WRAP") -*/ -function system_identify_specific_platform() { - global $g; - - if ($g['platform'] == 'generic-pc') - return array('name' => 'generic-pc', 'descr' => "Generic PC"); - - if ($g['platform'] == 'generic-pc-cdrom') - return array('name' => 'generic-pc-cdrom', 'descr' => "Generic PC (CD-ROM)"); - - /* the rest of the code only deals with 'embedded' platforms */ - if ($g['platform'] != 'embedded') - return array('name' => $g['platform'], 'descr' => $g['platform']); - - $dmesg = system_get_dmesg_boot(); - - if (strpos($dmesg, "PC Engines WRAP") !== false) - return array('name' => 'wrap', 'descr' => 'PC Engines WRAP'); - - if (strpos($dmesg, "PC Engines ALIX") !== false) - return array('name' => 'alix', 'descr' => 'PC Engines ALIX'); - - if (preg_match("/Soekris net45../", $dmesg, $matches)) - return array('name' => 'net45xx', 'descr' => $matches[0]); - - if (preg_match("/Soekris net48../", $dmesg, $matches)) - return array('name' => 'net48xx', 'descr' => $matches[0]); - - if (preg_match("/Soekris net55../", $dmesg, $matches)) - return array('name' => 'net55xx', 'descr' => $matches[0]); - - /* unknown embedded platform */ - return array('name' => 'embedded', 'descr' => 'embedded (unknown)'); -} - -function system_get_dmesg_boot() { - global $g; - - if (!file_exists("{$g['varlog_path']}/dmesg.boot")) - system_dmesg_save(); - - return file_get_contents("{$g['varlog_path']}/dmesg.boot"); -} - -function system_dmesg_save() { - global $g; - - if (file_exists("{$g['varlog_path']}/dmesg.boot")) - return 0; /* nothing to do */ - - exec("/sbin/dmesg", $dmesg); - - /* find last copyright line (output from previous boots may be present) */ - $lastcpline = 0; - - for ($i = 0; $i < count($dmesg); $i++) { - if (strstr($dmesg[$i], "Copyright (c) 1992-")) - $lastcpline = $i; - } - - $fd = fopen("{$g['varlog_path']}/dmesg.boot", "w"); - if (!$fd) { - printf("Error: cannot open dmesg.boot in system_dmesg_save().\n"); - return 1; - } - - for ($i = $lastcpline; $i < count($dmesg); $i++) - fwrite($fd, $dmesg[$i] . "\n"); - - fclose($fd); - - return 0; -} - ?>
\ No newline at end of file |