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
88aab655
Commit
88aab655
authored
Nov 29, 2016
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rc: further boot rework
parent
b234d36f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
65 additions
and
47 deletions
+65
-47
system.inc
src/etc/inc/system.inc
+37
-10
rc.bootup
src/etc/rc.bootup
+27
-36
system_advanced_sysctl.php
src/www/system_advanced_sysctl.php
+1
-1
No files found.
src/etc/inc/system.inc
View file @
88aab655
...
@@ -382,19 +382,28 @@ function system_hosts_generate()
...
@@ -382,19 +382,28 @@ function system_hosts_generate()
unbound_hosts_generate
();
unbound_hosts_generate
();
}
}
function
system_hostname_configure
()
function
system_hostname_configure
(
$verbose
=
false
)
{
{
global
$config
;
global
$config
;
if
(
$verbose
)
{
echo
'Setting hostname: '
;
flush
();
}
$syscfg
=
$config
[
'system'
];
$syscfg
=
$config
[
'system'
];
$hostname
=
"
{
$syscfg
[
'hostname'
]
}
.
{
$syscfg
[
'domain'
]
}
"
;
/* set hostname */
/* set hostname */
$status
=
mwexecf
(
'/bin/hostname %s'
,
"
{
$syscfg
[
'hostname'
]
}
.
{
$syscfg
[
'domain'
]
}
"
);
mwexecf
(
'/bin/hostname %s'
,
$hostname
);
/* Setup host GUID ID. This is used by ZFS. */
/* Setup host GUID ID. This is used by ZFS. */
mwexec
(
"/etc/rc.d/hostid start"
);
mwexec
(
"/etc/rc.d/hostid start"
);
return
$status
;
if
(
$verbose
)
{
echo
"
{
$hostname
}
\n
"
;
}
}
}
function
system_routing_configure
(
$interface
=
''
)
function
system_routing_configure
(
$interface
=
''
)
...
@@ -698,17 +707,17 @@ function system_syslogd_start($verbose = false)
...
@@ -698,17 +707,17 @@ function system_syslogd_start($verbose = false)
{
{
global
$config
,
$g
;
global
$config
,
$g
;
if
(
$verbose
)
{
echo
'Starting syslog...'
;
flush
();
}
configd_run
(
'template reload OPNsense/Syslog'
);
configd_run
(
'template reload OPNsense/Syslog'
);
mwexec
(
'/etc/rc.d/hostid start'
);
mwexec
(
'/etc/rc.d/hostid start'
);
$syslogcfg
=
$config
[
'syslog'
];
$syslogcfg
=
$config
[
'syslog'
];
if
(
$verbose
)
{
echo
'Starting syslog...'
;
flush
();
}
$log_directive
=
'%'
;
$log_directive
=
'%'
;
$syslogd_extra
=
''
;
$syslogd_extra
=
''
;
...
@@ -1273,10 +1282,15 @@ EOD;
...
@@ -1273,10 +1282,15 @@ EOD;
return
0
;
return
0
;
}
}
function
system_firmware_configure
()
function
system_firmware_configure
(
$verbose
=
false
)
{
{
global
$config
;
global
$config
;
if
(
$verbose
)
{
echo
'Writing firmware setting...'
;
flush
();
}
/* rewrite the config via the defaults */
/* rewrite the config via the defaults */
$origin_conf
=
'/usr/local/etc/pkg/repos/origin.conf'
;
$origin_conf
=
'/usr/local/etc/pkg/repos/origin.conf'
;
copy
(
"${origin_conf}.sample"
,
$origin_conf
);
copy
(
"${origin_conf}.sample"
,
$origin_conf
);
...
@@ -1306,6 +1320,10 @@ function system_firmware_configure()
...
@@ -1306,6 +1320,10 @@ function system_firmware_configure()
array
(
'-sn'
,
str_replace
(
'/'
,
'\/'
,
$osabi
.
$config
[
'system'
][
'firmware'
][
'flavour'
]))
array
(
'-sn'
,
str_replace
(
'/'
,
'\/'
,
$osabi
.
$config
[
'system'
][
'firmware'
][
'flavour'
]))
);
);
}
}
if
(
$verbose
)
{
echo
"done.
\n
"
;
}
}
}
function
system_timezone_configure
(
$verbose
=
false
)
function
system_timezone_configure
(
$verbose
=
false
)
...
@@ -1359,10 +1377,19 @@ function system_reboot($sync = false)
...
@@ -1359,10 +1377,19 @@ function system_reboot($sync = false)
}
}
}
}
function
system_s
etup_sysctl
(
)
function
system_s
ysctl_configure
(
$verbose
=
false
)
{
{
if
(
$verbose
)
{
echo
'Setting up extended sysctls...'
;
flush
();
}
activate_sysctls
();
activate_sysctls
();
system_arp_wrong_if
();
system_arp_wrong_if
();
if
(
$verbose
)
{
echo
"done.
\n
"
;
}
}
}
function
system_arp_wrong_if
()
function
system_arp_wrong_if
()
...
...
src/etc/rc.bootup
View file @
88aab655
...
@@ -30,31 +30,32 @@
...
@@ -30,31 +30,32 @@
*/
*/
/* looks weird, but means we started PHP successfully */
/* looks weird, but means we started PHP successfully */
echo
"
done.
\n
"
;
echo
"done.
\n
"
;
echo
"Initializing..."
;
echo
"Initializing..."
;
require_once
(
"config.inc"
);
flush
();
echo
"."
;
require_once
(
"config.console.inc"
);
$inc_files
=
array
(
echo
"."
;
'config.inc'
,
require_once
(
"auth.inc"
);
'config.console.inc'
,
echo
"."
;
'auth.inc'
,
require_once
(
"util.inc"
);
'util.inc'
,
echo
"."
;
'interfaces.inc'
,
require_once
(
"interfaces.inc"
);
'services.inc'
,
echo
"."
;
'system.inc'
,
require_once
(
"services.inc"
);
'filter.inc'
,
echo
"."
;
'ipsec.inc'
,
require_once
(
"system.inc"
);
'openvpn.inc'
,
echo
"."
;
'rrd.inc'
,
require_once
(
"filter.inc"
);
);
echo
"."
;
require_once
(
"ipsec.inc"
);
foreach
(
$inc_files
as
$inc_file
)
{
echo
"."
;
require_once
$inc_file
;
require_once
(
"openvpn.inc"
);
echo
'.'
;
echo
"."
;
flush
();
require_once
(
"rrd.inc"
);
}
echo
" done.
\n
"
;
echo
"done.
\n
"
;
system_devd_configure
(
true
);
system_devd_configure
(
true
);
system_login_configure
(
true
);
system_login_configure
(
true
);
...
@@ -95,20 +96,10 @@ if (is_interface_mismatch()) {
...
@@ -95,20 +96,10 @@ if (is_interface_mismatch()) {
}
}
system_kernel_configure
(
true
);
system_kernel_configure
(
true
);
system_sysctl_configure
(
true
);
/* read in /etc/sysctl.conf and set values if needed */
echo
"Setting up extended sysctls..."
;
system_setup_sysctl
();
echo
"done.
\n
"
;
/* set up our timezone */
system_timezone_configure
(
true
);
system_timezone_configure
(
true
);
system_firmware_configure
(
true
);
/* set up firmware configuration */
system_hostname_configure
(
true
);
system_firmware_configure
();
/* set up our hostname */
system_hostname_configure
();
/* make hosts file */
/* make hosts file */
system_hosts_generate
();
system_hosts_generate
();
...
...
src/www/system_advanced_sysctl.php
View file @
88aab655
...
@@ -74,7 +74,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
...
@@ -74,7 +74,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
header
(
url_safe
(
'Location: /system_advanced_sysctl.php'
));
header
(
url_safe
(
'Location: /system_advanced_sysctl.php'
));
exit
;
exit
;
}
else
if
(
!
empty
(
$pconfig
[
'apply'
]))
{
}
else
if
(
!
empty
(
$pconfig
[
'apply'
]))
{
system_s
etup_sysctl
();
system_s
ysctl_configure
();
clear_subsystem_dirty
(
'sysctl'
);
clear_subsystem_dirty
(
'sysctl'
);
header
(
url_safe
(
'Location: /system_advanced_sysctl.php'
));
header
(
url_safe
(
'Location: /system_advanced_sysctl.php'
));
exit
;
exit
;
...
...
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