Revision 5f36c658
Added by Jim Pingle over 14 years ago
etc/inc/pfsense-utils.inc | ||
---|---|---|
978 | 978 |
} |
979 | 979 |
/* serial console - write out /boot/loader.conf */ |
980 | 980 |
$boot_config = file_get_contents("/boot/loader.conf"); |
981 |
$boot_config_split = split("\n", $boot_config); |
|
982 |
$fd = fopen("/boot/loader.conf","w"); |
|
983 |
if($fd) { |
|
984 |
foreach($boot_config_split as $bcs) { |
|
985 |
if(stristr($bcs, "console")) { |
|
986 |
/* DONT WRITE OUT, WE'LL DO IT LATER */ |
|
987 |
} else { |
|
988 |
if($bcs <> "") |
|
989 |
fwrite($fd, "{$bcs}\n"); |
|
990 |
} |
|
991 |
} |
|
992 |
if(isset($config['system']['enableserial'])) { |
|
993 |
fwrite($fd, "console=\"comconsole\"\n"); |
|
994 |
} |
|
995 |
fclose($fd); |
|
981 |
$boot_config_split = explode("\n", $boot_config); |
|
982 |
if(count($boot_config_split) > 0) { |
|
983 |
$new_boot_config = array(); |
|
984 |
// Loop through and only add lines that are not empty, and which |
|
985 |
// do not contain a console directive. |
|
986 |
foreach($boot_config_split as $bcs) |
|
987 |
if(!empty($bcs) && (stripos($bcs, "console") === false)) |
|
988 |
$new_boot_config[] = $bcs; |
|
989 |
|
|
990 |
if(isset($config['system']['enableserial'])) |
|
991 |
$new_boot_config[] = 'console="comconsole"'); |
|
992 |
file_put_contents("/boot/loader.conf", implode("\n", $new_boot_config)); |
|
996 | 993 |
} |
997 | 994 |
} |
998 | 995 |
$ttys = file_get_contents("/etc/ttys"); |
Also available in: Unified diff
Rework this loader.conf changing code a bit. Might help with ticket #560