summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--etc/inc/pfsense-utils.inc75
-rwxr-xr-xusr/local/www/diag_backup.php1
-rwxr-xr-xusr/local/www/system_advanced.php47
3 files changed, 76 insertions, 47 deletions
diff --git a/etc/inc/pfsense-utils.inc b/etc/inc/pfsense-utils.inc
index fed82ec..0686079 100644
--- a/etc/inc/pfsense-utils.inc
+++ b/etc/inc/pfsense-utils.inc
@@ -1606,6 +1606,79 @@ function reload_all_sync() {
}
+function auto_login($status) {
+ $gettytab = file_get_contents("/etc/gettytab");
+ $getty_split = split("\n", $gettytab);
+ conf_mount_rw();
+ $fd = fopen("/etc/gettytab", "w");
+ foreach($getty_split as $gs) {
+ if(stristr($gs, "cb:ce:ck:lc") == true) {
+ if($status == true) {
+ fwrite($fd, ":cb:ce:ck:lc:fd#1000:im=\\r\\n%s/%m (%h) (%t)\\r\\n\\r\\n:sp#1200:\\\n");
+ } else {
+ fwrite($fd, ":al=root:cb:ce:ck:lc:fd#1000:im=\\r\\n%s/%m (%h) (%t)\\r\\n\\r\\n:sp#1200:\\\n");
+ }
+ } else {
+ fwrite($fd, "{$gs}\n");
+ }
+ }
+ fclose($fd);
+ conf_mount_ro();
+}
+
+function setup_serial_port() {
+ global $g, $config;
+ /* serial console - write out /boot.config */
+ if(file_exists("/boot.config"))
+ $boot_config = file_get_contents("/boot.config");
+ else
+ $boot_config = "";
+
+ if($g['platform'] <> "cdrom") {
+ $boot_config_split = split("\n", $boot_config);
+ $fd = fopen("/boot.config","w");
+ if($fd) {
+ foreach($boot_config_split as $bcs) {
+ if(stristr($bcs, "-D")) {
+ /* DONT WRITE OUT, WE'LL DO IT LATER */
+ } else {
+ if($bcs <> "")
+ fwrite($fd, "{$bcs}\n");
+ }
+ }
+ if(isset($config['system']['enableserial'])) {
+ fwrite($fd, "-D");
+ }
+ fclose($fd);
+ }
+ /* serial console - write out /boot/loader.conf */
+ $boot_config = file_get_contents("/boot/loader.conf");
+ $boot_config_split = split("\n", $boot_config);
+ $fd = fopen("/boot/loader.conf","w");
+ if($fd) {
+ foreach($boot_config_split as $bcs) {
+ if(stristr($bcs, "console")) {
+ /* DONT WRITE OUT, WE'LL DO IT LATER */
+ } else {
+ if($bcs <> "")
+ fwrite($fd, "{$bcs}\n");
+ }
+ }
+ if(isset($config['system']['enableserial'])) {
+ fwrite($fd, "console=\"comconsole\"\n");
+ }
+ fclose($fd);
+ }
+ }
+ if(isset($config['system']['disableconsolemenu'])) {
+ auto_login(true);
+ } else {
+ auto_login(false);
+ }
+ conf_mount_ro();
+ return;
+}
+
function print_value_list($list, $count = 10, $separator = ",") {
$list = implode($separator, array_slice($list, 0, $count));
if(count($list) < $count) {
@@ -1616,4 +1689,4 @@ function print_value_list($list, $count = 10, $separator = ",") {
return $list;
}
-?>
+?> \ No newline at end of file
diff --git a/usr/local/www/diag_backup.php b/usr/local/www/diag_backup.php
index bdd01ac..d27155a 100755
--- a/usr/local/www/diag_backup.php
+++ b/usr/local/www/diag_backup.php
@@ -171,6 +171,7 @@ if ($_POST) {
$savemsg = "The configuration has been restored.<p>The firewall is now rebooting due to captive portal.";
$reboot_needed = true;
}
+ setup_serial_port();
} else {
$input_errors[] = "The configuration could not be restored.";
}
diff --git a/usr/local/www/system_advanced.php b/usr/local/www/system_advanced.php
index dc77910..44bb1b2 100755
--- a/usr/local/www/system_advanced.php
+++ b/usr/local/www/system_advanced.php
@@ -216,53 +216,8 @@ if ($_POST) {
$savemsg = $retval;
$retval |= interfaces_optional_configure();
config_unlock();
-
- conf_mount_rw();
-
- /* serial console - write out /boot.config */
- if(file_exists("/boot.config"))
- $boot_config = file_get_contents("/boot.config");
- else
- $boot_config = "";
- $boot_config_split = split("\n", $boot_config);
- if($g['platform'] <> "cdrom") {
- $fd = fopen("/boot.config","w");
- if($fd) {
- foreach($boot_config_split as $bcs) {
- if(stristr($bcs, "-D")) {
- /* DONT WRITE OUT, WE'LL DO IT LATER */
- } else {
- if($bcs <> "")
- fwrite($fd, "{$bcs}\n");
- }
- }
- if(isset($config['system']['enableserial'])) {
- fwrite($fd, "-D");
- }
- fclose($fd);
- }
- /* serial console - write out /boot/loader.conf */
- $boot_config = file_get_contents("/boot/loader.conf");
- $boot_config_split = split("\n", $boot_config);
- $fd = fopen("/boot/loader.conf","w");
- if($fd) {
- foreach($boot_config_split as $bcs) {
- if(stristr($bcs, "console")) {
- /* DONT WRITE OUT, WE'LL DO IT LATER */
- } else {
- if($bcs <> "")
- fwrite($fd, "{$bcs}\n");
- }
- }
- if(isset($config['system']['enableserial'])) {
- fwrite($fd, "console=\"comconsole\"\n");
- }
- fclose($fd);
- }
- }
-
- conf_mount_ro();
+ setup_serial_port();
setup_filter_bridge();
OpenPOWER on IntegriCloud