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
b6f56e68
Commit
b6f56e68
authored
Jul 09, 2017
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rc: batch-run bootup command before starting services; closes #1699
(cherry picked from commit
1b970b37
)
parent
5f54b54b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
15 deletions
+38
-15
rc.freebsd
src/etc/rc.freebsd
+38
-15
No files found.
src/etc/rc.freebsd
View file @
b6f56e68
...
...
@@ -37,13 +37,15 @@ for RC_CONF in $(find /etc/rc.conf.d -type f); do
.
${
RC_CONF
}
done
# probe all deamons in /usr/local/etc/rc.d/
ls
/usr/local/etc/rc.d/[a-z]
*
/etc/rc.d/[a-z]
*
|
while
read
rc_filename
;
do
rc_enabled
()
{
rc_filename
=
${
1
}
name
=
${
2
}
# check if service has a name
eval
"
$(
grep
"^name[[:blank:]]*="
${
rc_filename
}
)
"
if
[
-z
"
${
name
}
"
]
;
then
echo
"Error: no name set in
${
rc_filename
}
"
continue
return
1
fi
# check if service has a variable
...
...
@@ -51,21 +53,42 @@ ls /usr/local/etc/rc.d/[a-z]* /etc/rc.d/[a-z]* | while read rc_filename; do
if
[
-z
"
${
rcvar
}
"
]
;
then
# FreeBSD does this, leave here for debugging
#echo "Error: no rcvar set in $rc_filename"
continue
return
1
fi
# check if service is enabled
eval
"enabled=
\$
${
rcvar
}
"
if
[
"
${
enabled
}
"
==
"YES"
]
;
then
# run our bootstrap command on startup
if
[
"
${
1
}
"
==
"start"
]
;
then
if
[
"
${
enabled
}
"
!=
"YES"
]
;
then
return
1
fi
return
0
}
rc_filenames
=
"
$(
ls
/etc/rc.d/[a-z]
*
/usr/local/etc/rc.d/[a-z]
*
2> /dev/null
||
true
)
"
# run our bootstrap command on startup
if
[
"
${
1
}
"
==
"start"
]
;
then
for
rc_filename
in
${
rc_filenames
}
;
do
eval
"
$(
grep
"^name[[:blank:]]*="
${
rc_filename
}
)
"
if
!
rc_enabled
${
rc_filename
}
${
name
}
;
then
continue
fi
pre_run_var
=
"
${
name
}
_opnsense_bootup_run"
eval
"pre_run_cmd=
\$
${
pre_run_var
}
"
if
[
-n
"
${
pre_run_cmd
}
"
]
;
then
${
pre_run_cmd
}
done
fi
# pass all commands to script now
for
rc_filename
in
${
rc_filenames
}
;
do
eval
"
$(
grep
"^name[[:blank:]]*="
${
rc_filename
}
)
"
if
!
rc_enabled
${
rc_filename
}
${
name
}
;
then
continue
fi
fi
# pass all commands to script now
${
rc_filename
}
${
1
}
fi
done
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