Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
OpnSense
Commits
836dbe5a
Commit
836dbe5a
authored
Aug 14, 2015
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
diagnostics: poking init may clobber console execution
Slight refactoring in the general area while at it...
parent
65790c5f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
37 deletions
+21
-37
config.lib.inc
src/etc/inc/config.lib.inc
+1
-1
pfsense-utils.inc
src/etc/inc/pfsense-utils.inc
+20
-36
No files found.
src/etc/inc/config.lib.inc
View file @
836dbe5a
...
...
@@ -218,7 +218,7 @@ function reset_factory_defaults($sync = true)
{
mwexec
(
'/bin/rm -r /conf/*'
);
disable_security_checks
();
setup_serial_port
();
setup_serial_port
(
false
);
/* as we go through a special case directly reboot */
$shutdown_cmd
=
'/sbin/shutdown -or now'
;
...
...
src/etc/inc/pfsense-utils.inc
View file @
836dbe5a
...
...
@@ -284,53 +284,34 @@ function host_firmware_version()
);
}
/****f* legacy/reload_all
* NAME
* reload_all - triggers a reload of all settings
* * INPUTS
* none
* RESULT
* none
******/
function
reload_all
()
{
configd_run
(
"service reload all"
,
true
);
configd_run
(
'service reload all'
,
true
);
}
/****f* legacy/reload_interfaces
* NAME
* reload_interfaces - triggers a reload of all interfaces
* INPUTS
* none
* RESULT
* none
******/
function
reload_interfaces
()
{
configd_run
(
"interface reload"
);
configd_run
(
'interface reload'
);
}
function
setup_serial_port
(
$when
=
'save'
,
$path
=
''
)
function
setup_serial_port
(
$sync
=
true
)
{
global
$config
;
$serialspeed
=
(
is_numeric
(
$config
[
'system'
][
'serialspeed'
]))
?
$config
[
'system'
][
'serialspeed'
]
:
'115200'
;
$serial_enabled
=
isset
(
$config
[
'system'
][
'enableserial'
]);
$prefix
=
""
;
if
((
$when
==
"upgrade"
)
&&
(
!
empty
(
$path
))
&&
is_dir
(
$path
.
'/boot/'
))
$prefix
=
"/tmp/
{
$path
}
"
;
$boot_config_file
=
"
{
$path
}
/boot.config"
;
$loader_conf_file
=
"
{
$path
}
/boot/loader.conf"
;
/* serial console - write out /boot.config */
if
(
file_exists
(
$boot_config_file
))
$boot_config
=
file_get_contents
(
$boot_config_file
);
else
$boot_config
=
""
;
$loader_conf_file
=
'/boot/loader.conf'
;
$boot_config_file
=
'/boot.config'
;
$serialspeed
=
(
is_numeric
(
$config
[
'system'
][
'serialspeed'
]))
?
$config
[
'system'
][
'serialspeed'
]
:
'115200'
;
if
(
!
is_install_media
())
{
/* serial console - write out /boot.config */
if
(
file_exists
(
$boot_config_file
))
{
$boot_config
=
file_get_contents
(
$boot_config_file
);
}
else
{
$boot_config
=
''
;
}
$boot_config_split
=
explode
(
"
\n
"
,
$boot_config
);
$fd
=
fopen
(
$boot_config_file
,
"w"
);
if
(
$fd
)
{
...
...
@@ -348,9 +329,6 @@ function setup_serial_port($when = 'save', $path = '')
fclose
(
$fd
);
}
/* serial console - write out /boot/loader.conf */
if
(
$when
==
"upgrade"
)
system
(
"echo
\"
Reading
{
$loader_conf_file
}
...
\"
>> /conf/upgrade_log.txt"
);
$boot_config
=
@
file_get_contents
(
$loader_conf_file
);
$boot_config_split
=
explode
(
"
\n
"
,
$boot_config
);
if
(
count
(
$boot_config_split
)
>
0
)
{
...
...
@@ -386,6 +364,7 @@ function setup_serial_port($when = 'save', $path = '')
file_put_contents
(
$loader_conf_file
,
implode
(
"
\n
"
,
$new_boot_config
)
.
"
\n
"
);
}
}
$ttys
=
file_get_contents
(
"/etc/ttys"
);
$ttys_split
=
explode
(
"
\n
"
,
$ttys
);
$fd
=
fopen
(
"/etc/ttys"
,
"w"
);
...
...
@@ -399,6 +378,7 @@ function setup_serial_port($when = 'save', $path = '')
$console_type
=
'al.Pc'
;
$serial_type
=
'al.'
.
$serialspeed
;
}
foreach
(
$ttys_split
as
$tty
)
{
if
(
stristr
(
$tty
,
"ttyv0"
))
fwrite
(
$fd
,
"ttyv0
\"
/usr/libexec/getty
{
$console_type
}
\"
cons25 on secure
\n
"
);
...
...
@@ -407,9 +387,13 @@ function setup_serial_port($when = 'save', $path = '')
else
fwrite
(
$fd
,
$tty
.
"
\n
"
);
}
unset
(
$on_off
,
$console_type
,
$serial_type
);
fclose
(
$fd
);
reload_ttys
();
if
(
$sync
)
{
reload_ttys
();
}
}
function
reload_ttys
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment