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
ecf405ad
Commit
ecf405ad
authored
Oct 28, 2015
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rc: add rc.syshook with early, start and stop hooks; closes #409
parent
18e1e7bb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
65 additions
and
0 deletions
+65
-0
rc
src/etc/rc
+6
-0
rc.halt.common
src/etc/rc.halt.common
+3
-0
rc.syshook
src/etc/rc.syshook
+56
-0
No files found.
src/etc/rc
View file @
ecf405ad
...
@@ -202,6 +202,9 @@ echo "done."
...
@@ -202,6 +202,9 @@ echo "done."
# startup configd
# startup configd
/usr/local/etc/rc.d/configd start
/usr/local/etc/rc.d/configd start
# Execute the early syshook / plugin commands
/usr/local/etc/rc.syshook early
# let the PHP-based configuration subsystem set up the system now
# let the PHP-based configuration subsystem set up the system now
echo
-n
"Launching the init system..."
echo
-n
"Launching the init system..."
rm
-f
/root/lighttpd
*
rm
-f
/root/lighttpd
*
...
@@ -216,6 +219,9 @@ if [ -f "/tmp/donotbootup" ]; then
...
@@ -216,6 +219,9 @@ if [ -f "/tmp/donotbootup" ]; then
exit
0
exit
0
fi
fi
# Execute the normal syshook / plugin commands
/usr/local/etc/rc.syshook start
echo
-n
"Starting CRON... "
echo
-n
"Starting CRON... "
cd
/tmp
&&
/usr/sbin/cron
-s
2>/dev/null
cd
/tmp
&&
/usr/sbin/cron
-s
2>/dev/null
echo
"done."
echo
"done."
...
...
src/etc/rc.halt.common
View file @
ecf405ad
...
@@ -3,6 +3,9 @@
...
@@ -3,6 +3,9 @@
# run beep sequence if enabled
# run beep sequence if enabled
/usr/local/sbin/beep.sh stop
/usr/local/sbin/beep.sh stop
# shutdown syshook / plugin scripts
/usr/local/etc/rc.syshook stop
# shutdown rc scripts
# shutdown rc scripts
/usr/local/etc/rc.opnsense stop
/usr/local/etc/rc.opnsense stop
...
...
src/etc/rc.syshook
0 → 100755
View file @
ecf405ad
#!/bin/sh
# Copyright (c) 2015 Franco Fichtner <franco@opnsense.org>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
SYSDIR
=
"/usr/local/etc/rc.syshook.d"
SYSLEVEL
=
"
${
1
}
"
if
[
-z
"
${
SYSLEVEL
}
"
]
;
then
# we don't know of a default
exit
1
;
fi
if
[
!
-d
${
SYSDIR
}
]
;
then
# no dir no fun
exit
0
;
fi
# collect all matching scripts
SYSHOOKS
=
$(
find
${
SYSDIR
}
-type
f
-name
"*.
${
SYSLEVEL
}
"
)
for
SYSHOOK
in
${
SYSHOOKS
}
;
do
# extract syshook origin
SYSHOOK
=
${
SYSHOOK
##
"
${
SYSDIR
}
/"
}
SYSHOOK
=
${
SYSHOOK
%%
".
${
SYSLEVEL
}
"
}
echo
"rc.syshook: launching
${
SYSHOOK
}
.
${
SYSLEVEL
}
"
if
!
${
SYSDIR
}
/
${
SYSHOOK
}
.
${
SYSLEVEL
}
;
then
echo
"rc.syshook: error in
${
SYSHOOK
}
.
${
SYSLEVEL
}
"
fi
done
exit
0
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