Compare commits
216 Commits
openrc-0.2
...
openrc-0.4
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6ce7001a1a | ||
|
|
0e0d0ab1ef | ||
|
|
dc712a109e | ||
|
|
1acbfcf5ca | ||
|
|
f8210050e5 | ||
|
|
38e6c9ba5c | ||
|
|
2c98c5326a | ||
|
|
57f90a42ba | ||
|
|
bde35d03ed | ||
|
|
8b76e1d2e0 | ||
|
|
b859710cc8 | ||
|
|
c064393f08 | ||
|
|
e84f71596e | ||
|
|
23e73957a0 | ||
|
|
2537a07e10 | ||
|
|
5403e70313 | ||
|
|
fe12134a5b | ||
|
|
1deaa0fae0 | ||
|
|
0cca768b82 | ||
|
|
df22978de9 | ||
|
|
fe509db660 | ||
|
|
937b1b2abf | ||
|
|
eafbed0366 | ||
|
|
0786141026 | ||
|
|
90d175ae27 | ||
|
|
a178fd0f32 | ||
|
|
03e8e0cb68 | ||
|
|
a3d266e741 | ||
|
|
42e6a95b1d | ||
|
|
45044c9239 | ||
|
|
5fc6f21169 | ||
|
|
2cf24fe793 | ||
|
|
cc14b55414 | ||
|
|
33d4fba5be | ||
|
|
32e17af92f | ||
|
|
77d56f5489 | ||
|
|
c520d4a23a | ||
|
|
8a76c27325 | ||
|
|
7467440a29 | ||
|
|
282ad4bae6 | ||
|
|
1e5a6f40e5 | ||
|
|
0af7d5bc20 | ||
|
|
895c4f4149 | ||
|
|
20380d3144 | ||
|
|
e1341e372b | ||
|
|
1c73f2967c | ||
|
|
2ff0838abb | ||
|
|
53ddd6ca96 | ||
|
|
9ec6ff02bb | ||
|
|
aa991a3c99 | ||
|
|
0d98d56188 | ||
|
|
ae692e294e | ||
|
|
f6e3c167ae | ||
|
|
1d96620b84 | ||
|
|
d12bb5cf3c | ||
|
|
9c76b077d6 | ||
|
|
0a39145a5e | ||
|
|
734e60608a | ||
|
|
66ae6e38a7 | ||
|
|
8d47d6c022 | ||
|
|
c18c74e816 | ||
|
|
da94fad3f5 | ||
|
|
10cb4c18df | ||
|
|
50b8aba8d9 | ||
|
|
72dcac8c55 | ||
|
|
d6da8e8c48 | ||
|
|
247766695c | ||
|
|
1a88a43aa5 | ||
|
|
c4e673edbc | ||
|
|
a872fe5590 | ||
|
|
8c8751fa60 | ||
|
|
5cdc489573 | ||
|
|
4d74e94c39 | ||
|
|
d117b2d644 | ||
|
|
cb44b0a46c | ||
|
|
4e4c4a5bf4 | ||
|
|
09a1a5ecd4 | ||
|
|
84f6bf4bff | ||
|
|
5f76c1121a | ||
|
|
41c1e170d6 | ||
|
|
f53197818b | ||
|
|
bb41d2cc80 | ||
|
|
4291b9140e | ||
|
|
28d7fb9430 | ||
|
|
abe94bec6f | ||
|
|
c3e192a834 | ||
|
|
13d88731b7 | ||
|
|
ffc79a50c2 | ||
|
|
6748c0e04e | ||
|
|
27805de20a | ||
|
|
53693367df | ||
|
|
554d2fea19 | ||
|
|
a63303971a | ||
|
|
5610c8560c | ||
|
|
2c62d095c8 | ||
|
|
a72dc1194a | ||
|
|
dcc4aa131c | ||
|
|
6b3d8cf598 | ||
|
|
600d1f62fb | ||
|
|
2de401bca1 | ||
|
|
e368a4b4f8 | ||
|
|
354fb96ee9 | ||
|
|
312d6f3e57 | ||
|
|
39ea0cb84d | ||
|
|
17bf78a539 | ||
|
|
072328ff60 | ||
|
|
e0dfa472d1 | ||
|
|
ccc24d1086 | ||
|
|
c4c024fc9d | ||
|
|
223015920c | ||
|
|
aa02a5516a | ||
|
|
80a17eb596 | ||
|
|
39304745d4 | ||
|
|
93a3b2dd02 | ||
|
|
00d010fbe0 | ||
|
|
01de348ede | ||
|
|
fabee4dc2d | ||
|
|
1ab1e9328a | ||
|
|
a9f7d2d5e5 | ||
|
|
a3c8706618 | ||
|
|
1f227d62bf | ||
|
|
cdace75539 | ||
|
|
15678263d5 | ||
|
|
cea206014d | ||
|
|
46a74f244e | ||
|
|
c67233f15c | ||
|
|
b15c4758f8 | ||
|
|
289889ebf0 | ||
|
|
7183cb1b18 | ||
|
|
b83108cd2e | ||
|
|
1ca63447c9 | ||
|
|
c2781c209e | ||
|
|
5983add0f2 | ||
|
|
a566493eb8 | ||
|
|
bdd8b150cd | ||
|
|
53401cd35f | ||
|
|
7a6112d3b0 | ||
|
|
157db50df7 | ||
|
|
a88a177f99 | ||
|
|
d61f831896 | ||
|
|
28a65393ca | ||
|
|
aa57dd1ff6 | ||
|
|
e0968a1c2e | ||
|
|
2f5d2855ba | ||
|
|
db9bf18587 | ||
|
|
feac5ea1d5 | ||
|
|
64dbae7f61 | ||
|
|
11e4059b05 | ||
|
|
5510451bac | ||
|
|
11acce3c7d | ||
|
|
4f2bb5ceaf | ||
|
|
bf8f0da921 | ||
|
|
9b1cb4e246 | ||
|
|
2adc99a8f5 | ||
|
|
fc747f9894 | ||
|
|
76063daee5 | ||
|
|
dc891b0647 | ||
|
|
3525e602d6 | ||
|
|
79ebd89d19 | ||
|
|
ba8008fb05 | ||
|
|
5e2c3fb5fe | ||
|
|
e6aed12328 | ||
|
|
83ade5b701 | ||
|
|
587051ec67 | ||
|
|
f2ea7ca514 | ||
|
|
b41c864fc3 | ||
|
|
c409dd0570 | ||
|
|
aaaa0b50d8 | ||
|
|
ca6f289c80 | ||
|
|
f640ecaebb | ||
|
|
75eff5a86b | ||
|
|
eeadc618fb | ||
|
|
bb069e1618 | ||
|
|
3a592fa31b | ||
|
|
6b77cc624f | ||
|
|
328215e841 | ||
|
|
b03282b901 | ||
|
|
08081f7ef4 | ||
|
|
8ca8e00a89 | ||
|
|
1df3ab05b5 | ||
|
|
775df18a70 | ||
|
|
148caecc7e | ||
|
|
d0f7a63487 | ||
|
|
b7e598ad91 | ||
|
|
5c114d9430 | ||
|
|
f13ea77491 | ||
|
|
a89171ee9b | ||
|
|
6d5d655b52 | ||
|
|
0f51f3e863 | ||
|
|
be8f8d0ac0 | ||
|
|
d667da8e5c | ||
|
|
9894669742 | ||
|
|
b732df31ef | ||
|
|
762dc3d197 | ||
|
|
30fe99dead | ||
|
|
2d75eb7976 | ||
|
|
3663cf1e2a | ||
|
|
766ec96e3d | ||
|
|
a854fe6d61 | ||
|
|
619b0b4f37 | ||
|
|
c8248d05a0 | ||
|
|
5ae702339e | ||
|
|
d384502e57 | ||
|
|
bdaca0baf5 | ||
|
|
5188fd2592 | ||
|
|
5b800030f1 | ||
|
|
208443fa0e | ||
|
|
a818eebf7b | ||
|
|
10910876d1 | ||
|
|
35b4978152 | ||
|
|
cedd81801a | ||
|
|
e273b4e08e | ||
|
|
50cff8ebc8 | ||
|
|
aec83494d6 | ||
|
|
5ba6f0a628 | ||
|
|
5a59542629 |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1,3 +0,0 @@
|
|||||||
openrc-0.1.tar.bz2
|
|
||||||
.gdb_history
|
|
||||||
.gdbinit
|
|
||||||
3
Makefile
3
Makefile
@@ -3,7 +3,7 @@
|
|||||||
# All rights reserved. Released under the 2-clause BSD license.
|
# All rights reserved. Released under the 2-clause BSD license.
|
||||||
|
|
||||||
NAME= openrc
|
NAME= openrc
|
||||||
VERSION= 0.2.3
|
VERSION= 0.4.0
|
||||||
PKG= ${NAME}-${VERSION}
|
PKG= ${NAME}-${VERSION}
|
||||||
|
|
||||||
SUBDIR= conf.d doc etc init.d man net sh src
|
SUBDIR= conf.d doc etc init.d man net sh src
|
||||||
@@ -17,7 +17,6 @@ include ${MK}/sys.mk
|
|||||||
include ${MK}/os.mk
|
include ${MK}/os.mk
|
||||||
include ${MK}/subdir.mk
|
include ${MK}/subdir.mk
|
||||||
include ${MK}/dist.mk
|
include ${MK}/dist.mk
|
||||||
include ${MK}/gitignore.mk
|
|
||||||
|
|
||||||
_installafter:
|
_installafter:
|
||||||
${INSTALL} -d ${DESTDIR}/${PREFIX}/${RC_LIB}/init.d
|
${INSTALL} -d ${DESTDIR}/${PREFIX}/${RC_LIB}/init.d
|
||||||
|
|||||||
2
README
2
README
@@ -19,6 +19,8 @@ PREFIX=/usr/local
|
|||||||
|
|
||||||
We don't support building a static OpenRC with PAM.
|
We don't support building a static OpenRC with PAM.
|
||||||
You may need to use PROGLDFLAGS=-Wl,-Bstatic on glibc instead of just -static.
|
You may need to use PROGLDFLAGS=-Wl,-Bstatic on glibc instead of just -static.
|
||||||
|
If you debug memory under valgrind, add -DDEBUG_MEMORY to your CPPFLAGS
|
||||||
|
so that all malloc memory should be freed at exit.
|
||||||
|
|
||||||
You can also brand OpenRC if you so wish like so
|
You can also brand OpenRC if you so wish like so
|
||||||
BRANDING=\"Gentoo/$(uname -s)\"
|
BRANDING=\"Gentoo/$(uname -s)\"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
DIR= ${CONFDIR}
|
DIR= ${CONFDIR}
|
||||||
CONF= bootmisc fsck hostname local net urandom
|
CONF= bootmisc fsck hostname local localmount net urandom
|
||||||
|
|
||||||
MK= ../mk
|
MK= ../mk
|
||||||
include ${MK}/os.mk
|
include ${MK}/os.mk
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
CONF+= moused powerd rarpd savecore syscons
|
CONF+= ipfw moused powerd rarpd savecore syscons
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
CONF+= consolefont hwclock keymaps modules
|
CONF+= consolefont dmesg hwclock keymaps modules
|
||||||
|
|||||||
3
conf.d/dmesg
Normal file
3
conf.d/dmesg
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# Sets the level at which logging of messages is done to the
|
||||||
|
# console. See dmesg(8) for more info.
|
||||||
|
dmesg_level="1"
|
||||||
14
conf.d/ipfw
Normal file
14
conf.d/ipfw
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
# ipfw provides a stateful firewall.
|
||||||
|
# This means we allow everything out, and if we have a connection we allow it
|
||||||
|
# back in. This is very flexable and quite secure.
|
||||||
|
|
||||||
|
# For ease of use, we allow auth and ssh ports through as well.
|
||||||
|
# To override the list of allowed ports
|
||||||
|
#ipfw_ports_in="auth ssh"
|
||||||
|
|
||||||
|
# You may want to enable logging of denied connections
|
||||||
|
#ipfw_log_deny="YES"
|
||||||
|
|
||||||
|
# This ports not logged
|
||||||
|
#ipfw_ports_nolog="135-139,445 1026,1027 1433,1434"
|
||||||
|
|
||||||
3
conf.d/localmount
Normal file
3
conf.d/localmount
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# Stop the unmounting of certain points.
|
||||||
|
# This could be useful for some NFS related work.
|
||||||
|
#no_umounts="/dir1:/var/dir2"
|
||||||
@@ -5,6 +5,10 @@
|
|||||||
#modules_2_6="tun"
|
#modules_2_6="tun"
|
||||||
#modules="ohci1394"
|
#modules="ohci1394"
|
||||||
|
|
||||||
|
# You can give modules a different name when they load - the new name
|
||||||
|
# will also be used to pick arguments below.
|
||||||
|
#modules="dummy:dummy1"
|
||||||
|
|
||||||
# Give the modules some arguments if needed, per version if necessary.
|
# Give the modules some arguments if needed, per version if necessary.
|
||||||
#module_ieee1394_args="debug"
|
#module_ieee1394_args="debug"
|
||||||
#module_ieee1394_args_2_6_23_gentoo_r5="ieee1394 ohci1394"
|
#module_ieee1394_args_2_6_23_gentoo_r5="ieee1394 ohci1394"
|
||||||
|
|||||||
1
doc/.gitignore
vendored
1
doc/.gitignore
vendored
@@ -1 +0,0 @@
|
|||||||
net.example
|
|
||||||
@@ -87,6 +87,10 @@
|
|||||||
# is how long we wait for carrier. The current default is 3 seconds
|
# is how long we wait for carrier. The current default is 3 seconds
|
||||||
#carrier_timeout_eth0=-1
|
#carrier_timeout_eth0=-1
|
||||||
|
|
||||||
|
# You may wish to disable the interface being brought down when stopping.
|
||||||
|
# This is only of use for WakeOnLan.
|
||||||
|
#ifdown_eth0="NO"
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
# OPTIONAL MODULES
|
# OPTIONAL MODULES
|
||||||
|
|
||||||
|
|||||||
@@ -120,6 +120,10 @@
|
|||||||
# tables you may have to set a global metric as the due to a simple read of
|
# tables you may have to set a global metric as the due to a simple read of
|
||||||
# the routing table taking over a minute at a time.
|
# the routing table taking over a minute at a time.
|
||||||
|
|
||||||
|
# You may wish to disable the interface being brought down when stopping.
|
||||||
|
# This is only of use for WakeOnLan.
|
||||||
|
#ifdown_eth0="NO"
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
# OPTIONAL MODULES
|
# OPTIONAL MODULES
|
||||||
|
|
||||||
@@ -565,12 +569,18 @@
|
|||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
# Bonding
|
# Bonding
|
||||||
# For link bonding/trunking emerge net-misc/ifenslave
|
# For link bonding/trunking on 2.4 kernels, or kernels without sysfs
|
||||||
|
# emerge net-misc/ifenslave
|
||||||
|
|
||||||
# To bond interfaces together
|
# To bond interfaces together
|
||||||
#slaves_bond0="eth0 eth1 eth2"
|
#slaves_bond0="eth0 eth1 eth2"
|
||||||
#config_bond0="null" # You may not want to assign an IP the the bond
|
#config_bond0="null" # You may not want to assign an IP the the bond
|
||||||
|
|
||||||
|
# You can also configure the bond here, which must be done via sysfs on 2.6
|
||||||
|
# kernels or newer. See the kernel bonding documention for a description of
|
||||||
|
# these options.
|
||||||
|
#arp_ip_target_bond0="+26.0.0.0"
|
||||||
|
|
||||||
# If any of the slaves require extra configuration - for example wireless or
|
# If any of the slaves require extra configuration - for example wireless or
|
||||||
# ppp devices - we need to depend function on the bonded interfaces
|
# ppp devices - we need to depend function on the bonded interfaces
|
||||||
#rc_need_bond0="net.eth0 net.eth1"
|
#rc_need_bond0="net.eth0 net.eth1"
|
||||||
@@ -1006,7 +1016,7 @@
|
|||||||
|
|
||||||
#postdown() {
|
#postdown() {
|
||||||
# # Enable Wake-On-LAN for every interface except for lo
|
# # Enable Wake-On-LAN for every interface except for lo
|
||||||
# # Probably a good idea to set RC_DOWN_INTERFACE="no" in /etc/conf.d/rc
|
# # Probably a good idea to set ifdown="no" in /etc/conf.d/net
|
||||||
# # as well ;)
|
# # as well ;)
|
||||||
# [ "${IFACE}" != "lo" ] && ethtool -s "${IFACE}" wol g
|
# [ "${IFACE}" != "lo" ] && ethtool -s "${IFACE}" wol g
|
||||||
|
|
||||||
|
|||||||
3
etc/.gitignore
vendored
3
etc/.gitignore
vendored
@@ -1,3 +0,0 @@
|
|||||||
rc.conf
|
|
||||||
rc
|
|
||||||
rc.shutdown
|
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
DIR= ${SYSCONFDIR}
|
DIR= ${SYSCONFDIR}
|
||||||
CONF= rc.conf
|
CONF= rc.conf
|
||||||
|
|
||||||
|
CLEANFILES+= rc.conf
|
||||||
|
|
||||||
MK= ../mk
|
MK= ../mk
|
||||||
include ${MK}/os.mk
|
include ${MK}/os.mk
|
||||||
include Makefile.${OS}
|
include Makefile.${OS}
|
||||||
|
|||||||
@@ -6,20 +6,3 @@
|
|||||||
# consolefont, numlock, etc ...)
|
# consolefont, numlock, etc ...)
|
||||||
rc_tty_number=12
|
rc_tty_number=12
|
||||||
|
|
||||||
# Use this variable to control the /dev management behavior.
|
|
||||||
# devfs - use devfs (requires sys-fs/devfsd)
|
|
||||||
# mdev - use mdev (requires sys-apps/busybox)
|
|
||||||
# udev - use udev (requires sys-fs/udev)
|
|
||||||
# static - let the user manage /dev (YOU need to create ALL device nodes)
|
|
||||||
# Leave it blank to let rc work it out (udev, mdev, devfs, static)
|
|
||||||
#rc_devices=""
|
|
||||||
|
|
||||||
# UDEV OPTION:
|
|
||||||
# Set to "yes" if you want to save /dev to a tarball on shutdown
|
|
||||||
# and restore it on startup. This is useful if you have a lot of
|
|
||||||
# custom device nodes that udev does not handle/know about.
|
|
||||||
rc_device_tarball="NO"
|
|
||||||
|
|
||||||
# Sets the level at which logging of messages is done to the
|
|
||||||
# console. See dmesg(8) for more info.
|
|
||||||
dmesg_level="1"
|
|
||||||
|
|||||||
@@ -4,6 +4,9 @@
|
|||||||
# in parallel for a slight speed improvement. When running in parallel we
|
# in parallel for a slight speed improvement. When running in parallel we
|
||||||
# prefix the service output with it's name as the output will get
|
# prefix the service output with it's name as the output will get
|
||||||
# jumbled up.
|
# jumbled up.
|
||||||
|
# WARNING: whilst we have improved parallel, it can still potentially lock
|
||||||
|
# the boot process. Don't file bugs about this unless you can supply
|
||||||
|
# patches that fix it without breaking other things!
|
||||||
rc_parallel="NO"
|
rc_parallel="NO"
|
||||||
|
|
||||||
# Set rc_interactive to "YES" and you'll be able to press the I key during
|
# Set rc_interactive to "YES" and you'll be able to press the I key during
|
||||||
@@ -19,36 +22,36 @@ rc_interactive="YES"
|
|||||||
# come up.
|
# come up.
|
||||||
rc_depend_strict="YES"
|
rc_depend_strict="YES"
|
||||||
|
|
||||||
# Do we allow services to be hotplugged? If not, set to rc_hotplug="NO"
|
# rc_hotplug is a list of services that we allow to be hotplugged.
|
||||||
# NOTE: This does not affect anything hotplug/udev/devd related, just the
|
# By default we do not allow hotplugging.
|
||||||
# starting/stopping of the init.d service triggered by it.
|
# A hotplugged service is one started by a dynamic dev manager when a matching
|
||||||
rc_hotplug="YES"
|
# hardware device is found.
|
||||||
|
# This service is intrinsically included in the boot runlevel.
|
||||||
# Dynamic /dev managers can trigger coldplug events which cause services to
|
# To disable services, prefix with a !
|
||||||
# start before we are ready for them. If this happens, we can defer these
|
# Example - rc_hotplug="net.wlan !net.*"
|
||||||
# services to start in the boot runlevel. Set rc_coldplug="NO" if you don't
|
|
||||||
# want this.
|
|
||||||
# NOTE: This also affects module coldplugging in udev-096 and higher
|
|
||||||
# If you want module coldplugging but not coldplugging of services then you
|
|
||||||
# can set rc_coldplug="YES" and rc_plug_services="!*"
|
|
||||||
rc_coldplug="YES"
|
|
||||||
|
|
||||||
# Some people want a finer grain over hotplug/coldplug. rc_plug_services is a
|
|
||||||
# list of services that are matched in order, either allowing or not. By
|
|
||||||
# default we allow services through as rc_coldplug/rc_hotplug has to be YES
|
|
||||||
# anyway.
|
|
||||||
# Example - rc_plug_services="net.wlan !net.*"
|
|
||||||
# This allows net.wlan and any service not matching net.* to be plugged.
|
# This allows net.wlan and any service not matching net.* to be plugged.
|
||||||
rc_plug_services=""
|
# Example - rc_hotplug="*"
|
||||||
|
# This allows all services to be hotplugged
|
||||||
|
#rc_hotplug="*"
|
||||||
|
|
||||||
# rc_logger launches a logging daemon to log the entire rc process to
|
# rc_logger launches a logging daemon to log the entire rc process to
|
||||||
# /var/log/rc.log
|
# /var/log/rc.log
|
||||||
|
# NOTE: Linux systems require the devfs service to be started before
|
||||||
|
# logging can take place and as such cannot log the sysinit runlevel.
|
||||||
rc_logger="NO"
|
rc_logger="NO"
|
||||||
|
|
||||||
# By default we filter the environment for our running scripts. To allow other
|
# By default we filter the environment for our running scripts. To allow other
|
||||||
# variables through, add them here. Use a * to allow all variables through.
|
# variables through, add them here. Use a * to allow all variables through.
|
||||||
# rc_env_allow="VAR1 VAR2"
|
# rc_env_allow="VAR1 VAR2"
|
||||||
|
|
||||||
|
# By default we assume that all daemons will start correctly.
|
||||||
|
# However, some do not - a classic example is that they fork and return 0 AND
|
||||||
|
# then child barfs on a configuration error. Or the daemon has a bug and the
|
||||||
|
# child crashes. You can set the number of milliseconds start-stop-daemon
|
||||||
|
# waits to check that the daemon is still running after starting here.
|
||||||
|
# The default is 0 - no checking.
|
||||||
|
# rc_start_wait=100
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
# MISC CONFIGURATION VARIABLES
|
# MISC CONFIGURATION VARIABLES
|
||||||
# There variables are shared between many init scripts
|
# There variables are shared between many init scripts
|
||||||
|
|||||||
@@ -10,12 +10,9 @@
|
|||||||
trap : SIGINT
|
trap : SIGINT
|
||||||
trap "echo 'Boot interrupted'; exit 1" SIGQUIT
|
trap "echo 'Boot interrupted'; exit 1" SIGQUIT
|
||||||
|
|
||||||
# BSD's init works somewhat differently to sysvinit.
|
/sbin/rc sysinit || exit 1
|
||||||
# This block should 'translate' from the way init calls it to the way it would
|
/sbin/rc boot || exit 1
|
||||||
# be called by sysvinit on linux.
|
/sbin/rc default
|
||||||
RUNLEVEL="1" /sbin/rc sysinit || exit 1
|
|
||||||
RUNLEVEL="1" /sbin/rc boot || exit 1
|
|
||||||
PREVLEVEL="1" /sbin/rc default
|
|
||||||
|
|
||||||
# We don't actually care if rc default worked or not, we should exit 0
|
# We don't actually care if rc default worked or not, we should exit 0
|
||||||
# to allow logins
|
# to allow logins
|
||||||
|
|||||||
@@ -14,13 +14,4 @@ export LD_LIBRARY_PATH="/lib${LD_LIBRARY_PATH:+:}${LDLIBRARY_PATH}"
|
|||||||
[ -z "$TERM" -o "$TERM" = "dumb" ] && export TERM="@TERM@"
|
[ -z "$TERM" -o "$TERM" = "dumb" ] && export TERM="@TERM@"
|
||||||
|
|
||||||
action=${1:-shutdown}
|
action=${1:-shutdown}
|
||||||
|
|
||||||
# BSD's init works somewhat differently to sysvinit.
|
|
||||||
# This block should 'translate' from the way init calls it to the way it would
|
|
||||||
# be called by sysvinit on linux.
|
|
||||||
case "${action}" in
|
|
||||||
reboot) export RUNLEVEL=6;;
|
|
||||||
single) export RUNLEVEL=S;;
|
|
||||||
*) export RUNLEVEL=0;;
|
|
||||||
esac
|
|
||||||
exec /sbin/rc "${action}"
|
exec /sbin/rc "${action}"
|
||||||
|
|||||||
9
init.d.misc/.gitignore
vendored
9
init.d.misc/.gitignore
vendored
@@ -1,9 +0,0 @@
|
|||||||
avahi-dnsconfd
|
|
||||||
avahid
|
|
||||||
dbus
|
|
||||||
hald
|
|
||||||
named
|
|
||||||
ntpd
|
|
||||||
openvpn
|
|
||||||
polkitd
|
|
||||||
sshd
|
|
||||||
28
init.d/.gitignore
vendored
28
init.d/.gitignore
vendored
@@ -1,28 +0,0 @@
|
|||||||
bootmisc
|
|
||||||
fsck
|
|
||||||
halt.sh
|
|
||||||
hostname
|
|
||||||
local
|
|
||||||
localmount
|
|
||||||
netmount
|
|
||||||
root
|
|
||||||
swap
|
|
||||||
sysctl
|
|
||||||
urandom
|
|
||||||
hostid
|
|
||||||
moused
|
|
||||||
newsyslog
|
|
||||||
pf
|
|
||||||
rarpd
|
|
||||||
rc-enabled
|
|
||||||
rpcbind
|
|
||||||
savecore
|
|
||||||
syslogd
|
|
||||||
adjkerntz
|
|
||||||
devd
|
|
||||||
dumpon
|
|
||||||
ipfw
|
|
||||||
mixer
|
|
||||||
nscd
|
|
||||||
powerd
|
|
||||||
syscons
|
|
||||||
@@ -1,9 +1,16 @@
|
|||||||
DIR= ${INITDIR}
|
DIR= ${INITDIR}
|
||||||
SRCS= bootmisc.in fsck.in halt.sh.in hostname.in local.in localmount.in \
|
SRCS= bootmisc.in fsck.in hostname.in local.in localmount.in \
|
||||||
netmount.in root.in swap.in sysctl.in urandom.in
|
netmount.in root.in savecache.in swap.in sysctl.in urandom.in
|
||||||
BIN= ${OBJS}
|
BIN= ${OBJS}
|
||||||
|
|
||||||
|
INSTALLAFTER= _installafter
|
||||||
|
CLEANFILES+= net.lo
|
||||||
|
TARGETS+= net.lo
|
||||||
|
|
||||||
MK= ../mk
|
MK= ../mk
|
||||||
include ${MK}/os.mk
|
include ${MK}/os.mk
|
||||||
include Makefile.${OS}
|
include Makefile.${OS}
|
||||||
include ${MK}/scripts.mk
|
include ${MK}/scripts.mk
|
||||||
|
|
||||||
|
_installafter: realinstall
|
||||||
|
${INSTALL} -m ${BINMODE} net.lo ${DESTDIR}/${INITDIR}/${NET_LO}
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
NET_LO= net.lo0
|
||||||
|
|
||||||
# Generic BSD scripts
|
# Generic BSD scripts
|
||||||
SRCS+= hostid.in moused.in newsyslog.in pf.in rarpd.in rc-enabled.in \
|
SRCS+= hostid.in moused.in newsyslog.in pf.in rarpd.in rc-enabled.in \
|
||||||
rpcbind.in savecore.in syslogd.in
|
rpcbind.in savecore.in syslogd.in
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
SRCS+= hwclock.in consolefont.in keymaps.in modules.in mtab.in numlock.in \
|
NET_LO= net.lo
|
||||||
procfs.in termencoding.in
|
|
||||||
|
SRCS+= devfs.in dmesg.in hwclock.in consolefont.in keymaps.in killprocs.in \
|
||||||
|
modules.in mount-ro.in mtab.in numlock.in procfs.in sysfs.in \
|
||||||
|
termencoding.in
|
||||||
|
|
||||||
.SUFFIXES: .Linux.in
|
.SUFFIXES: .Linux.in
|
||||||
.Linux.in:
|
.Linux.in:
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
|
NET_LO= net.lo0
|
||||||
|
|
||||||
# Generic BSD scripts
|
# Generic BSD scripts
|
||||||
SRCS+= hostid.in moused.in newsyslog.in pf.in rarpd.in rc-enabled.in \
|
SRCS+= hostid.in moused.in newsyslog.in pf.in rarpd.in rc-enabled.in \
|
||||||
rpcbind.in savecore.in syslogd.in
|
rpcbind.in savecore.in syslogd.in
|
||||||
|
|
||||||
# These are NetBSD specific
|
# These are NetBSD specific
|
||||||
SRCS+= swap-blk.in ttys.in wscons.in
|
SRCS+= devdb.in swap-blk.in ttys.in wscons.in
|
||||||
|
|
||||||
.SUFFIXES: .BSD.in
|
.SUFFIXES: .BSD.in
|
||||||
.BSD.in:
|
.BSD.in:
|
||||||
|
|||||||
@@ -28,13 +28,8 @@ cleanup_tmp_dir()
|
|||||||
cd "${dir}"
|
cd "${dir}"
|
||||||
if yesno ${wipe_tmp:-${WIPE_TMP:-yes}}; then
|
if yesno ${wipe_tmp:-${WIPE_TMP:-yes}}; then
|
||||||
ebegin "Wiping ${dir} directory"
|
ebegin "Wiping ${dir} directory"
|
||||||
local startopts="-x . -depth" delete="-exec rm -rf -- {} ;"
|
local startopts="-x . -depth"
|
||||||
|
[ "${RC_UNAME}" = "Linux" ] && startopts=". -xdev -depth"
|
||||||
if [ "${RC_UNAME}" = "Linux" ]; then
|
|
||||||
startopts=". -xdev -depth"
|
|
||||||
# busybox find / rm cannot handle --
|
|
||||||
delete="-delete"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Faster than find
|
# Faster than find
|
||||||
rm -rf -- [b-ikm-pr-zA-Z0-9\.]*
|
rm -rf -- [b-ikm-pr-zA-Z0-9\.]*
|
||||||
@@ -54,8 +49,7 @@ cleanup_tmp_dir()
|
|||||||
! -path "./journal/*" \
|
! -path "./journal/*" \
|
||||||
! -path "./.private" \
|
! -path "./.private" \
|
||||||
! -path "./.private/*" \
|
! -path "./.private/*" \
|
||||||
${delete} \
|
-exec rm -rf {} \;
|
||||||
-type d -prune
|
|
||||||
eend 0
|
eend 0
|
||||||
else
|
else
|
||||||
ebegin "Cleaning ${dir} directory"
|
ebegin "Cleaning ${dir} directory"
|
||||||
@@ -83,18 +77,29 @@ start()
|
|||||||
if dir_writeable /var/run; then
|
if dir_writeable /var/run; then
|
||||||
ebegin "Creating user login records"
|
ebegin "Creating user login records"
|
||||||
cp /dev/null /var/run/utmp
|
cp /dev/null /var/run/utmp
|
||||||
|
chgrp utmp /var/run/utmp
|
||||||
|
chmod 0664 /var/run/utmp
|
||||||
if dir_writeable /var/log; then
|
if dir_writeable /var/log; then
|
||||||
logw=true
|
logw=true
|
||||||
[ -e /var/log/wtmp ] || cp /dev/null /var/log/wtmp
|
[ -e /var/log/wtmp ] || cp /dev/null /var/log/wtmp
|
||||||
chmod 0644 /var/run/utmp /var/log/wtmp
|
chgrp utmp /var/log/wtmp
|
||||||
|
chmod 0664 /var/log/wtmp
|
||||||
fi
|
fi
|
||||||
eend 0
|
eend 0
|
||||||
|
|
||||||
ebegin "Cleaning /var/run"
|
ebegin "Cleaning /var/run"
|
||||||
for x in $(find /var/run ! -type d ! -name utmp \
|
for x in $(find /var/run ! -type d ! -name utmp \
|
||||||
! -name random-seed \
|
! -name random-seed ! -name dev.db \
|
||||||
! -name ld-elf.so.hints ! -name ld.so.hints);
|
! -name ld-elf.so.hints ! -name ld.so.hints);
|
||||||
do
|
do
|
||||||
|
# Clean stale sockets
|
||||||
|
if [ -S "${x}" ]; then
|
||||||
|
if type fuser >/dev/null 2>&1; then
|
||||||
|
fuser "${x}" 2>/dev/null || rm "${x}"
|
||||||
|
else
|
||||||
|
rm "${x}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
[ ! -f "${x}" ] && continue
|
[ ! -f "${x}" ] && continue
|
||||||
# Do not remove pidfiles of already running daemons
|
# Do not remove pidfiles of already running daemons
|
||||||
case "${x}" in
|
case "${x}" in
|
||||||
|
|||||||
21
init.d/devdb.in
Normal file
21
init.d/devdb.in
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
#!@PREFIX@/sbin/runscript
|
||||||
|
# Copyright 2008 Roy Marples <roy@marples.name>
|
||||||
|
# All rights reserved. Released under the 2-clause BSD license.
|
||||||
|
|
||||||
|
description="Creates the dev database"
|
||||||
|
|
||||||
|
depend()
|
||||||
|
{
|
||||||
|
need localmount
|
||||||
|
}
|
||||||
|
|
||||||
|
start()
|
||||||
|
{
|
||||||
|
ebegin "Bulding the dev database"
|
||||||
|
if [ /var/run/dev.db -nt /dev ]; then
|
||||||
|
:
|
||||||
|
else
|
||||||
|
dev_mkdb
|
||||||
|
fi
|
||||||
|
eend $?
|
||||||
|
}
|
||||||
36
init.d/devfs.in
Normal file
36
init.d/devfs.in
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
#!@PREFIX@/sbin/runscript
|
||||||
|
# Copyright 2007-2008 Roy Marples <roy@marples.name>
|
||||||
|
# All rights reserved. Released under the 2-clause BSD license.
|
||||||
|
|
||||||
|
description="Mount system critical filesystems in /dev."
|
||||||
|
|
||||||
|
depend() {
|
||||||
|
use dev
|
||||||
|
keyword noprefix
|
||||||
|
}
|
||||||
|
|
||||||
|
start() {
|
||||||
|
# Mount required stuff as user may not have then in /etc/fstab
|
||||||
|
for x in \
|
||||||
|
"devpts /dev/pts 0755 ,gid=5,mode=0620 devpts" \
|
||||||
|
"tmpfs /dev/shm 1777 ,nodev shm" \
|
||||||
|
; do
|
||||||
|
set -- ${x}
|
||||||
|
grep -Eq "[[:space:]]+$1$" /proc/filesystems || continue
|
||||||
|
mountinfo -q "$2" && continue
|
||||||
|
|
||||||
|
if [ ! -d "$2" ]; then
|
||||||
|
mkdir -m "$3" -p "$2" >/dev/null 2>&1 || \
|
||||||
|
ewarn "Could not create $2!"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -d "$2" ]; then
|
||||||
|
ebegin "Mounting $2"
|
||||||
|
if ! fstabinfo --mount "$2"; then
|
||||||
|
mount -n -t "$1" -o noexec,nosuid"$4" "$5" "$2"
|
||||||
|
fi
|
||||||
|
eend $?
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
return 0
|
||||||
|
}
|
||||||
17
init.d/dmesg.in
Normal file
17
init.d/dmesg.in
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
#!@PREFIX@/sbin/runscript
|
||||||
|
# Copyright 2007-2008 Roy Marples <roy@marples.name>
|
||||||
|
# All rights reserved. Released under the 2-clause BSD license.
|
||||||
|
|
||||||
|
description="Set the dmesg level for a cleaner boot"
|
||||||
|
|
||||||
|
depend()
|
||||||
|
{
|
||||||
|
before dev modules
|
||||||
|
}
|
||||||
|
|
||||||
|
start()
|
||||||
|
{
|
||||||
|
if [ -n "${dmesg_level}" ]; then
|
||||||
|
dmesg -n"${dmesg_level}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
@@ -3,12 +3,12 @@
|
|||||||
# All rights reserved. Released under the 2-clause BSD license.
|
# All rights reserved. Released under the 2-clause BSD license.
|
||||||
|
|
||||||
description="Check and repair filesystems according to /etc/fstab"
|
description="Check and repair filesystems according to /etc/fstab"
|
||||||
_ISF="
|
_IFS="
|
||||||
"
|
"
|
||||||
|
|
||||||
depend()
|
depend()
|
||||||
{
|
{
|
||||||
after clock modules
|
use dev clock modules
|
||||||
keyword nojail noopenvz noprefix notimeout novserver
|
keyword nojail noopenvz noprefix notimeout novserver
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -27,13 +27,13 @@ _reboot() {
|
|||||||
|
|
||||||
start()
|
start()
|
||||||
{
|
{
|
||||||
local reboot_opts= fsck_opts= p= check_extra=
|
local fsck_opts= p= check_extra=
|
||||||
|
|
||||||
if [ -e /fastboot ]; then
|
if [ -e /fastboot ]; then
|
||||||
ewarn "Skipping fsck due to /fastboot"
|
ewarn "Skipping fsck due to /fastboot"
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
if [ -e /forcefsck ]; then
|
if [ -e /forcefsck ] || get_bootparam forcefsck; then
|
||||||
fsck_opts="${fsck_opts} -f"
|
fsck_opts="${fsck_opts} -f"
|
||||||
check_extra="(check forced)"
|
check_extra="(check forced)"
|
||||||
fi
|
fi
|
||||||
@@ -47,7 +47,7 @@ start()
|
|||||||
case "${p}" in
|
case "${p}" in
|
||||||
[0-9]*) p="=${p}";;
|
[0-9]*) p="=${p}";;
|
||||||
esac
|
esac
|
||||||
set -- "$@" "$(fstabinfo --passno "${p}")"
|
set -- "$@" $(fstabinfo --passno "${p}")
|
||||||
unset IFS
|
unset IFS
|
||||||
done
|
done
|
||||||
|
|
||||||
@@ -60,21 +60,31 @@ start()
|
|||||||
fsck_opts="${fsck_opts} -R"
|
fsck_opts="${fsck_opts} -R"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
reboot_opts="-f"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
trap : QUIT
|
trap : INT QUIT
|
||||||
fsck ${fsck_args--p} ${fsck_opts} "$@"
|
fsck ${fsck_args--p} ${fsck_opts} "$@"
|
||||||
case $? in
|
case $? in
|
||||||
0) eend 0; return 0;;
|
0) eend 0; return 0;;
|
||||||
1) ewend 1 "Filesystems repaired"; return 0;;
|
1) ewend 1 "Filesystems repaired"; return 0;;
|
||||||
2|3|4) ewend 1 "Filesystems repaired, but reboot needed"
|
2|3) if [ "${RC_UNAME}" = "Linux" ]; then
|
||||||
_reboot ${reboot_opts} || return 1;;
|
ewend 1 "Filesystems repaired, but reboot needed"
|
||||||
8) ewend 1 "Operational error"; return 0;;
|
_reboot -f
|
||||||
12) ewend 1 "fsck interupted"; return 1;;
|
else
|
||||||
*) eend 2 "Filesystems couldn't be fixed"
|
ewend 1 "Filesystems still have errors; manual fsck required"
|
||||||
_abort || return 1;;
|
fi;;
|
||||||
|
4) if [ "${RC_UNAME}" = "Linux" ]; then
|
||||||
|
ewend 1 "Fileystem errors left uncorrected"
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
ewend 1 "Filesystems repaired, but reboot needed"
|
||||||
|
_reboot
|
||||||
|
fi;;
|
||||||
|
8) ewend 1 "Operational error"; return 0;;
|
||||||
|
12) ewend 1 "fsck interupted";;
|
||||||
|
*) eend 2 "Filesystems couldn't be fixed";;
|
||||||
esac
|
esac
|
||||||
|
_abort || return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
stop()
|
stop()
|
||||||
|
|||||||
@@ -1,100 +0,0 @@
|
|||||||
#!@SHELL@
|
|
||||||
# Copyright 2007-2008 Roy Marples <roy@marples.name>
|
|
||||||
# All rights reserved. Released under the 2-clause BSD license.
|
|
||||||
|
|
||||||
. @SYSCONFDIR@/init.d/functions.sh
|
|
||||||
. "${RC_LIBDIR}"/sh/rc-functions.sh
|
|
||||||
[ -r @SYSCONFDIR@/rc.conf ] && . @SYSCONFDIR@/rc.conf
|
|
||||||
|
|
||||||
# Support LiveCD foo
|
|
||||||
if [ -r /sbin/livecd-functions.sh ]; then
|
|
||||||
. /sbin/livecd-functions.sh
|
|
||||||
livecd_read_commandline
|
|
||||||
fi
|
|
||||||
|
|
||||||
stop_addon devfs
|
|
||||||
stop_addon udev
|
|
||||||
|
|
||||||
# Really kill things off before unmounting
|
|
||||||
if [ -x /sbin/killall5 ]; then
|
|
||||||
killall5 -15
|
|
||||||
killall5 -9
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Flush all pending disk writes now
|
|
||||||
sync; sync
|
|
||||||
|
|
||||||
# If we are in a VPS, we don't need anything below here, because
|
|
||||||
# 1) we don't need (and by default can't) umount anything (VServer) or
|
|
||||||
# 2) the host utils take care of all umounting stuff (OpenVZ)
|
|
||||||
if [ "${RC_SYS}" = "VSERVER" -o "${RC_SYS}" = "OPENVZ" ]; then
|
|
||||||
[ "${RC_SYS}" = "OPENVZ" -a "$1" = "reboot" ] && echo "" > /reboot
|
|
||||||
if [ -e @SYSCONFDIR@/init.d/"$1".sh ]; then
|
|
||||||
. @SYSCONFDIR@/init.d/"$1".sh
|
|
||||||
else
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# If $svcdir is still mounted, preserve it if we can
|
|
||||||
mnt=$(mountinfo --node "${RC_SVCDIR}")
|
|
||||||
if [ -n "${mnt}" -a -w "${RC_LIBDIR}" ]; then
|
|
||||||
f_opts="-m -c"
|
|
||||||
[ "${RC_UNAME}" = "Linux" ] && f_opts="-c"
|
|
||||||
if type fuser >/dev/null 2>&1; then
|
|
||||||
if [ -n "$(fuser ${f_opts} "${svcdir}" 2>/dev/null)" ]; then
|
|
||||||
fuser -k ${f_opts} "${svcdir}" >/dev/null 2>&1
|
|
||||||
sleep 2
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
cp -p "${RC_SVCDIR}"/deptree "${RC_SVCDIR}"/depconfig \
|
|
||||||
"${RC_SVCDIR}"/softlevel "${RC_SVCDIR}"/nettree \
|
|
||||||
"${RC_SVCDIR}"/rc.log \
|
|
||||||
"${RC_LIBDIR}" 2>/dev/null
|
|
||||||
umount "${RC_SVCDIR}"
|
|
||||||
rm -rf "${RC_SVCDIR}"/*
|
|
||||||
# Pipe errors to /dev/null as we may have future timestamps
|
|
||||||
cp -p "${RC_LIBDIR}"/deptree "${RC_LIBDIR}"/depconfig \
|
|
||||||
"${RC_LIBDIR}"/softlevel "${RC_LIBDIR}"/nettree \
|
|
||||||
"${RC_LIBDIR}"/rc.log \
|
|
||||||
"${RC_SVCDIR}" 2>/dev/null
|
|
||||||
rm -f "${RC_LIBDIR}"/deptree "${RC_LIBDIR}"/depconfig \
|
|
||||||
"${RC_LIBDIR}"/softlevel "${RC_LIBDIR}"/nettree \
|
|
||||||
"${RC_LIBDIR}"/rc.log
|
|
||||||
# Release the memory disk if we used it
|
|
||||||
case "${mnt}" in
|
|
||||||
"/dev/md"[0-9]*) mdconfig -d -u "${mnt#/dev/md*}";;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
|
|
||||||
unmounted=0
|
|
||||||
# Remount the remaining filesystems read-only
|
|
||||||
# Most BSD's don't need this as the kernel handles it nicely
|
|
||||||
if [ "${RC_UNAME}" = "Linux" ]; then
|
|
||||||
ebegin "Remounting remaining filesystems read-only"
|
|
||||||
# We need the do_unmount function
|
|
||||||
. "${RC_LIBDIR}"/sh/rc-mount.sh
|
|
||||||
eindent
|
|
||||||
fs=
|
|
||||||
for x in ${net_fs_list}; do
|
|
||||||
fs="${fs}${fs:+|}${x}"
|
|
||||||
done
|
|
||||||
[ -n "${fs}" ] && fs="^(${fs})$"
|
|
||||||
do_unmount "mount -n -o remount,ro" \
|
|
||||||
--skip-point-regex "^(/dev|/dev/.*|/proc|/proc/.*|/sys|/sys/.*)$" \
|
|
||||||
${fs:+--skip-fstype-regex} ${fs} --nonetdev
|
|
||||||
eoutdent
|
|
||||||
eend $?
|
|
||||||
unmounted=$?
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ${unmounted} -ne 0 ]; then
|
|
||||||
[ -x /sbin/sulogin ] && sulogin -t 10 /dev/console
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Load the final script - not needed on BSD so they should not exist
|
|
||||||
[ -e @SYSCONFDIR@/init.d/"$1".sh ] && . @SYSCONFDIR@/init.d/"$1".sh
|
|
||||||
|
|
||||||
# Always exit 0 here
|
|
||||||
exit 0
|
|
||||||
@@ -38,9 +38,11 @@ _set()
|
|||||||
# otherwise we generate a random UUID.
|
# otherwise we generate a random UUID.
|
||||||
reset()
|
reset()
|
||||||
{
|
{
|
||||||
local uuid=$(kenv smbios.system.uuid 2>/dev/null)
|
local uuid= x="[0-9a-f]" y="${x}${x}${x}${x}"
|
||||||
local x="[0-9a-f]"
|
|
||||||
local y="${x}${x}${x}${x}"
|
if type kenv >/dev/null 2>&1; then
|
||||||
|
uuid=$(kenv smbios.system.uuid 2>/dev/null)
|
||||||
|
fi
|
||||||
case "${uuid}" in
|
case "${uuid}" in
|
||||||
${y}${y}-${y}-${y}-${y}-${y}${y}${y});;
|
${y}${y}-${y}-${y}-${y}-${y}${y}${y});;
|
||||||
*) uuid=;;
|
*) uuid=;;
|
||||||
|
|||||||
@@ -74,8 +74,14 @@ start()
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
ebegin "Setting system clock using the hardware clock [${utc}]"
|
ebegin "Setting system clock using the hardware clock [${utc}]"
|
||||||
if [ -e /proc/modules -a ! -e /dev/rtc ]; then
|
if [ -e /proc/modules ]; then
|
||||||
modprobe -q rtc || modprobe -q genrtc
|
local rtc=
|
||||||
|
for rtc in /dev/rtc /dev/rtc[0-9]*; do
|
||||||
|
[ -e "${rtc}" ] && break
|
||||||
|
done
|
||||||
|
if [ ! -e "${rtc}" ]; then
|
||||||
|
modprobe -q rtc-cmos || modprobe -q rtc || modprobe -q genrtc
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -e /etc/adjtime ] && yesno ${clock_adjfile}; then
|
if [ -e /etc/adjtime ] && yesno ${clock_adjfile}; then
|
||||||
|
|||||||
@@ -20,6 +20,10 @@ ipfw() {
|
|||||||
/sbin/ipfw -f -q "$@"
|
/sbin/ipfw -f -q "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
have_ip6() {
|
||||||
|
sysctl net.ipv6 2>/dev/null
|
||||||
|
}
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
# Load the kernel module
|
# Load the kernel module
|
||||||
if ! sysctl net.inet.ip.fw.enable=1 >/dev/null 2>&1; then
|
if ! sysctl net.inet.ip.fw.enable=1 >/dev/null 2>&1; then
|
||||||
@@ -36,13 +40,15 @@ init() {
|
|||||||
ipfw add deny all from any to 127.0.0.0/8
|
ipfw add deny all from any to 127.0.0.0/8
|
||||||
ipfw add deny ip from 127.0.0.0/8 to any
|
ipfw add deny ip from 127.0.0.0/8 to any
|
||||||
|
|
||||||
ipfw add pass ip6 from any to any via lo0
|
if have_ip6; then
|
||||||
ipfw add deny ip6 from any to ::1
|
ipfw add pass ip6 from any to any via lo0
|
||||||
ipfw add deny ip6 from ::1 to any
|
ipfw add deny ip6 from any to ::1
|
||||||
|
ipfw add deny ip6 from ::1 to any
|
||||||
|
|
||||||
ipfw add pass ip6 from :: to ff02::/16 proto ipv6-icmp
|
ipfw add pass ip6 from :: to ff02::/16 proto ipv6-icmp
|
||||||
ipfw add pass ip6 from fe80::/10 to fe80::/10 proto ipv6-icmp
|
ipfw add pass ip6 from fe80::/10 to fe80::/10 proto ipv6-icmp
|
||||||
ipfw add pass ip6 from fe80::/10 to ff02::/16 proto ipv6-icmp
|
ipfw add pass ip6 from fe80::/10 to ff02::/16 proto ipv6-icmp
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
@@ -62,9 +68,11 @@ start() {
|
|||||||
ipfw add pass udp from me to any keep-state
|
ipfw add pass udp from me to any keep-state
|
||||||
ipfw add pass icmp from me to any keep-state
|
ipfw add pass icmp from me to any keep-state
|
||||||
|
|
||||||
ipfw add pass tcp from me6 to any setup keep-state
|
if have_ip6; then
|
||||||
ipfw add pass udp from me6 to any keep-state
|
ipfw add pass tcp from me6 to any setup keep-state
|
||||||
ipfw add pass icmp from me6 to any keep-state
|
ipfw add pass udp from me6 to any keep-state
|
||||||
|
ipfw add pass icmp from me6 to any keep-state
|
||||||
|
fi
|
||||||
|
|
||||||
# Allow DHCP.
|
# Allow DHCP.
|
||||||
ipfw add pass udp from 0.0.0.0 68 to 255.255.255.255 67 out
|
ipfw add pass udp from 0.0.0.0 68 to 255.255.255.255 67 out
|
||||||
@@ -77,11 +85,13 @@ start() {
|
|||||||
# Allow "mandatory" ICMP in.
|
# Allow "mandatory" ICMP in.
|
||||||
ipfw add pass icmp from any to any icmptype 3,4,11
|
ipfw add pass icmp from any to any icmptype 3,4,11
|
||||||
|
|
||||||
# Allow ICMPv6 destination unreach
|
if have_ip6; then
|
||||||
ipfw add pass ip6 from any to any icmp6types 1 proto ipv6-icmp
|
# Allow ICMPv6 destination unreach
|
||||||
|
ipfw add pass ip6 from any to any icmp6types 1 proto ipv6-icmp
|
||||||
|
|
||||||
# Allow NS/NA/toobig (don't filter it out)
|
# Allow NS/NA/toobig (don't filter it out)
|
||||||
ipfw add pass ip6 from any to any icmp6types 2,135,136 proto ipv6-icmp
|
ipfw add pass ip6 from any to any icmp6types 2,135,136 proto ipv6-icmp
|
||||||
|
fi
|
||||||
|
|
||||||
# Add permits for this workstations published services below
|
# Add permits for this workstations published services below
|
||||||
# Only IPs and nets in firewall_allowservices is allowed in.
|
# Only IPs and nets in firewall_allowservices is allowed in.
|
||||||
|
|||||||
22
init.d/killprocs.in
Normal file
22
init.d/killprocs.in
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
#!@PREFIX@/sbin/runscript
|
||||||
|
# Copyright 2007-2008 Roy Marples <roy@marples.name>
|
||||||
|
# All rights reserved. Released under the 2-clause BSD license.
|
||||||
|
|
||||||
|
description="Kill all processes so we can unmount disks cleanly."
|
||||||
|
|
||||||
|
depend()
|
||||||
|
{
|
||||||
|
keyword noprefix
|
||||||
|
}
|
||||||
|
|
||||||
|
start()
|
||||||
|
{
|
||||||
|
ebegin "Terminating remaining processes"
|
||||||
|
killall5 -15
|
||||||
|
sleep 1
|
||||||
|
eend 0
|
||||||
|
ebegin "Killing remaining processes"
|
||||||
|
killall5 -9
|
||||||
|
sleep 1
|
||||||
|
eend 0
|
||||||
|
}
|
||||||
@@ -39,5 +39,5 @@ stop()
|
|||||||
. @SYSCONFDIR@/conf.d/local.stop
|
. @SYSCONFDIR@/conf.d/local.stop
|
||||||
fi
|
fi
|
||||||
|
|
||||||
eend $? $"Failed to stop local"
|
eend $? "Failed to stop local"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,13 +30,13 @@ start()
|
|||||||
stop()
|
stop()
|
||||||
{
|
{
|
||||||
# We never unmount / or /dev or $RC_SVCDIR
|
# We never unmount / or /dev or $RC_SVCDIR
|
||||||
local x= no_umounts="/|/dev|/dev/.*|${RC_SVCDIR}"
|
local x= no_umounts_r="/|/dev|/dev/.*|${RC_SVCDIR}"
|
||||||
|
|
||||||
# RC_NO_UMOUNTS is an env var that can be set by plugins
|
# RC_NO_UMOUNTS is an env var that can be set by plugins
|
||||||
OIFS=${IFS} SIFS=${IFS-y}
|
OIFS=${IFS} SIFS=${IFS-y}
|
||||||
IFS=$IFS:
|
IFS=$IFS:
|
||||||
for x in ${no_umounts} ${RC_NO_UMOUNTS}; do
|
for x in ${no_umounts} ${RC_NO_UMOUNTS}; do
|
||||||
no_umounts="${no_umounts}|${x}"
|
no_umounts_r="${no_umounts_r}|${x}"
|
||||||
done
|
done
|
||||||
if [ "${SIFS}" = "y" ]; then
|
if [ "${SIFS}" = "y" ]; then
|
||||||
IFS=$OIFS
|
IFS=$OIFS
|
||||||
@@ -45,9 +45,9 @@ stop()
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${RC_UNAME}" = "Linux" ]; then
|
if [ "${RC_UNAME}" = "Linux" ]; then
|
||||||
no_umounts="${no_umounts}|/proc|/proc/.*|/sys|/sys/.*"
|
no_umounts_r="${no_umounts_r}|/proc|/proc/.*|/sys|/sys/.*"
|
||||||
fi
|
fi
|
||||||
no_umounts="^(${no_umounts})$"
|
no_umounts_r="^(${no_umounts_r})$"
|
||||||
|
|
||||||
# Flush all pending disk writes now
|
# Flush all pending disk writes now
|
||||||
sync; sync
|
sync; sync
|
||||||
@@ -63,7 +63,7 @@ stop()
|
|||||||
# Umount loopback devices
|
# Umount loopback devices
|
||||||
einfo "Unmounting loopback devices"
|
einfo "Unmounting loopback devices"
|
||||||
eindent
|
eindent
|
||||||
do_unmount "umount -d" --skip-point-regex "${no_umounts}" \
|
do_unmount "umount -d" --skip-point-regex "${no_umounts_r}" \
|
||||||
--node-regex "^/dev/loop"
|
--node-regex "^/dev/loop"
|
||||||
eoutdent
|
eoutdent
|
||||||
|
|
||||||
@@ -76,7 +76,7 @@ stop()
|
|||||||
fs="${fs}${fs:+|}${x}"
|
fs="${fs}${fs:+|}${x}"
|
||||||
done
|
done
|
||||||
[ -n "${fs}" ] && fs="^(${fs})$"
|
[ -n "${fs}" ] && fs="^(${fs})$"
|
||||||
do_unmount "umount" --skip-point-regex "${no_umounts}" \
|
do_unmount "umount" --skip-point-regex "${no_umounts_r}" \
|
||||||
${fs:+--skip-fstype-regex} ${fs} --nonetdev
|
${fs:+--skip-fstype-regex} ${fs} --nonetdev
|
||||||
eoutdent
|
eoutdent
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ start()
|
|||||||
x=${KV#*.*.}
|
x=${KV#*.*.}
|
||||||
local KV_MICRO=${x%%-*}
|
local KV_MICRO=${x%%-*}
|
||||||
|
|
||||||
local list= x= xx= y= args= cnt=0
|
local list= x= xx= y= args= mpargs= cnt=0 a=
|
||||||
for x in "${KV}" \
|
for x in "${KV}" \
|
||||||
${KV_MAJOR}.${KV_MINOR}.${KV_MICRO} \
|
${KV_MAJOR}.${KV_MINOR}.${KV_MICRO} \
|
||||||
${KV_MAJOR}.${KV_MINOR} \
|
${KV_MAJOR}.${KV_MINOR} \
|
||||||
@@ -34,25 +34,30 @@ start()
|
|||||||
[ -z "${list}" ] && list=${modules}
|
[ -z "${list}" ] && list=${modules}
|
||||||
|
|
||||||
for x in ${list}; do
|
for x in ${list}; do
|
||||||
ebegin "Loading module ${x}"
|
a=${x#*:}
|
||||||
|
if [ "${a}" = "${x}" ]; then
|
||||||
|
unset mpargs
|
||||||
|
ebegin "Loading module ${x}"
|
||||||
|
else
|
||||||
|
x=${x%%:*}
|
||||||
|
mpargs="-o ${a}"
|
||||||
|
ebegin "Loading module ${x} as ${a}"
|
||||||
|
fi
|
||||||
|
aa=$(shell_var "${a}")
|
||||||
xx=$(shell_var "${x}")
|
xx=$(shell_var "${x}")
|
||||||
for y in "${KV}" \
|
for y in "${KV}" \
|
||||||
${KV_MAJOR}.${KV_MINOR}.${KV_MICRO} \
|
${KV_MAJOR}.${KV_MINOR}.${KV_MICRO} \
|
||||||
${KV_MAJOR}.${KV_MINOR} \
|
${KV_MAJOR}.${KV_MINOR} \
|
||||||
; do
|
; do
|
||||||
|
eval args=\$module_${aa}_args_$(shell_var "${y}")
|
||||||
|
[ -n "${args}" ] && break
|
||||||
eval args=\$module_${xx}_args_$(shell_var "${y}")
|
eval args=\$module_${xx}_args_$(shell_var "${y}")
|
||||||
[ -n "${args}" ] && break
|
[ -n "${args}" ] && break
|
||||||
done
|
done
|
||||||
|
[ -z "${args}" ] && eval args=\$module_${aa}_args
|
||||||
[ -z "${args}" ] && eval args=\$module_${xx}_args
|
[ -z "${args}" ] && eval args=\$module_${xx}_args
|
||||||
eval modprobe -q "${x}" "${args}"
|
eval modprobe -q "${mpargs}" "${x}" "${args}"
|
||||||
eend $? "Failed to load ${x}" && cnt=$((${cnt} + 1))
|
eend $? "Failed to load ${x}" && cnt=$((${cnt} + 1))
|
||||||
done
|
done
|
||||||
einfo "Autoloaded ${cnt} module(s)"
|
einfo "Autoloaded ${cnt} module(s)"
|
||||||
|
|
||||||
# Just in case a sysadmin prefers generic symbolic links in
|
|
||||||
# /lib/modules/boot for boot time modules we will load these modules
|
|
||||||
[ -n "$(modprobe -l -t boot)" ] && modprobe -a -t boot \* 2>/dev/null
|
|
||||||
|
|
||||||
# Above test clobbers the return
|
|
||||||
return 0
|
|
||||||
}
|
}
|
||||||
|
|||||||
45
init.d/mount-ro.in
Normal file
45
init.d/mount-ro.in
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
#!@PREFIX@/sbin/runscript
|
||||||
|
# Copyright 2007-2008 Roy Marples <roy@marples.name>
|
||||||
|
# All rights reserved. Released under the 2-clause BSD license.
|
||||||
|
|
||||||
|
description="Re-mount filesytems read-only for a clean reboot."
|
||||||
|
|
||||||
|
depend()
|
||||||
|
{
|
||||||
|
need killprocs savecache
|
||||||
|
keyword noprefix noopenvz novserver
|
||||||
|
}
|
||||||
|
|
||||||
|
start()
|
||||||
|
{
|
||||||
|
# Flush all pending disk writes now
|
||||||
|
sync; sync
|
||||||
|
|
||||||
|
ebegin "Remounting remaining filesystems read-only"
|
||||||
|
# We need the do_unmount function
|
||||||
|
. "${RC_LIBDIR}"/sh/rc-mount.sh
|
||||||
|
eindent
|
||||||
|
local m="/dev|/dev/.*|/proc|/proc.*|/sys|/sys/.*|${RC_SVCDIR}" x= fs=
|
||||||
|
# RC_NO_UMOUNTS is an env var that can be set by plugins
|
||||||
|
local OIFS=$IFS SIFS=${IFS-y} IFS=$IFS
|
||||||
|
IFS=$IFS:
|
||||||
|
for x in ${no_umounts} ${RC_NO_UMOUNTS}; do
|
||||||
|
m="${m}|${x}"
|
||||||
|
done
|
||||||
|
if [ "${SIFS}" = y ]; then
|
||||||
|
IFS=$OIFS
|
||||||
|
else
|
||||||
|
unset IFS
|
||||||
|
fi
|
||||||
|
m="^(${m})$"
|
||||||
|
fs=
|
||||||
|
for x in ${net_fs_list}; do
|
||||||
|
fs="${fs}${fs:+|}${x}"
|
||||||
|
done
|
||||||
|
[ -n "${fs}" ] && fs="^(${fs})$"
|
||||||
|
do_unmount "umount -r" \
|
||||||
|
--skip-point-regex "${m}" \
|
||||||
|
${fs:+--skip-fstype-regex} ${fs} --nonetdev
|
||||||
|
eoutdent
|
||||||
|
eend $?
|
||||||
|
}
|
||||||
@@ -445,6 +445,35 @@ _load_config()
|
|||||||
config_index=-1
|
config_index=-1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Support functions
|
||||||
|
_run_if()
|
||||||
|
{
|
||||||
|
local cmd=$1 iface=$2 ifr=${IFACE} ifv=${IFVAR}
|
||||||
|
# Ensure that we don't stamp on real values
|
||||||
|
local IFACE= IFVAR=
|
||||||
|
shift
|
||||||
|
if [ -n "${iface}" ]; then
|
||||||
|
IFACE="${iface}"
|
||||||
|
[ "${iface}" != "${ifr}" ] && IFVAR=$(shell_var "${IFACE}")
|
||||||
|
else
|
||||||
|
IFACE=${ifr}
|
||||||
|
IFVAR=${ifv}
|
||||||
|
fi
|
||||||
|
${cmd}
|
||||||
|
}
|
||||||
|
interface_exists()
|
||||||
|
{
|
||||||
|
_run_if _exists "$@"
|
||||||
|
}
|
||||||
|
interface_up()
|
||||||
|
{
|
||||||
|
_run_if _up "$@"
|
||||||
|
}
|
||||||
|
interface_down()
|
||||||
|
{
|
||||||
|
_run_if _down "$@"
|
||||||
|
}
|
||||||
|
|
||||||
start()
|
start()
|
||||||
{
|
{
|
||||||
local IFACE=${RC_SVCNAME#*.} oneworked=false module=
|
local IFACE=${RC_SVCNAME#*.} oneworked=false module=
|
||||||
@@ -581,7 +610,8 @@ ${routes}"
|
|||||||
-net" "*|-host" "*);;
|
-net" "*|-host" "*);;
|
||||||
*" "netmask" "*) cmd="-net ${cmd}";;
|
*" "netmask" "*) cmd="-net ${cmd}";;
|
||||||
*.*.*.*/32*) cmd="-host ${cmd}";;
|
*.*.*.*/32*) cmd="-host ${cmd}";;
|
||||||
*.*.*.*/*|0.0.0.0" "*|default" "*) cmd="-net ${cmd}";;
|
*.*.*.*/*|0.0.0.0|0.0.0.0" "*) cmd="-net ${cmd}";;
|
||||||
|
default|default" "*) cmd="-net ${cmd}";;
|
||||||
*) cmd="-host ${cmd}";;
|
*) cmd="-host ${cmd}";;
|
||||||
esac
|
esac
|
||||||
if ${hidefirstroute}; then
|
if ${hidefirstroute}; then
|
||||||
@@ -663,9 +693,14 @@ stop()
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
! yesno ${IN_BACKGROUND} && \
|
# If not in background, and not loopback then bring the interface down
|
||||||
[ "${IFACE}" != "lo" -a "${IFACE}" != "lo0" ] && \
|
# unless overridden.
|
||||||
_down 2>/dev/null
|
if ! yesno ${IN_BACKGROUND} && \
|
||||||
|
[ "${IFACE}" != "lo" -a "${IFACE}" != "lo0" ]; then
|
||||||
|
eval module=\$ifdown_${IFVAR}
|
||||||
|
module=${module:-${ifdown:-YES}}
|
||||||
|
yesno ${module} && _down 2>/dev/null
|
||||||
|
fi
|
||||||
|
|
||||||
type resolvconf >/dev/null 2>&1 && resolvconf -d "${IFACE}" 2>/dev/null
|
type resolvconf >/dev/null 2>&1 && resolvconf -d "${IFACE}" 2>/dev/null
|
||||||
|
|
||||||
@@ -33,8 +33,9 @@ depend()
|
|||||||
|
|
||||||
config /etc/fstab
|
config /etc/fstab
|
||||||
need net ${pmap}
|
need net ${pmap}
|
||||||
use afc-client amd autofs dns nfs nfsmount portmap rpcbind rpc.statd
|
use afc-client amd autofs openvpn
|
||||||
keyword nojail noopenvz noprefix novserver
|
use dns nfs nfsmount portmap rpcbind rpc.statd rpc.lockd
|
||||||
|
keyword nojail noprefix novserver
|
||||||
}
|
}
|
||||||
|
|
||||||
start()
|
start()
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ description="Mounts misc filesystems in /proc."
|
|||||||
|
|
||||||
depend()
|
depend()
|
||||||
{
|
{
|
||||||
|
use devfs
|
||||||
need localmount
|
need localmount
|
||||||
keyword noopenvz noprefix novserver
|
keyword noopenvz noprefix novserver
|
||||||
}
|
}
|
||||||
@@ -39,7 +40,7 @@ start()
|
|||||||
# Setup Kernel Support for the NFS daemon status
|
# Setup Kernel Support for the NFS daemon status
|
||||||
if [ -d /proc/fs/nfsd ] && ! mountinfo -q /proc/fs/nfsd; then
|
if [ -d /proc/fs/nfsd ] && ! mountinfo -q /proc/fs/nfsd; then
|
||||||
if grep -qs nfsd /proc/filesystems; then
|
if grep -qs nfsd /proc/filesystems; then
|
||||||
ebegin "Mounting nfsd filesystem"
|
ebegin "Mounting NFS filesystem"
|
||||||
mount -t nfsd -o nodev,noexec,nosuid \
|
mount -t nfsd -o nodev,noexec,nosuid \
|
||||||
nfsd /proc/fs/nfsd
|
nfsd /proc/fs/nfsd
|
||||||
eend $?
|
eend $?
|
||||||
@@ -56,26 +57,6 @@ start()
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Setup Kernel Support for securityfs
|
|
||||||
if [ -d /sys/kernel/security ] && ! mountinfo -q /sys/kernel/security; then
|
|
||||||
if grep -qs securityfs /proc/filesystems; then
|
|
||||||
ebegin "Mounting security filesystem"
|
|
||||||
mount -t securityfs -o nodev,noexec,nosuid \
|
|
||||||
securityfs /sys/kernel/security
|
|
||||||
eend $?
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Setup Kernel Support for debugfs
|
|
||||||
if [ -d /sys/kernel/debug ] && ! mountinfo -q /sys/kernel/debug; then
|
|
||||||
if grep -qs debugfs /proc/filesystems; then
|
|
||||||
ebegin "Mounting debug filesystem"
|
|
||||||
mount -t debugfs -o nodev,noexec,nosuid \
|
|
||||||
debugfs /sys/kernel/debug
|
|
||||||
eend $?
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Setup Kernel Support for SELinux
|
# Setup Kernel Support for SELinux
|
||||||
if [ -d /selinux ] && ! mountinfo -q /selinux; then
|
if [ -d /selinux ] && ! mountinfo -q /selinux; then
|
||||||
if grep -qs selinuxfs /proc/filesystems; then
|
if grep -qs selinuxfs /proc/filesystems; then
|
||||||
|
|||||||
25
init.d/savecache.in
Normal file
25
init.d/savecache.in
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
#!@PREFIX@/sbin/runscript
|
||||||
|
# Copyright 2007-2008 Roy Marples <roy@marples.name>
|
||||||
|
# All rights reserved. Released under the 2-clause BSD license.
|
||||||
|
|
||||||
|
description="Saves the caches OpenRC uses to non volatile storage"
|
||||||
|
|
||||||
|
start()
|
||||||
|
{
|
||||||
|
ebegin "Saving dependency cache"
|
||||||
|
if [ ! -d "${RC_LIBDIR}"/cache ]; then
|
||||||
|
rm -rf "${RC_LIBDIR}"/cache
|
||||||
|
if ! mkdir "${RC_LIBDIR}"/cache; then
|
||||||
|
eend $?
|
||||||
|
return $?
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
local save=
|
||||||
|
for x in deptree depconfig softlevel nettree rc.log; do
|
||||||
|
[ -e "${RC_SVCDIR}/${x}" ] && save="${save} ${RC_SVCDIR}/${x}"
|
||||||
|
done
|
||||||
|
if [ -n "${save}" ]; then
|
||||||
|
cp -p ${save} "${RC_LIBDIR}"/cache 2>/dev/null
|
||||||
|
fi
|
||||||
|
eend $?
|
||||||
|
}
|
||||||
@@ -49,10 +49,10 @@ start() {
|
|||||||
|
|
||||||
local v= f=
|
local v= f=
|
||||||
for v in font8x16 font8x14 font8x8; do
|
for v in font8x16 font8x14 font8x8; do
|
||||||
f=$(eval \$"${v}")
|
eval f=\$${v}
|
||||||
if [ -n "${f}" ]; then
|
if [ -n "${f}" ]; then
|
||||||
ebegin "Setting font ${f}"
|
ebegin "Setting font ${f}"
|
||||||
vidcontrol -f ${v##FONT} ${f}
|
vidcontrol -f ${v##font} ${f}
|
||||||
eend $?
|
eend $?
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|||||||
63
init.d/sysfs.in
Normal file
63
init.d/sysfs.in
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
#!@PREFIX@/sbin/runscript
|
||||||
|
# Copyright 2007-2008 Roy Marples <roy@marples.name>
|
||||||
|
# All rights reserved. Released under the 2-clause BSD license.
|
||||||
|
|
||||||
|
description="Mount the sys filesystem."
|
||||||
|
|
||||||
|
depend()
|
||||||
|
{
|
||||||
|
keyword noprefix
|
||||||
|
}
|
||||||
|
|
||||||
|
mount_sys()
|
||||||
|
{
|
||||||
|
grep -Eq "[[:space:]]+sysfs$" /proc/filesystems || return 1
|
||||||
|
mountinfo -q /sys && return 0
|
||||||
|
|
||||||
|
if [ ! -d /sys ]; then
|
||||||
|
if ! mkdir -m 0755 /sys; then
|
||||||
|
ewarn "Could not create /sys!"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
ebegin "Mounting /sys"
|
||||||
|
if ! fstabinfo --mount /sys; then
|
||||||
|
mount -n -t sysfs -o noexec,nosuid,nodev sysfs /sys
|
||||||
|
fi
|
||||||
|
eend $?
|
||||||
|
}
|
||||||
|
|
||||||
|
mount_misc()
|
||||||
|
{
|
||||||
|
# Setup Kernel Support for securityfs
|
||||||
|
if [ -d /sys/kernel/security ] && ! mountinfo -q /sys/kernel/security; then
|
||||||
|
if grep -qs securityfs /proc/filesystems; then
|
||||||
|
ebegin "Mounting security filesystem"
|
||||||
|
mount -n -t securityfs -o nodev,noexec,nosuid \
|
||||||
|
securityfs /sys/kernel/security
|
||||||
|
eend $?
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Setup Kernel Support for debugfs
|
||||||
|
if [ -d /sys/kernel/debug ] && ! mountinfo -q /sys/kernel/debug; then
|
||||||
|
if grep -qs debugfs /proc/filesystems; then
|
||||||
|
ebegin "Mounting debug filesystem"
|
||||||
|
mount -n -t debugfs -o nodev,noexec,nosuid \
|
||||||
|
debugfs /sys/kernel/debug
|
||||||
|
eend $?
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
start()
|
||||||
|
{
|
||||||
|
local retval
|
||||||
|
mount_sys
|
||||||
|
retval=$?
|
||||||
|
if [ ${retval} -eq 0 ]; then
|
||||||
|
mount_misc
|
||||||
|
fi
|
||||||
|
return ${retval}
|
||||||
|
}
|
||||||
@@ -18,7 +18,7 @@ MAKE_LINKS= suffix=$${man\#*.}; \
|
|||||||
|
|
||||||
MK= ../mk
|
MK= ../mk
|
||||||
include ${MK}/sys.mk
|
include ${MK}/sys.mk
|
||||||
include ${MK}/gitignore.mk
|
include ${MK}/svnignore.mk
|
||||||
|
|
||||||
all:
|
all:
|
||||||
|
|
||||||
|
|||||||
@@ -202,4 +202,4 @@ Rinse and repeat for the other verbose functions.
|
|||||||
.Sh SEE ALSO
|
.Sh SEE ALSO
|
||||||
.Xr printf 3 ,
|
.Xr printf 3 ,
|
||||||
.Sh AUTHORS
|
.Sh AUTHORS
|
||||||
.An "Roy Marples" Aq roy@marples.name
|
.An Roy Marples <roy@marples.name>
|
||||||
|
|||||||
@@ -61,4 +61,4 @@ does the same and also prints the full path of the service to stdout.
|
|||||||
.Xr rc 8 ,
|
.Xr rc 8 ,
|
||||||
.Xr stdout 3
|
.Xr stdout 3
|
||||||
.Sh AUTHORS
|
.Sh AUTHORS
|
||||||
.An "Roy Marples" Aq roy@marples.name
|
.An Roy Marples" <roy@marples.name>
|
||||||
|
|||||||
@@ -61,4 +61,4 @@ Show information only for the named
|
|||||||
.Xr rc 8 ,
|
.Xr rc 8 ,
|
||||||
.Xr rc-update 8
|
.Xr rc-update 8
|
||||||
.Sh AUTHORS
|
.Sh AUTHORS
|
||||||
.An "Roy Marples" Aq roy@marples.name
|
.An Roy Marples" <roy@marples.name>
|
||||||
|
|||||||
@@ -77,4 +77,4 @@ Show all services.
|
|||||||
.Xr rc 8 ,
|
.Xr rc 8 ,
|
||||||
.Xr rc-status 8
|
.Xr rc-status 8
|
||||||
.Sh AUTHORS
|
.Sh AUTHORS
|
||||||
.An "Roy Marples" Aq roy@marples.name
|
.An Roy Marples" <roy@marples.name>
|
||||||
|
|||||||
25
man/rc.8
25
man/rc.8
@@ -22,7 +22,7 @@
|
|||||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
.\" SUCH DAMAGE.
|
.\" SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.Dd Feb 22, 2008
|
.Dd November 03, 2008
|
||||||
.Dt RC 8 SMM
|
.Dt RC 8 SMM
|
||||||
.Os OpenRC
|
.Os OpenRC
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
@@ -60,18 +60,25 @@ sysinit always runs when the host first starts should not be run again.
|
|||||||
Generally the only services you should add to the boot runlevel are those
|
Generally the only services you should add to the boot runlevel are those
|
||||||
which deal with the mounting of filesystems, set the initial state of attached
|
which deal with the mounting of filesystems, set the initial state of attached
|
||||||
peripherals and logging.
|
peripherals and logging.
|
||||||
Coldplugged services are added to the boot runlevel by the system.
|
Hotplugged services are added to the boot runlevel by the system.
|
||||||
All services in the boot runlevel are automatically included in all other
|
All services in the boot and sysinit runlevels are automatically included
|
||||||
runlevels except for those listed here.
|
in all other runlevels except for those listed here.
|
||||||
.It Ar single
|
.It Ar single
|
||||||
Stops all services and enters single user mode.
|
Stops all services except for those in the sysinit runlevel.
|
||||||
.It Ar reboot
|
|
||||||
Changes to the single runlevel and then reboots the host.
|
|
||||||
.It Ar shutdown
|
.It Ar shutdown
|
||||||
Changes to the single runlevel and then halts the host.
|
Changes to the single runlevel and then halts the host.
|
||||||
.El
|
.El
|
||||||
|
.Pp
|
||||||
|
You should not call any of these runlevels yourself.
|
||||||
|
Instead you should use
|
||||||
|
.Xr init 8
|
||||||
|
and
|
||||||
|
.Xr shutdown 8
|
||||||
|
and let them call these special runlevels.
|
||||||
.Sh SEE ALSO
|
.Sh SEE ALSO
|
||||||
.Xr rc-status 8 ,
|
.Xr rc-status 8 ,
|
||||||
.Xr rc-update 8
|
.Xr rc-update 8 ,
|
||||||
|
.Xr init 8 ,
|
||||||
|
.Xr shutdown 8
|
||||||
.Sh AUTHORS
|
.Sh AUTHORS
|
||||||
.An "Roy Marples" Aq roy@marples.name
|
.An Roy Marples <roy@marples.name>
|
||||||
|
|||||||
@@ -70,4 +70,4 @@ is set to
|
|||||||
.Xr rc_stringlist_free 3 ,
|
.Xr rc_stringlist_free 3 ,
|
||||||
.Xr sh 1
|
.Xr sh 1
|
||||||
.Sh AUTHORS
|
.Sh AUTHORS
|
||||||
.An "Roy Marples" Aq roy@marples.name
|
.An Roy Marples" <roy@marples.name>
|
||||||
|
|||||||
@@ -110,4 +110,4 @@ when done.
|
|||||||
.Xr rc_stringlist_free 3 ,
|
.Xr rc_stringlist_free 3 ,
|
||||||
.Xr runscript 8
|
.Xr runscript 8
|
||||||
.Sh AUTHORS
|
.Sh AUTHORS
|
||||||
.An "Roy Marples" Aq roy@marples.name
|
.An Roy Marples" <roy@marples.name>
|
||||||
|
|||||||
@@ -67,4 +67,4 @@ Each RC_PID should be freed in the list as well as the list itself when done.
|
|||||||
.Xr free 3 ,
|
.Xr free 3 ,
|
||||||
.Xr queue 3
|
.Xr queue 3
|
||||||
.Sh AUTHORS
|
.Sh AUTHORS
|
||||||
.An "Roy Marples" Aq roy@marples.name
|
.An Roy Marples" <roy@marples.name>
|
||||||
|
|||||||
@@ -48,4 +48,4 @@ Plugins can affect the parent environemnt by writing NULL separated strings to
|
|||||||
.Xr rc 8 ,
|
.Xr rc 8 ,
|
||||||
.Xr runscript 8
|
.Xr runscript 8
|
||||||
.Sh AUTHORS
|
.Sh AUTHORS
|
||||||
.An "Roy Marples" Aq roy@marples.name
|
.An Roy Marples" <roy@marples.name>
|
||||||
|
|||||||
@@ -63,4 +63,4 @@ Rinse and repeat for the other verbose functions.
|
|||||||
.Xr free 3
|
.Xr free 3
|
||||||
.Xr rc_stringlist_free 3
|
.Xr rc_stringlist_free 3
|
||||||
.Sh AUTHORS
|
.Sh AUTHORS
|
||||||
.An "Roy Marples" Aq roy@marples.name
|
.An Roy Marples" <roy@marples.name>
|
||||||
|
|||||||
@@ -227,4 +227,4 @@ normally holds the volatile state data for services on a RAM backed disk.
|
|||||||
.Xr rc_stringlist_free 3 ,
|
.Xr rc_stringlist_free 3 ,
|
||||||
.Xr start-stop-daemon 8
|
.Xr start-stop-daemon 8
|
||||||
.Sh AUTHORS
|
.Sh AUTHORS
|
||||||
.An "Roy Marples" Aq roy@marples.name
|
.An Roy Marples" <roy@marples.name>
|
||||||
|
|||||||
@@ -85,4 +85,4 @@ itself.
|
|||||||
.Xr queue 3 ,
|
.Xr queue 3 ,
|
||||||
.Xr strcmp 3
|
.Xr strcmp 3
|
||||||
.Sh AUTHORS
|
.Sh AUTHORS
|
||||||
.An "Roy Marples" Aq roy@marples.name
|
.An Roy Marples" <roy@marples.name>
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
.\" SUCH DAMAGE.
|
.\" SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.Dd Mar 19, 2008
|
.Dd September 19, 2008
|
||||||
.Dt RUNSCRIPT 8 SMM
|
.Dt RUNSCRIPT 8 SMM
|
||||||
.Os OpenRC
|
.Os OpenRC
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
@@ -111,11 +111,11 @@ You should define a
|
|||||||
function for the service so that
|
function for the service so that
|
||||||
.Nm
|
.Nm
|
||||||
will start and stop it in the right order in relation to other services.
|
will start and stop it in the right order in relation to other services.
|
||||||
As it's a function it can be very flexable, see the example below.
|
As it's a function it can be very flexible, see the example below.
|
||||||
Here is a list of the functions you can use in a
|
Here is a list of the functions you can use in a
|
||||||
.Ic depend
|
.Ic depend
|
||||||
function. You simply pass the names of the services to it to add to that
|
function. You simply pass the names of the services to it to add to that
|
||||||
dpendency type, or prefix it with ! to remove it.
|
dependency type, or prefix it with ! to remove it.
|
||||||
.Bl -tag -width "RC_DEFAULTLEVEL"
|
.Bl -tag -width "RC_DEFAULTLEVEL"
|
||||||
.It Ic need
|
.It Ic need
|
||||||
The service will refuse to start until needed services have started and it
|
The service will refuse to start until needed services have started and it
|
||||||
@@ -173,8 +173,9 @@ If
|
|||||||
does not equal 0 then output the string using
|
does not equal 0 then output the string using
|
||||||
.Ic eerror
|
.Ic eerror
|
||||||
and !! in square brackets
|
and !! in square brackets
|
||||||
at the end of the line. Otherwise output ok in square brackets at the end of
|
at the end of the line.
|
||||||
the line. The value of
|
Otherwise output ok in square brackets at the end of the line.
|
||||||
|
The value of
|
||||||
.Ar retval
|
.Ar retval
|
||||||
is returned.
|
is returned.
|
||||||
.It Ic ewend Ar retval Op Ar string
|
.It Ic ewend Ar retval Op Ar string
|
||||||
@@ -193,6 +194,14 @@ output when the environment variable
|
|||||||
.Va EINFO_VERBOSE
|
.Va EINFO_VERBOSE
|
||||||
is true.
|
is true.
|
||||||
.Bl -tag -width indent
|
.Bl -tag -width indent
|
||||||
|
.It Ic ewaitfile Ar timeout Ar file1 Ar file2 ...
|
||||||
|
Wait for
|
||||||
|
.Ar timeout
|
||||||
|
seconds until all files exist.
|
||||||
|
Returns 0 if all files exist, otherwise non zero.
|
||||||
|
If
|
||||||
|
.Ar timeout
|
||||||
|
is less then 1 then we wait indefinitely.
|
||||||
.It Ic is_newer_than Ar file1 Ar file2 ...
|
.It Ic is_newer_than Ar file1 Ar file2 ...
|
||||||
If
|
If
|
||||||
.Ar file1
|
.Ar file1
|
||||||
@@ -205,7 +214,7 @@ is a directory, then check all it's contents too.
|
|||||||
.It Ic is_older_than Ar file1 Ar file2 ...
|
.It Ic is_older_than Ar file1 Ar file2 ...
|
||||||
If
|
If
|
||||||
.Ar file1
|
.Ar file1
|
||||||
is older than
|
is newer than
|
||||||
.Ar file2
|
.Ar file2
|
||||||
return 0, otherwise 1.
|
return 0, otherwise 1.
|
||||||
If
|
If
|
||||||
@@ -432,6 +441,16 @@ show()
|
|||||||
}
|
}
|
||||||
|
|
||||||
.Ed
|
.Ed
|
||||||
|
.Sh BUGS
|
||||||
|
Because of the way we load our configuration files and the need to handle
|
||||||
|
more than one service directory, you can only use symlinks in service
|
||||||
|
directories to other services in the same directory.
|
||||||
|
You cannot symlink to a service in a different directory even if it is
|
||||||
|
another service directory.
|
||||||
|
.Pp
|
||||||
|
is_older_than should return 0 on success.
|
||||||
|
Instead we return 1 to be compliant with Gentoo baselayout.
|
||||||
|
Users are encouraged to use the is_newer_than function which returns correctly.
|
||||||
.Sh SEE ALSO
|
.Sh SEE ALSO
|
||||||
.Xr einfo 3 ,
|
.Xr einfo 3 ,
|
||||||
.Xr rc 8 ,
|
.Xr rc 8 ,
|
||||||
@@ -442,4 +461,4 @@ show()
|
|||||||
.Xr start-stop-daemon 8 ,
|
.Xr start-stop-daemon 8 ,
|
||||||
.Xr uname 1
|
.Xr uname 1
|
||||||
.Sh AUTHORS
|
.Sh AUTHORS
|
||||||
.An "Roy Marples" Aq roy@marples.name
|
.An Roy Marples" <roy@marples.name>
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
.\" SUCH DAMAGE.
|
.\" SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.Dd Feb 24, 2008
|
.Dd September 27, 2008
|
||||||
.Dt START-STOP-DAEMON 8 SMM
|
.Dt START-STOP-DAEMON 8 SMM
|
||||||
.Os OpenRC
|
.Os OpenRC
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
@@ -44,6 +44,11 @@
|
|||||||
.Sh DESCRIPTION
|
.Sh DESCRIPTION
|
||||||
.Nm
|
.Nm
|
||||||
provides a consistent method of starting, stopping and signalling daemons.
|
provides a consistent method of starting, stopping and signalling daemons.
|
||||||
|
If neither
|
||||||
|
.Fl K , -stop
|
||||||
|
nor
|
||||||
|
.Fl s , -signal
|
||||||
|
are provided, then we assume we are starting the daemon.
|
||||||
If a daemon cannot background by itself, nor create a pidfile,
|
If a daemon cannot background by itself, nor create a pidfile,
|
||||||
.Nm
|
.Nm
|
||||||
can do it for the daemon in a secure fashion.
|
can do it for the daemon in a secure fashion.
|
||||||
@@ -67,16 +72,8 @@ Here are the options to specify the daemon and how it should start or stop:
|
|||||||
The
|
The
|
||||||
.Ar daemon
|
.Ar daemon
|
||||||
we start or stop.
|
we start or stop.
|
||||||
If the
|
If this option is not specified, then the first non option argument
|
||||||
.Ar daemon
|
is used.
|
||||||
is a script and you are not using the pidfile or process name options,
|
|
||||||
then you should replace
|
|
||||||
.Ar daemon
|
|
||||||
with the interpreter and pass
|
|
||||||
.Ar daemon
|
|
||||||
as an argument. Below is an example:
|
|
||||||
.Pp
|
|
||||||
start-stop-daemon -Sx /usr/bin/perl -- /usr/bin/daemon.pl
|
|
||||||
.It Fl p , -pidfile Ar pidfile
|
.It Fl p , -pidfile Ar pidfile
|
||||||
When starting, we expect the daemon to create a valid
|
When starting, we expect the daemon to create a valid
|
||||||
.Ar pidfile
|
.Ar pidfile
|
||||||
@@ -97,10 +94,17 @@ name here also.
|
|||||||
.It Fl t , -test
|
.It Fl t , -test
|
||||||
Print the action(s) that would be taken, but don't actually do anything.
|
Print the action(s) that would be taken, but don't actually do anything.
|
||||||
The return value is set as if the command was taken and worked.
|
The return value is set as if the command was taken and worked.
|
||||||
|
.It Fl v , -verbose
|
||||||
|
P
|
||||||
|
Print the action(s) that are taken just before doing them.
|
||||||
.El
|
.El
|
||||||
.Pp
|
.Pp
|
||||||
These options are only used for starting daemons:
|
These options are only used for starting daemons:
|
||||||
.Bl -tag -width indent
|
.Bl -tag -width indent
|
||||||
|
.It Fl a , -startas Ar name
|
||||||
|
Change the process name of the daemon to
|
||||||
|
.Ar name .
|
||||||
|
This just changes the first argument passed to the daemon.
|
||||||
.It Fl b , -background
|
.It Fl b , -background
|
||||||
Force the daemon into the background. Some daemons don't create pidfiles, so a
|
Force the daemon into the background. Some daemons don't create pidfiles, so a
|
||||||
good trick is to get the daemon to run in the foreground, and use the this
|
good trick is to get the daemon to run in the foreground, and use the this
|
||||||
@@ -116,6 +120,8 @@ as the path to the daemon, chdir and pidfile, should be relative to the chroot.
|
|||||||
Set the environment variable VAR to VALUE.
|
Set the environment variable VAR to VALUE.
|
||||||
.It Fl g , -group Ar group
|
.It Fl g , -group Ar group
|
||||||
Start the daemon as in the group.
|
Start the daemon as in the group.
|
||||||
|
.It Fl k , -umask Ar mode
|
||||||
|
Set the umask of the daemon.
|
||||||
.It Fl m , -make-pidfile
|
.It Fl m , -make-pidfile
|
||||||
Saves the pid of the daemon in the file specified by the
|
Saves the pid of the daemon in the file specified by the
|
||||||
.Fl p , -pidfile
|
.Fl p , -pidfile
|
||||||
@@ -123,7 +129,7 @@ option. Only useful when used with daemons that run in the foreground and
|
|||||||
forced into the background with the
|
forced into the background with the
|
||||||
.Fl -b , -background
|
.Fl -b , -background
|
||||||
option.
|
option.
|
||||||
.It Fl n , -nice Ar level
|
.It Fl N , -nice Ar level
|
||||||
Modifies the scheduling priority of the daemon.
|
Modifies the scheduling priority of the daemon.
|
||||||
.It Fl 1 , -stdout Ar logfile
|
.It Fl 1 , -stdout Ar logfile
|
||||||
Redirect the standard output of the process to logfile when started with
|
Redirect the standard output of the process to logfile when started with
|
||||||
@@ -142,13 +148,19 @@ These options are only used for stopping daemons:
|
|||||||
.It Fl R , -retry Ar timeout | Ar signal Ns / Ns Ar timeout
|
.It Fl R , -retry Ar timeout | Ar signal Ns / Ns Ar timeout
|
||||||
You can either specify a timeout or a multiple signal/timeout pairs as a
|
You can either specify a timeout or a multiple signal/timeout pairs as a
|
||||||
stopping schedule.
|
stopping schedule.
|
||||||
If not specified then a default value of SIGTERM/5 is
|
If not specified then a default value of SIGTERM/0 is
|
||||||
assumed.
|
assumed.
|
||||||
.El
|
.El
|
||||||
.Sh ENVIRONMENT
|
.Sh ENVIRONMENT
|
||||||
.Va SSD_NICELEVEL
|
.Va SSD_NICELEVEL
|
||||||
can also set the scheduling priority of the daemon, but the command line
|
can also set the scheduling priority of the daemon, but the command line
|
||||||
option takes precedence.
|
option takes precedence.
|
||||||
|
.Pp
|
||||||
|
.Va SSD_STARTWAIT
|
||||||
|
overrides the number of milliseconds set in
|
||||||
|
.Pa /etc/rc.conf
|
||||||
|
.Nm
|
||||||
|
waits for to check the daemon is still running.
|
||||||
.Sh NOTE
|
.Sh NOTE
|
||||||
.Nm
|
.Nm
|
||||||
uses
|
uses
|
||||||
@@ -163,6 +175,9 @@ to stop or signal.
|
|||||||
.Xr getopt 3 ,
|
.Xr getopt 3 ,
|
||||||
.Xr nice 2 ,
|
.Xr nice 2 ,
|
||||||
.Xr rc_find_pids 3
|
.Xr rc_find_pids 3
|
||||||
|
.Sh BUGS
|
||||||
|
.Nm
|
||||||
|
cannot stop an interpreted daemon that no longer exists without a pidfile.
|
||||||
.Sh HISTORY
|
.Sh HISTORY
|
||||||
.Nm
|
.Nm
|
||||||
first appeared in Debian.
|
first appeared in Debian.
|
||||||
@@ -170,4 +185,4 @@ first appeared in Debian.
|
|||||||
This is a complete re-implementation with the process finding code in the
|
This is a complete re-implementation with the process finding code in the
|
||||||
OpenRC library (librc, -lrc) so other programs can make use of it.
|
OpenRC library (librc, -lrc) so other programs can make use of it.
|
||||||
.Sh AUTHORS
|
.Sh AUTHORS
|
||||||
.An "Roy Marples" Aq roy@marples.name
|
.An Roy Marples" <roy@marples.name>
|
||||||
|
|||||||
31
mk/cc.mk
31
mk/cc.mk
@@ -1,5 +1,4 @@
|
|||||||
# Copyright 2008 Roy Marples <roy@marples.name>
|
# Copyright 2008 Roy Marples <roy@marples.name>
|
||||||
# All rights reserved. Released under the 2-clause BSD license.
|
|
||||||
|
|
||||||
# Setup some good default CFLAGS
|
# Setup some good default CFLAGS
|
||||||
CFLAGS?= -O2
|
CFLAGS?= -O2
|
||||||
@@ -10,15 +9,25 @@ _CSTD_SH= if test -n "${CSTD}"; then echo "-std=${CSTD}"; else echo ""; fi
|
|||||||
_CSTD!= ${_CSTD_SH}
|
_CSTD!= ${_CSTD_SH}
|
||||||
CFLAGS+= ${_CSTD}$(shell ${_CSTD_SH})
|
CFLAGS+= ${_CSTD}$(shell ${_CSTD_SH})
|
||||||
|
|
||||||
# Try and use some good cc flags
|
# Try and use some good cc flags if we're building from git
|
||||||
_CC_FLAGS= -pedantic -Wall -Wunused -Wimplicit -Wshadow -Wformat=2 \
|
# We don't use -pedantic as it will warn about our perfectly valid
|
||||||
-Wmissing-declarations -Wno-missing-prototypes -Wwrite-strings \
|
# use of %m in our logger.
|
||||||
-Wbad-function-cast -Wnested-externs -Wcomment -Winline \
|
_CCFLAGS= -Wall -Wextra -Wimplicit -Wshadow -Wformat=2 \
|
||||||
-Wchar-subscripts -Wcast-align -Wno-format-nonliteral \
|
-Wmissing-prototypes -Wmissing-declarations \
|
||||||
-Wdeclaration-after-statement -Wsequence-point -Wextra
|
-Wmissing-noreturn -Wmissing-format-attribute \
|
||||||
_CC_FLAGS_SH= for f in ${_CC_FLAGS}; do \
|
-Wnested-externs \
|
||||||
if ${CC} $$f -S -o /dev/null -xc /dev/null >/dev/null 2>&1; \
|
-Winline -Wwrite-strings -Wcast-align -Wcast-qual \
|
||||||
|
-Wpointer-arith \
|
||||||
|
-Wdeclaration-after-statement -Wsequence-point
|
||||||
|
|
||||||
|
# We should be using -Wredundant-decls, but our library hidden proto stuff
|
||||||
|
# gives loads of warnings. I don't fully understand it (the hidden proto,
|
||||||
|
# not the warning) so we just silence the warning.
|
||||||
|
|
||||||
|
_CC_FLAGS_SH= for f in ${_CCFLAGS}; do \
|
||||||
|
if echo "int main(void) { return 0;} " | \
|
||||||
|
${CC} $$f -S -xc -o /dev/null - ; \
|
||||||
then printf "%s" "$$f "; fi \
|
then printf "%s" "$$f "; fi \
|
||||||
done
|
done;
|
||||||
_CC_FLAGS!= ${_CC_FLAGS_SH}
|
_CC_FLAGS!= ${_CC_FLAGS_SH}
|
||||||
CFLAGS+= ${_CC_FLAGS}$(shell ${CC_FLAGS_SH})
|
CFLAGS+= ${_CC_FLAGS}$(shell ${_CC_FLAGS_SH})
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
_RC_DEBUG_SH= case "${DEBUG}" in "") echo "";; *) echo "-DRC_DEBUG";; esac
|
_RC_DEBUG_SH= case "${DEBUG}" in "") echo "";; *) echo "-DRC_DEBUG";; esac
|
||||||
_RC_DEBUG!= ${_RC_DEBUG_SH}
|
_RC_DEBUG!= ${_RC_DEBUG_SH}
|
||||||
CFLAGS+= ${_RC_DEBUG}$(shell ${_RC_DEBUG_SH})
|
CPPFLAGS+= ${_RC_DEBUG}$(shell ${_RC_DEBUG_SH})
|
||||||
|
|
||||||
# Should we enable this with a different flag?
|
# Should we enable this with a different flag?
|
||||||
_LD_DEBUG_SH= case "${DEBUG}" in "") echo "";; *) echo "-Wl,--rpath=../librc -Wl,--rpath=../libeinfo";; esac
|
_LD_DEBUG_SH= case "${DEBUG}" in "") echo "";; *) echo "-Wl,--rpath=../librc -Wl,--rpath=../libeinfo";; esac
|
||||||
|
|||||||
2
mk/depend-.mk
Normal file
2
mk/depend-.mk
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
# This space left intentionally blank because gmake does not load .depend
|
||||||
|
# by default
|
||||||
3
mk/depend-gmake.mk
Normal file
3
mk/depend-gmake.mk
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# Tell gmake to include the optional dependency file.
|
||||||
|
# This sucks, but I don't know any other way of portably making this work.
|
||||||
|
-include .depend
|
||||||
16
mk/depend.mk
16
mk/depend.mk
@@ -1,13 +1,17 @@
|
|||||||
# This only works for make implementations that always include a .depend if
|
# Generate .depend
|
||||||
# it exists. Only GNU make does not do this.
|
|
||||||
|
|
||||||
# Copyright 2008 Roy Marples <roy@marples.name>
|
# Copyright 2008 Roy Marples <roy@marples.name>
|
||||||
# All rights reserved. Released under the 2-clause BSD license.
|
|
||||||
|
|
||||||
CLEANFILES+= .depend
|
CLEANFILES+= .depend
|
||||||
IGNOREFILES+= .depend
|
IGNOREFILES+= .depend
|
||||||
|
|
||||||
.depend: ${SRCS}
|
.depend: ${SRCS}
|
||||||
${CC} ${CFLAGS} -MM ${SRCS} > .depend
|
${CC} ${CPPFLAGS} -MM ${SRCS} > .depend
|
||||||
|
|
||||||
depend: .depend
|
depend: .depend extra_depend
|
||||||
|
|
||||||
|
# Nasty hack. depend-.mk is a blank file, depend-gmake.mk has a gmake specific
|
||||||
|
# command to optionally include .depend.
|
||||||
|
# Someone should patch gmake to optionally include .depend if it exists.
|
||||||
|
_INC_DEP= $(shell if ${MAKE} --version | grep -q "^GNU "; then \
|
||||||
|
echo "gmake"; else echo ""; fi)
|
||||||
|
include ${MK}/depend-${_INC_DEP}.mk
|
||||||
|
|||||||
@@ -2,11 +2,12 @@
|
|||||||
# Copyright 2008 Roy Marples <roy@marples.name>
|
# Copyright 2008 Roy Marples <roy@marples.name>
|
||||||
# All rights reserved. Released under the 2-clause BSD license.
|
# All rights reserved. Released under the 2-clause BSD license.
|
||||||
|
|
||||||
GITREF?= HEAD
|
|
||||||
DISTPREFIX?= ${NAME}-${VERSION}
|
DISTPREFIX?= ${NAME}-${VERSION}
|
||||||
DISTFILE?= ${DISTPREFIX}.tar.bz2
|
DISTFILE?= ${DISTPREFIX}.tar.bz2
|
||||||
|
|
||||||
CLEANFILES+= ${DISTFILE}
|
CLEANFILES+= ${DISTFILE}
|
||||||
|
|
||||||
dist:
|
dist:
|
||||||
git archive --prefix=${DISTPREFIX}/ ${GITREF} | bzip2 > ${DISTFILE}
|
svn export . ${DISTPREFIX}
|
||||||
|
tar cjpf ${DISTFILE} ${DISTPREFIX}
|
||||||
|
rm -rf ${DISTPREFIX}
|
||||||
|
|||||||
12
mk/lib.mk
12
mk/lib.mk
@@ -16,8 +16,11 @@ CLEANFILES+= ${OBJS} ${SOBJS} ${_LIBS} ${SHLIB_LINK}
|
|||||||
|
|
||||||
.SUFFIXES: .So
|
.SUFFIXES: .So
|
||||||
|
|
||||||
|
.c.o:
|
||||||
|
${CC} ${CFLAGS} ${CPPFLAGS} -c $< -o $@
|
||||||
|
|
||||||
.c.So:
|
.c.So:
|
||||||
${CC} ${PICFLAG} -DPIC ${CFLAGS} -c $< -o $@
|
${CC} ${PICFLAG} -DPIC ${CPPFLAGS} ${CFLAGS} -c $< -o $@
|
||||||
|
|
||||||
all: depend ${_LIBS}
|
all: depend ${_LIBS}
|
||||||
|
|
||||||
@@ -53,7 +56,12 @@ check test::
|
|||||||
clean:
|
clean:
|
||||||
rm -f ${OBJS} ${SOBJS} ${_LIBS} ${SHLIB_LINK} ${CLEANFILES}
|
rm -f ${OBJS} ${SOBJS} ${_LIBS} ${SHLIB_LINK} ${CLEANFILES}
|
||||||
|
|
||||||
|
extra_depend:
|
||||||
|
@TMP=depend.$$$$; \
|
||||||
|
${SED} -e 's/^\([^\.]*\).o[ ]*:/\1.o \1.So:/' .depend > $${TMP}; \
|
||||||
|
mv $${TMP} .depend
|
||||||
|
|
||||||
include ${MK}/sys.mk
|
include ${MK}/sys.mk
|
||||||
include ${MK}/os.mk
|
include ${MK}/os.mk
|
||||||
include ${MK}/depend.mk
|
include ${MK}/depend.mk
|
||||||
include ${MK}/gitignore.mk
|
include ${MK}/svnignore.mk
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
LIBTERMCAP?= -lncurses
|
LIBTERMCAP?= -lncurses
|
||||||
CFLAGS+= -DHAVE_TERMCAP
|
CPPFLAGS+= -DHAVE_TERMCAP
|
||||||
LDADD+= ${LIBTERMCAP}
|
LDADD+= ${LIBTERMCAP}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# Copyright 2008 Roy Marples <roy@marples.name>
|
# Copyright 2008 Roy Marples <roy@marples.name>
|
||||||
# All rights reserved. Released under the 2-clause BSD license.
|
# All rights reserved. Released under the 2-clause BSD license.
|
||||||
|
|
||||||
CFLAGS+= -D_BSD_SOURCE -D_XOPEN_SOURCE=600
|
CPPFLAGS+= -D_BSD_SOURCE -D_XOPEN_SOURCE=600
|
||||||
LIBDL= -Wl,-Bdynamic -ldl
|
LIBDL= -Wl,-Bdynamic -ldl
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
LIBPAM?= -lpam
|
LIBPAM?= -lpam
|
||||||
CFLAGS+= -DHAVE_PAM
|
CPPFLAGS+= -DHAVE_PAM
|
||||||
LDADD+= ${LIBPAM}
|
LDADD+= ${LIBPAM}
|
||||||
|
|
||||||
PAMDIR?= /etc/pam.d
|
PAMDIR?= /etc/pam.d
|
||||||
|
|||||||
@@ -24,13 +24,18 @@ CLEANFILES+= ${OBJS} ${PROG}
|
|||||||
|
|
||||||
all: depend ${PROG}
|
all: depend ${PROG}
|
||||||
|
|
||||||
|
.c.o:
|
||||||
|
${CC} ${CFLAGS} ${CPPFLAGS} -c $< -o $@
|
||||||
|
|
||||||
${PROG}: ${SCRIPTS} ${OBJS}
|
${PROG}: ${SCRIPTS} ${OBJS}
|
||||||
${CC} ${LDFLAGS} -o $@ ${OBJS} ${LDADD}
|
${CC} ${LDFLAGS} -o $@ ${OBJS} ${LDADD}
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f ${CLEANFILES}
|
rm -f ${CLEANFILES}
|
||||||
|
|
||||||
|
extra_depend:
|
||||||
|
|
||||||
include ${MK}/sys.mk
|
include ${MK}/sys.mk
|
||||||
include ${MK}/os.mk
|
include ${MK}/os.mk
|
||||||
include ${MK}/depend.mk
|
include ${MK}/depend.mk
|
||||||
include ${MK}/gitignore.mk
|
include ${MK}/svnignore.mk
|
||||||
|
|||||||
@@ -22,9 +22,9 @@ SED_REPLACE= -e 's:@SHELL@:${SH}:g' -e 's:@LIB@:${LIBNAME}:g' -e 's:@SYSCONFDIR
|
|||||||
.in:
|
.in:
|
||||||
${SED} ${SED_REPLACE} ${SED_EXTRA} $< > $@
|
${SED} ${SED_REPLACE} ${SED_EXTRA} $< > $@
|
||||||
|
|
||||||
all: ${OBJS}
|
all: ${OBJS} ${TARGETS}
|
||||||
|
|
||||||
realinstall: ${BIN} ${CONF} ${CONF_APPEND}
|
realinstall: ${BIN} ${CONF} ${INC}
|
||||||
@if test -n "${DIR}"; then \
|
@if test -n "${DIR}"; then \
|
||||||
${ECHO} ${INSTALL} -d ${DESTDIR}/${DIR}; \
|
${ECHO} ${INSTALL} -d ${DESTDIR}/${DIR}; \
|
||||||
${INSTALL} -d ${DESTDIR}/${DIR} || exit $$?; \
|
${INSTALL} -d ${DESTDIR}/${DIR} || exit $$?; \
|
||||||
@@ -56,4 +56,4 @@ CLEANFILES+= ${OBJS}
|
|||||||
clean:
|
clean:
|
||||||
@if test -n "${CLEANFILES}"; then echo "rm -f ${CLEANFILES}"; rm -f ${CLEANFILES}; fi
|
@if test -n "${CLEANFILES}"; then echo "rm -f ${CLEANFILES}"; rm -f ${CLEANFILES}; fi
|
||||||
|
|
||||||
include ${MK}/gitignore.mk
|
include ${MK}/svnignore.mk
|
||||||
|
|||||||
@@ -27,5 +27,5 @@ check test::
|
|||||||
${_SUBDIR}
|
${_SUBDIR}
|
||||||
depend:
|
depend:
|
||||||
${_SUBDIR}
|
${_SUBDIR}
|
||||||
gitignore:
|
ignore:
|
||||||
${_SUBDIR}
|
${_SUBDIR}
|
||||||
|
|||||||
@@ -1,15 +1,12 @@
|
|||||||
# rules to make .gitignore files
|
# rules to make svn ignore files
|
||||||
# Copyright 2008 Roy Marples <roy@marples.name>
|
# Copyright 2008 Roy Marples <roy@marples.name>
|
||||||
# All rights reserved. Released under the 2-clause BSD license.
|
# All rights reserved. Released under the 2-clause BSD license.
|
||||||
|
|
||||||
IGNOREFILES+= ${CLEANFILES}
|
IGNOREFILES+= ${CLEANFILES}
|
||||||
|
|
||||||
.PHONY: .gitignore
|
ignore:
|
||||||
|
|
||||||
.gitignore:
|
|
||||||
@if test -n "${IGNOREFILES}"; then \
|
@if test -n "${IGNOREFILES}"; then \
|
||||||
echo "Ignoring ${IGNOREFILES}"; \
|
echo "Ignoring ${IGNOREFILES}"; \
|
||||||
echo ${IGNOREFILES} | tr ' ' '\n' > .gitignore; \
|
files="$$(echo ${IGNOREFILES} | tr ' ' '\n')"; \
|
||||||
|
eval svn propset svn:ignore \'"$${files}"\' .; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
gitignore: .gitignore
|
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
LIBTERMCAP?= -ltermcap
|
LIBTERMCAP?= -ltermcap
|
||||||
CFLAGS+= -DHAVE_TERMCAP
|
CPPFLAGS+= -DHAVE_TERMCAP
|
||||||
LDADD+= ${LIBTERMCAP}
|
LDADD+= ${LIBTERMCAP}
|
||||||
|
|||||||
2
net/.gitignore
vendored
2
net/.gitignore
vendored
@@ -1,2 +0,0 @@
|
|||||||
ifconfig.sh
|
|
||||||
iwconfig.sh
|
|
||||||
@@ -4,7 +4,6 @@
|
|||||||
bonding_depend()
|
bonding_depend()
|
||||||
{
|
{
|
||||||
before interface macchanger
|
before interface macchanger
|
||||||
program /sbin/ifenslave
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_config_vars="$_config_vars slaves"
|
_config_vars="$_config_vars slaves"
|
||||||
@@ -16,7 +15,7 @@ _is_bond()
|
|||||||
|
|
||||||
bonding_pre_start()
|
bonding_pre_start()
|
||||||
{
|
{
|
||||||
local s= slaves="$(_get_array "slaves_${IFVAR}")"
|
local x= s= slaves="$(_get_array "slaves_${IFVAR}")"
|
||||||
|
|
||||||
[ -z "${slaves}" ] && return 0
|
[ -z "${slaves}" ] && return 0
|
||||||
|
|
||||||
@@ -40,6 +39,16 @@ bonding_pre_start()
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Configure the bond.
|
||||||
|
# Nice and dynamic :)
|
||||||
|
for x in /sys/class/net/"${IFACE}"/bonding/*; do
|
||||||
|
[ -f "${x}" ] || continue
|
||||||
|
eval s=\$${x##*/}_${IFVAR}
|
||||||
|
if [ -n "${s}" ]; then
|
||||||
|
echo "${s}" >"${x}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
ebegin "Adding slaves to ${IFACE}"
|
ebegin "Adding slaves to ${IFACE}"
|
||||||
eindent
|
eindent
|
||||||
einfo "${slaves}"
|
einfo "${slaves}"
|
||||||
@@ -53,7 +62,7 @@ bonding_pre_start()
|
|||||||
# Must force the slaves to a particular state before adding them
|
# Must force the slaves to a particular state before adding them
|
||||||
for IFACE in ${slaves}; do
|
for IFACE in ${slaves}; do
|
||||||
_delete_addresses
|
_delete_addresses
|
||||||
_up
|
_down
|
||||||
done
|
done
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -62,7 +71,13 @@ bonding_pre_start()
|
|||||||
|
|
||||||
# finally add in slaves
|
# finally add in slaves
|
||||||
eoutdent
|
eoutdent
|
||||||
/sbin/ifenslave "${IFACE}" ${slaves} >/dev/null
|
if [ -d /sys/class/net ]; then
|
||||||
|
for s in ${slaves}; do
|
||||||
|
echo "+${s}" >/sys/class/net/"${IFACE}"/bonding/slaves
|
||||||
|
done
|
||||||
|
else
|
||||||
|
/sbin/ifenslave "${IFACE}" ${slaves} >/dev/null
|
||||||
|
fi
|
||||||
eend $?
|
eend $?
|
||||||
|
|
||||||
return 0 #important
|
return 0 #important
|
||||||
@@ -84,7 +99,13 @@ bonding_stop()
|
|||||||
eindent
|
eindent
|
||||||
einfo "${slaves}"
|
einfo "${slaves}"
|
||||||
eoutdent
|
eoutdent
|
||||||
/sbin/ifenslave -d "${IFACE}" ${slaves}
|
if [ -d /sys/class/net ]; then
|
||||||
|
for s in ${slaves}; do
|
||||||
|
echo -"${s}" > /sys/class/net/"${IFACE}"/bonding/slaves
|
||||||
|
done
|
||||||
|
else
|
||||||
|
/sbin/ifenslave -d "${IFACE}" ${slaves}
|
||||||
|
fi
|
||||||
|
|
||||||
# reset all slaves
|
# reset all slaves
|
||||||
(
|
(
|
||||||
|
|||||||
@@ -16,12 +16,15 @@ _is_bridge()
|
|||||||
|
|
||||||
bridge_pre_start()
|
bridge_pre_start()
|
||||||
{
|
{
|
||||||
local ports= brif= iface="${IFACE}" e= x=
|
local brif= iface="${IFACE}" e= x=
|
||||||
local ports="$(_get_array "bridge_${IFVAR}")"
|
local ports="$(_get_array "bridge_${IFVAR}")"
|
||||||
local opts="$(_get_array "brctl_${IFVAR}")"
|
local opts="$(_get_array "brctl_${IFVAR}")"
|
||||||
|
|
||||||
eval brif=\$bridge_add_${IFVAR}
|
eval brif=\$bridge_add_${IFVAR}
|
||||||
[ -z "${ports}" -a -z "${brif}" -a -z "${opts}" ] && return 0
|
eval x=\${bridge_${IFVAR}-y\}
|
||||||
|
if [ -z "${brif}" -a -z "${opts}" ]; then
|
||||||
|
[ -n "${ports}" -o "${x}" != "y" ] || return 0
|
||||||
|
fi
|
||||||
|
|
||||||
[ -n "${ports}" ] && bridge_post_stop
|
[ -n "${ports}" ] && bridge_post_stop
|
||||||
|
|
||||||
|
|||||||
@@ -15,20 +15,42 @@ _config_vars="$_config_vars dhcp dhcpcd"
|
|||||||
|
|
||||||
dhcpcd_start()
|
dhcpcd_start()
|
||||||
{
|
{
|
||||||
local args= opt= opts= pidfile="/var/run/dhcpcd-${IFACE}.pid"
|
local args= opt= opts= pidfile="/var/run/dhcpcd-${IFACE}.pid" new=true
|
||||||
|
|
||||||
eval args=\$dhcpcd_${IFVAR}
|
eval args=\$dhcpcd_${IFVAR}
|
||||||
|
[ -z "${args}" ] && args=${dhcpcd}
|
||||||
|
|
||||||
# Get our options
|
# Get our options
|
||||||
eval opts=\$dhcp_${IFVAR}
|
eval opts=\$dhcp_${IFVAR}
|
||||||
[ -z "${opts}" ] && opts=${dhcp}
|
[ -z "${opts}" ] && opts=${dhcp}
|
||||||
|
|
||||||
|
case "$(dhcpcd --version)" in
|
||||||
|
"dhcpcd "[123]*) new=false;;
|
||||||
|
esac
|
||||||
|
|
||||||
# Map some generic options to dhcpcd
|
# Map some generic options to dhcpcd
|
||||||
for opt in ${opts}; do
|
for opt in ${opts}; do
|
||||||
case "${opt}" in
|
case "${opt}" in
|
||||||
nodns) args="${args} -R";;
|
nodns)
|
||||||
nontp) args="${args} -N";;
|
if ${new}; then
|
||||||
nonis) args="${args} -Y";;
|
args="${args} -C resolv.conf"
|
||||||
|
else
|
||||||
|
args="${args} -R"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
nontp)
|
||||||
|
if ${new}; then
|
||||||
|
args="${args} -C ntp.conf"
|
||||||
|
else
|
||||||
|
args="${args} -N"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
nonis)
|
||||||
|
if ${new}; then
|
||||||
|
args="${args} -C yp.conf"
|
||||||
|
else
|
||||||
|
args="${args} -Y"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
nogateway) args="${args} -G";;
|
nogateway) args="${args} -G";;
|
||||||
nosendhost) args="${args} -h ''";
|
nosendhost) args="${args} -h ''";
|
||||||
esac
|
esac
|
||||||
|
|||||||
@@ -235,7 +235,11 @@ _delete_addresses()
|
|||||||
local addr=
|
local addr=
|
||||||
for addr in $(LC_ALL=C ifconfig "${IFACE}" | \
|
for addr in $(LC_ALL=C ifconfig "${IFACE}" | \
|
||||||
sed -n -e 's/^.*\(inet6 addr:\|inet6\) \([^ ]*\) .*\(Scope:[^L]\|scopeid [^<]*<[^l]\).*/\2/p'); do
|
sed -n -e 's/^.*\(inet6 addr:\|inet6\) \([^ ]*\) .*\(Scope:[^L]\|scopeid [^<]*<[^l]\).*/\2/p'); do
|
||||||
[ "${addr}" = "::1/128" -a "${IFACE}" = "lo" ] && continue
|
if [ "${IFACE}" = "lo" ]; then
|
||||||
|
case "${addr}" in
|
||||||
|
"::1/128"|"/128") continue;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
einfo "${addr}"
|
einfo "${addr}"
|
||||||
ifconfig "${IFACE}" inet6 del "${addr}"
|
ifconfig "${IFACE}" inet6 del "${addr}"
|
||||||
done
|
done
|
||||||
@@ -274,7 +278,7 @@ ifconfig_pre_start()
|
|||||||
metric=1000
|
metric=1000
|
||||||
|
|
||||||
ebegin "Creating tunnel ${IFVAR}"
|
ebegin "Creating tunnel ${IFVAR}"
|
||||||
iptunnel add "${tunnel}"
|
iptunnel add ${tunnel}
|
||||||
eend $?
|
eend $?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,13 +31,13 @@ ifplugd_pre_start()
|
|||||||
for f in bond bridge tuntap vlan wireless; do
|
for f in bond bridge tuntap vlan wireless; do
|
||||||
if type "_is_${f}" >/dev/null 2>&1; then
|
if type "_is_${f}" >/dev/null 2>&1; then
|
||||||
if _is_${f}; then
|
if _is_${f}; then
|
||||||
veinfo "netplug does not work with" "${f}"
|
veinfo "ifplugd does not work with ${f}"
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
ebegin "Starting ifplugd on" "${IFACE}"
|
ebegin "Starting ifplugd on ${IFACE}"
|
||||||
|
|
||||||
eval args=\$ifplugd_${IFVAR}
|
eval args=\$ifplugd_${IFVAR}
|
||||||
|
|
||||||
@@ -47,7 +47,7 @@ ifplugd_pre_start()
|
|||||||
# Start ifplugd
|
# Start ifplugd
|
||||||
eval start-stop-daemon --start --exec /usr/sbin/ifplugd \
|
eval start-stop-daemon --start --exec /usr/sbin/ifplugd \
|
||||||
--pidfile "${pidfile}" -- "${args}" --iface="${IFACE}"
|
--pidfile "${pidfile}" -- "${args}" --iface="${IFACE}"
|
||||||
eend "$?" || return 1
|
eend $? || return 1
|
||||||
|
|
||||||
eindent
|
eindent
|
||||||
|
|
||||||
@@ -85,7 +85,7 @@ ifplugd_stop()
|
|||||||
local pidfile="/var/run/ifplugd.${IFACE}.pid"
|
local pidfile="/var/run/ifplugd.${IFACE}.pid"
|
||||||
[ ! -e "${pidfile}" ] && return 0
|
[ ! -e "${pidfile}" ] && return 0
|
||||||
|
|
||||||
ebegin "Stopping ifplugd on" "${IFACE}"
|
ebegin "Stopping ifplugd on ${IFACE}"
|
||||||
start-stop-daemon --stop --quiet --exec /usr/sbin/ifplugd \
|
start-stop-daemon --stop --quiet --exec /usr/sbin/ifplugd \
|
||||||
--pidfile "${pidfile}" --signal QUIT
|
--pidfile "${pidfile}" --signal QUIT
|
||||||
eend $?
|
eend $?
|
||||||
|
|||||||
@@ -54,7 +54,6 @@ ifwatchd_stop()
|
|||||||
ebegin "Stopping ifwatchd on" "${IFACE}"
|
ebegin "Stopping ifwatchd on" "${IFACE}"
|
||||||
start-stop-daemon --stop --exec /usr/sbin/ifwatchd \
|
start-stop-daemon --stop --exec /usr/sbin/ifwatchd \
|
||||||
-- -c "${RC_LIBDIR}/sh/ifwatchd-carrier.sh" \
|
-- -c "${RC_LIBDIR}/sh/ifwatchd-carrier.sh" \
|
||||||
-n "${RC_LIBDIR}/sh/ifwatchd-nocarrier.sh" "${IFACE}" \
|
-n "${RC_LIBDIR}/sh/ifwatchd-nocarrier.sh" "${IFACE}"
|
||||||
&& return 0
|
|
||||||
eend $?
|
eend $?
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,12 +10,12 @@ iproute2_depend()
|
|||||||
|
|
||||||
_up()
|
_up()
|
||||||
{
|
{
|
||||||
ip link set up dev "${IFACE}"
|
ip link set "${IFACE}" up
|
||||||
}
|
}
|
||||||
|
|
||||||
_down()
|
_down()
|
||||||
{
|
{
|
||||||
ip link set down dev "${IFACE}"
|
ip link set "${IFACE}" down
|
||||||
}
|
}
|
||||||
|
|
||||||
_exists()
|
_exists()
|
||||||
@@ -78,7 +78,7 @@ _get_mac_address()
|
|||||||
|
|
||||||
_set_mac_address()
|
_set_mac_address()
|
||||||
{
|
{
|
||||||
ip link set address "$1" dev "${IFACE}"
|
ip link set "${IFACE}" address "$1"
|
||||||
}
|
}
|
||||||
|
|
||||||
_get_inet_addresses()
|
_get_inet_addresses()
|
||||||
@@ -126,7 +126,7 @@ _add_address()
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
ip addr add dev "${IFACE}" "$@"
|
ip addr add "$@" dev "${IFACE}"
|
||||||
}
|
}
|
||||||
|
|
||||||
_add_route()
|
_add_route()
|
||||||
@@ -184,12 +184,12 @@ iproute2_pre_start()
|
|||||||
# MTU support
|
# MTU support
|
||||||
local mtu=
|
local mtu=
|
||||||
eval mtu=\$mtu_${IFVAR}
|
eval mtu=\$mtu_${IFVAR}
|
||||||
[ -n "${mtu}" ] && ip link set mtu "${mtu}" dev "${IFACE}"
|
[ -n "${mtu}" ] && ip link set "${IFACE}" mtu "${mtu}"
|
||||||
|
|
||||||
# TX Queue Length support
|
# TX Queue Length support
|
||||||
local len=
|
local len=
|
||||||
eval len=\$txqueuelen_${IFVAR}
|
eval len=\$txqueuelen_${IFVAR}
|
||||||
[ -n "${len}" ] && ip link set qlen "${len}" dev "${IFACE}"
|
[ -n "${len}" ] && ip link set "${IFACE}" txqueuelen "${len}"
|
||||||
|
|
||||||
local tunnel=
|
local tunnel=
|
||||||
eval tunnel=\$iptunnel_${IFVAR}
|
eval tunnel=\$iptunnel_${IFVAR}
|
||||||
@@ -208,6 +208,8 @@ iproute2_pre_start()
|
|||||||
|
|
||||||
_iproute2_ipv6_tentative()
|
_iproute2_ipv6_tentative()
|
||||||
{
|
{
|
||||||
|
# Only check tentative when we have a carrier.
|
||||||
|
LC_ALL=C ip link show dev "${IFACE}" | grep -q "NO-CARRIER" && return 1
|
||||||
LC_ALL=C ip addr show dev "${IFACE}" | \
|
LC_ALL=C ip addr show dev "${IFACE}" | \
|
||||||
grep -q "^[[:space:]]*inet6 .* tentative"
|
grep -q "^[[:space:]]*inet6 .* tentative"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ iwconfig_associate()
|
|||||||
case "${caps}" in
|
case "${caps}" in
|
||||||
[EI]P*)
|
[EI]P*)
|
||||||
if [ "${key}" = "-" ] ; then
|
if [ "${key}" = "-" ] ; then
|
||||||
ewarn "WEP key is not set for \"${SSID}\"; not connecting"
|
ewarn "WEP key is not set for \"${SSID}\""
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
@@ -145,7 +145,7 @@ iwconfig_associate()
|
|||||||
*)
|
*)
|
||||||
if [ "${key}" != "-" ] ; then
|
if [ "${key}" != "-" ] ; then
|
||||||
key="-"
|
key="-"
|
||||||
ewarn "\"${SSID}\" is not WEP enabled; ignoring setting"
|
ewarn "\"${SSID}\" is not WEP enabled"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|||||||
@@ -206,9 +206,13 @@ iwconfig_wait_for_association()
|
|||||||
# Use sysfs if we can
|
# Use sysfs if we can
|
||||||
if [ -e /sys/class/net/"${IFACE}"/carrier ]; then
|
if [ -e /sys/class/net/"${IFACE}"/carrier ]; then
|
||||||
if [ "$(cat /sys/class/net/"${IFACE}"/carrier)" = "1" ]; then
|
if [ "$(cat /sys/class/net/"${IFACE}"/carrier)" = "1" ]; then
|
||||||
# Double check we have an ssid. This is mainly for buggy
|
# Double check we have an ssid and a non-zero
|
||||||
# prism54 drivers that always set their carrier on :/
|
# mac address. This is mainly for buggy
|
||||||
[ -n "$(iwgetid --raw "${IFACE}")" ] && return 0
|
# prism54 drivers that always set their
|
||||||
|
# carrier on or buggy madwifi drivers that
|
||||||
|
# sometimes have carrier on and ssid set
|
||||||
|
# without being associated. :/
|
||||||
|
[ -n "$(iwgetid --raw "${IFACE}")" ] && [ "$(iwgetid --ap --raw "${IFACE}")" != "00:00:00:00:00:00" ] && return 0
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
local atest=
|
local atest=
|
||||||
@@ -246,12 +250,12 @@ iwconfig_associate()
|
|||||||
SSIDVAR=$(shell_var "${SSID}")
|
SSIDVAR=$(shell_var "${SSID}")
|
||||||
key="$(iwconfig_get_wep_key "${mac}")"
|
key="$(iwconfig_get_wep_key "${mac}")"
|
||||||
if [ "${wep_required}" = "on" -a "${key}" = "off" ]; then
|
if [ "${wep_required}" = "on" -a "${key}" = "off" ]; then
|
||||||
ewarn "WEP key is not set for \"${SSID}\" - not connecting"
|
ewarn "WEP key is not set for \"${SSID}\""
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
if [ "${wep_required}" = "off" -a "${key}" != "off" ]; then
|
if [ "${wep_required}" = "off" -a "${key}" != "off" ]; then
|
||||||
key="off"
|
key="off"
|
||||||
ewarn "\"${SSID}\" is not WEP enabled - ignoring setting"
|
ewarn "\"${SSID}\" is not WEP enabled"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! eval iwconfig "${IFACE}" key "${key}"; then
|
if ! eval iwconfig "${IFACE}" key "${key}"; then
|
||||||
@@ -429,7 +433,7 @@ iwconfig_scan()
|
|||||||
[ -z "${a}" ] && break
|
[ -z "${a}" ] && break
|
||||||
eval b=\$QUALITY_${k}
|
eval b=\$QUALITY_${k}
|
||||||
if [ -n "${b}" -a "${a}" -lt "${b}" ]; then
|
if [ -n "${b}" -a "${a}" -lt "${b}" ]; then
|
||||||
for x in MAC SSID CHAN QUALITY ENC; do
|
for x in MAC SSID MODE CHAN QUALITY ENC; do
|
||||||
eval t=\$${x}_${i}
|
eval t=\$${x}_${i}
|
||||||
eval ${x}_${i}=\$${x}_${k}
|
eval ${x}_${i}=\$${x}_${k}
|
||||||
eval ${x}_${k}=\$t
|
eval ${x}_${k}=\$t
|
||||||
@@ -453,7 +457,7 @@ iwconfig_scan()
|
|||||||
local u=${k}
|
local u=${k}
|
||||||
# We need to split this into two tests, otherwise bash errors
|
# We need to split this into two tests, otherwise bash errors
|
||||||
[ -n "${a}" -a -n "${b}" ] && [ "${a}" -lt "${b}" ] && u=${i}
|
[ -n "${a}" -a -n "${b}" ] && [ "${a}" -lt "${b}" ] && u=${i}
|
||||||
unset MAC_${u} SSID_${u} CHAN_${u} QUALITY_${u} ENC_${u}
|
unset MAC_${u} SSID_${u} MODE_${u} CHAN_${u} QUALITY_${u} ENC_${u}
|
||||||
fi
|
fi
|
||||||
k=$((${k} + 1))
|
k=$((${k} + 1))
|
||||||
done
|
done
|
||||||
@@ -499,7 +503,7 @@ iwconfig_scan()
|
|||||||
for x; do
|
for x; do
|
||||||
if [ "${x}" = "${s}" ]; then
|
if [ "${x}" = "${s}" ]; then
|
||||||
ewarn "${s} has been blacklisted - not connecting"
|
ewarn "${s} has been blacklisted - not connecting"
|
||||||
unset SSID_${i} MAC_${i} CHAN_${i} QUALITY_${i} ENC_${i}
|
unset SSID_${i} MAC_${i} ${MODE}_${i} CHAN_${i} QUALITY_${i} ENC_${i}
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
i=$((${i} + 1))
|
i=$((${i} + 1))
|
||||||
@@ -597,10 +601,8 @@ iwconfig_connect_not_preferred()
|
|||||||
|
|
||||||
iwconfig_defaults()
|
iwconfig_defaults()
|
||||||
{
|
{
|
||||||
local x=
|
# Turn on the radio
|
||||||
for x in txpower rate rts frag; do
|
iwconfig "${IFACE}" txpower on 2>/dev/null
|
||||||
iwconfig "${IFACE}" "${x}" auto 2>/dev/null
|
|
||||||
done
|
|
||||||
|
|
||||||
# Release the AP forced
|
# Release the AP forced
|
||||||
# Must do ap and then ssid otherwise scanning borks
|
# Must do ap and then ssid otherwise scanning borks
|
||||||
@@ -735,7 +737,7 @@ iwconfig_pre_start()
|
|||||||
# which reports NOT READY!
|
# which reports NOT READY!
|
||||||
x="$(iwconfig_get_type)"
|
x="$(iwconfig_get_type)"
|
||||||
if [ "${x}" = "NOT READY!" ]; then
|
if [ "${x}" = "NOT READY!" ]; then
|
||||||
eerror "Looks like there was a probem loading the firmware for ${IFACE}"
|
eerror "Looks like there was a problem loading the firmware for ${IFACE}"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -78,11 +78,9 @@ wpa_supplicant_pre_start()
|
|||||||
service_set_value "SSID" ""
|
service_set_value "SSID" ""
|
||||||
ebegin "Starting wpa_supplicant on ${IFVAR}"
|
ebegin "Starting wpa_supplicant on ${IFVAR}"
|
||||||
|
|
||||||
if [ -x /sbin/iwconfig ]; then
|
if type iwconfig_defaults >/dev/null 2>&1; then
|
||||||
local x=
|
iwconfig_defaults
|
||||||
for x in txpower rate rts frag; do
|
iwconfig_user_config
|
||||||
iwconfig "${IFACE}" "${x}" auto 2>/dev/null
|
|
||||||
done
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cfgfile=${opts##* -c}
|
cfgfile=${opts##* -c}
|
||||||
|
|||||||
@@ -1,22 +1,33 @@
|
|||||||
BOOT= bootmisc fsck hostname localmount \
|
BOOT= bootmisc fsck hostname localmount \
|
||||||
root swap sysctl urandom
|
root swap sysctl urandom
|
||||||
DEFAULT= local netmount
|
DEFAULT= local netmount
|
||||||
|
SHUTDOWN= savecache
|
||||||
|
|
||||||
LEVELDIR= ${DESTDIR}/${SYSCONFDIR}/runlevels
|
LEVELDIR= ${DESTDIR}/${SYSCONFDIR}/runlevels
|
||||||
|
SYSINITDIR= ${LEVELDIR}/sysinit
|
||||||
BOOTDIR= ${LEVELDIR}/boot
|
BOOTDIR= ${LEVELDIR}/boot
|
||||||
DEFAULTDIR= ${LEVELDIR}/default
|
DEFAULTDIR= ${LEVELDIR}/default
|
||||||
|
SHUTDOWNDIR= ${LEVELDIR}/shutdown
|
||||||
|
|
||||||
INITDIR= ../init.d
|
INITDIR= ../init.d
|
||||||
|
|
||||||
MK= ../mk
|
MK= ../mk
|
||||||
include ${MK}/sys.mk
|
include ${MK}/sys.mk
|
||||||
include ${MK}/os.mk
|
include ${MK}/os.mk
|
||||||
include ${MK}/gitignore.mk
|
include ${MK}/svnignore.mk
|
||||||
include Makefile.${OS}
|
include Makefile.${OS}
|
||||||
|
|
||||||
all:
|
all:
|
||||||
|
|
||||||
install:
|
install:
|
||||||
|
if ! test -d "${SYSINITDIR}"; then \
|
||||||
|
${INSTALL} -d ${SYSINITDIR} || exit $$?; \
|
||||||
|
for x in ${SYSINIT}; do \
|
||||||
|
if test -n "${PREFIX}"; then \
|
||||||
|
grep -q "keyword .*noprefix" ${INITDIR}/"$$x" && continue; \
|
||||||
|
fi; \
|
||||||
|
ln -snf ${PREFIX}/etc/init.d/"$$x" ${SYSINITDIR}/"$$x" || exit $$?; done \
|
||||||
|
fi
|
||||||
if ! test -d "${BOOTDIR}"; then \
|
if ! test -d "${BOOTDIR}"; then \
|
||||||
${INSTALL} -d ${BOOTDIR} || exit $$?; \
|
${INSTALL} -d ${BOOTDIR} || exit $$?; \
|
||||||
for x in ${BOOT}; do \
|
for x in ${BOOT}; do \
|
||||||
@@ -35,6 +46,14 @@ install:
|
|||||||
fi; \
|
fi; \
|
||||||
ln -snf ${PREFIX}/etc/init.d/"$$x" ${DEFAULTDIR}/"$$x" || exit $$?; done \
|
ln -snf ${PREFIX}/etc/init.d/"$$x" ${DEFAULTDIR}/"$$x" || exit $$?; done \
|
||||||
fi
|
fi
|
||||||
|
if ! test -d "${SHUTDOWNDIR}"; then \
|
||||||
|
${INSTALL} -d ${SHUTDOWNDIR} || exit $$?; \
|
||||||
|
for x in ${SHUTDOWN}; do \
|
||||||
|
if test -n "${PREFIX}"; then \
|
||||||
|
grep -q "keyword .*noprefix" ${INITDIR}/"$$x" && continue; \
|
||||||
|
fi; \
|
||||||
|
ln -snf ${PREFIX}/etc/init.d/"$$x" ${SHUTDOWNDIR}/"$$x" || exit $$?; done \
|
||||||
|
fi
|
||||||
|
|
||||||
check test::
|
check test::
|
||||||
|
|
||||||
|
|||||||
@@ -1,2 +1,3 @@
|
|||||||
BOOT+= hwclock consolefont keymaps modules mtab net.lo procfs \
|
SYSINIT+= devfs dmesg
|
||||||
termencoding
|
BOOT+= hwclock keymaps modules mtab net.lo procfs termencoding
|
||||||
|
SHUTDOWN+= killprocs mount-ro
|
||||||
|
|||||||
@@ -2,4 +2,4 @@
|
|||||||
BOOT+= hostid net.lo0 newsyslog savecore syslogd
|
BOOT+= hostid net.lo0 newsyslog savecore syslogd
|
||||||
|
|
||||||
# NetBSD specific stuff
|
# NetBSD specific stuff
|
||||||
BOOT+= swap-blk ttys wscons
|
BOOT+= devdb swap-blk ttys wscons
|
||||||
|
|||||||
6
sh/.gitignore
vendored
6
sh/.gitignore
vendored
@@ -1,6 +0,0 @@
|
|||||||
functions.sh
|
|
||||||
gendepends.sh
|
|
||||||
net.sh
|
|
||||||
rc-functions.sh
|
|
||||||
runscript.sh
|
|
||||||
init.sh
|
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
DIR= ${PREFIX}/${RC_LIB}/sh
|
DIR= ${PREFIX}/${RC_LIB}/sh
|
||||||
SRCS= functions.sh.in gendepends.sh.in net.sh.in \
|
SRCS= functions.sh.in gendepends.sh.in init-common-post.sh.in \
|
||||||
rc-functions.sh.in runscript.sh.in
|
rc-functions.sh.in runscript.sh.in
|
||||||
INC= init-common-post.sh rc-mount.sh functions.sh rc-functions.sh
|
INC= init-common-post.sh rc-mount.sh functions.sh rc-functions.sh
|
||||||
BIN= gendepends.sh init.sh net.sh runscript.sh
|
BIN= gendepends.sh init.sh runscript.sh
|
||||||
|
|
||||||
INSTALLAFTER= _installafter
|
INSTALLAFTER= _installafter
|
||||||
|
|
||||||
@@ -13,8 +13,6 @@ include ${MK}/scripts.mk
|
|||||||
|
|
||||||
_installafter:
|
_installafter:
|
||||||
${INSTALL} -d ${DESTDIR}/${INITDIR}
|
${INSTALL} -d ${DESTDIR}/${INITDIR}
|
||||||
@# Provide an init script for the loopback interface
|
|
||||||
ln -snf ${PREFIX}/${RC_LIB}/sh/net.sh ${DESTDIR}/${INITDIR}/${NET_LO} || exit $$?
|
|
||||||
@# Put functions.sh into the init.d dir so 3rd party apps don't have to
|
@# Put functions.sh into the init.d dir so 3rd party apps don't have to
|
||||||
@# be multilib aware
|
@# be multilib aware
|
||||||
ln -snf ${PREFIX}/${RC_LIB}/sh/functions.sh ${DESTDIR}/${INITDIR} || exit $$?
|
ln -snf ${PREFIX}/${RC_LIB}/sh/functions.sh ${DESTDIR}/${INITDIR} || exit $$?
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
SRCS+= init.sh.in
|
SRCS+= init.sh.in
|
||||||
|
|
||||||
NET_LO= net.lo0
|
|
||||||
|
|
||||||
.SUFFIXES: .sh.BSD.in
|
.SUFFIXES: .sh.BSD.in
|
||||||
.sh.BSD.in.sh:
|
.sh.BSD.in.sh:
|
||||||
${SED} ${SED_REPLACE} ${SED_EXTRA} $< > $@
|
${SED} ${SED_REPLACE} ${SED_EXTRA} $< > $@
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
NET_LO= net.lo
|
|
||||||
SRCS+= init.sh.in init-early.sh.in
|
SRCS+= init.sh.in init-early.sh.in
|
||||||
BIN+= init-early.sh
|
BIN+= init-early.sh
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
SRCS+= init.sh.in
|
SRCS+= init.sh.in
|
||||||
|
|
||||||
NET_LO= net.lo0
|
|
||||||
SRCS+= ifwatchd-carrier.sh.in ifwatchd-nocarrier.sh.in
|
SRCS+= ifwatchd-carrier.sh.in ifwatchd-nocarrier.sh.in
|
||||||
BIN+= ifwatchd-carrier.sh ifwatchd-nocarrier.sh
|
BIN+= ifwatchd-carrier.sh ifwatchd-nocarrier.sh
|
||||||
|
|
||||||
|
|||||||
@@ -51,9 +51,11 @@ do
|
|||||||
[ -x "${RC_SERVICE}" -a -f "${RC_SERVICE}" ] || continue
|
[ -x "${RC_SERVICE}" -a -f "${RC_SERVICE}" ] || continue
|
||||||
|
|
||||||
# Only generate dependencies for runscripts
|
# Only generate dependencies for runscripts
|
||||||
read one two < "${RC_SERVICE}"
|
read one two three < "${RC_SERVICE}"
|
||||||
[ "${one}" = "#!@PREFIX@/sbin/runscript" ] || continue
|
[ "${one}" = "#!@PREFIX@/sbin/runscript" ] || \
|
||||||
unset one two
|
[ "${one}" = "#!" -a "${two}" = "@PREFIX@/sbin/runscript" ] || \
|
||||||
|
continue
|
||||||
|
unset one two three
|
||||||
|
|
||||||
export RC_SVCNAME=${RC_SERVICE##*/}
|
export RC_SVCNAME=${RC_SERVICE##*/}
|
||||||
|
|
||||||
|
|||||||
@@ -6,23 +6,18 @@ retval=0
|
|||||||
# mount $svcdir as something we can write to if it's not rw
|
# mount $svcdir as something we can write to if it's not rw
|
||||||
# On vservers, / is always rw at this point, so we need to clean out
|
# On vservers, / is always rw at this point, so we need to clean out
|
||||||
# the old service state data
|
# the old service state data
|
||||||
|
RC_SVCDIR=${RC_SVCDIR:-/@LIB@/rc/init.d}
|
||||||
if [ "${RC_SVCDIR}" != "/" ] && mkdir "${RC_SVCDIR}/.test.$$" 2>/dev/null; then
|
if [ "${RC_SVCDIR}" != "/" ] && mkdir "${RC_SVCDIR}/.test.$$" 2>/dev/null; then
|
||||||
rmdir "${RC_SVCDIR}/.test.$$"
|
rmdir "${RC_SVCDIR}/.test.$$"
|
||||||
for x in ${RC_SVCDIR:-/@LIB@/rc/init.d}/*; do
|
rm -rf "${RC_SVCDIR}"/*
|
||||||
[ -e "${x}" ] || continue
|
|
||||||
case ${x##*/} in
|
|
||||||
depconfig|deptree|ksoftlevel|rc.log);;
|
|
||||||
*) rm -rf "${x}";;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
else
|
else
|
||||||
mount_svcdir
|
mount_svcdir
|
||||||
retval=$?
|
retval=$?
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -e "${RC_LIBDIR}"/cache/deptree ]; then
|
||||||
|
cp -p "${RC_LIBDIR}"/cache/* "${RC_SVCDIR}" 2>/dev/null
|
||||||
|
fi
|
||||||
|
|
||||||
echo "sysinit" > "${RC_SVCDIR}/softlevel"
|
echo "sysinit" > "${RC_SVCDIR}/softlevel"
|
||||||
|
|
||||||
# sysinit is now done, so allow init scripts to run normally
|
|
||||||
[ -e /dev/.rcsysinit ] && rm -f /dev/.rcsysinit
|
|
||||||
|
|
||||||
exit ${retval}
|
exit ${retval}
|
||||||
@@ -10,18 +10,6 @@
|
|||||||
# FreeBSD-7 supports tmpfs now :)
|
# FreeBSD-7 supports tmpfs now :)
|
||||||
mount_svcdir()
|
mount_svcdir()
|
||||||
{
|
{
|
||||||
local dotmp=false release=false retval=0
|
|
||||||
if [ -e "${RC_SVCDIR}"/deptree ]; then
|
|
||||||
dotmp=true
|
|
||||||
if ! mount -t tmpfs none "${RC_LIBDIR}"/tmp 2>/dev/null; then
|
|
||||||
mdconfig -a -t malloc -s 1m -u 1
|
|
||||||
newfs /dev/md1
|
|
||||||
mount /dev/md1 "${RC_LIBDIR}"/tmp
|
|
||||||
release=true
|
|
||||||
fi
|
|
||||||
cp -p "${RC_SVCDIR}"/deptree "${RC_SVCDIR}"/depconfig \
|
|
||||||
"${RC_SVCDIR}"/nettree "${RC_LIBDIR}"/tmp 2>/dev/null
|
|
||||||
fi
|
|
||||||
if ! fstabinfo --mount "${RC_SVCDIR}"; then
|
if ! fstabinfo --mount "${RC_SVCDIR}"; then
|
||||||
if ! mount -t tmpfs -o rw,noexec,nosuid none "${RC_SVCDIR}" 2>/dev/null; then
|
if ! mount -t tmpfs -o rw,noexec,nosuid none "${RC_SVCDIR}" 2>/dev/null; then
|
||||||
mdconfig -a -t malloc -s "${rc_svcsize:-1024}"k -u 0
|
mdconfig -a -t malloc -s "${rc_svcsize:-1024}"k -u 0
|
||||||
@@ -29,15 +17,6 @@ mount_svcdir()
|
|||||||
mount -o rw,noexec,nosuid /dev/md0 "${RC_SVCDIR}"
|
mount -o rw,noexec,nosuid /dev/md0 "${RC_SVCDIR}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
retval=$?
|
|
||||||
if ${dotmp}; then
|
|
||||||
cp -p "${RC_LIBDIR}"/tmp/deptree "${RC_LIBDIR}"/tmp/depconfig \
|
|
||||||
"${RC_LIBDIR}"/tmp/nettree "${RC_SVCDIR}" 2>/dev/null
|
|
||||||
umount "${RC_LIBDIR}"/tmp
|
|
||||||
${release} && mdconfig -d -u 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
return ${retval}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
. "${RC_LIBDIR}"/sh/functions.sh
|
. "${RC_LIBDIR}"/sh/functions.sh
|
||||||
|
|||||||
@@ -3,13 +3,13 @@
|
|||||||
# Copyright 2007-2008 Roy Marples <roy@marples.name>
|
# Copyright 2007-2008 Roy Marples <roy@marples.name>
|
||||||
# All rights reserved. Released under the 2-clause BSD license.
|
# All rights reserved. Released under the 2-clause BSD license.
|
||||||
|
|
||||||
# This basically mounts $RC_SVCDIR as a ramdisk, but preserving its content
|
# This basically mounts $RC_SVCDIR as a ramdisk.
|
||||||
# which allows us to store service state and generate dependencies if needed.
|
|
||||||
# The tricky part is finding something our kernel supports
|
# The tricky part is finding something our kernel supports
|
||||||
# tmpfs and ramfs are easy, so force one or the other.
|
# tmpfs and ramfs are easy, so force one or the other.
|
||||||
mount_svcdir()
|
mount_svcdir()
|
||||||
{
|
{
|
||||||
local fs= fsopts="-o rw,noexec,nodev,nosuid" devdir="rc-svcdir" devtmp="none" x=
|
local fs= fsopts="-o rw,noexec,nodev,nosuid"
|
||||||
|
local devdir="rc-svcdir" x=
|
||||||
local svcsize=${rc_svcsize:-1024}
|
local svcsize=${rc_svcsize:-1024}
|
||||||
|
|
||||||
if grep -Eq "[[:space:]]+tmpfs$" /proc/filesystems; then
|
if grep -Eq "[[:space:]]+tmpfs$" /proc/filesystems; then
|
||||||
@@ -18,55 +18,29 @@ mount_svcdir()
|
|||||||
elif grep -Eq "[[:space:]]+ramfs$" /proc/filesystems; then
|
elif grep -Eq "[[:space:]]+ramfs$" /proc/filesystems; then
|
||||||
fs="ramfs"
|
fs="ramfs"
|
||||||
# ramfs has no special options
|
# ramfs has no special options
|
||||||
elif [ -e /dev/ram0 -a -e /dev/ram1 ] \
|
elif [ -e /dev/ram0 ] \
|
||||||
&& grep -Eq "[[:space:]]+ext2$" /proc/filesystems; then
|
&& grep -Eq "[[:space:]]+ext2$" /proc/filesystems; then
|
||||||
devdir="/dev/ram0"
|
devdir="/dev/ram0"
|
||||||
devtmp="/dev/ram1"
|
|
||||||
fs="ext2"
|
fs="ext2"
|
||||||
for x in ${devdir} ${devtmp}; do
|
dd if=/dev/zero of="${devdir}" bs=1k count="${svcsize}"
|
||||||
dd if=/dev/zero of="${x}" bs=1k count="${svcsize}"
|
mkfs -t "${fs}" -i 1024 -vm0 "${devdir}" "${svcsize}"
|
||||||
mkfs -t "${fs}" -i 1024 -vm0 "${x}" "${svcsize}"
|
|
||||||
done
|
|
||||||
else
|
else
|
||||||
echo
|
echo
|
||||||
eerror "OpenRC requires tmpfs, ramfs or 2 ramdisks + ext2"
|
eerror "OpenRC requires tmpfs, ramfs or a ramdisk + ext2"
|
||||||
eerror "compiled into the kernel"
|
eerror "compiled into the kernel"
|
||||||
echo
|
echo
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local dotmp=false
|
|
||||||
if [ -e "${RC_SVCDIR}"/deptree ]; then
|
|
||||||
dotmp=true
|
|
||||||
mount -n -t "${fs}" -o rw "${devtmp}" "${RC_LIBDIR}"/tmp
|
|
||||||
cp -p "${RC_SVCDIR}"/deptree "${RC_SVCDIR}"/depconfig \
|
|
||||||
"${RC_SVCDIR}"/nettree "${RC_LIBDIR}"/tmp 2>/dev/null
|
|
||||||
fi
|
|
||||||
|
|
||||||
# If we have no entry in fstab for $RC_SVCDIR, provide our own
|
# If we have no entry in fstab for $RC_SVCDIR, provide our own
|
||||||
if ! fstabinfo --mount "${RC_SVCDIR}"; then
|
if ! fstabinfo --mount "${RC_SVCDIR}"; then
|
||||||
mount -n -t "${fs}" ${fsopts} "${devdir}" "${RC_SVCDIR}"
|
mount -n -t "${fs}" ${fsopts} "${devdir}" "${RC_SVCDIR}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ${dotmp}; then
|
|
||||||
cp -p "${RC_LIBDIR}"/tmp/deptree "${RC_LIBDIR}"/tmp/depconfig \
|
|
||||||
"${RC_LIBDIR}"/tmp/nettree "${RC_SVCDIR}" 2>/dev/null
|
|
||||||
umount -n "${RC_LIBDIR}"/tmp
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
. /etc/init.d/functions.sh
|
. /etc/init.d/functions.sh
|
||||||
. "${RC_LIBDIR}"/sh/rc-functions.sh
|
|
||||||
[ -r /etc/conf.d/rc ] && . /etc/conf.d/rc
|
|
||||||
[ -r /etc/rc.conf ] && . /etc/rc.conf
|
[ -r /etc/rc.conf ] && . /etc/rc.conf
|
||||||
|
|
||||||
# Set the console loglevel to 1 for a cleaner boot
|
|
||||||
# the logger should anyhow dump the ring-0 buffer at start to the
|
|
||||||
# logs, and that with dmesg can be used to check for problems
|
|
||||||
if [ -n "${dmesg_level}" -a "${RC_SYS}" != "VSERVER" ]; then
|
|
||||||
dmesg -n "${dmesg_level}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# By default VServer already has /proc mounted, but OpenVZ does not!
|
# By default VServer already has /proc mounted, but OpenVZ does not!
|
||||||
# However, some of our users have an old proc image in /proc
|
# However, some of our users have an old proc image in /proc
|
||||||
# NFC how they managed that, but the end result means we have to test if
|
# NFC how they managed that, but the end result means we have to test if
|
||||||
@@ -82,7 +56,6 @@ if [ -e /proc/uptime ]; then
|
|||||||
einfo "/proc is already mounted, skipping"
|
einfo "/proc is already mounted, skipping"
|
||||||
mountproc=false
|
mountproc=false
|
||||||
fi
|
fi
|
||||||
unset up
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ${mountproc}; then
|
if ${mountproc}; then
|
||||||
@@ -94,95 +67,5 @@ if ${mountproc}; then
|
|||||||
fi
|
fi
|
||||||
eend $?
|
eend $?
|
||||||
fi
|
fi
|
||||||
unset mountproc
|
|
||||||
|
|
||||||
# Re-load RC_SYS if empty now we have /proc mounted
|
|
||||||
[ -z "${RC_SYS}" ] && export RC_SYS="$(rc --sys)"
|
|
||||||
|
|
||||||
# Read off the kernel commandline to see if there's any special settings
|
|
||||||
# especially check to see if we need to set the CDBOOT environment variable
|
|
||||||
# Note: /proc MUST be mounted
|
|
||||||
if [ -r /sbin/livecd-functions.sh ]; then
|
|
||||||
. /sbin/livecd-functions.sh
|
|
||||||
livecd_read_commandline
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "${RC_UNAME}" != "GNU/kFreeBSD" \
|
|
||||||
-a "${RC_SYS}" != "VSERVER" \
|
|
||||||
-a "${RC_SYS}" != "OPENVZ" ]
|
|
||||||
then
|
|
||||||
if grep -Eq "[[:space:]]+sysfs$" /proc/filesystems; then
|
|
||||||
if [ -d /sys ]; then
|
|
||||||
if ! mountinfo --quiet /sys; then
|
|
||||||
ebegin "Mounting /sys"
|
|
||||||
if ! fstabinfo --mount /sys; then
|
|
||||||
mount -n -t sysfs -o noexec,nosuid,nodev sysfs /sys
|
|
||||||
fi
|
|
||||||
eend $?
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
ewarn "No /sys to mount sysfs needed in 2.6 and later kernels!"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Try to figure out how the user wants /dev handled
|
|
||||||
if [ "${rc_devices}" = "static" \
|
|
||||||
-o "${RC_SYS}" = "VSERVER" \
|
|
||||||
-o "${RC_SYS}" = "OPENVZ" \
|
|
||||||
-o "${RC_UNAME}" = "GNU/kFreeBSD" ]
|
|
||||||
then
|
|
||||||
ebegin "Using existing device nodes in /dev"
|
|
||||||
eend 0
|
|
||||||
else
|
|
||||||
case ${rc_devices} in
|
|
||||||
devfs) managers="devfs udev mdev";;
|
|
||||||
udev) managers="udev devfs mdev";;
|
|
||||||
mdev) managers="mdev udev devfs";;
|
|
||||||
*) managers="udev devfs mdev";;
|
|
||||||
esac
|
|
||||||
|
|
||||||
for m in ${managers}; do
|
|
||||||
# Check kernel params
|
|
||||||
if get_bootparam "no${m}" || ! has_addon ${m}-start; then
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
# Let's see if we can get this puppy rolling
|
|
||||||
start_addon ${m} && break
|
|
||||||
|
|
||||||
# Clean up
|
|
||||||
mountinfo -q /dev && umount -n /dev
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Mount required stuff as user may not have then in /etc/fstab
|
|
||||||
for x in "devpts /dev/pts 0755 ,gid=5,mode=0620 devpts" "tmpfs /dev/shm 1777 ,nodev shm"
|
|
||||||
do
|
|
||||||
set -- ${x}
|
|
||||||
grep -Eq "[[:space:]]+$1$" /proc/filesystems || continue
|
|
||||||
mountinfo -q "$2" && continue
|
|
||||||
|
|
||||||
if [ ! -d "$2" ] && \
|
|
||||||
[ "${m}" = "devfs" -o "${m}" = "udev" ]; then
|
|
||||||
mkdir -m "$3" -p "$2" >/dev/null 2>&1 || \
|
|
||||||
ewarn "Could not create $2!"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -d "$2" ]; then
|
|
||||||
ebegin "Mounting $2"
|
|
||||||
if ! fstabinfo --mount "$2"; then
|
|
||||||
mount -n -t "$1" -o noexec,nosuid"$4" "$5" "$2"
|
|
||||||
fi
|
|
||||||
eend $?
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
# If booting off CD, we want to update inittab before setting the runlevel
|
|
||||||
if [ -f /sbin/livecd-functions.sh -a -n "${CDBOOT}" ]; then
|
|
||||||
ebegin "Updating inittab"
|
|
||||||
livecd_fix_inittab
|
|
||||||
eend $?
|
|
||||||
telinit q &>/dev/null
|
|
||||||
fi
|
|
||||||
|
|
||||||
. "${RC_LIBDIR}"/sh/init-common-post.sh
|
. "${RC_LIBDIR}"/sh/init-common-post.sh
|
||||||
|
|||||||
@@ -7,11 +7,21 @@ has_addon()
|
|||||||
[ -e "${RC_LIBDIR}/addons/$1.sh" ] || [ -e /@LIB@/rcscripts/addons/"$1".sh ]
|
[ -e "${RC_LIBDIR}/addons/$1.sh" ] || [ -e /@LIB@/rcscripts/addons/"$1".sh ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_addon_warn()
|
||||||
|
{
|
||||||
|
eindent
|
||||||
|
ewarn "${RC_SVCNAME} uses addon code which is deprecated"
|
||||||
|
ewarn "and may not be available in the future."
|
||||||
|
eoutdent
|
||||||
|
}
|
||||||
|
|
||||||
import_addon()
|
import_addon()
|
||||||
{
|
{
|
||||||
if [ -e "${RC_LIBDIR}/addons/$1.sh" ]; then
|
if [ -e "${RC_LIBDIR}/addons/$1.sh" ]; then
|
||||||
|
_addon_warn
|
||||||
. "${RC_LIBDIR}/addons/$1.sh"
|
. "${RC_LIBDIR}/addons/$1.sh"
|
||||||
elif [ -e /@LIB@/rcscripts/addons/"$1".sh ]; then
|
elif [ -e /@LIB@/rcscripts/addons/"$1".sh ]; then
|
||||||
|
_addon_warn
|
||||||
. /@LIB@/rcscripts/addons/"$1".sh
|
. /@LIB@/rcscripts/addons/"$1".sh
|
||||||
else
|
else
|
||||||
return 1
|
return 1
|
||||||
@@ -58,6 +68,7 @@ get_bootparam()
|
|||||||
|
|
||||||
set -- $(cat /proc/cmdline)
|
set -- $(cat /proc/cmdline)
|
||||||
while [ -n "$1" ]; do
|
while [ -n "$1" ]; do
|
||||||
|
[ "$1" = "${match}" ] && return 0
|
||||||
case "$1" in
|
case "$1" in
|
||||||
gentoo=*)
|
gentoo=*)
|
||||||
local params="${1##*=}"
|
local params="${1##*=}"
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
# Copyright 2007-2008 Roy Marples <roy@marples.name>
|
# Copyright 2007-2008 Roy Marples <roy@marples.name>
|
||||||
# All rights reserved. Released under the 2-clause BSD license.
|
# All rights reserved. Released under the 2-clause BSD license.
|
||||||
|
|
||||||
|
# Declare this here so that no formatting doesn't affect the embedded newline
|
||||||
|
__IFS="
|
||||||
|
"
|
||||||
|
|
||||||
# Handy function to handle all our unmounting needs
|
# Handy function to handle all our unmounting needs
|
||||||
# mountinfo is a C program to actually find our mounts on our supported OS's
|
# mountinfo is a C program to actually find our mounts on our supported OS's
|
||||||
# We rely on fuser being preset, so if it's not then we don't unmount anything.
|
# We rely on fuser being preset, so if it's not then we don't unmount anything.
|
||||||
@@ -15,17 +19,20 @@ do_unmount()
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
shift
|
shift
|
||||||
mountinfo "$@" | while read mnt; do
|
local IFS="$__IFS"
|
||||||
|
set -- $(mountinfo "$@")
|
||||||
|
unset IFS
|
||||||
|
for mnt; do
|
||||||
# Unmounting a shared mount can unmount other mounts, so
|
# Unmounting a shared mount can unmount other mounts, so
|
||||||
# we need to check the mount is still valid
|
# we need to check the mount is still valid
|
||||||
mountinfo --quiet "${mnt}" || continue
|
mountinfo --quiet "${mnt}" || continue
|
||||||
|
|
||||||
case "${cmd}" in
|
case "${cmd}" in
|
||||||
umount*)
|
umount)
|
||||||
ebegin "Unmounting ${mnt}"
|
ebegin "Unmounting ${mnt}"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
ebegin "Remounting ${mnt}"
|
ebegin "Remounting ${mnt} read only"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user