Compare commits
311 Commits
openrc-0.2
...
openrc-0.4
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0298e4ffa0 | ||
|
|
a063035b37 | ||
|
|
213cef1739 | ||
|
|
386ee57432 | ||
|
|
631acff7aa | ||
|
|
877a328179 | ||
|
|
1efa64cae8 | ||
|
|
22959c3963 | ||
|
|
2464f9e93b | ||
|
|
d91201cb94 | ||
|
|
1c5ec9d161 | ||
|
|
f4b8366942 | ||
|
|
438665357b | ||
|
|
7ad40abf64 | ||
|
|
7e12abe035 | ||
|
|
4dba5b1ff1 | ||
|
|
1ff289e305 | ||
|
|
53e2bec385 | ||
|
|
9d9f17aa52 | ||
|
|
803dbbf0c8 | ||
|
|
9e5e60f257 | ||
|
|
6bf0289f33 | ||
|
|
bdb3485b49 | ||
|
|
eb6daeca43 | ||
|
|
10e88090f6 | ||
|
|
8cce75925f | ||
|
|
e72aeebbcd | ||
|
|
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 | ||
|
|
52711bdca7 | ||
|
|
53902cefb8 | ||
|
|
75f991068d | ||
|
|
e499e58310 | ||
|
|
b08b6cd91b | ||
|
|
3c2b93fc9c | ||
|
|
b5d829789f | ||
|
|
1e3442f95d | ||
|
|
2bda1871a1 | ||
|
|
d3b111bd58 | ||
|
|
dbea63b76d | ||
|
|
6a5287dbb5 | ||
|
|
df8eeba2fb | ||
|
|
54fce42c6f | ||
|
|
54d7aa39dd | ||
|
|
dc5d63aa97 | ||
|
|
bab5d7767d | ||
|
|
799686e40d | ||
|
|
d83ae59cca | ||
|
|
18b4108755 | ||
|
|
e96347523f | ||
|
|
f0aacec02e | ||
|
|
57e1dd7389 | ||
|
|
c89b3763fb | ||
|
|
425abe40c5 | ||
|
|
725b9dc89c | ||
|
|
22d650c450 | ||
|
|
809ac86c69 | ||
|
|
b3310e8e10 | ||
|
|
29369c44c1 | ||
|
|
292fe3a568 | ||
|
|
99d5046a56 | ||
|
|
0e38dcc4d2 | ||
|
|
9176b77c23 | ||
|
|
fad61a7c4b | ||
|
|
0e114abf5d | ||
|
|
bc369085c7 | ||
|
|
6d8b36e09d | ||
|
|
8759735711 | ||
|
|
034b9b7a12 | ||
|
|
e82435c2f4 | ||
|
|
71dd280656 | ||
|
|
594d98eddc | ||
|
|
dcdfdb442f | ||
|
|
143239e143 | ||
|
|
5d38d4d6e9 | ||
|
|
c18c4fc4cc | ||
|
|
5ebe7f1349 | ||
|
|
6a227d0c45 | ||
|
|
403abe73de | ||
|
|
be82e950d7 | ||
|
|
3ca8387966 | ||
|
|
f5a9b42215 | ||
|
|
d370918f0c | ||
|
|
e995404e3b | ||
|
|
caa4704ce6 | ||
|
|
17d28fde42 | ||
|
|
b418f2e471 | ||
|
|
ee4e861796 | ||
|
|
11e33e81c8 | ||
|
|
5e8ed2aeca | ||
|
|
742310744d | ||
|
|
4e9b58b07d | ||
|
|
c564043f86 | ||
|
|
b3d1182a2f | ||
|
|
f6cb321f9f | ||
|
|
f85c6ca84c | ||
|
|
d09f9f47eb | ||
|
|
b271ac5af5 | ||
|
|
fccff6a4ed |
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.
|
||||
|
||||
NAME= openrc
|
||||
VERSION= 0.2
|
||||
VERSION= 0.4.1
|
||||
PKG= ${NAME}-${VERSION}
|
||||
|
||||
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}/subdir.mk
|
||||
include ${MK}/dist.mk
|
||||
include ${MK}/gitignore.mk
|
||||
|
||||
_installafter:
|
||||
${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.
|
||||
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
|
||||
BRANDING=\"Gentoo/$(uname -s)\"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
DIR= ${CONFDIR}
|
||||
CONF= bootmisc fsck hostname local net urandom
|
||||
CONF= bootmisc fsck hostname local localmount net urandom
|
||||
|
||||
MK= ../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
|
||||
|
||||
@@ -1 +1 @@
|
||||
CONF+= moused powerd rarpd savecore
|
||||
CONF+= moused rarpd savecore
|
||||
|
||||
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="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.
|
||||
#module_ieee1394_args="debug"
|
||||
#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
|
||||
#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
|
||||
|
||||
|
||||
@@ -120,6 +120,10 @@
|
||||
# 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.
|
||||
|
||||
# You may wish to disable the interface being brought down when stopping.
|
||||
# This is only of use for WakeOnLan.
|
||||
#ifdown_eth0="NO"
|
||||
|
||||
##############################################################################
|
||||
# OPTIONAL MODULES
|
||||
|
||||
@@ -565,12 +569,18 @@
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# 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
|
||||
#slaves_bond0="eth0 eth1 eth2"
|
||||
#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
|
||||
# ppp devices - we need to depend function on the bonded interfaces
|
||||
#rc_need_bond0="net.eth0 net.eth1"
|
||||
@@ -1006,7 +1016,7 @@
|
||||
|
||||
#postdown() {
|
||||
# # 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 ;)
|
||||
# [ "${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}
|
||||
CONF= rc.conf
|
||||
|
||||
CLEANFILES+= rc.conf
|
||||
|
||||
MK= ../mk
|
||||
include ${MK}/os.mk
|
||||
include Makefile.${OS}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
SED_EXTRA= -e 's:@TERM@:cons25:g'
|
||||
SRCS+= rc.conf.in rc.in rc.shutdown.in
|
||||
CONF+= devd.conf
|
||||
BIN+= rc.devd
|
||||
BIN+= rc rc.shutdown rc.devd
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
SED_EXTRA= -e 's:@TERM@:wsvt25:g'
|
||||
SRCS+= rc.conf.in rc.in rc.shutdown.in
|
||||
BIN+= rc rc.shutdown
|
||||
|
||||
@@ -6,20 +6,3 @@
|
||||
# consolefont, numlock, etc ...)
|
||||
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
|
||||
# prefix the service output with it's name as the output will get
|
||||
# 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"
|
||||
|
||||
# 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.
|
||||
rc_depend_strict="YES"
|
||||
|
||||
# Do we allow services to be hotplugged? If not, set to rc_hotplug="NO"
|
||||
# NOTE: This does not affect anything hotplug/udev/devd related, just the
|
||||
# starting/stopping of the init.d service triggered by it.
|
||||
rc_hotplug="YES"
|
||||
|
||||
# Dynamic /dev managers can trigger coldplug events which cause services to
|
||||
# start before we are ready for them. If this happens, we can defer these
|
||||
# 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.*"
|
||||
# rc_hotplug is a list of services that we allow to be hotplugged.
|
||||
# By default we do not allow hotplugging.
|
||||
# A hotplugged service is one started by a dynamic dev manager when a matching
|
||||
# hardware device is found.
|
||||
# This service is intrinsically included in the boot runlevel.
|
||||
# To disable services, prefix with a !
|
||||
# Example - rc_hotplug="net.wlan !net.*"
|
||||
# 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
|
||||
# /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"
|
||||
|
||||
# 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.
|
||||
# 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
|
||||
# There variables are shared between many init scripts
|
||||
|
||||
@@ -10,12 +10,9 @@
|
||||
trap : SIGINT
|
||||
trap "echo 'Boot interrupted'; exit 1" SIGQUIT
|
||||
|
||||
# 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.
|
||||
RUNLEVEL="1" /sbin/rc sysinit || exit 1
|
||||
RUNLEVEL="1" /sbin/rc boot || exit 1
|
||||
PREVLEVEL="1" /sbin/rc default
|
||||
/sbin/rc sysinit || exit 1
|
||||
/sbin/rc boot || exit 1
|
||||
/sbin/rc default
|
||||
|
||||
# We don't actually care if rc default worked or not, we should exit 0
|
||||
# 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@"
|
||||
|
||||
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}"
|
||||
|
||||
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
|
||||
@@ -3,5 +3,8 @@ SRCS= avahi-dnsconfd.in avahid.in dbus.in hald.in named.in ntpd.in \
|
||||
openvpn.in polkitd.in sshd.in
|
||||
|
||||
MK= ../mk
|
||||
|
||||
SED_EXTRA+= -e 's:@VARBASE@:/var:g'
|
||||
|
||||
include ${MK}/scripts.mk
|
||||
include Makefile.${OS}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
# All rights reserved. Released under the 2-clause BSD license.
|
||||
|
||||
command=@PKG_PREFIX@/bin/dbus-daemon
|
||||
pidfile=@VARBASE@/run/dbus/dbus.pid
|
||||
pidfile=@VARBASE@/run/dbus/pid
|
||||
command_args="${dbusd_args---system}"
|
||||
name="Message Bus Daemon"
|
||||
|
||||
|
||||
@@ -4,12 +4,22 @@
|
||||
|
||||
command=/usr/sbin/named
|
||||
command_args=${named_args}
|
||||
pidfile=@VARBASE@/run/named/pid
|
||||
pidfile=@VARBASE@/run/named.pid
|
||||
name="Domain Name server"
|
||||
extra_started_commands="reload"
|
||||
|
||||
namedb=/etc/namedb
|
||||
named_uid=${named_uid:-bind}
|
||||
uid=named
|
||||
case "${RC_UNAME}" in
|
||||
FreeBSD)
|
||||
uid=bind
|
||||
pidfile=@VARBASE@/run/named/pid
|
||||
;;
|
||||
Linux)
|
||||
uid=bind
|
||||
;;
|
||||
esac
|
||||
named_uid=${named_uid:-${uid}}
|
||||
|
||||
depend()
|
||||
{
|
||||
|
||||
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}
|
||||
SRCS= bootmisc.in fsck.in halt.sh.in hostname.in local.in localmount.in \
|
||||
netmount.in root.in swap.in sysctl.in urandom.in
|
||||
SRCS= bootmisc.in fsck.in hostname.in local.in localmount.in \
|
||||
netmount.in root.in savecache.in swap.in sysctl.in urandom.in
|
||||
BIN= ${OBJS}
|
||||
|
||||
INSTALLAFTER= _installafter
|
||||
CLEANFILES+= net.lo
|
||||
TARGETS+= net.lo
|
||||
|
||||
MK= ../mk
|
||||
include ${MK}/os.mk
|
||||
include Makefile.${OS}
|
||||
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
|
||||
SRCS+= hostid.in moused.in newsyslog.in pf.in rarpd.in rc-enabled.in \
|
||||
rpcbind.in savecore.in syslogd.in
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
SRCS+= hwclock.in consolefont.in keymaps.in modules.in mtab.in numlock.in \
|
||||
procfs.in
|
||||
NET_LO= net.lo
|
||||
|
||||
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
|
||||
.Linux.in:
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
NET_LO= net.lo0
|
||||
|
||||
# Generic BSD scripts
|
||||
SRCS+= hostid.in moused.in newsyslog.in pf.in rarpd.in rc-enabled.in \
|
||||
rpcbind.in savecore.in syslogd.in
|
||||
|
||||
# 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
|
||||
.BSD.in:
|
||||
|
||||
@@ -11,21 +11,25 @@ depend()
|
||||
keyword noprefix
|
||||
}
|
||||
|
||||
dir_writeable()
|
||||
{
|
||||
mkdir "$1"/.test.$$ 2>/dev/null && rmdir "$1"/.test.$$
|
||||
}
|
||||
|
||||
cleanup_tmp_dir()
|
||||
{
|
||||
local dir=$1
|
||||
local dir="$1"
|
||||
|
||||
mkdir -p "${dir}"
|
||||
if ! [ -d "${dir}" ]; then
|
||||
mkdir -p "${dir}" || return $?
|
||||
fi
|
||||
dir_writeable "${dir}" || return 1
|
||||
chmod +t "${dir}"
|
||||
cd "${dir}"
|
||||
if yesno ${wipe_tmp:-${WIPE_TMP:-yes}}; then
|
||||
ebegin "Wiping ${dir} directory"
|
||||
local startopts="-x . -depth" delete="-exec rm -rf -- {} ;"
|
||||
|
||||
if [ "${RC_UNAME}" = "Linux" ]; then
|
||||
startopts=". -xdev -depth"
|
||||
# busybox find / rm cannot handle --
|
||||
delete="-delete"
|
||||
fi
|
||||
local startopts="-x . -depth"
|
||||
[ "${RC_UNAME}" = "Linux" ] && startopts=". -xdev -depth"
|
||||
|
||||
# Faster than find
|
||||
rm -rf -- [b-ikm-pr-zA-Z0-9\.]*
|
||||
@@ -45,8 +49,7 @@ cleanup_tmp_dir()
|
||||
! -path "./journal/*" \
|
||||
! -path "./.private" \
|
||||
! -path "./.private/*" \
|
||||
${delete} \
|
||||
-type d -prune
|
||||
-exec rm -rf {} \;
|
||||
eend 0
|
||||
else
|
||||
ebegin "Cleaning ${dir} directory"
|
||||
@@ -60,12 +63,7 @@ cleanup_tmp_dir()
|
||||
|
||||
start()
|
||||
{
|
||||
if ! mkdir /.test.$$ 2>/dev/null; then
|
||||
ewarn "Skipping /var and /tmp initialization (ro root?)"
|
||||
return 0
|
||||
fi
|
||||
rmdir /.test.$$
|
||||
|
||||
local logw=false
|
||||
# Ensure that our basic dirs exist
|
||||
for x in /var/log /var/run /tmp; do
|
||||
if ! [ -d "${x}" ]; then
|
||||
@@ -76,51 +74,71 @@ start()
|
||||
fi
|
||||
done
|
||||
|
||||
ebegin "Creating user login records"
|
||||
cp /dev/null /var/run/utmp
|
||||
[ -e /var/log/wtmp ] || cp /dev/null /var/log/wtmp
|
||||
chmod 0644 /var/run/utmp /var/log/wtmp
|
||||
eend 0
|
||||
if dir_writeable /var/run; then
|
||||
ebegin "Creating user login records"
|
||||
cp /dev/null /var/run/utmp
|
||||
chgrp utmp /var/run/utmp
|
||||
chmod 0664 /var/run/utmp
|
||||
if dir_writeable /var/log; then
|
||||
logw=true
|
||||
[ -e /var/log/wtmp ] || cp /dev/null /var/log/wtmp
|
||||
chgrp utmp /var/log/wtmp
|
||||
chmod 0664 /var/log/wtmp
|
||||
fi
|
||||
eend 0
|
||||
|
||||
ebegin "Cleaning /var/run"
|
||||
for x in $(find /var/run ! -type d ! -name utmp ! -name random-seed \
|
||||
! -name ld-elf.so.hints ! -name ld.so.hints);
|
||||
do
|
||||
[ ! -f "${x}" ] && continue
|
||||
# Do not remove pidfiles of already running daemons
|
||||
case "${x}" in
|
||||
*.pid)
|
||||
start-stop-daemon --test --quiet --stop \
|
||||
--pidfile "${x}"
|
||||
[ $? -eq 0 ] && continue
|
||||
ebegin "Cleaning /var/run"
|
||||
for x in $(find /var/run ! -type d ! -name utmp \
|
||||
! -name random-seed ! -name dev.db \
|
||||
! -name ld-elf.so.hints ! -name ld.so.hints);
|
||||
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
|
||||
# Do not remove pidfiles of already running daemons
|
||||
case "${x}" in
|
||||
*.pid)
|
||||
start-stop-daemon --test --quiet \
|
||||
--stop --pidfile "${x}" && continue
|
||||
;;
|
||||
esac
|
||||
rm -f -- "${x}"
|
||||
done
|
||||
eend 0
|
||||
esac
|
||||
rm -f -- "${x}"
|
||||
done
|
||||
eend 0
|
||||
fi
|
||||
|
||||
# Clean up /tmp directories
|
||||
local tmp=
|
||||
for tmp in ${wipe_tmp_dirs-/tmp}; do
|
||||
cleanup_tmp_dir "${tmp}"
|
||||
done
|
||||
chmod +t /tmp /var/tmp
|
||||
|
||||
# Make sure our X11 stuff have the correct permissions
|
||||
# Omit the chown as bootmisc is run before network is up
|
||||
# and users may be using lame LDAP auth #139411
|
||||
rm -rf /tmp/.ICE-unix /tmp/.X11-unix
|
||||
mkdir -p /tmp/.ICE-unix /tmp/.X11-unix
|
||||
chmod 1777 /tmp/.ICE-unix /tmp/.X11-unix
|
||||
[ -x /sbin/restorecon ] && restorecon /tmp/.ICE-unix /tmp/.X11-unix
|
||||
if dir_writeable /tmp; then
|
||||
# Make sure our X11 stuff have the correct permissions
|
||||
# Omit the chown as bootmisc is run before network is up
|
||||
# and users may be using lame LDAP auth #139411
|
||||
rm -rf /tmp/.ICE-unix /tmp/.X11-unix
|
||||
mkdir -p /tmp/.ICE-unix /tmp/.X11-unix
|
||||
chmod 1777 /tmp/.ICE-unix /tmp/.X11-unix
|
||||
[ -x /sbin/restorecon ] && restorecon /tmp/.ICE-unix /tmp/.X11-unix
|
||||
fi
|
||||
|
||||
# Create an 'after-boot' dmesg log
|
||||
if [ "${RC_SYS}" != "VSERVER" -a "${RC_SYS}" != "OPENVZ" ]; then
|
||||
dmesg > /var/log/dmesg
|
||||
chmod 640 /var/log/dmesg
|
||||
if ${logw} || dir_writeable /var/log; then
|
||||
# Create an 'after-boot' dmesg log
|
||||
if [ "${RC_SYS}" != "VSERVER" -a "${RC_SYS}" != "OPENVZ" ]; then
|
||||
dmesg > /var/log/dmesg
|
||||
chmod 640 /var/log/dmesg
|
||||
fi
|
||||
fi
|
||||
|
||||
rm -f /etc/nologin
|
||||
return 0
|
||||
}
|
||||
|
||||
stop()
|
||||
|
||||
@@ -6,8 +6,7 @@ description="Sets a font for the consoles."
|
||||
|
||||
depend()
|
||||
{
|
||||
need localmount
|
||||
need keymaps # sets up terminal encoding scheme
|
||||
need localmount termencoding
|
||||
after hotplug
|
||||
keyword noopenvz noprefix nouml novserver noxenu
|
||||
}
|
||||
@@ -34,7 +33,7 @@ start()
|
||||
return 0
|
||||
fi
|
||||
|
||||
local x= param= sf_param= retval=0 ttydev=
|
||||
local x= param= sf_param= retval=0 ttydev=/dev/tty
|
||||
|
||||
# Get additional parameters
|
||||
if [ -n "${consoletranslation}" ]; then
|
||||
@@ -45,11 +44,8 @@ start()
|
||||
fi
|
||||
|
||||
# Set the console font
|
||||
ebegin "Setting user font"
|
||||
[ -d /dev/vc ] \
|
||||
&& ttydev=/dev/vc/ \
|
||||
|| ttydev=/dev/tty
|
||||
|
||||
ebegin "Setting console font [${consolefont}]"
|
||||
[ -d /dev/vc ] && ttydev=/dev/vc/
|
||||
x=1
|
||||
while [ ${x} -le ${ttyn} ]; do
|
||||
setfont ${consolefont} ${param} -C ${ttydev}${x} >/dev/null
|
||||
@@ -61,17 +57,17 @@ start()
|
||||
# Store the last font so we can use it ASAP on boot
|
||||
if [ ${retval} -eq 0 -a -w "${RC_LIBDIR}" ]; then
|
||||
mkdir -p "${RC_LIBDIR}"/console
|
||||
|
||||
for font in /usr/share/consolefonts/"${consolefont}".*; do
|
||||
:
|
||||
done
|
||||
cp "${font}" "${RC_LIBDIR}"/console
|
||||
echo "${font##*/}" > "${RC_LIBDIR}"/console/font
|
||||
if yesno ${unicode:-${UNICODE}}; then
|
||||
cp /dev/null "${RC_LIBDIR}"/console/unicode
|
||||
echo "" > "${RC_LIBDIR}"/console/unicode
|
||||
else
|
||||
rm -f "${RC_LIBDIR}"/console/unicode
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
return ${retval}
|
||||
|
||||
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
|
||||
}
|
||||
18
init.d/dmesg.in
Normal file
18
init.d/dmesg.in
Normal file
@@ -0,0 +1,18 @@
|
||||
#!@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
|
||||
keyword novserver
|
||||
}
|
||||
|
||||
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.
|
||||
|
||||
description="Check and repair filesystems according to /etc/fstab"
|
||||
_ISF="
|
||||
_IFS="
|
||||
"
|
||||
|
||||
depend()
|
||||
{
|
||||
after clock modules
|
||||
use dev clock modules
|
||||
keyword nojail noopenvz noprefix notimeout novserver
|
||||
}
|
||||
|
||||
@@ -25,22 +25,39 @@ _reboot() {
|
||||
fi
|
||||
}
|
||||
|
||||
_forcefsck()
|
||||
{
|
||||
[ -e /forcefsck ] || get_bootparam forcefsck
|
||||
}
|
||||
|
||||
start()
|
||||
{
|
||||
local reboot_opts= fsck_opts= p=
|
||||
local fsck_opts= p= check_extra=
|
||||
|
||||
ebegin "Checking local filesystems"
|
||||
if [ -e /fastboot ]; then
|
||||
ewarn "Skipping fsck due to /fastboot"
|
||||
return 0
|
||||
fi
|
||||
if _forcefsck; then
|
||||
fsck_opts="${fsck_opts} -f"
|
||||
check_extra="(check forced)"
|
||||
fi
|
||||
|
||||
if [ -n "${fsck_passno}" ]; then
|
||||
check_extra="[passno ${fsck_passno}] ${check_extra}"
|
||||
fi
|
||||
ebegin "Checking local filesystems ${check_extra}"
|
||||
for p in ${fsck_passno}; do
|
||||
local IFS="${_IFS}"
|
||||
case "${p}" in
|
||||
[0-9]*) p="=${p}";;
|
||||
esac
|
||||
set -- "$@" "$(fstabinfo --passno "${p}")"
|
||||
set -- "$@" $(fstabinfo --passno "${p}")
|
||||
unset IFS
|
||||
done
|
||||
|
||||
if [ "${RC_UNAME}" = "Linux" ]; then
|
||||
fsck_opts="-C0 -T"
|
||||
fsck_opts="${fsck_opts} -C0 -T"
|
||||
if [ -z "${fsck_passno}" ]; then
|
||||
fsck_args=${fsck_args--A -p}
|
||||
if echo 2>/dev/null >/.test.$$; then
|
||||
@@ -48,21 +65,31 @@ start()
|
||||
fsck_opts="${fsck_opts} -R"
|
||||
fi
|
||||
fi
|
||||
reboot_opts="-f"
|
||||
fi
|
||||
|
||||
trap : QUIT
|
||||
trap : INT QUIT
|
||||
fsck ${fsck_args--p} ${fsck_opts} "$@"
|
||||
case $? in
|
||||
0) eend 0; return 0;;
|
||||
1) ewend 1 "Filesystems repaired"; return 0;;
|
||||
2|3|4) ewend 1 "Filesystems repaired, but reboot needed"
|
||||
_reboot ${reboot_opts} || return 1;;
|
||||
8) ewend 1 "Operational error"; return 0;;
|
||||
12) ewend 1 "fsck interupted"; return 1;;
|
||||
*) eend 2 "Filesystems couldn't be fixed"
|
||||
_abort || return 1;;
|
||||
0) eend 0; return 0;;
|
||||
1) ewend 1 "Filesystems repaired"; return 0;;
|
||||
2|3) if [ "${RC_UNAME}" = "Linux" ]; then
|
||||
ewend 1 "Filesystems repaired, but reboot needed"
|
||||
_reboot -f
|
||||
else
|
||||
ewend 1 "Filesystems still have errors; manual fsck required"
|
||||
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
|
||||
_abort || return 1
|
||||
}
|
||||
|
||||
stop()
|
||||
@@ -70,6 +97,7 @@ stop()
|
||||
# Fake function so we always shutdown correctly.
|
||||
_abort() { return 0; }
|
||||
_reboot() { return 0; }
|
||||
_forcefsck() { return 1; }
|
||||
|
||||
yesno "${fsck_shutdown}" && start
|
||||
return 0
|
||||
|
||||
@@ -1,99 +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
|
||||
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.
|
||||
reset()
|
||||
{
|
||||
local uuid=$(kenv smbios.system.uuid 2>/dev/null)
|
||||
local x="[0-9a-f]"
|
||||
local y="${x}${x}${x}${x}"
|
||||
local uuid= x="[0-9a-f]" 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
|
||||
${y}${y}-${y}-${y}-${y}-${y}${y}${y});;
|
||||
*) uuid=;;
|
||||
|
||||
@@ -74,8 +74,14 @@ start()
|
||||
fi
|
||||
|
||||
ebegin "Setting system clock using the hardware clock [${utc}]"
|
||||
if [ -e /proc/modules -a ! -e /dev/rtc ]; then
|
||||
modprobe -q rtc || modprobe -q genrtc
|
||||
if [ -e /proc/modules ]; then
|
||||
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
|
||||
|
||||
if [ -e /etc/adjtime ] && yesno ${clock_adjfile}; then
|
||||
|
||||
@@ -20,6 +20,10 @@ ipfw() {
|
||||
/sbin/ipfw -f -q "$@"
|
||||
}
|
||||
|
||||
have_ip6() {
|
||||
sysctl net.ipv6 2>/dev/null
|
||||
}
|
||||
|
||||
init() {
|
||||
# Load the kernel module
|
||||
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 ip from 127.0.0.0/8 to any
|
||||
|
||||
ipfw add pass ip6 from any to any via lo0
|
||||
ipfw add deny ip6 from any to ::1
|
||||
ipfw add deny ip6 from ::1 to any
|
||||
if have_ip6; then
|
||||
ipfw add pass ip6 from any to any via lo0
|
||||
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 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 :: 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 ff02::/16 proto ipv6-icmp
|
||||
fi
|
||||
}
|
||||
|
||||
start() {
|
||||
@@ -62,9 +68,11 @@ start() {
|
||||
ipfw add pass udp 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
|
||||
ipfw add pass udp from me6 to any keep-state
|
||||
ipfw add pass icmp from me6 to any keep-state
|
||||
if have_ip6; then
|
||||
ipfw add pass tcp from me6 to any setup 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.
|
||||
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.
|
||||
ipfw add pass icmp from any to any icmptype 3,4,11
|
||||
|
||||
# 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)
|
||||
ipfw add pass ip6 from any to any icmp6types 2,135,136 proto ipv6-icmp
|
||||
if have_ip6; then
|
||||
# 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)
|
||||
ipfw add pass ip6 from any to any icmp6types 2,135,136 proto ipv6-icmp
|
||||
fi
|
||||
|
||||
# Add permits for this workstations published services below
|
||||
# Only IPs and nets in firewall_allowservices is allowed in.
|
||||
|
||||
@@ -8,13 +8,13 @@ ttyn=${rc_tty_number:-${RC_TTY_NUMBER:-12}}
|
||||
unicode=${unicode:-${UNICODE}}
|
||||
keymap=${keymap:-${KEYMAP}}
|
||||
extended_keymaps=${extended_keymaps:-${EXTENDED_KEYMAPS}}
|
||||
windowskeys=${windowskeys:-${SET_WINDOWSKEYS}}
|
||||
windowkeys=${windowkeys:-${SET_WINDOWSKEYS}}
|
||||
fix_euro=${fix_euro:-${FIX_EURO}}
|
||||
dumpkeys_charset=${dumpkeys_charset:-${DUMPKEYS_CHARSET}}
|
||||
|
||||
depend()
|
||||
{
|
||||
need localmount
|
||||
need localmount termencoding
|
||||
keyword noopenvz noprefix nouml novserver noxenu
|
||||
}
|
||||
|
||||
@@ -25,43 +25,41 @@ start()
|
||||
return 1
|
||||
fi
|
||||
|
||||
local ttydev= n=
|
||||
[ -d /dev/vc ] \
|
||||
&& ttydev=/dev/vc/ \
|
||||
|| ttydev=/dev/tty
|
||||
local ttydev=/dev/tty n=
|
||||
[ -d /dev/vc ] && ttydev=/dev/vc/
|
||||
|
||||
# Force linux keycodes for PPC.
|
||||
if [ -f /proc/sys/dev/mac_hid/keyboard_sends_linux_keycodes ]; then
|
||||
echo 1 > /proc/sys/dev/mac_hid/keyboard_sends_linux_keycodes
|
||||
fi
|
||||
|
||||
ebegin "Loading key mappings"
|
||||
local loadkeys_uni= wkeys=
|
||||
yesno ${unicode} && loadkeys_uni="--unicode"
|
||||
yesno ${windowskeys} && wkeys="windowkeys"
|
||||
ebegin "Loading key mappings [${keymap}]"
|
||||
local loadkeys_uni= wkeys= kmode="-a" msg="ASCII"
|
||||
if yesno ${unicode}; then
|
||||
loadkeys_uni="--unicode"
|
||||
kmode="-u"
|
||||
msg="UTF-8"
|
||||
fi
|
||||
yesno ${windowkeys} && wkeys="windowkeys"
|
||||
loadkeys -q ${loadkeys_uni} ${wkeys} ${keymap} ${extended_keymaps}
|
||||
eend $? "Error loading key mappings" || return $?
|
||||
|
||||
if yesno ${fix_euro}; then
|
||||
ebegin "Fixing font for euro symbol"
|
||||
# Fix some fonts displaying the Euro, #173528.
|
||||
echo "altgr keycode 18 = U+20AC" | loadkeys -q
|
||||
eend $?
|
||||
fi
|
||||
|
||||
# Set terminal encoding to either ASCII or UNICODE.
|
||||
# See utf-8(7) for more information.
|
||||
local termencoding="%@" termmsg="ASCII" kmode="-a"
|
||||
ebegin "Setting keyboard mode [${msg}]"
|
||||
if yesno ${unicode}; then
|
||||
dumpkeys ${dumpkeys_charset:+-c} \
|
||||
${dumpkeys_charset} | loadkeys --unicode
|
||||
termencoding="%G"
|
||||
termmsg="UTF-8"
|
||||
kmode="-u"
|
||||
fi
|
||||
|
||||
ebegin "Setting terminal encoding to" ${termmsg}
|
||||
n=1
|
||||
while [ ${n} -le "${ttyn}" ]; do
|
||||
printf "\033%s" "${termencoding}" >"${ttydev}${n}"
|
||||
kbd_mode "${kmode}" -C "${ttydev}${n}"
|
||||
n=$((${n} + 1))
|
||||
done
|
||||
|
||||
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
|
||||
fi
|
||||
|
||||
eend $? $"Failed to stop local"
|
||||
eend $? "Failed to stop local"
|
||||
}
|
||||
|
||||
@@ -30,13 +30,13 @@ start()
|
||||
stop()
|
||||
{
|
||||
# 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
|
||||
OIFS=${IFS} SIFS=${IFS-y}
|
||||
IFS=$IFS:
|
||||
for x in ${no_umounts} ${RC_NO_UMOUNTS}; do
|
||||
no_umounts="${no_umounts}|${x}"
|
||||
no_umounts_r="${no_umounts_r}|${x}"
|
||||
done
|
||||
if [ "${SIFS}" = "y" ]; then
|
||||
IFS=$OIFS
|
||||
@@ -45,9 +45,9 @@ stop()
|
||||
fi
|
||||
|
||||
if [ "${RC_UNAME}" = "Linux" ]; then
|
||||
no_umounts="${no_umounts}|/proc|/proc/.*|/sys|/sys/.*"
|
||||
no_umounts_r="${no_umounts_r}|/proc|/proc/.*|/sys|/sys/.*"
|
||||
fi
|
||||
no_umounts="^(${no_umounts})$"
|
||||
no_umounts_r="^(${no_umounts_r})$"
|
||||
|
||||
# Flush all pending disk writes now
|
||||
sync; sync
|
||||
@@ -63,7 +63,7 @@ stop()
|
||||
# Umount loopback devices
|
||||
einfo "Unmounting loopback devices"
|
||||
eindent
|
||||
do_unmount "umount -d" --skip-point-regex "${no_umounts}" \
|
||||
do_unmount "umount -d" --skip-point-regex "${no_umounts_r}" \
|
||||
--node-regex "^/dev/loop"
|
||||
eoutdent
|
||||
|
||||
@@ -76,7 +76,7 @@ stop()
|
||||
fs="${fs}${fs:+|}${x}"
|
||||
done
|
||||
[ -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
|
||||
eoutdent
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ start()
|
||||
x=${KV#*.*.}
|
||||
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}" \
|
||||
${KV_MAJOR}.${KV_MINOR}.${KV_MICRO} \
|
||||
${KV_MAJOR}.${KV_MINOR} \
|
||||
@@ -34,25 +34,30 @@ start()
|
||||
[ -z "${list}" ] && list=${modules}
|
||||
|
||||
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}")
|
||||
for y in "${KV}" \
|
||||
${KV_MAJOR}.${KV_MINOR}.${KV_MICRO} \
|
||||
${KV_MAJOR}.${KV_MINOR} \
|
||||
; do
|
||||
eval args=\$module_${aa}_args_$(shell_var "${y}")
|
||||
[ -n "${args}" ] && break
|
||||
eval args=\$module_${xx}_args_$(shell_var "${y}")
|
||||
[ -n "${args}" ] && break
|
||||
done
|
||||
[ -z "${args}" ] && eval args=\$module_${aa}_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))
|
||||
done
|
||||
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 $?
|
||||
}
|
||||
@@ -28,7 +28,7 @@ depend()
|
||||
*) after net.lo net.lo0;;
|
||||
esac
|
||||
|
||||
if type depend_${IFVAR} >/dev/null 2>&1; then
|
||||
if [ "$(command -v "depend_${IFVAR}")" = "depend_${IFVAR}" ]; then
|
||||
depend_${IFVAR}
|
||||
fi
|
||||
|
||||
@@ -344,7 +344,7 @@ _load_modules()
|
||||
# Wrap our provides
|
||||
local f=
|
||||
for f in pre_start start post_start; do
|
||||
eval "${provides}_${f}() { type ${mod}_${f} >/dev/null 2>&1 || return 0; ${mod}_${f} \"\$@\"; }"
|
||||
eval "${provides}_${f}() { [ "$(command -v "${mod}_${f}")" = "${mod}_${f}" ] || return 0; ${mod}_${f} \"\$@\"; }"
|
||||
done
|
||||
|
||||
eval module_${mod}_provides="${provides}"
|
||||
@@ -358,7 +358,7 @@ _load_modules()
|
||||
eval x=\$module_${mod}_provides
|
||||
[ -z "${x}" ] && continue
|
||||
for f in pre_start start post_start; do
|
||||
eval "${x}_${f}() { type ${mod}_${f} >/dev/null 2>&1 || return 0; ${mod}_${f} \"\$@\"; }"
|
||||
eval "${x}_${f}() { [ "$(command -v "${mod}_${f}")" = "${mod}_${f}" ] || return 0; ${mod}_${f} \"\$@\"; }"
|
||||
done
|
||||
eval module_${x}_providedby="${mod}"
|
||||
;;
|
||||
@@ -445,6 +445,35 @@ _load_config()
|
||||
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()
|
||||
{
|
||||
local IFACE=${RC_SVCNAME#*.} oneworked=false module=
|
||||
@@ -462,7 +491,7 @@ start()
|
||||
# We up the iface twice if we have a preup to ensure it's up if
|
||||
# available in preup and afterwards incase the user inadvertently
|
||||
# brings it down
|
||||
if type preup >/dev/null 2>&1; then
|
||||
if [ "$(command -v preup)" = "preup" ]; then
|
||||
_up 2>/dev/null
|
||||
ebegin "Running preup"
|
||||
eindent
|
||||
@@ -473,7 +502,7 @@ start()
|
||||
_up 2>/dev/null
|
||||
|
||||
for module in ${MODULES}; do
|
||||
if type "${module}_pre_start" >/dev/null 2>&1; then
|
||||
if [ "$(command -v "${module}_pre_start")" = "${module}_pre_start" ]; then
|
||||
${module}_pre_start || exit $?
|
||||
fi
|
||||
done
|
||||
@@ -522,7 +551,7 @@ start()
|
||||
null) :;;
|
||||
[0-9]*|*:*) _add_address ${config};;
|
||||
*)
|
||||
if type "${config}_start" >/dev/null 2>&1; then
|
||||
if [ "$(command -v "${config}_start")" = "${config}_start" ]; then
|
||||
"${config}"_start
|
||||
else
|
||||
eerror "nothing provides \`${config}'"
|
||||
@@ -547,7 +576,7 @@ start()
|
||||
done
|
||||
|
||||
if ! ${oneworked}; then
|
||||
if type failup >/dev/null 2>&1; then
|
||||
if [ "$(command -v failup)" = "failup" ]; then
|
||||
ebegin "Running failup"
|
||||
eindent
|
||||
failup
|
||||
@@ -566,7 +595,7 @@ ${routes}"
|
||||
fi
|
||||
fi
|
||||
|
||||
local OIFS="${IFS}" SIFS=${IFS-y}
|
||||
local OIFS="${IFS}" SIFS="${IFS-y}"
|
||||
local IFS="$__IFS"
|
||||
for cmd in ${routes}; do
|
||||
unset IFS
|
||||
@@ -581,7 +610,8 @@ ${routes}"
|
||||
-net" "*|-host" "*);;
|
||||
*" "netmask" "*) cmd="-net ${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}";;
|
||||
esac
|
||||
if ${hidefirstroute}; then
|
||||
@@ -600,12 +630,12 @@ ${routes}"
|
||||
fi
|
||||
|
||||
for module in ${MODULES}; do
|
||||
if type "${module}_post_start" >/dev/null 2>&1; then
|
||||
if [ "$(command -v "${module}_post_start")" = "${module}_post_start" ]; then
|
||||
${module}_post_start || exit $?
|
||||
fi
|
||||
done
|
||||
|
||||
if type postup >/dev/null 2>&1; then
|
||||
if [ "$(command -v postup)" = "postup" ]; then
|
||||
ebegin "Running postup"
|
||||
eindent
|
||||
postup
|
||||
@@ -628,7 +658,7 @@ stop()
|
||||
_load_modules false
|
||||
fi
|
||||
|
||||
if type predown >/dev/null 2>&1; then
|
||||
if [ "$(command -v predown)" = "predown" ]; then
|
||||
ebegin "Running predown"
|
||||
eindent
|
||||
predown || return 1
|
||||
@@ -641,35 +671,40 @@ stop()
|
||||
fi
|
||||
|
||||
for module in ${MODULES}; do
|
||||
if type "${module}_pre_stop" >/dev/null 2>&1; then
|
||||
if [ "$(command -v "${module}_pre_stop")" = "${module}_pre_stop" ]; then
|
||||
${module}_pre_stop || exit $?
|
||||
fi
|
||||
done
|
||||
|
||||
for module in ${MODULES}; do
|
||||
if type "${module}_stop" >/dev/null 2>&1; then
|
||||
if [ "$(command -v "${module}_stop")" = "${module}_stop" ]; then
|
||||
${module}_stop
|
||||
fi
|
||||
done
|
||||
|
||||
# Only delete addresses for non PPP interfaces
|
||||
if ! type is_ppp >/dev/null 2>&1 || ! is_ppp; then
|
||||
if ! [ "$(command -v is_ppp)" = "is_ppp" ] || ! is_ppp; then
|
||||
_delete_addresses "${IFACE}"
|
||||
fi
|
||||
|
||||
for module in ${MODULES}; do
|
||||
if type "${module}_post_stop" >/dev/null 2>&1; then
|
||||
if [ "$(command -v "${module}_post_stop")" = "${module}_post_stop" ]; then
|
||||
${module}_post_stop
|
||||
fi
|
||||
done
|
||||
|
||||
! yesno ${IN_BACKGROUND} && \
|
||||
[ "${IFACE}" != "lo" -a "${IFACE}" != "lo0" ] && \
|
||||
_down 2>/dev/null
|
||||
# If not in background, and not loopback then bring the interface down
|
||||
# unless overridden.
|
||||
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
|
||||
|
||||
if type postdown >/dev/null 2>&1; then
|
||||
if [ "$(command -v "postdown")" = "postdown" ]; then
|
||||
ebegin "Running postdown"
|
||||
eindent
|
||||
postdown
|
||||
@@ -23,18 +23,19 @@ depend()
|
||||
{
|
||||
# Only have portmap as a dependency if there is a nfs mount in fstab
|
||||
# that is set to mount at boot
|
||||
local pmap=""
|
||||
local pmap=
|
||||
if need_portmap; then
|
||||
pmap="${pmap} rpc.statd"
|
||||
pmap="rpc.statd"
|
||||
[ -x @SYSCONFDIR@/init.d/rpcbind ] \
|
||||
&& pmap="rpcbind" \
|
||||
|| pmap="portmap"
|
||||
&& pmap="${pmap} rpcbind" \
|
||||
|| pmap="${pmap} portmap"
|
||||
fi
|
||||
|
||||
config /etc/fstab
|
||||
need net ${pmap}
|
||||
use afc-client amd autofs dns nfs nfsmount portmap rpcbind rpc.statd
|
||||
keyword nojail noopenvz noprefix novserver
|
||||
use afc-client amd autofs openvpn
|
||||
use dns nfs nfsmount portmap rpcbind rpc.statd rpc.lockd
|
||||
keyword nojail noprefix novserver
|
||||
}
|
||||
|
||||
start()
|
||||
|
||||
@@ -6,6 +6,7 @@ description="Mounts misc filesystems in /proc."
|
||||
|
||||
depend()
|
||||
{
|
||||
use devfs
|
||||
need localmount
|
||||
keyword noopenvz noprefix novserver
|
||||
}
|
||||
@@ -26,7 +27,7 @@ start()
|
||||
local usbfs=$(grep -Fow usbfs /proc/filesystems ||
|
||||
grep -Fow usbdevfs /proc/filesystems)
|
||||
if [ -n "${usbfs}" ]; then
|
||||
ebegin "Mounting USB device filesystem (${usbfs})"
|
||||
ebegin "Mounting USB device filesystem [${usbfs}]"
|
||||
local usbgid="$(getent group usb | \
|
||||
sed -e 's/.*:.*:\(.*\):.*/\1/')"
|
||||
mount -t ${usbfs} \
|
||||
@@ -39,7 +40,7 @@ start()
|
||||
# Setup Kernel Support for the NFS daemon status
|
||||
if [ -d /proc/fs/nfsd ] && ! mountinfo -q /proc/fs/nfsd; then
|
||||
if grep -qs nfsd /proc/filesystems; then
|
||||
ebegin "Mounting nfsd filesystem"
|
||||
ebegin "Mounting NFS filesystem"
|
||||
mount -t nfsd -o nodev,noexec,nosuid \
|
||||
nfsd /proc/fs/nfsd
|
||||
eend $?
|
||||
@@ -56,26 +57,6 @@ start()
|
||||
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
|
||||
if [ -d /selinux ] && ! mountinfo -q /selinux; then
|
||||
if grep -qs selinuxfs /proc/filesystems; then
|
||||
|
||||
@@ -13,7 +13,7 @@ depend()
|
||||
start()
|
||||
{
|
||||
if echo 2>/dev/null >/.test.$$; then
|
||||
rm -f /.test.$$
|
||||
rm -f /.test.$$ /fastboot /forcefsck
|
||||
return 0
|
||||
fi
|
||||
|
||||
@@ -22,5 +22,7 @@ start()
|
||||
Linux) mount -n -o remount,rw /;;
|
||||
*) mount -u -o rw /;;
|
||||
esac
|
||||
eend $? "Root filesystem could not be mounted read/write"
|
||||
if eend $? "Root filesystem could not be mounted read/write"; then
|
||||
rm -f /fastboot /forcefsck
|
||||
fi
|
||||
}
|
||||
|
||||
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=
|
||||
for v in font8x16 font8x14 font8x8; do
|
||||
f=$(eval \$"${v}")
|
||||
eval f=\$${v}
|
||||
if [ -n "${f}" ]; then
|
||||
ebegin "Setting font ${f}"
|
||||
vidcontrol -f ${v##FONT} ${f}
|
||||
vidcontrol -f ${v##font} ${f}
|
||||
eend $?
|
||||
fi
|
||||
done
|
||||
|
||||
@@ -6,7 +6,7 @@ depend()
|
||||
{
|
||||
use hostname
|
||||
before bootmisc logger
|
||||
keyword noprefix
|
||||
keyword noopenvz noprefix novserver
|
||||
}
|
||||
|
||||
start()
|
||||
|
||||
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 novserver
|
||||
}
|
||||
|
||||
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}
|
||||
}
|
||||
35
init.d/termencoding.in
Normal file
35
init.d/termencoding.in
Normal file
@@ -0,0 +1,35 @@
|
||||
#!@PREFIX@/sbin/runscript
|
||||
# Copyright 2008 Roy Marples <roy@marples.name>
|
||||
# All rights reserved. Released under the 2-clause BSD license.
|
||||
|
||||
description="Configures terminal encoding."
|
||||
|
||||
ttyn=${rc_tty_number:-${RC_TTY_NUMBER:-12}}
|
||||
unicode=${unicode:-${UNICODE}}
|
||||
|
||||
depend()
|
||||
{
|
||||
keyword noopenvz noprefix nouml novserver noxenu
|
||||
}
|
||||
|
||||
start()
|
||||
{
|
||||
local ttydev=/dev/tty n=
|
||||
[ -d /dev/vc ] && ttydev=/dev/vc/
|
||||
|
||||
# Set terminal encoding to either ASCII or UNICODE.
|
||||
# See utf-8(7) for more information.
|
||||
local termencoding="%@" termmsg="ASCII"
|
||||
if yesno ${unicode}; then
|
||||
termencoding="%G"
|
||||
termmsg="UTF-8"
|
||||
fi
|
||||
|
||||
ebegin "Setting terminal encoding [${termmsg}]"
|
||||
n=1
|
||||
while [ ${n} -le "${ttyn}" ]; do
|
||||
printf "\033%s" "${termencoding}" >"${ttydev}${n}"
|
||||
n=$((${n} + 1))
|
||||
done
|
||||
eend 0
|
||||
}
|
||||
@@ -18,7 +18,7 @@ MAKE_LINKS= suffix=$${man\#*.}; \
|
||||
|
||||
MK= ../mk
|
||||
include ${MK}/sys.mk
|
||||
include ${MK}/gitignore.mk
|
||||
include ${MK}/svnignore.mk
|
||||
|
||||
all:
|
||||
|
||||
|
||||
@@ -202,4 +202,4 @@ Rinse and repeat for the other verbose functions.
|
||||
.Sh SEE ALSO
|
||||
.Xr printf 3 ,
|
||||
.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 stdout 3
|
||||
.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
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd Feb 22, 2008
|
||||
.Dd Arp 9, 2008
|
||||
.Dt RC-STATUS 8 SMM
|
||||
.Os OpenRC
|
||||
.Sh NAME
|
||||
@@ -36,7 +36,8 @@
|
||||
.Nm
|
||||
gathers and displays information about the status of services
|
||||
in different runlevels. The default behavior is to show information
|
||||
about the current runlevel, but any runlevel can be quickly examined.
|
||||
about the current runlevel and any unassgined services that are not stopped,
|
||||
but any runlevel can be quickly examined.
|
||||
.Pp
|
||||
The options are as follows:
|
||||
.Bl -tag -width ".Fl test , test string"
|
||||
@@ -60,4 +61,4 @@ Show information only for the named
|
||||
.Xr rc 8 ,
|
||||
.Xr rc-update 8
|
||||
.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-status 8
|
||||
.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
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd Feb 22, 2008
|
||||
.Dd November 03, 2008
|
||||
.Dt RC 8 SMM
|
||||
.Os OpenRC
|
||||
.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
|
||||
which deal with the mounting of filesystems, set the initial state of attached
|
||||
peripherals and logging.
|
||||
Coldplugged services are added to the boot runlevel by the system.
|
||||
All services in the boot runlevel are automatically included in all other
|
||||
runlevels except for those listed here.
|
||||
Hotplugged services are added to the boot runlevel by the system.
|
||||
All services in the boot and sysinit runlevels are automatically included
|
||||
in all other runlevels except for those listed here.
|
||||
.It Ar single
|
||||
Stops all services and enters single user mode.
|
||||
.It Ar reboot
|
||||
Changes to the single runlevel and then reboots the host.
|
||||
Stops all services except for those in the sysinit runlevel.
|
||||
.It Ar shutdown
|
||||
Changes to the single runlevel and then halts the host.
|
||||
.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
|
||||
.Xr rc-status 8 ,
|
||||
.Xr rc-update 8
|
||||
.Xr rc-update 8 ,
|
||||
.Xr init 8 ,
|
||||
.Xr shutdown 8
|
||||
.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 sh 1
|
||||
.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 runscript 8
|
||||
.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 queue 3
|
||||
.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 runscript 8
|
||||
.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 rc_stringlist_free 3
|
||||
.Sh AUTHORS
|
||||
.An "Roy Marples" Aq roy@marples.name
|
||||
.An Roy Marples <roy@marples.name>
|
||||
|
||||
@@ -31,11 +31,10 @@
|
||||
.Nm rc_service_mark , rc_service_extra_commands , rc_service_plugable ,
|
||||
.Nm rc_service_resolve , rc_service_schedule_start , rc_services_scheduled_by ,
|
||||
.Nm rc_service_schedule_clear , rc_service_state ,
|
||||
.Nm rc_service_start , rc_service_stop ,
|
||||
.Nm rc_service_started_daemon , rc_service_value_get , rc_service_value_set ,
|
||||
.Nm rc_services_in_runlevel , rc_services_in_state , rc_services_scheduled ,
|
||||
.Nm rc_service_daemons_crashed
|
||||
.Nd functions to start, stop and query OpenRC services
|
||||
.Nd functions to query OpenRC services
|
||||
.Sh LIBRARY
|
||||
Run Command library (librc, -lrc)
|
||||
.Sh SYNOPSIS
|
||||
@@ -66,8 +65,6 @@ Run Command library (librc, -lrc)
|
||||
.Ft "RC_STRINGLIST *" Fn rc_services_scheduled_by "const char *service"
|
||||
.Ft bool Fn rc_service_schedule_clear "const char *service"
|
||||
.Ft RC_SERVICE Fn rc_service_state "const char *service"
|
||||
.Ft pid_t Fn rc_service_start "const char *service"
|
||||
.Ft pid_t Fn rc_service_stop "const char *service"
|
||||
.Ft bool Fo rc_service_started_daemon
|
||||
.Fa "const char *service"
|
||||
.Fa "const char *exec"
|
||||
@@ -176,16 +173,6 @@ clears these scheduled services for
|
||||
.Fa service .
|
||||
The return value is a bitmask, where more than one state can apply.
|
||||
.Pp
|
||||
.Fn rc_service_start
|
||||
starts
|
||||
.Fa service ,
|
||||
returning the pid of new process.
|
||||
.Pp
|
||||
.Fn rc_service_stop
|
||||
stops
|
||||
.Fa service ,
|
||||
returning the pid of new process.
|
||||
.Pp
|
||||
.Fn rc_service_started_daemon
|
||||
checks to see if
|
||||
.Fa service
|
||||
@@ -240,4 +227,4 @@ normally holds the volatile state data for services on a RAM backed disk.
|
||||
.Xr rc_stringlist_free 3 ,
|
||||
.Xr start-stop-daemon 8
|
||||
.Sh AUTHORS
|
||||
.An "Roy Marples" Aq roy@marples.name
|
||||
.An Roy Marples <roy@marples.name>
|
||||
|
||||
@@ -85,4 +85,4 @@ itself.
|
||||
.Xr queue 3 ,
|
||||
.Xr strcmp 3
|
||||
.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
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd Mar 19, 2008
|
||||
.Dd September 19, 2008
|
||||
.Dt RUNSCRIPT 8 SMM
|
||||
.Os OpenRC
|
||||
.Sh NAME
|
||||
@@ -111,11 +111,11 @@ You should define a
|
||||
function for the service so that
|
||||
.Nm
|
||||
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
|
||||
.Ic depend
|
||||
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"
|
||||
.It Ic need
|
||||
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
|
||||
.Ic eerror
|
||||
and !! in square brackets
|
||||
at the end of the line. Otherwise output ok in square brackets at the end of
|
||||
the line. The value of
|
||||
at the end of the line.
|
||||
Otherwise output ok in square brackets at the end of the line.
|
||||
The value of
|
||||
.Ar retval
|
||||
is returned.
|
||||
.It Ic ewend Ar retval Op Ar string
|
||||
@@ -193,6 +194,14 @@ output when the environment variable
|
||||
.Va EINFO_VERBOSE
|
||||
is true.
|
||||
.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 ...
|
||||
If
|
||||
.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 ...
|
||||
If
|
||||
.Ar file1
|
||||
is older than
|
||||
is newer than
|
||||
.Ar file2
|
||||
return 0, otherwise 1.
|
||||
If
|
||||
@@ -432,6 +441,16 @@ show()
|
||||
}
|
||||
|
||||
.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
|
||||
.Xr einfo 3 ,
|
||||
.Xr rc 8 ,
|
||||
@@ -442,4 +461,4 @@ show()
|
||||
.Xr start-stop-daemon 8 ,
|
||||
.Xr uname 1
|
||||
.Sh AUTHORS
|
||||
.An "Roy Marples" Aq roy@marples.name
|
||||
.An Roy Marples <roy@marples.name>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
.\" Copyright 2007-2008 Roy Marples
|
||||
.\" Copyright 2007-2009 Roy Marples
|
||||
.\" All rights reserved
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
@@ -22,7 +22,7 @@
|
||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd Feb 24, 2008
|
||||
.Dd January 1, 2009
|
||||
.Dt START-STOP-DAEMON 8 SMM
|
||||
.Os OpenRC
|
||||
.Sh NAME
|
||||
@@ -44,6 +44,11 @@
|
||||
.Sh DESCRIPTION
|
||||
.Nm
|
||||
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,
|
||||
.Nm
|
||||
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
|
||||
.Ar daemon
|
||||
we start or stop.
|
||||
If the
|
||||
.Ar daemon
|
||||
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
|
||||
If this option is not specified, then the first non option argument
|
||||
is used.
|
||||
.It Fl p , -pidfile Ar pidfile
|
||||
When starting, we expect the daemon to create a valid
|
||||
.Ar pidfile
|
||||
@@ -97,10 +94,17 @@ name here also.
|
||||
.It Fl t , -test
|
||||
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.
|
||||
.It Fl v , -verbose
|
||||
P
|
||||
Print the action(s) that are taken just before doing them.
|
||||
.El
|
||||
.Pp
|
||||
These options are only used for starting daemons:
|
||||
.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
|
||||
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
|
||||
@@ -112,10 +116,16 @@ chdir to this directory before starting the daemon.
|
||||
.It Fl r , -chroot Ar path
|
||||
chroot to this directory before starting the daemon. All other paths, such
|
||||
as the path to the daemon, chdir and pidfile, should be relative to the chroot.
|
||||
.It Fl c , -chuid Ar user
|
||||
Same as the
|
||||
.Fl u , -user
|
||||
option.
|
||||
.It Fl e , -env Ar VAR=VALUE
|
||||
Set the environment variable VAR to VALUE.
|
||||
.It Fl g , -group Ar 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
|
||||
Saves the pid of the daemon in the file specified by the
|
||||
.Fl p , -pidfile
|
||||
@@ -123,7 +133,7 @@ option. Only useful when used with daemons that run in the foreground and
|
||||
forced into the background with the
|
||||
.Fl -b , -background
|
||||
option.
|
||||
.It Fl n , -nice Ar level
|
||||
.It Fl N , -nice Ar level
|
||||
Modifies the scheduling priority of the daemon.
|
||||
.It Fl 1 , -stdout Ar logfile
|
||||
Redirect the standard output of the process to logfile when started with
|
||||
@@ -142,9 +152,19 @@ These options are only used for stopping daemons:
|
||||
.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
|
||||
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.
|
||||
.El
|
||||
.Sh ENVIRONMENT
|
||||
.Va SSD_NICELEVEL
|
||||
can also set the scheduling priority of the daemon, but the command line
|
||||
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
|
||||
.Nm
|
||||
uses
|
||||
@@ -159,6 +179,9 @@ to stop or signal.
|
||||
.Xr getopt 3 ,
|
||||
.Xr nice 2 ,
|
||||
.Xr rc_find_pids 3
|
||||
.Sh BUGS
|
||||
.Nm
|
||||
cannot stop an interpreted daemon that no longer exists without a pidfile.
|
||||
.Sh HISTORY
|
||||
.Nm
|
||||
first appeared in Debian.
|
||||
@@ -166,4 +189,4 @@ first appeared in Debian.
|
||||
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.
|
||||
.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>
|
||||
# All rights reserved. Released under the 2-clause BSD license.
|
||||
|
||||
# Setup some good default CFLAGS
|
||||
CFLAGS?= -O2
|
||||
@@ -10,15 +9,25 @@ _CSTD_SH= if test -n "${CSTD}"; then echo "-std=${CSTD}"; else echo ""; fi
|
||||
_CSTD!= ${_CSTD_SH}
|
||||
CFLAGS+= ${_CSTD}$(shell ${_CSTD_SH})
|
||||
|
||||
# Try and use some good cc flags
|
||||
_CC_FLAGS= -pedantic -Wall -Wunused -Wimplicit -Wshadow -Wformat=2 \
|
||||
-Wmissing-declarations -Wno-missing-prototypes -Wwrite-strings \
|
||||
-Wbad-function-cast -Wnested-externs -Wcomment -Winline \
|
||||
-Wchar-subscripts -Wcast-align -Wno-format-nonliteral \
|
||||
-Wdeclaration-after-statement -Wsequence-point -Wextra
|
||||
_CC_FLAGS_SH= for f in ${_CC_FLAGS}; do \
|
||||
if ${CC} $$f -S -o /dev/null -xc /dev/null >/dev/null 2>&1; \
|
||||
# Try and use some good cc flags if we're building from git
|
||||
# We don't use -pedantic as it will warn about our perfectly valid
|
||||
# use of %m in our logger.
|
||||
_CCFLAGS= -Wall -Wextra -Wimplicit -Wshadow -Wformat=2 \
|
||||
-Wmissing-prototypes -Wmissing-declarations \
|
||||
-Wmissing-noreturn -Wmissing-format-attribute \
|
||||
-Wnested-externs \
|
||||
-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 \
|
||||
done
|
||||
done;
|
||||
_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!= ${_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?
|
||||
_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
|
||||
# it exists. Only GNU make does not do this.
|
||||
|
||||
# Generate .depend
|
||||
# Copyright 2008 Roy Marples <roy@marples.name>
|
||||
# All rights reserved. Released under the 2-clause BSD license.
|
||||
|
||||
CLEANFILES+= .depend
|
||||
IGNOREFILES+= .depend
|
||||
|
||||
.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>
|
||||
# All rights reserved. Released under the 2-clause BSD license.
|
||||
|
||||
GITREF?= HEAD
|
||||
DISTPREFIX?= ${NAME}-${VERSION}
|
||||
DISTFILE?= ${DISTPREFIX}.tar.bz2
|
||||
|
||||
CLEANFILES+= ${DISTFILE}
|
||||
|
||||
dist:
|
||||
git archive --prefix=${DISTPREFIX}/ ${GITREF} | bzip2 > ${DISTFILE}
|
||||
svn export . ${DISTPREFIX}
|
||||
tar cjpf ${DISTFILE} ${DISTPREFIX}
|
||||
rm -rf ${DISTPREFIX}
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
# rules to make .gitignore files
|
||||
# Copyright 2008 Roy Marples <roy@marples.name>
|
||||
# All rights reserved. Released under the 2-clause BSD license.
|
||||
|
||||
IGNOREFILES+= ${CLEANFILES}
|
||||
|
||||
.PHONY: .gitignore
|
||||
|
||||
.gitignore:
|
||||
@if test -n "${IGNOREFILES}"; then \
|
||||
echo "Ignoring ${IGNOREFILES}"; \
|
||||
echo ${IGNOREFILES} | tr ' ' '\n' > .gitignore; \
|
||||
fi
|
||||
|
||||
gitignore: .gitignore
|
||||
12
mk/lib.mk
12
mk/lib.mk
@@ -16,8 +16,11 @@ CLEANFILES+= ${OBJS} ${SOBJS} ${_LIBS} ${SHLIB_LINK}
|
||||
|
||||
.SUFFIXES: .So
|
||||
|
||||
.c.o:
|
||||
${CC} ${CFLAGS} ${CPPFLAGS} -c $< -o $@
|
||||
|
||||
.c.So:
|
||||
${CC} ${PICFLAG} -DPIC ${CFLAGS} -c $< -o $@
|
||||
${CC} ${PICFLAG} -DPIC ${CPPFLAGS} ${CFLAGS} -c $< -o $@
|
||||
|
||||
all: depend ${_LIBS}
|
||||
|
||||
@@ -53,7 +56,12 @@ check test::
|
||||
clean:
|
||||
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}/os.mk
|
||||
include ${MK}/depend.mk
|
||||
include ${MK}/gitignore.mk
|
||||
include ${MK}/svnignore.mk
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
LIBTERMCAP?= -lncurses
|
||||
CFLAGS+= -DHAVE_TERMCAP
|
||||
CPPFLAGS+= -DHAVE_TERMCAP
|
||||
LDADD+= ${LIBTERMCAP}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Copyright 2008 Roy Marples <roy@marples.name>
|
||||
# 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
|
||||
|
||||
11
mk/os.mk
11
mk/os.mk
@@ -10,14 +10,3 @@ include ${MK}/os-${OS}.mk
|
||||
|
||||
RC_LIB= /$(LIBNAME)/rc
|
||||
|
||||
_PREFIX_SH= if test -n "${PREFIX}" && test "${PREFIX}" != "/"; then echo "-DPREFIX=\\\"${PREFIX}\\\""; else echo ""; fi
|
||||
_PREFIX!= ${_PREFIX_SH}
|
||||
CFLAGS+= ${_PREFIX}$(shell ${_PREFIX_SH})
|
||||
|
||||
_PKG_PREFIX_SH= if test -n "${PKG_PREFIX}" && test "${PKG_PREFIX}" != "/" && test "${PKG_PREFIX}" != "${PREFIX}"; then echo "-DPKG_PREFIX=\\\"${PKG_PREFIX}\\\""; else echo ""; fi
|
||||
_PKG_PREFIX!= ${_PKG_PREFIX_SH}
|
||||
CFLAGS+= ${_PKG_PREFIX}$(shell ${_PKG_PREFIX_SH})
|
||||
|
||||
_LCL_PREFIX_SH= if test -n "${LOCAL_PREFIX}" && test "${LOCAL_PREFIX}" != "/" && test "${LOCAL_PREFIX}" != "${PREFIX}"; then echo "-DLOCAL_PREFIX=\\\"${LOCAL_PREFIX}\\\""; else echo ""; fi
|
||||
_LCL_PREFIX!= ${_LCL_PREFIX_SH}
|
||||
CFLAGS+= ${_LCL_PREFIX}$(shell ${_LCL_PREFIX_SH})
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
LIBPAM?= -lpam
|
||||
CFLAGS+= -DHAVE_PAM
|
||||
CPPFLAGS+= -DHAVE_PAM
|
||||
LDADD+= ${LIBPAM}
|
||||
|
||||
PAMDIR?= /etc/pam.d
|
||||
|
||||
@@ -24,13 +24,18 @@ CLEANFILES+= ${OBJS} ${PROG}
|
||||
|
||||
all: depend ${PROG}
|
||||
|
||||
.c.o:
|
||||
${CC} ${CFLAGS} ${CPPFLAGS} -c $< -o $@
|
||||
|
||||
${PROG}: ${SCRIPTS} ${OBJS}
|
||||
${CC} ${LDFLAGS} -o $@ ${OBJS} ${LDADD}
|
||||
|
||||
clean:
|
||||
rm -f ${CLEANFILES}
|
||||
|
||||
extra_depend:
|
||||
|
||||
include ${MK}/sys.mk
|
||||
include ${MK}/os.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:
|
||||
${SED} ${SED_REPLACE} ${SED_EXTRA} $< > $@
|
||||
|
||||
all: ${OBJS}
|
||||
all: ${OBJS} ${TARGETS}
|
||||
|
||||
realinstall: ${BIN} ${CONF} ${CONF_APPEND}
|
||||
realinstall: ${BIN} ${CONF} ${INC}
|
||||
@if test -n "${DIR}"; then \
|
||||
${ECHO} ${INSTALL} -d ${DESTDIR}/${DIR}; \
|
||||
${INSTALL} -d ${DESTDIR}/${DIR} || exit $$?; \
|
||||
@@ -56,4 +56,4 @@ CLEANFILES+= ${OBJS}
|
||||
clean:
|
||||
@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}
|
||||
depend:
|
||||
${_SUBDIR}
|
||||
gitignore:
|
||||
ignore:
|
||||
${_SUBDIR}
|
||||
|
||||
14
mk/svnignore.mk
Normal file
14
mk/svnignore.mk
Normal file
@@ -0,0 +1,14 @@
|
||||
# rules to make svn ignore files
|
||||
# Copyright 2008 Roy Marples <roy@marples.name>
|
||||
# All rights reserved. Released under the 2-clause BSD license.
|
||||
|
||||
IGNOREFILES+= ${CLEANFILES}
|
||||
|
||||
ignore:
|
||||
@if test -n "${IGNOREFILES}"; then \
|
||||
echo "=> Ignoring ${IGNOREFILES}"; \
|
||||
files="$$(echo "${IGNOREFILES}" | tr ' ' '\n')"; \
|
||||
efiles="$$(svn propget svn:ignore .)"; \
|
||||
sfiles="$$(printf "$${files}\n$${efiles}" | sort -u)"; \
|
||||
eval svn propset svn:ignore \'"$${sfiles}"\' .; \
|
||||
fi
|
||||
@@ -1,3 +1,3 @@
|
||||
LIBTERMCAP?= -ltermcap
|
||||
CFLAGS+= -DHAVE_TERMCAP
|
||||
CPPFLAGS+= -DHAVE_TERMCAP
|
||||
LDADD+= ${LIBTERMCAP}
|
||||
|
||||
2
net/.gitignore
vendored
2
net/.gitignore
vendored
@@ -1,2 +0,0 @@
|
||||
ifconfig.sh
|
||||
iwconfig.sh
|
||||
@@ -4,7 +4,6 @@
|
||||
bonding_depend()
|
||||
{
|
||||
before interface macchanger
|
||||
program /sbin/ifenslave
|
||||
}
|
||||
|
||||
_config_vars="$_config_vars slaves"
|
||||
@@ -16,7 +15,7 @@ _is_bond()
|
||||
|
||||
bonding_pre_start()
|
||||
{
|
||||
local s= slaves="$(_get_array "slaves_${IFVAR}")"
|
||||
local x= s= slaves="$(_get_array "slaves_${IFVAR}")"
|
||||
|
||||
[ -z "${slaves}" ] && return 0
|
||||
|
||||
@@ -40,6 +39,16 @@ bonding_pre_start()
|
||||
return 1
|
||||
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}"
|
||||
eindent
|
||||
einfo "${slaves}"
|
||||
@@ -53,7 +62,7 @@ bonding_pre_start()
|
||||
# Must force the slaves to a particular state before adding them
|
||||
for IFACE in ${slaves}; do
|
||||
_delete_addresses
|
||||
_up
|
||||
_down
|
||||
done
|
||||
)
|
||||
|
||||
@@ -62,7 +71,13 @@ bonding_pre_start()
|
||||
|
||||
# finally add in slaves
|
||||
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 $?
|
||||
|
||||
return 0 #important
|
||||
@@ -84,7 +99,13 @@ bonding_stop()
|
||||
eindent
|
||||
einfo "${slaves}"
|
||||
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
|
||||
(
|
||||
|
||||
@@ -16,12 +16,15 @@ _is_bridge()
|
||||
|
||||
bridge_pre_start()
|
||||
{
|
||||
local ports= brif= iface="${IFACE}" e= x=
|
||||
local brif= iface="${IFACE}" e= x=
|
||||
local ports="$(_get_array "bridge_${IFVAR}")"
|
||||
local opts="$(_get_array "brctl_${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
|
||||
|
||||
|
||||
@@ -15,20 +15,42 @@ _config_vars="$_config_vars dhcp dhcpcd"
|
||||
|
||||
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}
|
||||
[ -z "${args}" ] && args=${dhcpcd}
|
||||
|
||||
# Get our options
|
||||
eval opts=\$dhcp_${IFVAR}
|
||||
[ -z "${opts}" ] && opts=${dhcp}
|
||||
|
||||
case "$(dhcpcd --version)" in
|
||||
"dhcpcd "[123]*) new=false;;
|
||||
esac
|
||||
|
||||
# Map some generic options to dhcpcd
|
||||
for opt in ${opts}; do
|
||||
case "${opt}" in
|
||||
nodns) args="${args} -R";;
|
||||
nontp) args="${args} -N";;
|
||||
nonis) args="${args} -Y";;
|
||||
nodns)
|
||||
if ${new}; then
|
||||
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";;
|
||||
nosendhost) args="${args} -h ''";
|
||||
esac
|
||||
|
||||
@@ -151,9 +151,12 @@ _delete_addresses()
|
||||
{
|
||||
einfo "Removing addresses"
|
||||
eindent
|
||||
LC_ALL=C ifconfig "${IFACE}" | while read inet address rest; do
|
||||
LC_ALL=C ifconfig "${IFACE}" | while read inet address ali rest; do
|
||||
case "${inet}" in
|
||||
inet|inet6)
|
||||
if [ "${address}" = "alias" ]; then
|
||||
address="${ali}"
|
||||
fi
|
||||
case "${address}" in
|
||||
*"%${IFACE}"|::1) continue;;
|
||||
127.0.0.1) [ "${IFACE}" = "lo0" ] && continue;;
|
||||
|
||||
@@ -56,7 +56,7 @@ _set_flag()
|
||||
_get_mac_address()
|
||||
{
|
||||
local mac=$(LC_ALL=C ifconfig "${IFACE}" | \
|
||||
sed -n -e 's/.* HWaddr \(..:..:..:..:..:..\).*/\1/p')
|
||||
sed -n -e 's/.* \(HWaddr\|ether\) \(..:..:..:..:..:..\).*/\2/p')
|
||||
|
||||
case "${mac}" in
|
||||
00:00:00:00:00:00);;
|
||||
@@ -77,7 +77,7 @@ _set_mac_address()
|
||||
_get_inet_address()
|
||||
{
|
||||
set -- $(LC_ALL=C ifconfig "${IFACE}" |
|
||||
sed -n -e 's/.*inet addr:\([^ ]*\).*Mask:\([^ ]*\).*/\1 \2/p')
|
||||
sed -n -e 's/.*\(inet addr:\|inet \)\([^ ]*\).*\(Mask:\|netmask \)\([^ ]*\).*/\2 \4/p')
|
||||
[ -z "$1" ] && return 1
|
||||
|
||||
echo -n "$1"
|
||||
@@ -145,7 +145,7 @@ _add_address()
|
||||
# IPv4 is tricky - ifconfig requires an aliased device
|
||||
# for multiple addresses
|
||||
local iface="${IFACE}"
|
||||
if LC_ALL=C ifconfig "${iface}" | grep -Eq "\<inet addr:.*"; then
|
||||
if LC_ALL=C ifconfig "${iface}" | grep -Eq '\<inet (addr:)?.*'; then
|
||||
# Get the last alias made for the interface and add 1 to it
|
||||
i=$(ifconfig | sed '1!G;h;$!d' | grep -m 1 -o "^${iface}:[0-9]*" \
|
||||
| sed -n -e 's/'"${iface}"'://p')
|
||||
@@ -234,8 +234,12 @@ _delete_addresses()
|
||||
# Remove IPv6 addresses
|
||||
local addr=
|
||||
for addr in $(LC_ALL=C ifconfig "${IFACE}" | \
|
||||
sed -n -e 's/^.*inet6 addr: \([^ ]*\) Scope:[^L].*/\1/p'); do
|
||||
[ "${addr}" = "::1/128" -a "${IFACE}" = "lo" ] && continue
|
||||
sed -n -e 's/^.*\(inet6 addr:\|inet6\) \([^ ]*\) .*\(Scope:[^L]\|scopeid [^<]*<[^l]\).*/\2/p'); do
|
||||
if [ "${IFACE}" = "lo" ]; then
|
||||
case "${addr}" in
|
||||
"::1/128"|"/128") continue;;
|
||||
esac
|
||||
fi
|
||||
einfo "${addr}"
|
||||
ifconfig "${IFACE}" inet6 del "${addr}"
|
||||
done
|
||||
@@ -274,7 +278,7 @@ ifconfig_pre_start()
|
||||
metric=1000
|
||||
|
||||
ebegin "Creating tunnel ${IFVAR}"
|
||||
iptunnel add "${tunnel}"
|
||||
iptunnel add ${tunnel}
|
||||
eend $?
|
||||
}
|
||||
|
||||
|
||||
@@ -31,13 +31,13 @@ ifplugd_pre_start()
|
||||
for f in bond bridge tuntap vlan wireless; do
|
||||
if type "_is_${f}" >/dev/null 2>&1; then
|
||||
if _is_${f}; then
|
||||
veinfo "netplug does not work with" "${f}"
|
||||
veinfo "ifplugd does not work with ${f}"
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
ebegin "Starting ifplugd on" "${IFACE}"
|
||||
ebegin "Starting ifplugd on ${IFACE}"
|
||||
|
||||
eval args=\$ifplugd_${IFVAR}
|
||||
|
||||
@@ -47,7 +47,7 @@ ifplugd_pre_start()
|
||||
# Start ifplugd
|
||||
eval start-stop-daemon --start --exec /usr/sbin/ifplugd \
|
||||
--pidfile "${pidfile}" -- "${args}" --iface="${IFACE}"
|
||||
eend "$?" || return 1
|
||||
eend $? || return 1
|
||||
|
||||
eindent
|
||||
|
||||
@@ -85,7 +85,7 @@ ifplugd_stop()
|
||||
local pidfile="/var/run/ifplugd.${IFACE}.pid"
|
||||
[ ! -e "${pidfile}" ] && return 0
|
||||
|
||||
ebegin "Stopping ifplugd on" "${IFACE}"
|
||||
ebegin "Stopping ifplugd on ${IFACE}"
|
||||
start-stop-daemon --stop --quiet --exec /usr/sbin/ifplugd \
|
||||
--pidfile "${pidfile}" --signal QUIT
|
||||
eend $?
|
||||
|
||||
@@ -54,7 +54,6 @@ ifwatchd_stop()
|
||||
ebegin "Stopping ifwatchd on" "${IFACE}"
|
||||
start-stop-daemon --stop --exec /usr/sbin/ifwatchd \
|
||||
-- -c "${RC_LIBDIR}/sh/ifwatchd-carrier.sh" \
|
||||
-n "${RC_LIBDIR}/sh/ifwatchd-nocarrier.sh" "${IFACE}" \
|
||||
&& return 0
|
||||
-n "${RC_LIBDIR}/sh/ifwatchd-nocarrier.sh" "${IFACE}"
|
||||
eend $?
|
||||
}
|
||||
|
||||
@@ -10,12 +10,12 @@ iproute2_depend()
|
||||
|
||||
_up()
|
||||
{
|
||||
ip link set up dev "${IFACE}"
|
||||
ip link set "${IFACE}" up
|
||||
}
|
||||
|
||||
_down()
|
||||
{
|
||||
ip link set down dev "${IFACE}"
|
||||
ip link set "${IFACE}" down
|
||||
}
|
||||
|
||||
_exists()
|
||||
@@ -78,7 +78,7 @@ _get_mac_address()
|
||||
|
||||
_set_mac_address()
|
||||
{
|
||||
ip link set address "$1" dev "${IFACE}"
|
||||
ip link set "${IFACE}" address "$1"
|
||||
}
|
||||
|
||||
_get_inet_addresses()
|
||||
@@ -126,7 +126,7 @@ _add_address()
|
||||
;;
|
||||
esac
|
||||
|
||||
ip addr add dev "${IFACE}" "$@"
|
||||
ip addr add "$@" dev "${IFACE}"
|
||||
}
|
||||
|
||||
_add_route()
|
||||
@@ -184,12 +184,12 @@ iproute2_pre_start()
|
||||
# MTU support
|
||||
local mtu=
|
||||
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
|
||||
local len=
|
||||
eval len=\$txqueuelen_${IFVAR}
|
||||
[ -n "${len}" ] && ip link set txqueuelen "${len}" dev "${IFACE}"
|
||||
[ -n "${len}" ] && ip link set "${IFACE}" txqueuelen "${len}"
|
||||
|
||||
local tunnel=
|
||||
eval tunnel=\$iptunnel_${IFVAR}
|
||||
@@ -208,6 +208,8 @@ iproute2_pre_start()
|
||||
|
||||
_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}" | \
|
||||
grep -q "^[[:space:]]*inet6 .* tentative"
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@ iwconfig_associate()
|
||||
case "${caps}" in
|
||||
[EI]P*)
|
||||
if [ "${key}" = "-" ] ; then
|
||||
ewarn "WEP key is not set for \"${SSID}\"; not connecting"
|
||||
ewarn "WEP key is not set for \"${SSID}\""
|
||||
return 1
|
||||
fi
|
||||
;;
|
||||
@@ -145,7 +145,7 @@ iwconfig_associate()
|
||||
*)
|
||||
if [ "${key}" != "-" ] ; then
|
||||
key="-"
|
||||
ewarn "\"${SSID}\" is not WEP enabled; ignoring setting"
|
||||
ewarn "\"${SSID}\" is not WEP enabled"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
@@ -414,8 +414,9 @@ iwconfig_connect_preferred()
|
||||
[ $# = 0 ] && eval set -- $(_flatten_array "preferred_aps")
|
||||
[ $# = 0 ] && return 1
|
||||
|
||||
local ssid= i=0 mode= mac= caps= freq= chan=
|
||||
local ssid= i= mode= mac= caps= freq= chan=
|
||||
for ssid; do
|
||||
i=0
|
||||
while [ ${i} -le ${APS} ] ; do
|
||||
eval e=\$SSID_${i}
|
||||
if [ "${e}" = "${ssid}" ] ; then
|
||||
@@ -484,7 +485,7 @@ iwconfig_defaults()
|
||||
|
||||
iwconfig_configure()
|
||||
{
|
||||
local x APS
|
||||
local x= APS=-1
|
||||
eval SSID=\$ssid_${IFVAR}
|
||||
|
||||
# Setup ad-hoc mode?
|
||||
|
||||
@@ -206,9 +206,13 @@ iwconfig_wait_for_association()
|
||||
# Use sysfs if we can
|
||||
if [ -e /sys/class/net/"${IFACE}"/carrier ]; then
|
||||
if [ "$(cat /sys/class/net/"${IFACE}"/carrier)" = "1" ]; then
|
||||
# Double check we have an ssid. This is mainly for buggy
|
||||
# prism54 drivers that always set their carrier on :/
|
||||
[ -n "$(iwgetid --raw "${IFACE}")" ] && return 0
|
||||
# Double check we have an ssid and a non-zero
|
||||
# mac address. This is mainly for buggy
|
||||
# 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
|
||||
else
|
||||
local atest=
|
||||
@@ -246,12 +250,12 @@ iwconfig_associate()
|
||||
SSIDVAR=$(shell_var "${SSID}")
|
||||
key="$(iwconfig_get_wep_key "${mac}")"
|
||||
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
|
||||
fi
|
||||
if [ "${wep_required}" = "off" -a "${key}" != "off" ]; then
|
||||
key="off"
|
||||
ewarn "\"${SSID}\" is not WEP enabled - ignoring setting"
|
||||
ewarn "\"${SSID}\" is not WEP enabled"
|
||||
fi
|
||||
|
||||
if ! eval iwconfig "${IFACE}" key "${key}"; then
|
||||
@@ -429,7 +433,7 @@ iwconfig_scan()
|
||||
[ -z "${a}" ] && break
|
||||
eval b=\$QUALITY_${k}
|
||||
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 ${x}_${i}=\$${x}_${k}
|
||||
eval ${x}_${k}=\$t
|
||||
@@ -453,7 +457,7 @@ iwconfig_scan()
|
||||
local u=${k}
|
||||
# We need to split this into two tests, otherwise bash errors
|
||||
[ -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
|
||||
k=$((${k} + 1))
|
||||
done
|
||||
@@ -499,7 +503,7 @@ iwconfig_scan()
|
||||
for x; do
|
||||
if [ "${x}" = "${s}" ]; then
|
||||
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
|
||||
done
|
||||
i=$((${i} + 1))
|
||||
@@ -525,7 +529,7 @@ iwconfig_force_preferred()
|
||||
i=$((${i} + 1))
|
||||
done
|
||||
if ! ${found_AP}; then
|
||||
SSID=${e}
|
||||
SSID=${ssid}
|
||||
iwconfig_associate && return 0
|
||||
fi
|
||||
done
|
||||
@@ -597,10 +601,8 @@ iwconfig_connect_not_preferred()
|
||||
|
||||
iwconfig_defaults()
|
||||
{
|
||||
local x=
|
||||
for x in txpower rate rts frag; do
|
||||
iwconfig "${IFACE}" "${x}" auto 2>/dev/null
|
||||
done
|
||||
# Turn on the radio
|
||||
iwconfig "${IFACE}" txpower on 2>/dev/null
|
||||
|
||||
# Release the AP forced
|
||||
# Must do ap and then ssid otherwise scanning borks
|
||||
@@ -610,7 +612,7 @@ iwconfig_defaults()
|
||||
|
||||
iwconfig_configure()
|
||||
{
|
||||
local x= APS=
|
||||
local x= APS=-1
|
||||
eval SSID=\$ssid_${IFVAR}
|
||||
|
||||
# Support old variable
|
||||
@@ -735,7 +737,7 @@ iwconfig_pre_start()
|
||||
# which reports NOT READY!
|
||||
x="$(iwconfig_get_type)"
|
||||
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
|
||||
fi
|
||||
|
||||
|
||||
@@ -58,8 +58,8 @@ _system_ntp()
|
||||
local servers= buffer= x=
|
||||
|
||||
eval servers=\$ntp_servers_${IFVAR}
|
||||
[ -z ${servers} ] && servers=${ntp_servers}
|
||||
[ -z ${servers} ] && return 0
|
||||
[ -z "${servers}" ] && servers=${ntp_servers}
|
||||
[ -z "${servers}" ] && return 0
|
||||
|
||||
buffer="# Generated by net-scripts for interface ${IFACE}\n"
|
||||
buffer="${buffer}restrict default noquery notrust nomodify\n"
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user