Compare commits
138 Commits
openrc-0.9
...
openrc-0.9
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
14b7f0e7fa | ||
|
|
e45cd15930 | ||
|
|
e4ce98b3b4 | ||
|
|
8a41537f68 | ||
|
|
d8a5d35760 | ||
|
|
cc8a9cdab9 | ||
|
|
04e6696782 | ||
|
|
85193674da | ||
|
|
a73c26a70b | ||
|
|
6fcc55cef8 | ||
|
|
380752f4e0 | ||
|
|
e7649f117a | ||
|
|
66f4305e1c | ||
|
|
4255ba175b | ||
|
|
d02d3af02e | ||
|
|
61e05331d1 | ||
|
|
f2e404ab66 | ||
|
|
adde73141f | ||
|
|
84aa4ba818 | ||
|
|
982ac38f35 | ||
|
|
cd52fecc4e | ||
|
|
dbfcf23273 | ||
|
|
f583030e3c | ||
|
|
1771a83b92 | ||
|
|
e873ef2ba7 | ||
|
|
26edfe369c | ||
|
|
34b7632d1d | ||
|
|
fb8db18d79 | ||
|
|
6d5a2d5f9e | ||
|
|
810f2e55fb | ||
|
|
372745844b | ||
|
|
191ea10f86 | ||
|
|
0d6ae379f4 | ||
|
|
2471d741f7 | ||
|
|
759f4ca4f2 | ||
|
|
6c8e8e2a96 | ||
|
|
29da0c8bf0 | ||
|
|
49e99a7393 | ||
|
|
8dcb7554ee | ||
|
|
b754a27f62 | ||
|
|
ec65f181ea | ||
|
|
b12cb2f507 | ||
|
|
1875db4ff6 | ||
|
|
26ceddae5e | ||
|
|
20f612080c | ||
|
|
5615325a84 | ||
|
|
537171eac2 | ||
|
|
415f480410 | ||
|
|
acf77b73af | ||
|
|
9a01f68515 | ||
|
|
7b1c1e1623 | ||
|
|
8bb4b759eb | ||
|
|
e5eb062f05 | ||
|
|
f6dc3d5ae9 | ||
|
|
3e2001f6a2 | ||
|
|
ed4605bf9f | ||
|
|
461c69acdb | ||
|
|
879e1acd5d | ||
|
|
06f6ce408c | ||
|
|
ac2391e0cb | ||
|
|
ce9994f7ca | ||
|
|
a38a5071f3 | ||
|
|
2569eb644e | ||
|
|
dd45506a40 | ||
|
|
46b96eb80d | ||
|
|
e574b5d441 | ||
|
|
5e01051c4e | ||
|
|
8ea1190486 | ||
|
|
a1c655949f | ||
|
|
325a7bf206 | ||
|
|
5adb3930c7 | ||
|
|
b628481701 | ||
|
|
ab01a74405 | ||
|
|
695f3886fb | ||
|
|
d8e739e19a | ||
|
|
3baca9a35c | ||
|
|
467f91d870 | ||
|
|
cc45abb77b | ||
|
|
40576a32d3 | ||
|
|
483db945e1 | ||
|
|
17a1529416 | ||
|
|
815952a65a | ||
|
|
76fec58633 | ||
|
|
d8bbeb184f | ||
|
|
453d13296d | ||
|
|
c21c1f1e59 | ||
|
|
c7cc685458 | ||
|
|
ef1ff1b4f2 | ||
|
|
0510c473d4 | ||
|
|
9a3d6c7600 | ||
|
|
a5ba2f3264 | ||
|
|
62f4438376 | ||
|
|
0bbb764f70 | ||
|
|
20df56f0b2 | ||
|
|
66e99b6d63 | ||
|
|
260b61e9d8 | ||
|
|
5b1aaf8cc8 | ||
|
|
5994e55937 | ||
|
|
3f2e9c4e1f | ||
|
|
476034dd95 | ||
|
|
37294b4e82 | ||
|
|
16661d02e9 | ||
|
|
f46626dcfc | ||
|
|
5a3599df8a | ||
|
|
e3b39a677b | ||
|
|
27713e3a41 | ||
|
|
5066d40ac8 | ||
|
|
f94e883633 | ||
|
|
b1da4dcb99 | ||
|
|
9a539ebbe1 | ||
|
|
9c77502f96 | ||
|
|
ecf77254bb | ||
|
|
9f95878bbd | ||
|
|
7644e027fd | ||
|
|
3ad849c5d6 | ||
|
|
f6c27abeb5 | ||
|
|
9175534752 | ||
|
|
c5fb64d61f | ||
|
|
4b63929878 | ||
|
|
29693ecb7a | ||
|
|
930f4021b1 | ||
|
|
bf49e59e3e | ||
|
|
fb485366e6 | ||
|
|
f52dca6984 | ||
|
|
47d305d2af | ||
|
|
95adeb85ba | ||
|
|
0e4d169a40 | ||
|
|
72e31e753d | ||
|
|
645bbf2e0f | ||
|
|
539c4e5872 | ||
|
|
e14e78db16 | ||
|
|
2d180551ef | ||
|
|
a9738a8508 | ||
|
|
5cb985b6cc | ||
|
|
e2f1464f47 | ||
|
|
5df9dc1af5 | ||
|
|
b42ab3b2f4 | ||
|
|
5ed4d084d9 |
7
Makefile
7
Makefile
@@ -4,12 +4,7 @@
|
|||||||
|
|
||||||
include Makefile.inc
|
include Makefile.inc
|
||||||
|
|
||||||
SUBDIR= conf.d etc init.d local.d man scripts sh src
|
SUBDIR= conf.d doc etc init.d local.d man net scripts sh src
|
||||||
|
|
||||||
# Build our old net foo or not
|
|
||||||
ifeq (${MKOLDNET},yes)
|
|
||||||
SUBDIR+= net doc
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Build pkgconfig or not
|
# Build pkgconfig or not
|
||||||
MKPKGCONFIG?= yes
|
MKPKGCONFIG?= yes
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
NAME= openrc
|
NAME= openrc
|
||||||
VERSION= 0.9.2
|
VERSION= 0.9.8.4
|
||||||
PKG= ${NAME}-${VERSION}
|
PKG= ${NAME}-${VERSION}
|
||||||
|
|||||||
2
README
2
README
@@ -14,9 +14,9 @@ MKPAM=pam
|
|||||||
MKPKGCONFIG=no
|
MKPKGCONFIG=no
|
||||||
MKRCSYS=prefix
|
MKRCSYS=prefix
|
||||||
MKSELINUX=yes
|
MKSELINUX=yes
|
||||||
|
MKSTATICLIBS=no
|
||||||
MKTERMCAP=ncurses
|
MKTERMCAP=ncurses
|
||||||
MKTERMCAP=termcap
|
MKTERMCAP=termcap
|
||||||
MKOLDNET=yes
|
|
||||||
PKG_PREFIX=/usr/pkg
|
PKG_PREFIX=/usr/pkg
|
||||||
LOCAL_PREFIX=/usr/local
|
LOCAL_PREFIX=/usr/local
|
||||||
PREFIX=/usr/local
|
PREFIX=/usr/local
|
||||||
|
|||||||
@@ -1,40 +0,0 @@
|
|||||||
The following applies only to the newnet stack, which is not presently
|
|
||||||
maintained in OpenRC. The oldnet stack is maintained instead.
|
|
||||||
- Robin H. Johnson <robbat2@gentoo.org>, 2011/02/21
|
|
||||||
|
|
||||||
OpenRC Network Ideals
|
|
||||||
---------------------
|
|
||||||
|
|
||||||
The new style networking for OpenRC is very simplistic - provide a basic means
|
|
||||||
of configuring static interface address and routes whilst allowing the
|
|
||||||
possibility to run any command at any point.
|
|
||||||
|
|
||||||
In a nutshell, init.d/network is a wrapper around ifconfig(8) and
|
|
||||||
init.d/staticroute is wrapper around route(8).
|
|
||||||
|
|
||||||
In the Perfect World (TM) ifconfig should be able to configure everything
|
|
||||||
about the interface easily * . The BSD family almost get this right and Linux
|
|
||||||
epically fails.
|
|
||||||
|
|
||||||
* Only static configuration, including link setup.
|
|
||||||
For dynamic, static, IPv4LL, arping and per ssid IPv4 setup dhcpcd-5.x
|
|
||||||
provides your needs.
|
|
||||||
|
|
||||||
It fails because there are many tools to do the same job and often have
|
|
||||||
vastly different syntax where they could be similar. In other words, there
|
|
||||||
is no coherence.
|
|
||||||
|
|
||||||
OpenRC-0.4.x and older (inc Gentoo baselayout-1) had a collection of scripts
|
|
||||||
for each tool and allowed a script per interface. Over the years, this design
|
|
||||||
has proven very hard to maintain as each user has their own idea of how
|
|
||||||
things should work. Also, there were (and still are) race conditions.
|
|
||||||
|
|
||||||
So where do we go from here?
|
|
||||||
Well, it's possible to use the new network scripts using the tools
|
|
||||||
currently available. It's just harder as you have to know them and their
|
|
||||||
documentation can be lacking at times.
|
|
||||||
The correct end goal is a BSD style ifconfig tool.
|
|
||||||
I've started work on it, but the project has stalled somewhat.
|
|
||||||
It's display only right now and the source is not yet publicly available.
|
|
||||||
If you have the skills and share the vision then contact me privately and
|
|
||||||
we'll take it from there.
|
|
||||||
@@ -1,19 +1,23 @@
|
|||||||
DIR= ${CONFDIR}
|
DIR= ${CONFDIR}
|
||||||
CONF= bootmisc fsck hostname localmount network staticroute urandom
|
CONF= bootmisc fsck hostname localmount network staticroute urandom \
|
||||||
|
${CONF-${OS}}
|
||||||
|
|
||||||
TARGETS+= network staticroute
|
TARGETS+= network staticroute
|
||||||
CLEANFILES+= network staticroute
|
CLEANFILES+= network staticroute
|
||||||
|
|
||||||
MK= ../mk
|
MK= ../mk
|
||||||
include ${MK}/os.mk
|
include ${MK}/os.mk
|
||||||
include Makefile.${OS}
|
|
||||||
|
CONF-FreeBSD= ipfw moused powerd rarpd savecore syscons
|
||||||
|
|
||||||
|
CONF-Linux= consolefont dmesg hwclock keymaps killprocs modules
|
||||||
|
|
||||||
|
CONF-NetBSD= moused rarpd savecore
|
||||||
|
|
||||||
include ${MK}/scripts.mk
|
include ${MK}/scripts.mk
|
||||||
|
|
||||||
SOS?= BSD
|
network: network.in network${SFX}
|
||||||
|
cat $^ > $@
|
||||||
|
|
||||||
network: network.in network.${SOS}
|
staticroute: staticroute${SFX}
|
||||||
cp $@.in $@
|
cp $@${SFX} $@
|
||||||
[ -e $@.${SOS} ] && cat $@.${SOS} >> $@ || true
|
|
||||||
|
|
||||||
staticroute: staticroute.${SOS}
|
|
||||||
cp $@.${SOS} $@
|
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
CONF+= ipfw moused powerd rarpd savecore syscons
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
CONF+= consolefont dmesg hwclock keymaps killprocs modules
|
|
||||||
SOS= Linux
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
CONF+= moused rarpd savecore
|
|
||||||
@@ -4,3 +4,7 @@ clean_tmp_dirs="/tmp"
|
|||||||
# Should we wipe the tmp paths completely or just selectively remove known
|
# Should we wipe the tmp paths completely or just selectively remove known
|
||||||
# locks / files / etc... ?
|
# locks / files / etc... ?
|
||||||
wipe_tmp="YES"
|
wipe_tmp="YES"
|
||||||
|
|
||||||
|
# Write the initial dmesg log into /var/log/dmesg after boot
|
||||||
|
# This may be useful if you need the kernel boot log afterwards
|
||||||
|
log_dmesg="YES"
|
||||||
|
|||||||
@@ -13,6 +13,13 @@
|
|||||||
#fsck_passno=">1"
|
#fsck_passno=">1"
|
||||||
#fsck_passno="<2"
|
#fsck_passno="<2"
|
||||||
|
|
||||||
|
# If passno is not enough granularity, you can also specify mountpoints to
|
||||||
|
# check. This should NOT be used for the default non-multiplexed fsck, or your
|
||||||
|
# system might not be checked. Additionally, it is mutually exclusive with
|
||||||
|
# the fsck_passno setting.
|
||||||
|
#fsck_mnt=""
|
||||||
|
#fsck_mnt="/home"
|
||||||
|
|
||||||
# Most modern fs's don't require a full fsck on boot, but for those that do
|
# Most modern fs's don't require a full fsck on boot, but for those that do
|
||||||
# it may be advisable to skip this when running on battery.
|
# it may be advisable to skip this when running on battery.
|
||||||
# WARNING: Do not turn this off if you have any JFS partitions.
|
# WARNING: Do not turn this off if you have any JFS partitions.
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# This blank configuration will automatically use DHCP for any net.*
|
# This blank configuration will automatically use DHCP for any net.*
|
||||||
# scripts in /etc/init.d. To create a more complete configuration,
|
# scripts in /etc/init.d. To create a more complete configuration,
|
||||||
# please review /usr/share/doc/openrc/net.example and save your configuration
|
# please review /usr/share/doc/openrc*/net.example* and save your configuration
|
||||||
# in /etc/conf.d/net (this file :]!).
|
# in /etc/conf.d/net (this file :]!).
|
||||||
|
|||||||
@@ -2,4 +2,4 @@
|
|||||||
# (say for crypt swap), so you will need to customize this
|
# (say for crypt swap), so you will need to customize this
|
||||||
# behavior. If you have /var on a separate partition, then
|
# behavior. If you have /var on a separate partition, then
|
||||||
# make sure this path lives on your root device somewhere.
|
# make sure this path lives on your root device somewhere.
|
||||||
urandom_seed="/var/run/random-seed"
|
urandom_seed="/var/lib/misc/random-seed"
|
||||||
|
|||||||
@@ -1,7 +1,11 @@
|
|||||||
DIR= ${DOCDIR}/openrc
|
DIR= ${DOCDIR}/openrc
|
||||||
|
SRCS= net.example.in
|
||||||
INC= net.example
|
INC= net.example
|
||||||
|
|
||||||
MK= ../mk
|
MK= ../mk
|
||||||
include ${MK}/os.mk
|
include ${MK}/os.mk
|
||||||
include Makefile.${OS}
|
|
||||||
|
%.example.in: %.example${SFX}
|
||||||
|
${CP} $< $@
|
||||||
|
|
||||||
include ${MK}/scripts.mk
|
include ${MK}/scripts.mk
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
SRCS+= net.example.in
|
|
||||||
|
|
||||||
.SUFFIXES: .BSD.in
|
|
||||||
.BSD.in:
|
|
||||||
${CP} $< $@
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
SRCS+= net.example.in
|
|
||||||
|
|
||||||
.SUFFIXES: .Linux.in
|
|
||||||
.Linux.in:
|
|
||||||
${CP} $< $@
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
SRCS+= net.example.in
|
|
||||||
|
|
||||||
.SUFFIXES: .BSD.in
|
|
||||||
.BSD.in:
|
|
||||||
${CP} $< $@
|
|
||||||
@@ -388,6 +388,17 @@
|
|||||||
#
|
#
|
||||||
# ${IFACE} is set to the interface being brought up/down
|
# ${IFACE} is set to the interface being brought up/down
|
||||||
# ${IFVAR} is ${IFACE} converted to variable name bash allows
|
# ${IFVAR} is ${IFACE} converted to variable name bash allows
|
||||||
|
#
|
||||||
|
# For historical and compatibility reasons, preup is actually normally called
|
||||||
|
# in the following sequence: up ; preup ; up.
|
||||||
|
# The first up causes the kernel to initialize the device, so
|
||||||
|
# that it is available for use in the preup function. However, for some
|
||||||
|
# hardware, e.g. CAN devices, some configuration is needed before trying to up
|
||||||
|
# the interface will actually work. For such hardware, the
|
||||||
|
# up_before_preup variables will allow skipping the first up call if set
|
||||||
|
# to yes.
|
||||||
|
#up_before_preup_IFVAR="NO"
|
||||||
|
#up_before_preup="NO"
|
||||||
|
|
||||||
#preup() {
|
#preup() {
|
||||||
# # Remember to return 0 on success
|
# # Remember to return 0 on success
|
||||||
|
|||||||
@@ -68,6 +68,7 @@
|
|||||||
# NOTE: ifconfig creates an aliased device for each extra IPv4 address
|
# NOTE: ifconfig creates an aliased device for each extra IPv4 address
|
||||||
# (eth0:1, eth0:2, etc)
|
# (eth0:1, eth0:2, etc)
|
||||||
# iproute2 does not do this as there is no need to
|
# iproute2 does not do this as there is no need to
|
||||||
|
# WARNING: You cannot mix multiple addresses on a line with other parameters!
|
||||||
#config_eth0="192.168.0.2/24 192.168.0.3/24 192.168.0.4/24"
|
#config_eth0="192.168.0.2/24 192.168.0.3/24 192.168.0.4/24"
|
||||||
# However, that only works with CIDR addresses, so you can't use netmask.
|
# However, that only works with CIDR addresses, so you can't use netmask.
|
||||||
|
|
||||||
@@ -85,6 +86,14 @@
|
|||||||
# If you don't want ANY address (only useful when calling for advanced stuff)
|
# If you don't want ANY address (only useful when calling for advanced stuff)
|
||||||
#config_eth0="null"
|
#config_eth0="null"
|
||||||
|
|
||||||
|
# If you need to pass parameters to go with an address, you can do so on the
|
||||||
|
# same line as the address. You should split multiple addresses with newlines.
|
||||||
|
# WARNING: You cannot mix multiple addresses on a line with other parameters!
|
||||||
|
#config_eth0="192.168.0.2/24 scope host"
|
||||||
|
#config_eth0="4321:0:1:2:3:4:567:89ab/64 nodad home preferred_lft 0"
|
||||||
|
#config_eth0="192.168.0.2/24 scope host
|
||||||
|
#4321:0:1:2:3:4:567:89ab/64 nodad home preferred_lft 0"
|
||||||
|
|
||||||
# Here's how to do routing if you need it
|
# Here's how to do routing if you need it
|
||||||
# We add an IPv4 default route, IPv4 subnet route and an IPv6 unicast route
|
# We add an IPv4 default route, IPv4 subnet route and an IPv6 unicast route
|
||||||
#routes_eth0="default via 192.168.0.1
|
#routes_eth0="default via 192.168.0.1
|
||||||
@@ -350,7 +359,7 @@
|
|||||||
# By default we don't wait for wpa_supplicant to associate and authenticate.
|
# By default we don't wait for wpa_supplicant to associate and authenticate.
|
||||||
# If you need to change this behaviour then you don't know how our scripts work
|
# If you need to change this behaviour then you don't know how our scripts work
|
||||||
# and setting this value could cause strange things to happen.
|
# and setting this value could cause strange things to happen.
|
||||||
# If you would like to, so can specify how long in seconds.
|
# If you would like it to wait, you can specify how long in seconds.
|
||||||
#associate_timeout_eth0=60
|
#associate_timeout_eth0=60
|
||||||
# A value of 0 means wait forever.
|
# A value of 0 means wait forever.
|
||||||
|
|
||||||
@@ -581,6 +590,18 @@
|
|||||||
# NOTE: depend functions only work in /etc/conf.d/net
|
# NOTE: depend functions only work in /etc/conf.d/net
|
||||||
# and not in profile configs such as /etc/conf.d/net.foo
|
# and not in profile configs such as /etc/conf.d/net.foo
|
||||||
|
|
||||||
|
# MAC-VLAN support
|
||||||
|
# The following configuration can be used to create a new interface 'macvlan0'
|
||||||
|
# linked to 'eth0'
|
||||||
|
#macvlan_macvlan0="eth0"
|
||||||
|
|
||||||
|
# MAC-VLAN mode (private, vepa, bridge, passtru)
|
||||||
|
#mode_macvlan0="private"
|
||||||
|
|
||||||
|
# IP address, MAC address, ... are configured as a normal interface
|
||||||
|
#config_macvlan0="192.168.20.20/24"
|
||||||
|
#mac_macvlan0="00:50:06:20:20:20"
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
# Bonding
|
# Bonding
|
||||||
# For link bonding/trunking on 2.4 kernels, or kernels without sysfs
|
# For link bonding/trunking on 2.4 kernels, or kernels without sysfs
|
||||||
@@ -778,7 +799,7 @@
|
|||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
# TUN/TAP
|
# TUN/TAP
|
||||||
# For TUN/TAP support emerge net-misc/openvpn or sys-apps/usermode-utilities
|
# For TUN/TAP support install iproute2, openvpn or usermode-utilities
|
||||||
#
|
#
|
||||||
# You must specify if we're a tun or tap device. Then you can give it any
|
# You must specify if we're a tun or tap device. Then you can give it any
|
||||||
# name you like - such as vpn
|
# name you like - such as vpn
|
||||||
@@ -789,6 +810,9 @@
|
|||||||
#tuntap_tap0="tap"
|
#tuntap_tap0="tap"
|
||||||
#config_tap0="192.168.0.1/24"
|
#config_tap0="192.168.0.1/24"
|
||||||
|
|
||||||
|
# Use something like this to pass custom options to iproute2 during
|
||||||
|
# tunnel creation. This sets the user and group ownership of the node.
|
||||||
|
#iproute2_tun1="user foo group bar"
|
||||||
# For passing custom options to tunctl use something like the following. This
|
# For passing custom options to tunctl use something like the following. This
|
||||||
# example sets the owner to adm
|
# example sets the owner to adm
|
||||||
#tunctl_tun1="-u adm"
|
#tunctl_tun1="-u adm"
|
||||||
@@ -827,9 +851,9 @@
|
|||||||
|
|
||||||
# Below is an example of configuring the bridge
|
# Below is an example of configuring the bridge
|
||||||
# Consult "man brctl" for more details
|
# Consult "man brctl" for more details
|
||||||
#brctl_br0="setfd 0
|
#brctl_br0="setfd 15
|
||||||
#sethello 0
|
#sethello 2
|
||||||
#stp off"
|
#stp on"
|
||||||
|
|
||||||
# You can also configure the bridge or bridge members via sysfs on 2.6 kernels
|
# You can also configure the bridge or bridge members via sysfs on 2.6 kernels
|
||||||
# or newer. See the kernel bridge documentation for a description of these
|
# or newer. See the kernel bridge documentation for a description of these
|
||||||
@@ -917,6 +941,8 @@
|
|||||||
# /etc/iproute2/rt_tables, an example follows:
|
# /etc/iproute2/rt_tables, an example follows:
|
||||||
# 2 oob
|
# 2 oob
|
||||||
# 3 external
|
# 3 external
|
||||||
|
#
|
||||||
|
# IPv6 RPDB entries are to be found in the rules6_IFVAR variables:
|
||||||
|
|
||||||
#rules_eth0="
|
#rules_eth0="
|
||||||
#from ZZZ.ZZZ.200.128/27 table oob priority 500
|
#from ZZZ.ZZZ.200.128/27 table oob priority 500
|
||||||
@@ -931,6 +957,11 @@
|
|||||||
#XXX.XXX.112.0/24 dev eth1 table external scope link
|
#XXX.XXX.112.0/24 dev eth1 table external scope link
|
||||||
#default via XXX.XXX.112.1 dev eth1"
|
#default via XXX.XXX.112.1 dev eth1"
|
||||||
|
|
||||||
|
# IPv6 example:
|
||||||
|
#rules6_eth0="
|
||||||
|
#from 2001:0DB8:AAAA:BBBB::/64 table vpn priority 100
|
||||||
|
#to 2001:0DB8:AAAA:BBBB::/64 table vpn priority 150"
|
||||||
|
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
# System
|
# System
|
||||||
@@ -1080,6 +1111,17 @@
|
|||||||
#
|
#
|
||||||
# ${IFACE} is set to the interface being brought up/down
|
# ${IFACE} is set to the interface being brought up/down
|
||||||
# ${IFVAR} is ${IFACE} converted to variable name bash allows
|
# ${IFVAR} is ${IFACE} converted to variable name bash allows
|
||||||
|
#
|
||||||
|
# For historical and compatibility reasons, preup is actually normally called
|
||||||
|
# in the following sequence: up ; preup ; up.
|
||||||
|
# The first up causes the kernel to initialize the device, so
|
||||||
|
# that it is available for use in the preup function. However, for some
|
||||||
|
# hardware, e.g. CAN devices, some configuration is needed before trying to up
|
||||||
|
# the interface will actually work. For such hardware, the
|
||||||
|
# up_before_preup variables will allow skipping the first up call if set
|
||||||
|
# to yes.
|
||||||
|
#up_before_preup_IFVAR="NO"
|
||||||
|
#up_before_preup="NO"
|
||||||
|
|
||||||
#preup() {
|
#preup() {
|
||||||
# # Test for link on the interface prior to bringing it up. This
|
# # Test for link on the interface prior to bringing it up. This
|
||||||
|
|||||||
22
etc/Makefile
22
etc/Makefile
@@ -1,17 +1,33 @@
|
|||||||
DIR= ${SYSCONFDIR}
|
DIR= ${SYSCONFDIR}
|
||||||
CONF= rc.conf
|
SRCS= rc.conf.in rc.in rc.shutdown.in
|
||||||
|
BIN= ${BIN-${OS}}
|
||||||
|
CONF= rc.conf ${BIN-${OS}}
|
||||||
|
|
||||||
CLEANFILES+= rc.conf
|
CLEANFILES+= rc.conf
|
||||||
|
|
||||||
MK= ../mk
|
MK= ../mk
|
||||||
include ${MK}/os.mk
|
include ${MK}/os.mk
|
||||||
include Makefile.${OS}
|
|
||||||
|
SED_EXTRA-FreeBSD= -e 's:@TERM@:cons25:g'
|
||||||
|
BIN-FreeBSD= rc rc.shutdown rc.devd
|
||||||
|
CONF-FreeBSD= devd.conf
|
||||||
|
|
||||||
|
SED_EXTRA-Linux= -e 's:@TERM@:wsvt25:g'
|
||||||
|
BIN-Linux=
|
||||||
|
CONF-Linux=
|
||||||
|
|
||||||
|
SED_EXTRA-NetBSD= -e 's:@TERM@:wsvt25:g'
|
||||||
|
BIN-NetBSD= rc rc.shutdown
|
||||||
|
CONF-NetBSD=
|
||||||
|
|
||||||
|
SED_EXTRA= ${SED_EXTRA-${OS}}
|
||||||
|
|
||||||
include ${MK}/scripts.mk
|
include ${MK}/scripts.mk
|
||||||
|
|
||||||
# We can't use "ifndef" here because that treats set-but-empty
|
# We can't use "ifndef" here because that treats set-but-empty
|
||||||
# as not-set which is not what we want
|
# as not-set which is not what we want
|
||||||
MKRCSYS ?= automagicplease
|
MKRCSYS ?= automagicplease
|
||||||
ifeq ($(MKRCSYS),automagicplease)
|
ifeq (${MKRCSYS},automagicplease)
|
||||||
# If the user isn't picking a default, then have the
|
# If the user isn't picking a default, then have the
|
||||||
# config go with runtime automagic detection #357247
|
# config go with runtime automagic detection #357247
|
||||||
rc.conf: SED_EXTRA += -e '/^rc_sys=""/s:^:\#:'
|
rc.conf: SED_EXTRA += -e '/^rc_sys=""/s:^:\#:'
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
SED_EXTRA= -e 's:@TERM@:cons25:g'
|
|
||||||
SRCS+= rc.conf.in rc.in rc.shutdown.in
|
|
||||||
CONF+= devd.conf
|
|
||||||
BIN+= rc rc.shutdown rc.devd
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
SED_EXTRA= -e 's:@TERM@:wsvt25:g'
|
|
||||||
SRCS+= rc.conf.in rc.in rc.shutdown.in
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
SED_EXTRA= -e 's:@TERM@:wsvt25:g'
|
|
||||||
SRCS+= rc.conf.in rc.in rc.shutdown.in
|
|
||||||
BIN+= rc rc.shutdown
|
|
||||||
@@ -21,4 +21,3 @@ rc_sys="@RC_SYS_DEFAULT@"
|
|||||||
# This is the number of tty's used in most of the rc-scripts (like
|
# This is the number of tty's used in most of the rc-scripts (like
|
||||||
# consolefont, numlock, etc ...)
|
# consolefont, numlock, etc ...)
|
||||||
rc_tty_number=12
|
rc_tty_number=12
|
||||||
|
|
||||||
|
|||||||
@@ -1,18 +1,8 @@
|
|||||||
# Global OpenRC configuration settings
|
# Global OpenRC configuration settings
|
||||||
|
|
||||||
# Set to "YES" if you want the rc system to try and start services
|
|
||||||
# in parallel for a slight speed improvement. When running in parallel we
|
|
||||||
# prefix the service output with its 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
|
# Set rc_interactive to "YES" and you'll be able to press the I key during
|
||||||
# boot so you can choose to start specific services. Set to "NO" to disable
|
# boot so you can choose to start specific services. Set to "NO" to disable
|
||||||
# this feature. This feature is automatically disabled if rc_parallel is
|
# this feature.
|
||||||
# set to YES.
|
|
||||||
#rc_interactive="YES"
|
#rc_interactive="YES"
|
||||||
|
|
||||||
# If we need to drop to a shell, you can specify it here.
|
# If we need to drop to a shell, you can specify it here.
|
||||||
|
|||||||
@@ -7,5 +7,5 @@ MK= ../mk
|
|||||||
|
|
||||||
SED_EXTRA+= -e 's:@VARBASE@:/var:g'
|
SED_EXTRA+= -e 's:@VARBASE@:/var:g'
|
||||||
|
|
||||||
|
include ${MK}/os.mk
|
||||||
include ${MK}/scripts.mk
|
include ${MK}/scripts.mk
|
||||||
include Makefile.${OS}
|
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
PKG_PREFIX?= /usr/local
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
PKG_PREFIX?=/usr
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
PKG_PREFIX?= /usr/pkg
|
|
||||||
@@ -1,25 +1,42 @@
|
|||||||
DIR= ${INITDIR}
|
DIR= ${INITDIR}
|
||||||
SRCS= bootmisc.in fsck.in hostname.in local.in localmount.in netmount.in \
|
SRCS= bootmisc.in fsck.in hostname.in local.in localmount.in netmount.in \
|
||||||
network.in root.in savecache.in staticroute.in swap.in swclock.in \
|
network.in root.in savecache.in staticroute.in swap.in swclock.in \
|
||||||
sysctl.in urandom.in
|
sysctl.in urandom.in ${SRCS-${OS}}
|
||||||
BIN= ${OBJS}
|
BIN= ${OBJS}
|
||||||
|
|
||||||
# Build our old net foo or not
|
INSTALLAFTER= _installafter_net.lo
|
||||||
ifeq (${MKOLDNET},yes)
|
CLEANFILES+= net.lo
|
||||||
_OLDNET= net.lo
|
TARGETS+= net.lo
|
||||||
endif
|
|
||||||
_NET_LO= ${_OLDNET}
|
|
||||||
|
|
||||||
INSTALLAFTER= _installafter_${_NET_LO}
|
|
||||||
CLEANFILES+= ${_NET_LO}
|
|
||||||
TARGETS+= ${_NET_LO}
|
|
||||||
|
|
||||||
MK= ../mk
|
MK= ../mk
|
||||||
include ${MK}/os.mk
|
include ${MK}/os.mk
|
||||||
include Makefile.${OS}
|
|
||||||
|
NET_LO-FreeBSD= net.lo0
|
||||||
|
# Generic BSD scripts
|
||||||
|
SRCS-FreeBSD= hostid.in moused.in newsyslog.in pf.in rarpd.in rc-enabled.in \
|
||||||
|
rpcbind.in savecore.in syslogd.in
|
||||||
|
# These are FreeBSD specific
|
||||||
|
SRCS-FreeBSD+= adjkerntz.in devd.in dumpon.in ipfw.in mixer.in nscd.in \
|
||||||
|
powerd.in syscons.in
|
||||||
|
|
||||||
|
NET_LO-Linux= net.lo
|
||||||
|
SRCS-Linux= 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
|
||||||
|
|
||||||
|
NET_LO-NetBSD= net.lo0
|
||||||
|
# Generic BSD scripts
|
||||||
|
SRCS-NetBSD= hostid.in moused.in newsyslog.in pf.in rarpd.in rc-enabled.in \
|
||||||
|
rpcbind.in savecore.in syslogd.in
|
||||||
|
# These are NetBSD specific
|
||||||
|
SRCS-NetBSD+= devdb.in swap-blk.in ttys.in wscons.in
|
||||||
|
|
||||||
|
%.in: %${SFX}
|
||||||
|
sed ${SED_REPLACE} ${SED_EXTRA} $< > $@
|
||||||
|
|
||||||
include ${MK}/scripts.mk
|
include ${MK}/scripts.mk
|
||||||
|
|
||||||
_installafter_: realinstall
|
_installafter_: realinstall
|
||||||
|
|
||||||
_installafter_net.lo: realinstall
|
_installafter_net.lo: realinstall
|
||||||
${INSTALL} -m ${BINMODE} net.lo ${DESTDIR}/${INITDIR}/${NET_LO}
|
${INSTALL} -m ${BINMODE} net.lo ${DESTDIR}/${INITDIR}/${NET_LO-${OS}}
|
||||||
|
|||||||
@@ -1,13 +0,0 @@
|
|||||||
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 FreeBSD specific
|
|
||||||
SRCS+= adjkerntz.in devd.in dumpon.in ipfw.in mixer.in nscd.in \
|
|
||||||
powerd.in syscons.in
|
|
||||||
|
|
||||||
.SUFFIXES: .BSD.in
|
|
||||||
.BSD.in:
|
|
||||||
sed ${SED_REPLACE} ${SED_EXTRA} $< > $@
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
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:
|
|
||||||
sed ${SED_REPLACE} ${SED_EXTRA} $< > $@
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
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+= devdb.in swap-blk.in ttys.in wscons.in
|
|
||||||
|
|
||||||
.SUFFIXES: .BSD.in
|
|
||||||
.BSD.in:
|
|
||||||
sed ${SED_REPLACE} ${SED_EXTRA} $< > $@
|
|
||||||
@@ -10,12 +10,13 @@ depend()
|
|||||||
keyword -prefix -timeout
|
keyword -prefix -timeout
|
||||||
}
|
}
|
||||||
|
|
||||||
dir_writeable()
|
dir_writable()
|
||||||
{
|
{
|
||||||
mkdir "$1"/.test.$$ 2>/dev/null && rmdir "$1"/.test.$$
|
mkdir "$1"/.test.$$ 2>/dev/null && rmdir "$1"/.test.$$
|
||||||
}
|
}
|
||||||
|
|
||||||
: ${wipe_tmp:=${WIPE_TMP:-yes}}
|
: ${wipe_tmp:=${WIPE_TMP:-yes}}
|
||||||
|
: ${log_dmesg:=${LOG_DMESG:-yes}}
|
||||||
|
|
||||||
cleanup_tmp_dir()
|
cleanup_tmp_dir()
|
||||||
{
|
{
|
||||||
@@ -24,7 +25,7 @@ cleanup_tmp_dir()
|
|||||||
if ! [ -d "$dir" ]; then
|
if ! [ -d "$dir" ]; then
|
||||||
mkdir -p "$dir" || return $?
|
mkdir -p "$dir" || return $?
|
||||||
fi
|
fi
|
||||||
dir_writeable "$dir" || return 1
|
dir_writable "$dir" || return 1
|
||||||
chmod a+rwt "$dir" 2> /dev/null
|
chmod a+rwt "$dir" 2> /dev/null
|
||||||
cd "$dir" || return 1
|
cd "$dir" || return 1
|
||||||
if yesno $wipe_tmp; then
|
if yesno $wipe_tmp; then
|
||||||
@@ -71,6 +72,26 @@ mkutmp()
|
|||||||
chmod 0664 "$1"
|
chmod 0664 "$1"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
migrate_to_run()
|
||||||
|
{
|
||||||
|
src="$1"
|
||||||
|
dst="$2"
|
||||||
|
if [ -L $src -a "$(readlink -f $src)" != $dst ]; then
|
||||||
|
ewarn "$src does not point to $dst."
|
||||||
|
ewarn "Setting $src to point to $dst."
|
||||||
|
rm $src
|
||||||
|
elif [ ! -L $src -a -d $src ]; then
|
||||||
|
ebegin "Migrating $src to $dst"
|
||||||
|
cp -a $src/* $dst/
|
||||||
|
rm -rf $src
|
||||||
|
eend $?
|
||||||
|
fi
|
||||||
|
# If $src doesn't exist at all, just run this
|
||||||
|
if [ ! -e $src ]; then
|
||||||
|
ln -s $dst $src
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
start()
|
start()
|
||||||
{
|
{
|
||||||
# Remove any added console dirs
|
# Remove any added console dirs
|
||||||
@@ -78,8 +99,16 @@ start()
|
|||||||
|
|
||||||
local logw=false runw=false extra=
|
local logw=false runw=false extra=
|
||||||
# Ensure that our basic dirs exist
|
# Ensure that our basic dirs exist
|
||||||
[ "$RC_UNAME" = Linux ] && extra=/var/lib/misc # Satisfy Linux FHS
|
if [ "$RC_UNAME" = Linux ]; then
|
||||||
for x in /var/log /var/run /tmp $extra; do
|
# Satisfy Linux FHS
|
||||||
|
extra=/var/lib/misc
|
||||||
|
if [ ! -d /run ]; then
|
||||||
|
extra="/var/run $extra"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
extra=/var/run
|
||||||
|
fi
|
||||||
|
for x in /var/log /tmp $extra; do
|
||||||
if ! [ -d $x ]; then
|
if ! [ -d $x ]; then
|
||||||
if ! mkdir -p $x; then
|
if ! mkdir -p $x; then
|
||||||
eend 1 "failed to create needed directory $x"
|
eend 1 "failed to create needed directory $x"
|
||||||
@@ -88,7 +117,12 @@ start()
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
if dir_writeable /var/run; then
|
if [ "$RC_UNAME" = Linux -a -d /run ] && false; then
|
||||||
|
migrate_to_run /var/lock /run/lock
|
||||||
|
migrate_to_run /var/run /run
|
||||||
|
fi
|
||||||
|
|
||||||
|
if dir_writable /var/run; then
|
||||||
ebegin "Creating user login records"
|
ebegin "Creating user login records"
|
||||||
local xtra=
|
local xtra=
|
||||||
[ "$RC_UNAME" = NetBSD ] && xtra=x
|
[ "$RC_UNAME" = NetBSD ] && xtra=x
|
||||||
@@ -130,7 +164,7 @@ start()
|
|||||||
cleanup_tmp_dir "$tmp"
|
cleanup_tmp_dir "$tmp"
|
||||||
done
|
done
|
||||||
|
|
||||||
if dir_writeable /tmp; then
|
if dir_writable /tmp; then
|
||||||
# Make sure our X11 stuff have the correct permissions
|
# Make sure our X11 stuff have the correct permissions
|
||||||
# Omit the chown as bootmisc is run before network is up
|
# Omit the chown as bootmisc is run before network is up
|
||||||
# and users may be using lame LDAP auth #139411
|
# and users may be using lame LDAP auth #139411
|
||||||
@@ -142,11 +176,13 @@ start()
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if $logw || dir_writeable /var/log; then
|
if yesno $log_dmesg; then
|
||||||
# Create an 'after-boot' dmesg log
|
if $logw || dir_writable /var/log; then
|
||||||
if [ "$RC_SYS" != VSERVER -a "$RC_SYS" != OPENVZ ]; then
|
# Create an 'after-boot' dmesg log
|
||||||
dmesg > /var/log/dmesg
|
if [ "$RC_SYS" != VSERVER -a "$RC_SYS" != OPENVZ ]; then
|
||||||
chmod 640 /var/log/dmesg
|
dmesg > /var/log/dmesg
|
||||||
|
chmod 640 /var/log/dmesg
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ start()
|
|||||||
retval=1
|
retval=1
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
x=$(($x + 1))
|
: $(( x += 1 ))
|
||||||
done
|
done
|
||||||
eend $retval
|
eend $retval
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ depend()
|
|||||||
|
|
||||||
start()
|
start()
|
||||||
{
|
{
|
||||||
ebegin "Bulding the dev database"
|
ebegin "Building the dev database"
|
||||||
if [ /var/run/dev.db -nt /dev ]; then
|
if [ /var/run/dev.db -nt /dev ]; then
|
||||||
:
|
:
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ start() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
stop() {
|
stop() {
|
||||||
ebegin "Deactiving kernel core dump device"
|
ebegin "Deactivating kernel core dump device"
|
||||||
dumpon off
|
dumpon off
|
||||||
eend $?
|
eend $?
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,8 +48,13 @@ start()
|
|||||||
|
|
||||||
if [ -n "$fsck_passno" ]; then
|
if [ -n "$fsck_passno" ]; then
|
||||||
check_extra="[passno $fsck_passno] $check_extra"
|
check_extra="[passno $fsck_passno] $check_extra"
|
||||||
|
if [ -n "$fsck_mnt" ]; then
|
||||||
|
eerror "Only 1 of fsck_passno and fsck_mnt must be set!"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
ebegin "Checking local filesystems $check_extra"
|
ebegin "Checking local filesystems $check_extra"
|
||||||
|
# Append passno mounts
|
||||||
for p in $fsck_passno; do
|
for p in $fsck_passno; do
|
||||||
local IFS="$_IFS"
|
local IFS="$_IFS"
|
||||||
case "$p" in
|
case "$p" in
|
||||||
@@ -58,10 +63,16 @@ start()
|
|||||||
set -- "$@" $(fstabinfo --passno "$p")
|
set -- "$@" $(fstabinfo --passno "$p")
|
||||||
unset IFS
|
unset IFS
|
||||||
done
|
done
|
||||||
|
# Append custom mounts
|
||||||
|
for m in $fsck_mnt ; do
|
||||||
|
local IFS="$_IFS"
|
||||||
|
set -- "$@" "$m"
|
||||||
|
unset IFS
|
||||||
|
done
|
||||||
|
|
||||||
if [ "$RC_UNAME" = Linux ]; then
|
if [ "$RC_UNAME" = Linux ]; then
|
||||||
fsck_opts="$fsck_opts -C0 -T"
|
fsck_opts="$fsck_opts -C0 -T"
|
||||||
if [ -z "$fsck_passno" ]; then
|
if [ -z "$fsck_passno" -a -z "$fsck_mnt" ]; then
|
||||||
fsck_args=${fsck_args--A -p}
|
fsck_args=${fsck_args--A -p}
|
||||||
if echo 2>/dev/null >/.test.$$; then
|
if echo 2>/dev/null >/.test.$$; then
|
||||||
rm -f /.test.$$
|
rm -f /.test.$$
|
||||||
@@ -91,7 +102,7 @@ start()
|
|||||||
_reboot
|
_reboot
|
||||||
fi;;
|
fi;;
|
||||||
8) ewend 1 "Operational error"; return 0;;
|
8) ewend 1 "Operational error"; return 0;;
|
||||||
12) ewend 1 "fsck interupted";;
|
12) ewend 1 "fsck interrupted";;
|
||||||
*) eend 2 "Filesystems couldn't be fixed";;
|
*) eend 2 "Filesystems couldn't be fixed";;
|
||||||
esac
|
esac
|
||||||
_abort || return 1
|
_abort || return 1
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ start()
|
|||||||
|
|
||||||
if [ -e /etc/adjtime ] && yesno $clock_adjfile; then
|
if [ -e /etc/adjtime ] && yesno $clock_adjfile; then
|
||||||
_hwclock --adjust $utc_cmd
|
_hwclock --adjust $utc_cmd
|
||||||
retval=$(($retval + $?))
|
: $(( retval += $? ))
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If setting UTC, don't bother to run hwclock when first booting
|
# If setting UTC, don't bother to run hwclock when first booting
|
||||||
@@ -99,7 +99,7 @@ start()
|
|||||||
else
|
else
|
||||||
_hwclock --systz $utc_cmd $clock_args
|
_hwclock --systz $utc_cmd $clock_args
|
||||||
fi
|
fi
|
||||||
retval=$(($retval + $?))
|
: $(( retval += $? ))
|
||||||
fi
|
fi
|
||||||
|
|
||||||
eend $retval "Failed to set the system clock"
|
eend $retval "Failed to set the system clock"
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ start() {
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Use a statefull firewall
|
# Use a stateful firewall
|
||||||
ipfw add check-state
|
ipfw add check-state
|
||||||
ipfw add pass tcp from me to any established
|
ipfw add pass tcp from me to any established
|
||||||
|
|
||||||
@@ -123,7 +123,7 @@ start() {
|
|||||||
ipfw add deny udp from any to any 520 in
|
ipfw add deny udp from any to any 520 in
|
||||||
|
|
||||||
# Noise from webbrowsing.
|
# Noise from webbrowsing.
|
||||||
# The statefull filter is a bit agressive, and will cause some
|
# The stateful filter is a bit aggressive, and will cause some
|
||||||
# connection teardowns to be logged.
|
# connection teardowns to be logged.
|
||||||
ipfw add deny tcp from any 80,443 to any 1024-65535 in
|
ipfw add deny tcp from any 80,443 to any 1024-65535 in
|
||||||
|
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ start()
|
|||||||
n=1
|
n=1
|
||||||
while [ $n -le $ttyn ]; do
|
while [ $n -le $ttyn ]; do
|
||||||
kbd_mode $kmode -C $ttydev$n
|
kbd_mode $kmode -C $ttydev$n
|
||||||
n=$(($n + 1))
|
: $(( n += 1 ))
|
||||||
done
|
done
|
||||||
eend 0
|
eend 0
|
||||||
|
|
||||||
|
|||||||
@@ -34,8 +34,12 @@ start()
|
|||||||
stop()
|
stop()
|
||||||
{
|
{
|
||||||
# We never unmount / or /dev or $RC_SVCDIR
|
# We never unmount / or /dev or $RC_SVCDIR
|
||||||
local x= no_umounts_r="/|/dev|/dev/.*|${RC_SVCDIR}"
|
|
||||||
no_umounts_r="${no_umounts_r}|/bin|/sbin|/lib|/libexec"
|
# Bug 381783
|
||||||
|
local rc_svcdir=$(echo $RC_SVCDIR | sed 's:/lib\(32\|64\)\?/:/lib(32|64)?/:g')
|
||||||
|
|
||||||
|
local x= no_umounts_r="/|/dev|/dev/.*|${rc_svcdir}"
|
||||||
|
no_umounts_r="${no_umounts_r}|/bin|/sbin|/lib(32|64)?|/libexec"
|
||||||
# RC_NO_UMOUNTS is an env var that can be set by plugins
|
# RC_NO_UMOUNTS is an env var that can be set by plugins
|
||||||
local IFS="$IFS:"
|
local IFS="$IFS:"
|
||||||
for x in $no_umounts $RC_NO_UMOUNTS; do
|
for x in $no_umounts $RC_NO_UMOUNTS; do
|
||||||
@@ -69,7 +73,7 @@ stop()
|
|||||||
done
|
done
|
||||||
[ -n "$fs" ] && fs="^($fs)$"
|
[ -n "$fs" ] && fs="^($fs)$"
|
||||||
do_unmount umount --skip-point-regex "$no_umounts_r" \
|
do_unmount umount --skip-point-regex "$no_umounts_r" \
|
||||||
${fs:+--skip-fstype-regex} $fs --nonetdev
|
"${fs:+--skip-fstype-regex}" $fs --nonetdev
|
||||||
eoutdent
|
eoutdent
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ restore()
|
|||||||
mixer -f "$mixer" \
|
mixer -f "$mixer" \
|
||||||
$(cat "/var/db/${mixer#/dev/}-state") >/dev/null
|
$(cat "/var/db/${mixer#/dev/}-state") >/dev/null
|
||||||
veend $?
|
veend $?
|
||||||
: $((retval += $?))
|
: $(( retval += $? ))
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
@@ -40,7 +40,7 @@ stop()
|
|||||||
vebegin "$mixer"
|
vebegin "$mixer"
|
||||||
mixer -f "$mixer" -s >/var/db/"${mixer#/dev/}"-state
|
mixer -f "$mixer" -s >/var/db/"${mixer#/dev/}"-state
|
||||||
veend $?
|
veend $?
|
||||||
: $((retval += $?))
|
: $(( retval += $? ))
|
||||||
done
|
done
|
||||||
eoutdent
|
eoutdent
|
||||||
eend $retval
|
eend $retval
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ start()
|
|||||||
[ -z "$args" ] && eval args=\$module_${aa}_args
|
[ -z "$args" ] && eval args=\$module_${aa}_args
|
||||||
[ -z "$args" ] && eval args=\$module_${xx}_args
|
[ -z "$args" ] && eval args=\$module_${xx}_args
|
||||||
eval modprobe -q "$mpargs" "$x" "$args"
|
eval modprobe -q "$mpargs" "$x" "$args"
|
||||||
eend $? "Failed to load $x" && cnt=$(($cnt + 1))
|
eend $? "Failed to load $x" && : $(( cnt += 1 ))
|
||||||
done
|
done
|
||||||
einfo "Autoloaded $cnt module(s)"
|
einfo "Autoloaded $cnt module(s)"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,8 +19,12 @@ start()
|
|||||||
# We need the do_unmount function
|
# We need the do_unmount function
|
||||||
. "$RC_LIBEXECDIR"/sh/rc-mount.sh
|
. "$RC_LIBEXECDIR"/sh/rc-mount.sh
|
||||||
eindent
|
eindent
|
||||||
local m="/dev|/dev/.*|/proc|/proc.*|/sys|/sys/.*|${RC_SVCDIR}" x= fs=
|
|
||||||
m="$m|/bin|/sbin|/lib|/libexec"
|
# Bug 381783
|
||||||
|
local rc_svcdir=$(echo $RC_SVCDIR | sed 's:/lib\(32\|64\)\?/:/lib(32|64)?/:g')
|
||||||
|
|
||||||
|
local m="/dev|/dev/.*|/proc|/proc.*|/sys|/sys/.*|${rc_svcdir}" x= fs=
|
||||||
|
m="$m|/bin|/sbin|/lib(32|64)?|/libexec"
|
||||||
# RC_NO_UMOUNTS is an env var that can be set by plugins
|
# RC_NO_UMOUNTS is an env var that can be set by plugins
|
||||||
local IFS="$IFS:"
|
local IFS="$IFS:"
|
||||||
for x in $no_umounts $RC_NO_UMOUNTS; do
|
for x in $no_umounts $RC_NO_UMOUNTS; do
|
||||||
@@ -34,7 +38,7 @@ start()
|
|||||||
[ -n "$fs" ] && fs="^($fs)$"
|
[ -n "$fs" ] && fs="^($fs)$"
|
||||||
do_unmount "umount -r" \
|
do_unmount "umount -r" \
|
||||||
--skip-point-regex "$m" \
|
--skip-point-regex "$m" \
|
||||||
${fs:+--skip-fstype-regex} $fs --nonetdev
|
"${fs:+--skip-fstype-regex}" $fs --nonetdev
|
||||||
eoutdent
|
eoutdent
|
||||||
eend $?
|
eend $?
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ start()
|
|||||||
local ttyv=
|
local ttyv=
|
||||||
for ttyv in /dev/ttyv*; do
|
for ttyv in /dev/ttyv*; do
|
||||||
vidcontrol < "$ttyv" -m on
|
vidcontrol < "$ttyv" -m on
|
||||||
: $((retval+= $?))
|
: $(( retval += $? ))
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
116
init.d/net.lo.in
116
init.d/net.lo.in
@@ -25,7 +25,7 @@ depend()
|
|||||||
|
|
||||||
case "${IFACE}" in
|
case "${IFACE}" in
|
||||||
lo|lo0);;
|
lo|lo0);;
|
||||||
*) after net.lo net.lo0;;
|
*) after net.lo net.lo0 dbus;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if [ "$(command -v "depend_${IFVAR}")" = "depend_${IFVAR}" ]; then
|
if [ "$(command -v "depend_${IFVAR}")" = "depend_${IFVAR}" ]; then
|
||||||
@@ -42,6 +42,16 @@ depend()
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Support bash arrays - sigh
|
# Support bash arrays - sigh
|
||||||
|
_array_helper()
|
||||||
|
{
|
||||||
|
local _a=
|
||||||
|
|
||||||
|
eval _a=\$$1
|
||||||
|
_a=$(echo "${_a}" | sed -e 's:^[[:space:]]*::' -e 's:[[:space:]]*$::' -e '/^$/d' -e 's:[[:space:]]\{1,\}: :g')
|
||||||
|
|
||||||
|
[ -n "${_a}" ] && printf "%s\n" "${_a}"
|
||||||
|
}
|
||||||
|
|
||||||
_get_array()
|
_get_array()
|
||||||
{
|
{
|
||||||
local _a=
|
local _a=
|
||||||
@@ -60,10 +70,7 @@ _get_array()
|
|||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
eval _a=\$$1
|
_array_helper $1
|
||||||
printf "%s" "${_a}"
|
|
||||||
printf "\n"
|
|
||||||
[ -n "${_a}" ]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Flatten bash arrays to simple strings
|
# Flatten bash arrays to simple strings
|
||||||
@@ -84,10 +91,7 @@ _flatten_array()
|
|||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
eval _a=\$$1
|
_array_helper $1
|
||||||
printf "%s" "${_a}"
|
|
||||||
printf "\n"
|
|
||||||
[ -n "${_a}" ]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_wait_for_carrier()
|
_wait_for_carrier()
|
||||||
@@ -111,7 +115,7 @@ _wait_for_carrier()
|
|||||||
eend 0
|
eend 0
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
timeout=$((${timeout} - 1))
|
: $(( timeout -= 1 ))
|
||||||
[ "${efunc}" = "einfon" ] && printf "."
|
[ "${efunc}" = "einfon" ] && printf "."
|
||||||
done
|
done
|
||||||
|
|
||||||
@@ -140,9 +144,9 @@ _netmask2cidr()
|
|||||||
local i= len=
|
local i= len=
|
||||||
local IFS=.
|
local IFS=.
|
||||||
for i in $1; do
|
for i in $1; do
|
||||||
while [ ${i} != "0" ]; do
|
while [ ${i} -ne 0 ]; do
|
||||||
len=$((${len} + ${i} % 2))
|
: $(( len += i % 2 ))
|
||||||
i=$((${i} >> 1))
|
: $(( i >>= 1 ))
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
|
||||||
@@ -165,6 +169,36 @@ _configure_variables()
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_which()
|
||||||
|
{
|
||||||
|
local i OIFS
|
||||||
|
# Empty
|
||||||
|
[ -z "$1" ] && return
|
||||||
|
# check paths
|
||||||
|
OIFS="$IFS"
|
||||||
|
IFS=:
|
||||||
|
for i in $PATH ; do
|
||||||
|
[ -x $i/$1 ] && echo $i/$1 && break
|
||||||
|
done
|
||||||
|
IFS=$OIFS
|
||||||
|
}
|
||||||
|
|
||||||
|
# Like _which, but also consider shell builtins, and multiple alternatives
|
||||||
|
_program_available()
|
||||||
|
{
|
||||||
|
[ -z "$1" ] && return 0
|
||||||
|
local x=
|
||||||
|
for x; do
|
||||||
|
case "${x}" in
|
||||||
|
/*) [ -x "${x}" ] && break;;
|
||||||
|
*) type "${x}" >/dev/null 2>&1 && break;;
|
||||||
|
esac
|
||||||
|
unset x
|
||||||
|
done
|
||||||
|
[ -n "${x}" ] && echo $x && return 0
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
_show_address()
|
_show_address()
|
||||||
{
|
{
|
||||||
einfo "received address $(_get_inet_address "${IFACE}")"
|
einfo "received address $(_get_inet_address "${IFACE}")"
|
||||||
@@ -273,7 +307,7 @@ _gen_module_list()
|
|||||||
echo "module_${i}_program_start='${PROGRAM_START}'" >> "${MODULESLIST}"
|
echo "module_${i}_program_start='${PROGRAM_START}'" >> "${MODULESLIST}"
|
||||||
echo "module_${i}_program_stop='${PROGRAM_STOP}'" >> "${MODULESLIST}"
|
echo "module_${i}_program_stop='${PROGRAM_STOP}'" >> "${MODULESLIST}"
|
||||||
echo "module_${i}_provide='${PROVIDE}'" >> "${MODULESLIST}"
|
echo "module_${i}_provide='${PROVIDE}'" >> "${MODULESLIST}"
|
||||||
i=$((${i} + 1))
|
: $(( i += 1 ))
|
||||||
done
|
done
|
||||||
echo "module_${i}=" >> "${MODULESLIST}"
|
echo "module_${i}=" >> "${MODULESLIST}"
|
||||||
)
|
)
|
||||||
@@ -300,18 +334,17 @@ _load_modules()
|
|||||||
|
|
||||||
local i=-1 x= mod= f= provides=
|
local i=-1 x= mod= f= provides=
|
||||||
while true; do
|
while true; do
|
||||||
i=$((${i} + 1))
|
: $(( i += 1 ))
|
||||||
eval mod=\$module_${i}
|
eval mod=\$module_${i}
|
||||||
[ -z "${mod}" ] && break
|
[ -z "${mod}" ] && break
|
||||||
[ -e "${MODULESDIR}/${mod}.sh" ] || continue
|
[ -e "${MODULESDIR}/${mod}.sh" ] || continue
|
||||||
|
|
||||||
eval set -- \$module_${i}_program
|
eval set -- \$module_${i}_program
|
||||||
if [ -n "$1" ]; then
|
if [ -n "$1" ]; then
|
||||||
x=
|
if ! _program_available "$@" >/dev/null; then
|
||||||
for x; do
|
vewarn "Skipping module $mod due to missing program: $@"
|
||||||
[ -x "${x}" ] && break
|
continue
|
||||||
done
|
fi
|
||||||
[ -x "${x}" ] || continue
|
|
||||||
fi
|
fi
|
||||||
if ${starting}; then
|
if ${starting}; then
|
||||||
eval set -- \$module_${i}_program_start
|
eval set -- \$module_${i}_program_start
|
||||||
@@ -319,15 +352,10 @@ _load_modules()
|
|||||||
eval set -- \$module_${i}_program_stop
|
eval set -- \$module_${i}_program_stop
|
||||||
fi
|
fi
|
||||||
if [ -n "$1" ]; then
|
if [ -n "$1" ]; then
|
||||||
x=
|
if ! _program_available "$@" >/dev/null; then
|
||||||
for x; do
|
vewarn "Skipping module $mod due to missing program: $@"
|
||||||
case "${x}" in
|
continue
|
||||||
/*) [ -x "${x}" ] && break;;
|
fi
|
||||||
*) type "${x}" >/dev/null 2>&1 && break;;
|
|
||||||
esac
|
|
||||||
unset x
|
|
||||||
done
|
|
||||||
[ -n "${x}" ] || continue
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
eval provides=\$module_${i}_provide
|
eval provides=\$module_${i}_provide
|
||||||
@@ -403,16 +431,18 @@ _load_config()
|
|||||||
set -- ${config}
|
set -- ${config}
|
||||||
|
|
||||||
# We should support a space separated array for cidr configs
|
# We should support a space separated array for cidr configs
|
||||||
|
# But only as long as they do not contain other parameters for the address
|
||||||
if [ $# = 1 ]; then
|
if [ $# = 1 ]; then
|
||||||
unset IFS
|
unset IFS
|
||||||
set -- ${config}
|
set -- ${config}
|
||||||
# Of course, we may have a single address added old style.
|
# Of course, we may have a single address added old style.
|
||||||
case "$2" in
|
# If the NEXT argument is a v4 or v6 address, it's the next config.
|
||||||
netmask|broadcast|brd|brd+|peer|pointopoint)
|
# Otherwise, it's arguments to the first config...
|
||||||
local IFS="$__IFS"
|
if [ "${2#*.*}" = "${2}" -a "${2#*:*}" = "${2}" ]; then
|
||||||
set -- ${config}
|
# Not an IPv4/IPv6
|
||||||
;;
|
local IFS="$__IFS"
|
||||||
esac
|
set -- ${config}
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Ensure that loopback has the correct address
|
# Ensure that loopback has the correct address
|
||||||
@@ -434,7 +464,7 @@ _load_config()
|
|||||||
# so modules can influence it
|
# so modules can influence it
|
||||||
for cmd; do
|
for cmd; do
|
||||||
eval config_${config_index}="'${cmd}'"
|
eval config_${config_index}="'${cmd}'"
|
||||||
config_index=$((${config_index} + 1))
|
: $(( config_index += 1 ))
|
||||||
done
|
done
|
||||||
# Terminate the list
|
# Terminate the list
|
||||||
eval config_${config_index}=
|
eval config_${config_index}=
|
||||||
@@ -442,7 +472,7 @@ _load_config()
|
|||||||
config_index=0
|
config_index=0
|
||||||
for cmd in ${fallback}; do
|
for cmd in ${fallback}; do
|
||||||
eval fallback_${config_index}="'${cmd}'"
|
eval fallback_${config_index}="'${cmd}'"
|
||||||
config_index=$((${config_index} + 1))
|
: $(( config_index += 1 ))
|
||||||
done
|
done
|
||||||
# Terminate the list
|
# Terminate the list
|
||||||
eval fallback_${config_index}=
|
eval fallback_${config_index}=
|
||||||
@@ -484,7 +514,9 @@ start()
|
|||||||
{
|
{
|
||||||
local IFACE=${RC_SVCNAME#*.} oneworked=false fallback=false module=
|
local IFACE=${RC_SVCNAME#*.} oneworked=false fallback=false module=
|
||||||
local IFVAR=$(shell_var "${IFACE}") cmd= our_metric=
|
local IFVAR=$(shell_var "${IFACE}") cmd= our_metric=
|
||||||
local metric=0
|
local metric=0 _up_before_preup
|
||||||
|
eval _up_before_preup="\$up_before_preup_${IFVAR}"
|
||||||
|
[ -z "${_up_before_preup}" ] && _up_before_preup=$up_before_preup
|
||||||
|
|
||||||
einfo "Bringing up interface ${IFACE}"
|
einfo "Bringing up interface ${IFACE}"
|
||||||
eindent
|
eindent
|
||||||
@@ -498,7 +530,7 @@ start()
|
|||||||
# available in preup and afterwards incase the user inadvertently
|
# available in preup and afterwards incase the user inadvertently
|
||||||
# brings it down
|
# brings it down
|
||||||
if [ "$(command -v preup)" = "preup" ]; then
|
if [ "$(command -v preup)" = "preup" ]; then
|
||||||
_up 2>/dev/null
|
yesno "${_up_before_preup:-yes}" && _up 2>/dev/null
|
||||||
ebegin "Running preup"
|
ebegin "Running preup"
|
||||||
eindent
|
eindent
|
||||||
preup || return 1
|
preup || return 1
|
||||||
@@ -537,7 +569,7 @@ start()
|
|||||||
if [ -n "${our_metric}" ]; then
|
if [ -n "${our_metric}" ]; then
|
||||||
metric=${our_metric}
|
metric=${our_metric}
|
||||||
elif [ "${IFACE}" != "lo" -a "${IFACE}" != "lo0" ]; then
|
elif [ "${IFACE}" != "lo" -a "${IFACE}" != "lo0" ]; then
|
||||||
metric=$((${metric} + $(_ifindex)))
|
: $(( metric += $(_ifindex) ))
|
||||||
fi
|
fi
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
@@ -577,11 +609,11 @@ start()
|
|||||||
eindent
|
eindent
|
||||||
eval config_${config_index}=\$config
|
eval config_${config_index}=\$config
|
||||||
unset fallback_${config_index}
|
unset fallback_${config_index}
|
||||||
config_index=$((${config_index} - 1))
|
: $(( config_index -= 1 ))
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
eoutdent
|
eoutdent
|
||||||
config_index=$((${config_index} + 1))
|
: $(( config_index += 1 ))
|
||||||
done
|
done
|
||||||
|
|
||||||
if ! ${oneworked}; then
|
if ! ${oneworked}; then
|
||||||
|
|||||||
@@ -219,6 +219,12 @@ start()
|
|||||||
eend $?
|
eend $?
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
ewarn
|
||||||
|
ewarn "The $RC_SVCNAME script is deprecated and will be"
|
||||||
|
ewarn "removed in the future."
|
||||||
|
ewarn "Please use the net.* scripts to manage your network interfaces."
|
||||||
|
ewarn
|
||||||
|
|
||||||
einfo "Starting network"
|
einfo "Starting network"
|
||||||
routeflush
|
routeflush
|
||||||
if [ "$RC_UNAME" = "Linux" ]; then
|
if [ "$RC_UNAME" = "Linux" ]; then
|
||||||
@@ -281,7 +287,7 @@ start()
|
|||||||
tentative || break
|
tentative || break
|
||||||
[ $r = 5 ] && vebegin "Waiting for tentative addresses"
|
[ $r = 5 ] && vebegin "Waiting for tentative addresses"
|
||||||
sleep 1
|
sleep 1
|
||||||
r=$(($r - 1))
|
: $(( r -= 1 ))
|
||||||
done
|
done
|
||||||
if [ $r != 5 ]; then
|
if [ $r != 5 ]; then
|
||||||
[ $r != 0 ]
|
[ $r != 0 ]
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ _setleds()
|
|||||||
|
|
||||||
while [ $i -le $ttyn ]; do
|
while [ $i -le $ttyn ]; do
|
||||||
setleds -D "$1"num < $dev$i || retval=1
|
setleds -D "$1"num < $dev$i || retval=1
|
||||||
i=$(($i + 1))
|
: $(( i += 1 ))
|
||||||
done
|
done
|
||||||
|
|
||||||
return $retval
|
return $retval
|
||||||
|
|||||||
@@ -37,24 +37,24 @@ start()
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# 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 NFS filesystem"
|
|
||||||
mount -t nfsd -o nodev,noexec,nosuid \
|
|
||||||
nfsd /proc/fs/nfsd
|
|
||||||
eend $?
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Setup Kernel Support for miscellaneous Binary Formats
|
# Setup Kernel Support for miscellaneous Binary Formats
|
||||||
if [ -d /proc/sys/fs/binfmt_misc ] \
|
if [ -d /proc/sys/fs/binfmt_misc -a ! -e /proc/sys/fs/binfmt_misc/register ]; then
|
||||||
&& ! mountinfo -q /proc/sys/fs/binfmt_misc; then
|
|
||||||
if grep -qs binfmt_misc /proc/filesystems; then
|
if grep -qs binfmt_misc /proc/filesystems; then
|
||||||
ebegin "Mounting misc binary format filesystem"
|
ebegin "Mounting misc binary format filesystem"
|
||||||
mount -t binfmt_misc -o nodev,noexec,nosuid \
|
mount -t binfmt_misc -o nodev,noexec,nosuid \
|
||||||
binfmt_misc /proc/sys/fs/binfmt_misc
|
binfmt_misc /proc/sys/fs/binfmt_misc
|
||||||
eend $?
|
if eend $? ; then
|
||||||
|
local fmts
|
||||||
|
ebegin "Loading custom binary format handlers"
|
||||||
|
fmts=$(grep -hsv -e '^[#;]' -e '^[[:space:]]*$' \
|
||||||
|
/run/binfmt.d/*.conf \
|
||||||
|
"/etc"/binfmt.d/*.conf \
|
||||||
|
""/usr/lib/binfmt.d/*.conf)
|
||||||
|
if [ -n "${fmts}" ]; then
|
||||||
|
echo "${fmts}" > /proc/sys/fs/binfmt_misc/register
|
||||||
|
fi
|
||||||
|
eend $?
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ start()
|
|||||||
|
|
||||||
# Good to go!
|
# Good to go!
|
||||||
"$svc" start && started="$started $svc"
|
"$svc" start && started="$started $svc"
|
||||||
: $((retval += $?))
|
: $(( retval += $? ))
|
||||||
done
|
done
|
||||||
service_set_value started "$started"
|
service_set_value started "$started"
|
||||||
eend $retval "Some local rc services failed to start"
|
eend $retval "Some local rc services failed to start"
|
||||||
@@ -46,7 +46,7 @@ stop()
|
|||||||
local svc= retval=0
|
local svc= retval=0
|
||||||
for svc in $(rcorder $(service_get_value started) 2>/dev/null | sort -r); do
|
for svc in $(rcorder $(service_get_value started) 2>/dev/null | sort -r); do
|
||||||
"$svc" stop
|
"$svc" stop
|
||||||
: $((retval += $?))
|
: $(( retval += $? ))
|
||||||
done
|
done
|
||||||
eend $retval "Some local rc services failed to stop"
|
eend $retval "Some local rc services failed to stop"
|
||||||
return 0
|
return 0
|
||||||
|
|||||||
@@ -93,6 +93,11 @@ do_routes()
|
|||||||
|
|
||||||
start()
|
start()
|
||||||
{
|
{
|
||||||
|
ewarn
|
||||||
|
ewarn "The $RC_SVCNAME script is deprecated and will be"
|
||||||
|
ewarn "removed in the future."
|
||||||
|
ewarn "Please use the net.* scripts to manage your network interfaces."
|
||||||
|
ewarn
|
||||||
do_routes "Adding" "add"
|
do_routes "Adding" "add"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -50,6 +50,41 @@ mount_misc()
|
|||||||
eend $?
|
eend $?
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Setup Kernel Support for configfs
|
||||||
|
if [ -d /sys/kernel/config ] && ! mountinfo -q /sys/kernel/config; then
|
||||||
|
if grep -qs configfs /proc/filesystems; then
|
||||||
|
ebegin "Mounting config filesystem"
|
||||||
|
mount -n -t configfs -o nodev,noexec,nosuid \
|
||||||
|
configfs /sys/kernel/config
|
||||||
|
eend $?
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# set up kernel support for cgroups
|
||||||
|
if [ -d /sys/fs/cgroup ] && ! mountinfo -q /sys/fs/cgroup; then
|
||||||
|
if grep -qs cgroup /proc/filesystems; then
|
||||||
|
ebegin "Mounting cgroup filesystem"
|
||||||
|
local opts="nodev,noexec,nosuid,mode=755,size=${rc_cgroupsize:-10m}"
|
||||||
|
mount -n -t tmpfs -o ${opts} cgroup_root /sys/fs/cgroup
|
||||||
|
eend $?
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
mount_cgroups()
|
||||||
|
{
|
||||||
|
yesno ${rc_cgroups:-YES} && [ -e /proc/cgroups ] && \
|
||||||
|
mountinfo -q /sys/fs/cgroup || return 0
|
||||||
|
|
||||||
|
while read name hier groups enabled rest; do
|
||||||
|
case "${enabled}" in
|
||||||
|
1) mkdir /sys/fs/cgroup/${name}
|
||||||
|
mount -n -t cgroup -o nodev,noexec,nosuid,${name} \
|
||||||
|
${name} /sys/fs/cgroup/${name}
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done < /proc/cgroups
|
||||||
}
|
}
|
||||||
|
|
||||||
start()
|
start()
|
||||||
@@ -59,6 +94,11 @@ start()
|
|||||||
retval=$?
|
retval=$?
|
||||||
if [ $retval -eq 0 ]; then
|
if [ $retval -eq 0 ]; then
|
||||||
mount_misc
|
mount_misc
|
||||||
|
retval=$?
|
||||||
|
fi
|
||||||
|
if [ $retval -eq 0 ]; then
|
||||||
|
mount_cgroups
|
||||||
|
retval=$?
|
||||||
fi
|
fi
|
||||||
return $retval
|
return $retval
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ start()
|
|||||||
n=1
|
n=1
|
||||||
while [ ${n} -le "$ttyn" ]; do
|
while [ ${n} -le "$ttyn" ]; do
|
||||||
printf "\033%s" "$termencoding" >$ttydev$n
|
printf "\033%s" "$termencoding" >$ttydev$n
|
||||||
n=$(($n + 1))
|
: $(( n += 1 ))
|
||||||
done
|
done
|
||||||
|
|
||||||
# Save the encoding for use immediately at boot
|
# Save the encoding for use immediately at boot
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
# Copyright (c) 2007-2009 Roy Marples <roy@marples.name>
|
# Copyright (c) 2007-2009 Roy Marples <roy@marples.name>
|
||||||
# Released under the 2-clause BSD license.
|
# Released under the 2-clause BSD license.
|
||||||
|
|
||||||
: ${urandom_seed:=${URANDOM_SEED:-/var/run/random-seed}}
|
: ${urandom_seed:=${URANDOM_SEED:-/var/lib/misc/random-seed}}
|
||||||
description="Initializes the random number generator."
|
description="Initializes the random number generator."
|
||||||
|
|
||||||
depend()
|
depend()
|
||||||
@@ -16,7 +16,7 @@ save_seed()
|
|||||||
local psz=1
|
local psz=1
|
||||||
|
|
||||||
if [ -e /proc/sys/kernel/random/poolsize ]; then
|
if [ -e /proc/sys/kernel/random/poolsize ]; then
|
||||||
psz=$(($(cat /proc/sys/kernel/random/poolsize) / 4096))
|
: $(( psz = $(cat /proc/sys/kernel/random/poolsize) / 4096 ))
|
||||||
fi
|
fi
|
||||||
|
|
||||||
( # sub shell to prevent umask pollution
|
( # sub shell to prevent umask pollution
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
.\" SUCH DAMAGE.
|
.\" SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.Dd November 4, 2009
|
.Dd December 31, 2011
|
||||||
.Dt RUNSCRIPT 8 SMM
|
.Dt RUNSCRIPT 8 SMM
|
||||||
.Os OpenRC
|
.Os OpenRC
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
@@ -93,10 +93,15 @@ Space separated list of extra commands the service defines.
|
|||||||
.It Ar extra_started_commands
|
.It Ar extra_started_commands
|
||||||
Space separated list of extra commands the service defines. These only work if
|
Space separated list of extra commands the service defines. These only work if
|
||||||
the service has already been started.
|
the service has already been started.
|
||||||
|
.It Ar extra_stopped_commands
|
||||||
|
Space separated list of extra commands the service defines. These only work if
|
||||||
|
the service has already been stopped.
|
||||||
.It Ar description
|
.It Ar description
|
||||||
String describing the service.
|
String describing the service.
|
||||||
.It Ar description_$command
|
.It Ar description_$command
|
||||||
String describing the extra command the.
|
String describing the extra command.
|
||||||
|
.It Ar start_stop_daemon_args
|
||||||
|
List of arguments passed to start-stop-daemon when starting the daemon.
|
||||||
.It Ar command
|
.It Ar command
|
||||||
Daemon to start or stop via
|
Daemon to start or stop via
|
||||||
.Nm start-stop-daemon
|
.Nm start-stop-daemon
|
||||||
@@ -107,6 +112,9 @@ List of arguments to pass to the daemon when starting.
|
|||||||
Pidfile to use for the above defined command.
|
Pidfile to use for the above defined command.
|
||||||
.It Ar name
|
.It Ar name
|
||||||
Display name used for the above defined command.
|
Display name used for the above defined command.
|
||||||
|
.It Ar retry
|
||||||
|
Retry schedule to use when stopping the daemon. It can either be a
|
||||||
|
timeout in seconds or multiple signal/timeout pairs (like SIGTERM/5).
|
||||||
.El
|
.El
|
||||||
.Sh DEPENDENCIES
|
.Sh DEPENDENCIES
|
||||||
You should define a
|
You should define a
|
||||||
@@ -139,7 +147,7 @@ Tags a service with a keyword. Here's the keywords we currently understand:-
|
|||||||
.Bl -tag -width indent
|
.Bl -tag -width indent
|
||||||
.It Dv -shutdown
|
.It Dv -shutdown
|
||||||
Don't stop this service when shutting the system down.
|
Don't stop this service when shutting the system down.
|
||||||
This normally quite safe as remaining daemons will be sent a SIGTERM just
|
This is normally quite safe as remaining daemons will be sent a SIGTERM just
|
||||||
before final shutdown.
|
before final shutdown.
|
||||||
Network related services such as the network and dhcpcd init scripts normally
|
Network related services such as the network and dhcpcd init scripts normally
|
||||||
have this keyword.
|
have this keyword.
|
||||||
@@ -221,7 +229,7 @@ seconds until all files exist.
|
|||||||
Returns 0 if all files exist, otherwise non zero.
|
Returns 0 if all files exist, otherwise non zero.
|
||||||
If
|
If
|
||||||
.Ar timeout
|
.Ar timeout
|
||||||
is less then 1 then we wait indefinitely.
|
is less than 1 then we wait indefinitely.
|
||||||
.It Ic is_newer_than Ar file1 Ar file2 ...
|
.It Ic is_newer_than Ar file1 Ar file2 ...
|
||||||
If
|
If
|
||||||
.Ar file1
|
.Ar file1
|
||||||
@@ -288,8 +296,11 @@ Mark the service as coldplugged.
|
|||||||
Mark the service as inactive.
|
Mark the service as inactive.
|
||||||
.It Xo
|
.It Xo
|
||||||
.Ic checkpath
|
.Ic checkpath
|
||||||
|
.Op Fl D , -directory-truncate
|
||||||
.Op Fl d , -directory
|
.Op Fl d , -directory
|
||||||
|
.Op Fl F , -file-truncate
|
||||||
.Op Fl f , -file
|
.Op Fl f , -file
|
||||||
|
.Op Fl p , -pipe
|
||||||
.Op Fl m , -mode Ar mode
|
.Op Fl m , -mode Ar mode
|
||||||
.Op Fl o , owner Ar owner
|
.Op Fl o , owner Ar owner
|
||||||
.Ar path ...
|
.Ar path ...
|
||||||
@@ -446,7 +457,7 @@ eat()
|
|||||||
veinfo "Eating `basename ${food}`"
|
veinfo "Eating `basename ${food}`"
|
||||||
${command} --eat ${food}
|
${command} --eat ${food}
|
||||||
retval=$?
|
retval=$?
|
||||||
: $((${result} += ${retval}))
|
: $(( result += retval ))
|
||||||
[ ${retval} = 0 ] && ate="${ate} `basename ${food}`"
|
[ ${retval} = 0 ] && ate="${ate} `basename ${food}`"
|
||||||
done
|
done
|
||||||
|
|
||||||
@@ -462,6 +473,12 @@ show()
|
|||||||
|
|
||||||
.Ed
|
.Ed
|
||||||
.Sh BUGS
|
.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.
|
is_older_than should return 0 on success.
|
||||||
Instead we return 1 to be compliant with Gentoo baselayout.
|
Instead we return 1 to be compliant with Gentoo baselayout.
|
||||||
Users are encouraged to use the is_newer_than function which returns correctly.
|
Users are encouraged to use the is_newer_than function which returns correctly.
|
||||||
|
|||||||
@@ -162,9 +162,8 @@ but with the standard error output.
|
|||||||
These options are only used for stopping daemons:
|
These options are only used for stopping daemons:
|
||||||
.Bl -tag -width indent
|
.Bl -tag -width indent
|
||||||
.It Fl R , -retry Ar timeout | Ar signal Ns / Ns Ar timeout
|
.It Fl R , -retry Ar timeout | Ar signal Ns / Ns Ar timeout
|
||||||
You can either specify a timeout in seconds or a multiple signal/timeout
|
The retry specification can be either a timeout in seconds or multiple
|
||||||
pairs as a stopping schedule.
|
signal/timeout pairs (like SIGTERM/5).
|
||||||
If not specified then a default value of SIGTERM/5 is assumed.
|
|
||||||
.El
|
.El
|
||||||
.Sh ENVIRONMENT
|
.Sh ENVIRONMENT
|
||||||
.Va SSD_NICELEVEL
|
.Va SSD_NICELEVEL
|
||||||
|
|||||||
18
mk/lib.mk
18
mk/lib.mk
@@ -8,18 +8,22 @@ SHLIB_NAME= lib${LIB}.so.${SHLIB_MAJOR}
|
|||||||
SHLIB_LINK= lib${LIB}.so
|
SHLIB_LINK= lib${LIB}.so
|
||||||
SONAME?= ${SHLIB_NAME}
|
SONAME?= ${SHLIB_NAME}
|
||||||
|
|
||||||
|
SOBJS+= ${SRCS:.c=.So}
|
||||||
|
|
||||||
|
MKSTATICLIBS?= yes
|
||||||
|
ifeq (${MKSTATICLIBS},yes)
|
||||||
OBJS+= ${SRCS:.c=.o}
|
OBJS+= ${SRCS:.c=.o}
|
||||||
SOBJS+= ${OBJS:.o=.So}
|
_LIBS+= lib${LIB}.a
|
||||||
_LIBS= lib${LIB}.a ${SHLIB_NAME}
|
endif
|
||||||
|
|
||||||
|
_LIBS+= ${SHLIB_NAME}
|
||||||
|
|
||||||
CLEANFILES+= ${OBJS} ${SOBJS} ${_LIBS} ${SHLIB_LINK}
|
CLEANFILES+= ${OBJS} ${SOBJS} ${_LIBS} ${SHLIB_LINK}
|
||||||
|
|
||||||
.SUFFIXES: .So
|
%.o: %.c
|
||||||
|
|
||||||
.c.o:
|
|
||||||
${CC} ${CFLAGS} ${CPPFLAGS} -c $< -o $@
|
${CC} ${CFLAGS} ${CPPFLAGS} -c $< -o $@
|
||||||
|
|
||||||
.c.So:
|
%.So: %.c
|
||||||
${CC} ${PICFLAG} -DPIC ${CPPFLAGS} ${CFLAGS} -c $< -o $@
|
${CC} ${PICFLAG} -DPIC ${CPPFLAGS} ${CFLAGS} -c $< -o $@
|
||||||
|
|
||||||
all: depend ${_LIBS}
|
all: depend ${_LIBS}
|
||||||
@@ -41,8 +45,10 @@ ${SHLIB_NAME}: ${SOBJS}
|
|||||||
${SOBJS} ${LDADD}
|
${SOBJS} ${LDADD}
|
||||||
|
|
||||||
install: all
|
install: all
|
||||||
|
ifeq (${MKSTATICLIBS},yes)
|
||||||
${INSTALL} -d ${DESTDIR}${LIBDIR}
|
${INSTALL} -d ${DESTDIR}${LIBDIR}
|
||||||
${INSTALL} -m ${LIBMODE} lib${LIB}.a ${DESTDIR}${LIBDIR}
|
${INSTALL} -m ${LIBMODE} lib${LIB}.a ${DESTDIR}${LIBDIR}
|
||||||
|
endif
|
||||||
${INSTALL} -d ${DESTDIR}${SHLIBDIR}
|
${INSTALL} -d ${DESTDIR}${SHLIBDIR}
|
||||||
${INSTALL} -m ${LIBMODE} ${SHLIB_NAME} ${DESTDIR}${SHLIBDIR}
|
${INSTALL} -m ${LIBMODE} ${SHLIB_NAME} ${DESTDIR}${SHLIBDIR}
|
||||||
ln -fs ${SHLIB_NAME} ${DESTDIR}${SHLIBDIR}/${SHLIB_LINK}
|
ln -fs ${SHLIB_NAME} ${DESTDIR}${SHLIBDIR}/${SHLIB_LINK}
|
||||||
|
|||||||
@@ -3,4 +3,7 @@
|
|||||||
|
|
||||||
# Generic definitions
|
# Generic definitions
|
||||||
|
|
||||||
|
PKG_PREFIX?= /usr/local
|
||||||
|
SFX= .BSD.in
|
||||||
|
|
||||||
LIBKVM?= -lkvm
|
LIBKVM?= -lkvm
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
# Copyright (c) 2008 Roy Marples <roy@marples.name>
|
# Copyright (c) 2008 Roy Marples <roy@marples.name>
|
||||||
# Released under the 2-clause BSD license.
|
# Released under the 2-clause BSD license.
|
||||||
|
|
||||||
|
SFX= .Linux.in
|
||||||
|
PKG_PREFIX?= /usr
|
||||||
|
|
||||||
CPPFLAGS+= -D_BSD_SOURCE -D_XOPEN_SOURCE=600
|
CPPFLAGS+= -D_BSD_SOURCE -D_XOPEN_SOURCE=600
|
||||||
LIBDL= -Wl,-Bdynamic -ldl
|
LIBDL= -Wl,-Bdynamic -ldl
|
||||||
|
|||||||
1
mk/os.mk
1
mk/os.mk
@@ -9,4 +9,3 @@ OS?= ${_OS}
|
|||||||
include ${MK}/os-${OS}.mk
|
include ${MK}/os-${OS}.mk
|
||||||
|
|
||||||
RC_LIB= /$(LIBNAME)/rc
|
RC_LIB= /$(LIBNAME)/rc
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ CLEANFILES+= ${OBJS} ${PROG}
|
|||||||
|
|
||||||
all: depend ${PROG}
|
all: depend ${PROG}
|
||||||
|
|
||||||
.c.o:
|
%.o: %.c
|
||||||
${CC} ${CFLAGS} ${CPPFLAGS} -c $< -o $@
|
${CC} ${CFLAGS} ${CPPFLAGS} -c $< -o $@
|
||||||
|
|
||||||
${PROG}: ${SCRIPTS} ${OBJS}
|
${PROG}: ${SCRIPTS} ${OBJS}
|
||||||
|
|||||||
@@ -15,11 +15,10 @@ _LCL_SED:= $(shell ${_LCL_SED_SH})
|
|||||||
SED_REPLACE= -e 's:@SHELL@:${SH}:g' -e 's:@LIB@:${LIBNAME}:g' -e 's:@SYSCONFDIR@:${SYSCONFDIR}:g' -e 's:@LIBEXECDIR@:${LIBEXECDIR}:g' -e 's:@PREFIX@:${PREFIX}:g' -e 's:@RC_SYS_DEFAULT@:${MKRCSYS}:g' ${_PKG_SED} ${_LCL_SED}
|
SED_REPLACE= -e 's:@SHELL@:${SH}:g' -e 's:@LIB@:${LIBNAME}:g' -e 's:@SYSCONFDIR@:${SYSCONFDIR}:g' -e 's:@LIBEXECDIR@:${LIBEXECDIR}:g' -e 's:@PREFIX@:${PREFIX}:g' -e 's:@RC_SYS_DEFAULT@:${MKRCSYS}:g' ${_PKG_SED} ${_LCL_SED}
|
||||||
|
|
||||||
# Tweak our shell scripts
|
# Tweak our shell scripts
|
||||||
.SUFFIXES: .sh.in .in
|
%.sh: %.sh.in
|
||||||
.sh.in.sh:
|
|
||||||
${SED} ${SED_REPLACE} ${SED_EXTRA} $< > $@
|
${SED} ${SED_REPLACE} ${SED_EXTRA} $< > $@
|
||||||
|
|
||||||
.in:
|
%: %.in
|
||||||
${SED} ${SED_REPLACE} ${SED_EXTRA} $< > $@
|
${SED} ${SED_REPLACE} ${SED_EXTRA} $< > $@
|
||||||
|
|
||||||
all: ${OBJS} ${TARGETS}
|
all: ${OBJS} ${TARGETS}
|
||||||
|
|||||||
21
net/Makefile
21
net/Makefile
@@ -1,9 +1,24 @@
|
|||||||
DIR= ${LIBEXECDIR}/net
|
DIR= ${LIBEXECDIR}/net
|
||||||
SRCS= ifconfig.sh.in
|
SRCS= ifconfig.sh.in ${SRCS-${OS}}
|
||||||
INC= dhclient.sh dhcpcd.sh ifconfig.sh macchanger.sh macnet.sh \
|
INC= dhclient.sh dhcpcd.sh ifconfig.sh macchanger.sh macnet.sh \
|
||||||
ssidnet.sh system.sh wpa_supplicant.sh
|
ssidnet.sh system.sh wpa_supplicant.sh ${INC-${OS}}
|
||||||
|
|
||||||
MK= ../mk
|
MK= ../mk
|
||||||
include ${MK}/os.mk
|
include ${MK}/os.mk
|
||||||
include Makefile.${OS}
|
|
||||||
|
SRCS-FreeBSD= iwconfig.sh.in
|
||||||
|
INC-FreeBSD= iwconfig.sh
|
||||||
|
|
||||||
|
SRCS-Linux= iwconfig.sh.in
|
||||||
|
INC-Linux= adsl.sh apipa.sh arping.sh bonding.sh br2684ctl.sh bridge.sh \
|
||||||
|
ccwgroup.sh clip.sh ethtool.sh iproute2.sh ifplugd.sh ip6to4.sh \
|
||||||
|
ipppd.sh iwconfig.sh netplugd.sh pppd.sh pump.sh tuntap.sh udhcpc.sh \
|
||||||
|
vlan.sh macvlan.sh
|
||||||
|
|
||||||
|
SRCS-NetBSD=
|
||||||
|
INC-NetBSD= ifwatchd.sh
|
||||||
|
|
||||||
|
%.sh: %.sh${SFX}
|
||||||
|
${CP} $< $@
|
||||||
|
|
||||||
include ${MK}/scripts.mk
|
include ${MK}/scripts.mk
|
||||||
|
|||||||
@@ -1,6 +0,0 @@
|
|||||||
SRCS+= iwconfig.sh.in
|
|
||||||
INC+= iwconfig.sh
|
|
||||||
|
|
||||||
.SUFFIXES: .sh.BSD.in
|
|
||||||
.sh.BSD.in.sh:
|
|
||||||
${CP} $< $@
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
SRCS+= iwconfig.sh.in
|
|
||||||
INC+= adsl.sh apipa.sh arping.sh bonding.sh br2684ctl.sh bridge.sh \
|
|
||||||
ccwgroup.sh clip.sh ethtool.sh iproute2.sh ifplugd.sh ip6to4.sh \
|
|
||||||
ipppd.sh iwconfig.sh netplugd.sh pppd.sh pump.sh tuntap.sh udhcpc.sh \
|
|
||||||
vlan.sh
|
|
||||||
|
|
||||||
.SUFFIXES: .sh.Linux.in
|
|
||||||
.sh.Linux.in.sh:
|
|
||||||
${CP} $< $@
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
INC+= ifwatchd.sh
|
|
||||||
|
|
||||||
.SUFFIXES: .sh.BSD.in
|
|
||||||
.sh.BSD.in.sh:
|
|
||||||
${CP} $< $@
|
|
||||||
@@ -26,20 +26,20 @@ apipa_start()
|
|||||||
eindent
|
eindent
|
||||||
|
|
||||||
while [ ${i} -lt 64516 ]; do
|
while [ ${i} -lt 64516 ]; do
|
||||||
i1=$((($(_random) % 255) + 1))
|
: $(( i1 = (_random % 255) + 1 ))
|
||||||
i2=$((($(_random) % 255) + 1))
|
: $(( i2 = (_random % 255) + 1 ))
|
||||||
|
|
||||||
addr="169.254.${i1}.${i2}"
|
addr="169.254.${i1}.${i2}"
|
||||||
vebegin "${addr}/16"
|
vebegin "${addr}/16"
|
||||||
if ! arping_address "${addr}"; then
|
if ! arping_address "${addr}"; then
|
||||||
eval config_${config_index}="\"${addr}/16 broadcast 169.254.255.255\""
|
eval config_${config_index}="\"${addr}/16 broadcast 169.254.255.255\""
|
||||||
config_index=$((${config_index} - 1))
|
: $(( config_index -= 1 ))
|
||||||
veend 0
|
veend 0
|
||||||
eoutdent
|
eoutdent
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
i=$((${i} + 1))
|
: $(( i += 1 ))
|
||||||
done
|
done
|
||||||
|
|
||||||
eerror "No free address found!"
|
eerror "No free address found!"
|
||||||
|
|||||||
@@ -34,13 +34,13 @@ arping_address()
|
|||||||
while [ ${w} -gt 0 -a -z "${foundmac}" ]; do
|
while [ ${w} -gt 0 -a -z "${foundmac}" ]; do
|
||||||
foundmac="$(arping2 ${opts} -r -c 1 -i "${IFACE}" "${ip}" 2>/dev/null | \
|
foundmac="$(arping2 ${opts} -r -c 1 -i "${IFACE}" "${ip}" 2>/dev/null | \
|
||||||
sed -e 'y/abcdef/ABCDEF/')"
|
sed -e 'y/abcdef/ABCDEF/')"
|
||||||
w=$((${w} - 1))
|
: $(( w -= 1 ))
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
[ -z "$(_get_inet_address)" ] && opts="${opts} -D"
|
[ -z "$(_get_inet_address)" ] && opts="${opts} -D"
|
||||||
|
|
||||||
foundmac="$(arping -w "${w}" ${opts} -f -I "${IFACE}" "${ip}" 2>/dev/null | \
|
foundmac="$(arping -w "${w}" ${opts} -f -I "${IFACE}" "${ip}" 2>/dev/null | \
|
||||||
sed -n -e 'y/abcdef/ABCDEF/' -e 's/.*\[\([^]]*\)\].*/\1/p')"
|
sed -n -e 'y/abcdef/ABCDEF/' -e 's/[^[]*\[\([^]]*\)\].*/\1/p')"
|
||||||
fi
|
fi
|
||||||
[ -z "${foundmac}" ] && return 1
|
[ -z "${foundmac}" ] && return 1
|
||||||
|
|
||||||
|
|||||||
@@ -95,16 +95,28 @@ bonding_pre_start()
|
|||||||
_up
|
_up
|
||||||
|
|
||||||
# finally add in slaves
|
# finally add in slaves
|
||||||
|
# things needed in the process, and if they are done by ifenslave, openrc, and/or the kernel.
|
||||||
|
# down new slave interface: ifenslave, openrc
|
||||||
|
# set mtu: ifenslave, kernel
|
||||||
|
# set slave MAC: ifenslave, kernel
|
||||||
eoutdent
|
eoutdent
|
||||||
if [ -d /sys/class/net ]; then
|
if [ -d /sys/class/net ]; then
|
||||||
sys_bonding_path=/sys/class/net/"${IFACE}"/bonding
|
sys_bonding_path=/sys/class/net/"${IFACE}"/bonding
|
||||||
|
local oiface
|
||||||
|
oiface=$IFACE
|
||||||
if [ -n "${primary}" ]; then
|
if [ -n "${primary}" ]; then
|
||||||
|
IFACE=$primary
|
||||||
|
_down
|
||||||
|
IFACE=$oiface
|
||||||
echo "+${primary}" >$sys_bonding_path/slaves
|
echo "+${primary}" >$sys_bonding_path/slaves
|
||||||
echo "${primary}" >$sys_bonding_path/primary
|
echo "${primary}" >$sys_bonding_path/primary
|
||||||
fi
|
fi
|
||||||
for s in ${slaves}; do
|
for s in ${slaves}; do
|
||||||
[ "${s}" = "${primary}" ] && continue
|
[ "${s}" = "${primary}" ] && continue
|
||||||
if ! grep -q ${s} $sys_bonding_path/slaves; then
|
if ! grep -q ${s} $sys_bonding_path/slaves; then
|
||||||
|
IFACE=$s
|
||||||
|
_down
|
||||||
|
IFACE=$oiface
|
||||||
echo "+${s}" >$sys_bonding_path/slaves
|
echo "+${s}" >$sys_bonding_path/slaves
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|||||||
@@ -1,19 +1,10 @@
|
|||||||
# Copyright (c) 2007-2008 Roy Marples <roy@marples.name>
|
# Copyright (c) 2007-2008 Roy Marples <roy@marples.name>
|
||||||
# Released under the 2-clause BSD license.
|
# Released under the 2-clause BSD license.
|
||||||
|
|
||||||
_br2684ctl()
|
|
||||||
{
|
|
||||||
if [ -x /usr/sbin/br2684ctl ]; then
|
|
||||||
echo /usr/sbin/br2684ctl
|
|
||||||
else
|
|
||||||
echo /sbin/br2684ctl
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
br2684ctl_depend()
|
br2684ctl_depend()
|
||||||
{
|
{
|
||||||
before ppp
|
before ppp
|
||||||
program start $(_br2684ctl)
|
program start br2684ctl
|
||||||
}
|
}
|
||||||
|
|
||||||
_config_vars="$_config_vars bridge bridge_add brctl"
|
_config_vars="$_config_vars bridge bridge_add brctl"
|
||||||
@@ -42,7 +33,7 @@ br2684ctl_pre_start()
|
|||||||
esac
|
esac
|
||||||
|
|
||||||
einfo "Starting RFC 2684 Bridge control on ${IFACE}"
|
einfo "Starting RFC 2684 Bridge control on ${IFACE}"
|
||||||
start-stop-daemon --start --exec $(_br2684ctl) --background \
|
start-stop-daemon --start --exec $(_which br2684ctl) --background \
|
||||||
--make-pidfile --pidfile "/var/run/br2684ctl-${IFACE}.pid" \
|
--make-pidfile --pidfile "/var/run/br2684ctl-${IFACE}.pid" \
|
||||||
-- -c "${IFACE#nas*}" ${opts}
|
-- -c "${IFACE#nas*}" ${opts}
|
||||||
eend $?
|
eend $?
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
bridge_depend()
|
bridge_depend()
|
||||||
{
|
{
|
||||||
before interface macnet
|
before interface macnet
|
||||||
program /sbin/brctl
|
program brctl
|
||||||
}
|
}
|
||||||
|
|
||||||
_config_vars="$_config_vars bridge bridge_add brctl"
|
_config_vars="$_config_vars bridge bridge_add brctl"
|
||||||
|
|||||||
@@ -148,7 +148,7 @@ clip_post_start()
|
|||||||
|
|
||||||
local nleftretries=10 emsg= ecode=
|
local nleftretries=10 emsg= ecode=
|
||||||
while [ ${nleftretries} -gt 0 ]; do
|
while [ ${nleftretries} -gt 0 ]; do
|
||||||
nleftretries=$((${nleftretries} - 1))
|
: $(( nleftretries -= 1 ))
|
||||||
emsg="$(atmarp -s "${peerip}" "${ifvpivci}" "$@" 2>&1)"
|
emsg="$(atmarp -s "${peerip}" "${ifvpivci}" "$@" 2>&1)"
|
||||||
ecode=$? && break
|
ecode=$? && break
|
||||||
sleep 2
|
sleep 2
|
||||||
|
|||||||
@@ -1,13 +1,9 @@
|
|||||||
# Copyright (c) 2011 by Gentoo Foundation
|
# Copyright (c) 2011 by Gentoo Foundation
|
||||||
# Released under the 2-clause BSD license.
|
# Released under the 2-clause BSD license.
|
||||||
|
|
||||||
_ethtool() {
|
|
||||||
echo /usr/sbin/ethtool
|
|
||||||
}
|
|
||||||
|
|
||||||
ethtool_depend()
|
ethtool_depend()
|
||||||
{
|
{
|
||||||
program $(_ethtool)
|
program ethtool
|
||||||
before interface
|
before interface
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -31,6 +27,7 @@ ethtool_pre_start() {
|
|||||||
[ -z "${args}" ] && continue
|
[ -z "${args}" ] && continue
|
||||||
|
|
||||||
# Split on \n
|
# Split on \n
|
||||||
|
OIFS="${IFS}"
|
||||||
local IFS="$__IFS"
|
local IFS="$__IFS"
|
||||||
|
|
||||||
for p in ${args} ; do
|
for p in ${args} ; do
|
||||||
@@ -38,10 +35,11 @@ ethtool_pre_start() {
|
|||||||
local args_pretty="$(_trim "${p}")"
|
local args_pretty="$(_trim "${p}")"
|
||||||
# Do nothing if empty
|
# Do nothing if empty
|
||||||
[ -z "${args_pretty}" ] && continue
|
[ -z "${args_pretty}" ] && continue
|
||||||
|
[ "${opt}" = "ring" ] && opt="set-ring"
|
||||||
args_pretty="--${opt} $IFACE ${args_pretty}"
|
args_pretty="--${opt} $IFACE ${args_pretty}"
|
||||||
args="--${opt} $IFACE ${args}"
|
args="--${opt} $IFACE ${args}"
|
||||||
ebegin "ethtool ${args_pretty}"
|
ebegin "ethtool ${args_pretty}"
|
||||||
$(_ethtool) ${args}
|
ethtool ${args}
|
||||||
rc=$?
|
rc=$?
|
||||||
eend $rc "ethtool exit code $rc"
|
eend $rc "ethtool exit code $rc"
|
||||||
# TODO: ethtool has MANY different exit codes, with no
|
# TODO: ethtool has MANY different exit codes, with no
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ _ifindex()
|
|||||||
echo "${x#/dev/net}"
|
echo "${x#/dev/net}"
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
i=$((${i} + 1))
|
: $(( i += 1 ))
|
||||||
done
|
done
|
||||||
;;
|
;;
|
||||||
default)
|
default)
|
||||||
@@ -47,7 +47,7 @@ _ifindex()
|
|||||||
echo "${i}"
|
echo "${i}"
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
i=$((${i} + 1))
|
: $(( i += 1 ))
|
||||||
done
|
done
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
@@ -242,3 +242,23 @@ ifconfig_post_start()
|
|||||||
eend 0
|
eend 0
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Is the interface administratively/operationally up?
|
||||||
|
# The 'UP' status in ifconfig is the administrative status
|
||||||
|
# Operational state does not seem to be available in BSD?
|
||||||
|
# 0: up
|
||||||
|
# 1: down
|
||||||
|
# 2: invalid arguments
|
||||||
|
is_admin_up()
|
||||||
|
{
|
||||||
|
local iface="$1"
|
||||||
|
[ -z "$iface" ] && iface="$IFACE"
|
||||||
|
ifconfig "${iface}" | \
|
||||||
|
sed -n '1,1{ /flags=.*[<,]UP[,>]/{ q 0 }}; q 1; '
|
||||||
|
}
|
||||||
|
|
||||||
|
is_oper_up()
|
||||||
|
{
|
||||||
|
eerror "TODO: is_oper_up not available on BSD"
|
||||||
|
return 2
|
||||||
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ _ifindex()
|
|||||||
{
|
{
|
||||||
local line= i=-2
|
local line= i=-2
|
||||||
while read line; do
|
while read line; do
|
||||||
i=$((${i} + 1))
|
: $(( i += 1 ))
|
||||||
[ ${i} -lt 1 ] && continue
|
[ ${i} -lt 1 ] && continue
|
||||||
case "${line}" in
|
case "${line}" in
|
||||||
"${IFACE}:"*) echo "${i}"; return 0;;
|
"${IFACE}:"*) echo "${i}"; return 0;;
|
||||||
@@ -34,7 +34,7 @@ _ifindex()
|
|||||||
done < /proc/net/dev
|
done < /proc/net/dev
|
||||||
|
|
||||||
# Return the next available index
|
# Return the next available index
|
||||||
i=$((${i} + 1))
|
: $(( i += 1 ))
|
||||||
echo "${i}"
|
echo "${i}"
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
@@ -96,7 +96,7 @@ _get_inet_addresses()
|
|||||||
_exists || break
|
_exists || break
|
||||||
local addr="$(_get_inet_address)"
|
local addr="$(_get_inet_address)"
|
||||||
[ -n "${addr}" ] && addrs="${addrs}${addrs:+ }${addr}"
|
[ -n "${addr}" ] && addrs="${addrs}${addrs:+ }${addr}"
|
||||||
i=$((${i} + 1))
|
: $(( i += 1 ))
|
||||||
done
|
done
|
||||||
echo "${addrs}"
|
echo "${addrs}"
|
||||||
}
|
}
|
||||||
@@ -106,26 +106,26 @@ _cidr2netmask()
|
|||||||
local cidr="$1" netmask="" done=0 i=0 sum=0 cur=128
|
local cidr="$1" netmask="" done=0 i=0 sum=0 cur=128
|
||||||
local octets= frac=
|
local octets= frac=
|
||||||
|
|
||||||
local octets=$((${cidr} / 8))
|
local octets=$(( cidr / 8 ))
|
||||||
local frac=$((${cidr} % 8))
|
local frac=$(( cidr % 8 ))
|
||||||
while [ ${octets} -gt 0 ]; do
|
while [ ${octets} -gt 0 ]; do
|
||||||
netmask="${netmask}.255"
|
netmask="${netmask}.255"
|
||||||
octets=$((${octets} - 1))
|
: $(( octets -= 1 ))
|
||||||
done=$((${done} + 1))
|
: $(( done += 1 ))
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ ${done} -lt 4 ]; then
|
if [ ${done} -lt 4 ]; then
|
||||||
while [ ${i} -lt ${frac} ]; do
|
while [ ${i} -lt ${frac} ]; do
|
||||||
sum=$((${sum} + ${cur}))
|
: $(( sum += cur ))
|
||||||
cur=$((${cur} / 2))
|
: $(( cur /= 2 ))
|
||||||
i=$((${i} + 1))
|
: $(( i += 1 ))
|
||||||
done
|
done
|
||||||
netmask="${netmask}.${sum}"
|
netmask="${netmask}.${sum}"
|
||||||
done=$((${done} + 1))
|
: $(( done += 1 ))
|
||||||
|
|
||||||
while [ ${done} -lt 4 ]; do
|
while [ ${done} -lt 4 ]; do
|
||||||
netmask="${netmask}.0"
|
netmask="${netmask}.0"
|
||||||
done=$((${done} + 1))
|
: $(( done += 1 ))
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -150,7 +150,7 @@ _add_address()
|
|||||||
# Get the last alias made for the interface and add 1 to it
|
# 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]*" \
|
i=$(ifconfig | sed '1!G;h;$!d' | grep -m 1 -o "^${iface}:[0-9]*" \
|
||||||
| sed -n -e 's/'"${iface}"'://p')
|
| sed -n -e 's/'"${iface}"'://p')
|
||||||
i=$((${i:-0} + 1))
|
: $(( i = ${i:-0} + 1 ))
|
||||||
iface="${iface}:${i}"
|
iface="${iface}:${i}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -188,6 +188,12 @@ _add_route()
|
|||||||
if [ "$1" = "-A" -o "$1" = "-f" -o "$1" = "-family" ]; then
|
if [ "$1" = "-A" -o "$1" = "-f" -o "$1" = "-family" ]; then
|
||||||
family="-A $2"
|
family="-A $2"
|
||||||
shift; shift
|
shift; shift
|
||||||
|
elif [ "$1" = "-4" ]; then
|
||||||
|
family="-A inet"
|
||||||
|
shift
|
||||||
|
elif [ "$1" = "-6" ]; then
|
||||||
|
family="-A inet6"
|
||||||
|
shift
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "${metric}" ]; then
|
if [ -n "${metric}" ]; then
|
||||||
@@ -297,3 +303,26 @@ ifconfig_post_stop()
|
|||||||
iptunnel del "${IFACE}"
|
iptunnel del "${IFACE}"
|
||||||
eend $?
|
eend $?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Is the interface administratively/operationally up?
|
||||||
|
# The 'UP' status in ifconfig/iproute2 is the administrative status
|
||||||
|
# Operational state is available in iproute2 output as 'state UP', or the
|
||||||
|
# operstate sysfs variable.
|
||||||
|
# 0: up
|
||||||
|
# 1: down
|
||||||
|
# 2: invalid arguments
|
||||||
|
is_admin_up()
|
||||||
|
{
|
||||||
|
local iface="$1"
|
||||||
|
[ -z "$iface" ] && iface="$IFACE"
|
||||||
|
ifconfig "${iface}" | \
|
||||||
|
sed -n '1,1{ /flags=.*[<,]UP[,>]/{ q 0 }}; q 1; '
|
||||||
|
}
|
||||||
|
|
||||||
|
is_oper_up()
|
||||||
|
{
|
||||||
|
local iface="$1"
|
||||||
|
[ -z "$iface" ] && iface="$IFACE"
|
||||||
|
read state </sys/class/net/"${iface}"/operstate
|
||||||
|
[ "x$state" = "up" ]
|
||||||
|
}
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ ifplugd_pre_start()
|
|||||||
fi
|
fi
|
||||||
sleep 1
|
sleep 1
|
||||||
[ ${timeout} -eq 0 ] && continue
|
[ ${timeout} -eq 0 ] && continue
|
||||||
i=$((${i} + 1))
|
: $(( i += 1 ))
|
||||||
[ ${i} -ge ${timeout} ] && break
|
[ ${i} -ge ${timeout} ] && break
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|||||||
@@ -6,10 +6,18 @@ _config_vars="$_config_vars link suffix relay"
|
|||||||
ip6to4_depend()
|
ip6to4_depend()
|
||||||
{
|
{
|
||||||
after interface
|
after interface
|
||||||
|
program ip
|
||||||
}
|
}
|
||||||
|
|
||||||
ip6to4_start()
|
ip6to4_pre_start()
|
||||||
{
|
{
|
||||||
|
# ALL interfaces run pre_start blocks, not just those with something
|
||||||
|
# assigned, so we must check if we need to run on this interface before we
|
||||||
|
# do so.
|
||||||
|
local config
|
||||||
|
eval config=\$config_${IFVAR}
|
||||||
|
[ "$config" = "ip6to4" ] || return 0
|
||||||
|
|
||||||
case " ${MODULES} " in
|
case " ${MODULES} " in
|
||||||
*" ifconfig "*)
|
*" ifconfig "*)
|
||||||
if [ "${IFACE}" != "sit0" ]; then
|
if [ "${IFACE}" != "sit0" ]; then
|
||||||
@@ -19,7 +27,7 @@ ip6to4_start()
|
|||||||
fi
|
fi
|
||||||
esac
|
esac
|
||||||
|
|
||||||
local host= suffix= relay= addr= iface=${IFACE} new= localip=
|
local host= suffix= relay= addr= iface=${IFACE} config_ip6to4= localip=
|
||||||
eval host=\$link_${IFVAR}
|
eval host=\$link_${IFVAR}
|
||||||
if [ -z "${host}" ]; then
|
if [ -z "${host}" ]; then
|
||||||
eerror "link_${IFVAR} not set"
|
eerror "link_${IFVAR} not set"
|
||||||
@@ -51,7 +59,7 @@ ip6to4_start()
|
|||||||
case "${ip}" in
|
case "${ip}" in
|
||||||
172.${i}.*) break;;
|
172.${i}.*) break;;
|
||||||
esac
|
esac
|
||||||
i=$((${i} + 1))
|
: $(( i += 1 ))
|
||||||
done
|
done
|
||||||
[ ${i} -lt 32 ] && continue
|
[ ${i} -lt 32 ] && continue
|
||||||
;;
|
;;
|
||||||
@@ -67,7 +75,7 @@ ip6to4_start()
|
|||||||
veinfo "Derived IPv6 address: ${ip6}"
|
veinfo "Derived IPv6 address: ${ip6}"
|
||||||
|
|
||||||
# Now apply our IPv6 address to our config
|
# Now apply our IPv6 address to our config
|
||||||
new="${new}${new:+ }${ip6}/16"
|
config_ip6to4="${config_ip6to4}${config_ip6to4:+ }${ip6}/48"
|
||||||
|
|
||||||
if [ -n "${localip}" ]; then
|
if [ -n "${localip}" ]; then
|
||||||
localip="any"
|
localip="any"
|
||||||
@@ -76,7 +84,7 @@ ip6to4_start()
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ -z "${new}" ]; then
|
if [ -z "${config_ip6to4}" ]; then
|
||||||
eerror "No global IPv4 addresses found on interface ${host}"
|
eerror "No global IPv4 addresses found on interface ${host}"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
@@ -87,13 +95,22 @@ ip6to4_start()
|
|||||||
eend $? || return 1
|
eend $? || return 1
|
||||||
_up
|
_up
|
||||||
fi
|
fi
|
||||||
|
routes_ip6to4="2003::/3 via ::${relay} metric 2147483647"
|
||||||
|
service_set_value "config_ip6to4_$IFVAR" "$config_ip6to4"
|
||||||
|
service_set_value "routes_ip6to4_$IFVAR" "$routes_ip6to4"
|
||||||
|
}
|
||||||
|
|
||||||
|
ip6to4_start()
|
||||||
|
{
|
||||||
|
local config_ip6to4=$(service_get_value "config_ip6to4_$IFVAR")
|
||||||
|
local routes_ip6to4=$(service_get_value "routes_ip6to4_$IFVAR")
|
||||||
|
|
||||||
# Now apply our config
|
# Now apply our config
|
||||||
eval config_${config_index}=\'"${new}"\'
|
eval config_${config_index}=\'"${config_ip6to4}"\'
|
||||||
config_index=$((${config_index} - 1))
|
: $(( config_index -= 1 ))
|
||||||
|
|
||||||
# Add a route for us, ensuring we don't delete anything else
|
# Add a route for us, ensuring we don't delete anything else
|
||||||
local routes="$(_get_array "routes_${IFVAR}")
|
local routes="$(_get_array "routes_${IFVAR}")
|
||||||
2003::/3 via ::${relay} metric 2147483647"
|
$routes_ip6to4"
|
||||||
eval routes_${IFVAR}=\$routes
|
eval routes_${IFVAR}=\$routes
|
||||||
}
|
}
|
||||||
|
|||||||
154
net/iproute2.sh
154
net/iproute2.sh
@@ -1,18 +1,9 @@
|
|||||||
# Copyright (c) 2007-2008 Roy Marples <roy@marples.name>
|
# Copyright (c) 2007-2008 Roy Marples <roy@marples.name>
|
||||||
# Released under the 2-clause BSD license.
|
# Released under the 2-clause BSD license.
|
||||||
|
|
||||||
_ip()
|
|
||||||
{
|
|
||||||
if [ -x /bin/ip ]; then
|
|
||||||
echo /bin/ip
|
|
||||||
else
|
|
||||||
echo /sbin/ip
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
iproute2_depend()
|
iproute2_depend()
|
||||||
{
|
{
|
||||||
program $(_ip)
|
program ip
|
||||||
provide interface
|
provide interface
|
||||||
after ifconfig
|
after ifconfig
|
||||||
}
|
}
|
||||||
@@ -36,7 +27,7 @@ _ifindex()
|
|||||||
{
|
{
|
||||||
local line= i=-2
|
local line= i=-2
|
||||||
while read line; do
|
while read line; do
|
||||||
i=$((${i} + 1))
|
: $(( i += 1 ))
|
||||||
[ ${i} -lt 1 ] && continue
|
[ ${i} -lt 1 ] && continue
|
||||||
case "${line}" in
|
case "${line}" in
|
||||||
"${IFACE}:"*) echo "${i}"; return 0;;
|
"${IFACE}:"*) echo "${i}"; return 0;;
|
||||||
@@ -44,7 +35,7 @@ _ifindex()
|
|||||||
done < /proc/net/dev
|
done < /proc/net/dev
|
||||||
|
|
||||||
# Return the next available index
|
# Return the next available index
|
||||||
i=$((${i} + 1))
|
: $(( i += 1 ))
|
||||||
echo "${i}"
|
echo "${i}"
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
@@ -110,31 +101,54 @@ _add_address()
|
|||||||
ip addr add "$@" dev "${IFACE}" 2>/dev/null
|
ip addr add "$@" dev "${IFACE}" 2>/dev/null
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
local x
|
||||||
local address netmask broadcast peer anycast label scope
|
local address netmask broadcast peer anycast label scope
|
||||||
local valid_lft preferred_lft home nodad
|
local valid_lft preferred_lft home nodad
|
||||||
|
local confflaglist
|
||||||
address="$1" ; shift
|
address="$1" ; shift
|
||||||
while [ -n "$*" ]; do
|
while [ -n "$*" ]; do
|
||||||
case "$1" in
|
x=$1 ; shift
|
||||||
netmask)
|
case "$x" in
|
||||||
netmask="/$(_netmask2cidr "$2")" ; shift ; shift ;;
|
netmask|ne*)
|
||||||
broadcast|brd)
|
netmask="/$(_netmask2cidr "$1")" ; shift ;;
|
||||||
broadcast="broadcast $2" ; shift ; shift ;;
|
broadcast|brd|br*)
|
||||||
pointopoint|pointtopoint|peer)
|
broadcast="$1" ; shift ;;
|
||||||
peer="peer $2" ; shift ; shift ;;
|
pointopoint|pointtopoint|peer|po*|pe*)
|
||||||
anycast|label|scope|valid_lft|preferred_lft)
|
peer="$1" ; shift ;;
|
||||||
eval "$1=$2" ; shift ; shift ;;
|
anycast|label|scope|valid_lft|preferred_lft|a*|l*|s*|v*|pr*)
|
||||||
home|nodad)
|
case $x in
|
||||||
eval "$1=$1" ; shift ;;
|
a*) x=anycast ;;
|
||||||
|
l*) x=label ;;
|
||||||
|
s*) x=scope ;;
|
||||||
|
v*) x=valid_lft ;;
|
||||||
|
pr*) x=preferred_lft ;;
|
||||||
|
esac
|
||||||
|
eval "$x=$1" ; shift ;;
|
||||||
|
home|nodad|h*|no*)
|
||||||
|
case $x in h*) x=home ;; n*) x=nodad ;; esac
|
||||||
|
# FIXME: If we need to reorder these, this will take more code
|
||||||
|
confflaglist="${confflaglist} $x" ; ;;
|
||||||
|
*)
|
||||||
|
ewarn "Unknown argument to config_$IFACE: $x"
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
# Always scope lo addresses as host unless specified otherwise
|
# Always scope lo addresses as host unless specified otherwise
|
||||||
if [ "${IFACE}" = "lo" ]; then
|
if [ "${IFACE}" = "lo" ]; then
|
||||||
[ -z "$scope" ] && scope="scope host"
|
[ -z "$scope" ] && scope="host"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
set -- "${address}${netmask}" $peer $broadcast $anycast $label $scope dev "${IFACE}" $valid_lft $preferred_lft $home $nodad
|
# figure out the broadcast address if it is not specified
|
||||||
|
# This must NOT be set for IPv6 addresses
|
||||||
|
if [ "${address#*:}" = "${address}" ]; then
|
||||||
|
[ -z "$broadcast" ] && broadcast="+"
|
||||||
|
elif [ -n "$broadcast" ]; then
|
||||||
|
eerror "Broadcast keywords are not valid with IPv6 addresses"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# This must appear on a single line, continuations cannot be used
|
||||||
|
set -- "${address}${netmask}" ${peer:+peer} ${peer} ${broadcast:+broadcast} ${broadcast} ${anycast:+anycast} ${anycast} ${label:+label} ${label} ${scope:+scope} ${scope} dev "${IFACE}" ${valid_lft:+valid_lft} $valid_lft ${preferred_lft:+preferred_lft} $preferred_lft $confflaglist
|
||||||
veinfo ip addr add "$@"
|
veinfo ip addr add "$@"
|
||||||
ip addr add "$@"
|
ip addr add "$@"
|
||||||
}
|
}
|
||||||
@@ -146,6 +160,12 @@ _add_route()
|
|||||||
if [ "$1" = "-A" -o "$1" = "-f" -o "$1" = "-family" ]; then
|
if [ "$1" = "-A" -o "$1" = "-f" -o "$1" = "-family" ]; then
|
||||||
family="-f $2"
|
family="-f $2"
|
||||||
shift; shift
|
shift; shift
|
||||||
|
elif [ "$1" = "-4" ]; then
|
||||||
|
family="-f inet"
|
||||||
|
shift
|
||||||
|
elif [ "$1" = "-6" ]; then
|
||||||
|
family="-f inet6"
|
||||||
|
shift
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $# -eq 3 ]; then
|
if [ $# -eq 3 ]; then
|
||||||
@@ -208,7 +228,13 @@ _trim() {
|
|||||||
# This is our interface to Routing Policy Database RPDB
|
# This is our interface to Routing Policy Database RPDB
|
||||||
# This allows for advanced routing tricks
|
# This allows for advanced routing tricks
|
||||||
_ip_rule_runner() {
|
_ip_rule_runner() {
|
||||||
local cmd rules OIFS="${IFS}"
|
local cmd rules OIFS="${IFS}" family
|
||||||
|
if [ "$1" = "-4" -o "$1" = "-6" ]; then
|
||||||
|
family="$1"
|
||||||
|
shift
|
||||||
|
else
|
||||||
|
family="-4"
|
||||||
|
fi
|
||||||
cmd="$1"
|
cmd="$1"
|
||||||
rules="$2"
|
rules="$2"
|
||||||
veindent
|
veindent
|
||||||
@@ -218,7 +244,7 @@ _ip_rule_runner() {
|
|||||||
ruN="$(_trim "${ru}")"
|
ruN="$(_trim "${ru}")"
|
||||||
[ -z "${ruN}" ] && continue
|
[ -z "${ruN}" ] && continue
|
||||||
vebegin "${cmd} ${ruN}"
|
vebegin "${cmd} ${ruN}"
|
||||||
ip rule ${cmd} ${ru}
|
ip $family rule ${cmd} ${ru}
|
||||||
veend $?
|
veend $?
|
||||||
local IFS="$__IFS"
|
local IFS="$__IFS"
|
||||||
done
|
done
|
||||||
@@ -274,15 +300,30 @@ iproute2_post_start()
|
|||||||
if [ -e /proc/net/route ]; then
|
if [ -e /proc/net/route ]; then
|
||||||
local rules="$(_get_array "rules_${IFVAR}")"
|
local rules="$(_get_array "rules_${IFVAR}")"
|
||||||
if [ -n "${rules}" ]; then
|
if [ -n "${rules}" ]; then
|
||||||
if ! ip rule list | grep -q "^"; then
|
if ! ip -4 rule list | grep -q "^"; then
|
||||||
eerror "IP Policy Routing (CONFIG_IP_MULTIPLE_TABLES) needed for ip rule"
|
eerror "IP Policy Routing (CONFIG_IP_MULTIPLE_TABLES) needed for ip rule"
|
||||||
else
|
else
|
||||||
service_set_value "ip_rule" "${rules}"
|
service_set_value "ip_rule" "${rules}"
|
||||||
einfo "Adding RPDB rules"
|
einfo "Adding IPv4 RPDB rules"
|
||||||
_ip_rule_runner add "${rules}"
|
_ip_rule_runner -4 add "${rules}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
ip route flush table cache dev "${IFACE}"
|
ip -4 route flush table cache dev "${IFACE}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Kernel may not have IPv6 built in
|
||||||
|
if [ -e /proc/net/ipv6_route ]; then
|
||||||
|
local rules="$(_get_array "rules6_${IFVAR}")"
|
||||||
|
if [ -n "${rules}" ]; then
|
||||||
|
if ! ip -6 rule list | grep -q "^"; then
|
||||||
|
eerror "IPv6 Policy Routing (CONFIG_IPV6_MULTIPLE_TABLES) needed for ip rule"
|
||||||
|
else
|
||||||
|
service_set_value "ip6_rule" "${rules}"
|
||||||
|
einfo "Adding IPv6 RPDB rules"
|
||||||
|
_ip_rule_runner -6 add "${rules}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
ip -6 route flush table cache dev "${IFACE}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if _iproute2_ipv6_tentative; then
|
if _iproute2_ipv6_tentative; then
|
||||||
@@ -290,7 +331,7 @@ iproute2_post_start()
|
|||||||
while [ $n -ge 0 ]; do
|
while [ $n -ge 0 ]; do
|
||||||
_iproute2_ipv6_tentative || break
|
_iproute2_ipv6_tentative || break
|
||||||
sleep 1
|
sleep 1
|
||||||
n=$(($n - 1))
|
: $(( n -= 1 ))
|
||||||
done
|
done
|
||||||
[ $n -ge 0 ]
|
[ $n -ge 0 ]
|
||||||
eend $?
|
eend $?
|
||||||
@@ -305,10 +346,28 @@ iproute2_post_stop()
|
|||||||
if [ -e /proc/net/route ]; then
|
if [ -e /proc/net/route ]; then
|
||||||
local rules="$(service_get_value "ip_rule")"
|
local rules="$(service_get_value "ip_rule")"
|
||||||
if [ -n "${rules}" ]; then
|
if [ -n "${rules}" ]; then
|
||||||
einfo "Removing RPDB rules"
|
einfo "Removing IPv4 RPDB rules"
|
||||||
_ip_rule_runner del "${rules}"
|
_ip_rule_runner -4 del "${rules}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Only do something if the interface actually exist
|
||||||
|
if _exists; then
|
||||||
|
ip -4 route flush table cache dev "${IFACE}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Kernel may not have IPv6 built in
|
||||||
|
if [ -e /proc/net/ipv6_route ]; then
|
||||||
|
local rules="$(service_get_value "ip6_rule")"
|
||||||
|
if [ -n "${rules}" ]; then
|
||||||
|
einfo "Removing IPv6 RPDB rules"
|
||||||
|
_ip_rule_runner -6 del "${rules}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Only do something if the interface actually exist
|
||||||
|
if _exists; then
|
||||||
|
ip -6 route flush table cache dev "${IFACE}"
|
||||||
fi
|
fi
|
||||||
ip route flush table cache dev "${IFACE}"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Don't delete sit0 as it's a special tunnel
|
# Don't delete sit0 as it's a special tunnel
|
||||||
@@ -320,3 +379,26 @@ iproute2_post_stop()
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Is the interface administratively/operationally up?
|
||||||
|
# The 'UP' status in ifconfig/iproute2 is the administrative status
|
||||||
|
# Operational state is available in iproute2 output as 'state UP', or the
|
||||||
|
# operstate sysfs variable.
|
||||||
|
# 0: up
|
||||||
|
# 1: down
|
||||||
|
# 2: invalid arguments
|
||||||
|
is_admin_up()
|
||||||
|
{
|
||||||
|
local iface="$1"
|
||||||
|
[ -z "$iface" ] && iface="$IFACE"
|
||||||
|
ip link show dev $iface | \
|
||||||
|
sed -n '1,1{ /[<,]UP[,>]/{ q 0 }}; q 1; '
|
||||||
|
}
|
||||||
|
|
||||||
|
is_oper_up()
|
||||||
|
{
|
||||||
|
local iface="$1"
|
||||||
|
[ -z "$iface" ] && iface="$IFACE"
|
||||||
|
read state </sys/class/net/"${iface}"/operstate
|
||||||
|
[ "x$state" = "up" ]
|
||||||
|
}
|
||||||
|
|||||||
@@ -218,7 +218,7 @@ iwconfig_associate()
|
|||||||
sleep 1
|
sleep 1
|
||||||
|
|
||||||
[ ${timeout} -eq 0 ] && continue
|
[ ${timeout} -eq 0 ] && continue
|
||||||
i=$((${i} + 1))
|
: $(( i += 1 ))
|
||||||
[ ${i} -ge ${timeout} ] && { eend 1; return 1; }
|
[ ${i} -ge ${timeout} ] && { eend 1; return 1; }
|
||||||
done
|
done
|
||||||
|
|
||||||
@@ -252,13 +252,13 @@ iwconfig_scan()
|
|||||||
scan="$(LC_ALL=C ifconfig -v "${IFACE}" list scan 2>/dev/null | sed -e "1 d" -e "s/$/'/g" -e "s/^/'/g")"
|
scan="$(LC_ALL=C ifconfig -v "${IFACE}" list scan 2>/dev/null | sed -e "1 d" -e "s/$/'/g" -e "s/^/'/g")"
|
||||||
while [ ${i} -lt 3 -a -z "${scan}" ] ; do
|
while [ ${i} -lt 3 -a -z "${scan}" ] ; do
|
||||||
scan="${scan}${scan:+ }$(LC_ALL=C ifconfig -v "${IFACE}" scan 2>/dev/null | sed -e "1 d" -e "s/$/'/g" -e "s/^/'/g")"
|
scan="${scan}${scan:+ }$(LC_ALL=C ifconfig -v "${IFACE}" scan 2>/dev/null | sed -e "1 d" -e "s/$/'/g" -e "s/^/'/g")"
|
||||||
i=$((${i} + 1))
|
: $(( i += 1 ))
|
||||||
done
|
done
|
||||||
|
|
||||||
APS=-1
|
APS=-1
|
||||||
eval set -- ${scan}
|
eval set -- ${scan}
|
||||||
for line in "$@" ; do
|
for line in "$@" ; do
|
||||||
APS=$((${APS} + 1))
|
: $(( APS += 1 ))
|
||||||
set -- ${line}
|
set -- ${line}
|
||||||
while true ; do
|
while true ; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
@@ -276,7 +276,7 @@ iwconfig_scan()
|
|||||||
# Add 1000 for managed nodes as we prefer them to adhoc
|
# Add 1000 for managed nodes as we prefer them to adhoc
|
||||||
set -- $*
|
set -- $*
|
||||||
case "$1" in
|
case "$1" in
|
||||||
*E*) eval QUAL_${APS}=$((${quality} + 1000)) ;;
|
*E*) eval QUAL_${APS}=$(( quality + 1000 )) ;;
|
||||||
*) eval QUAL_${APS}=\$quality ;;
|
*) eval QUAL_${APS}=\$quality ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
@@ -290,7 +290,7 @@ iwconfig_scan()
|
|||||||
# Sort based on quality
|
# Sort based on quality
|
||||||
local i=0 k=1 a= b= x= t=
|
local i=0 k=1 a= b= x= t=
|
||||||
while [ ${i} -lt ${APS} ] ; do
|
while [ ${i} -lt ${APS} ] ; do
|
||||||
k=$((${i} + 1))
|
: $(( k = i + 1 ))
|
||||||
while [ ${k} -le ${APS} ] ; do
|
while [ ${k} -le ${APS} ] ; do
|
||||||
eval a=\$QUALITY_${i}
|
eval a=\$QUALITY_${i}
|
||||||
[ -z "${a}" ] && break
|
[ -z "${a}" ] && break
|
||||||
@@ -302,15 +302,15 @@ iwconfig_scan()
|
|||||||
eval ${x}_${k}=\$t
|
eval ${x}_${k}=\$t
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
k=$((${k} + 1))
|
: $(( k += 1 ))
|
||||||
done
|
done
|
||||||
i=$((${i} + 1))
|
: $(( i += 1 ))
|
||||||
done
|
done
|
||||||
|
|
||||||
# Strip any duplicates
|
# Strip any duplicates
|
||||||
local i=0 k=1 a= b=
|
local i=0 k=1 a= b=
|
||||||
while [ ${i} -lt ${APS} ] ; do
|
while [ ${i} -lt ${APS} ] ; do
|
||||||
k=$((${i} + 1))
|
: $(( k = i + 1 ))
|
||||||
while [ ${k} -le ${APS} ] ; do
|
while [ ${k} -le ${APS} ] ; do
|
||||||
eval a=\$MAC_${i}
|
eval a=\$MAC_${i}
|
||||||
eval b=\$MAC_${k}
|
eval b=\$MAC_${k}
|
||||||
@@ -327,9 +327,9 @@ iwconfig_scan()
|
|||||||
unset MAC_${k} SSID_${k} CHAN_${k} QUALITY_${k} CAPS_${k}
|
unset MAC_${k} SSID_${k} CHAN_${k} QUALITY_${k} CAPS_${k}
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
k=$((${k} + 1))
|
: $(( k += 1 ))
|
||||||
done
|
done
|
||||||
i=$((${i} + 1))
|
: $(( i += 1 ))
|
||||||
done
|
done
|
||||||
|
|
||||||
local i=0 e= m= s=
|
local i=0 e= m= s=
|
||||||
@@ -337,7 +337,7 @@ iwconfig_scan()
|
|||||||
while [ ${i} -le ${APS} ] ; do
|
while [ ${i} -le ${APS} ] ; do
|
||||||
eval x=\$MAC_${i}
|
eval x=\$MAC_${i}
|
||||||
if [ -z "${x}" ] ; then
|
if [ -z "${x}" ] ; then
|
||||||
i=$((${i} + 1))
|
: $(( i += 1 ))
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -374,7 +374,7 @@ iwconfig_scan()
|
|||||||
unset SSID_${i} MAC_${i} CHAN_${i} QUALITY_${i} CAPS_${i}
|
unset SSID_${i} MAC_${i} CHAN_${i} QUALITY_${i} CAPS_${i}
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
i=$((${i} + 1))
|
: $(( i += 1 ))
|
||||||
done
|
done
|
||||||
eoutdent
|
eoutdent
|
||||||
return 0
|
return 0
|
||||||
@@ -396,7 +396,7 @@ iwconfig_force_preferred()
|
|||||||
found_AP=true
|
found_AP=true
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
i=$((${i} + 1))
|
: $(( i += 1 ))
|
||||||
done
|
done
|
||||||
if ! ${found_AP} ; then
|
if ! ${found_AP} ; then
|
||||||
SSID=${ssid}
|
SSID=${ssid}
|
||||||
@@ -428,7 +428,7 @@ iwconfig_connect_preferred()
|
|||||||
iwconfig_associate "${mac}" \
|
iwconfig_associate "${mac}" \
|
||||||
"${chan}" "${caps}" && return 0
|
"${chan}" "${caps}" && return 0
|
||||||
fi
|
fi
|
||||||
i=$((${i} + 1))
|
: $(( i += 1 ))
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
|
||||||
@@ -442,7 +442,7 @@ iwconfig_connect_not_preferred()
|
|||||||
while [ ${i} -le ${APS} ] ; do
|
while [ ${i} -le ${APS} ] ; do
|
||||||
eval e=\$SSID_${i}
|
eval e=\$SSID_${i}
|
||||||
if [ -z "${e}" ] ; then
|
if [ -z "${e}" ] ; then
|
||||||
i=$((${i} + 1))
|
: $(( i += 1 ))
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -465,7 +465,7 @@ iwconfig_connect_not_preferred()
|
|||||||
iwconfig_associate "${mac}" \
|
iwconfig_associate "${mac}" \
|
||||||
"${chan}" "${caps}" && return 0
|
"${chan}" "${caps}" && return 0
|
||||||
fi
|
fi
|
||||||
i=$((${i} + 1))
|
: $(( i += 1 ))
|
||||||
done
|
done
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ _get_ssid()
|
|||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
sleep 1
|
sleep 1
|
||||||
i=$((${i} - 1))
|
: $(( i -= 1 ))
|
||||||
done
|
done
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
@@ -229,7 +229,7 @@ iwconfig_wait_for_association()
|
|||||||
|
|
||||||
sleep 1
|
sleep 1
|
||||||
[ ${timeout} -eq 0 ] && continue
|
[ ${timeout} -eq 0 ] && continue
|
||||||
i=$((${i} + 1))
|
: $(( i += 1 ))
|
||||||
[ ${i} -ge ${timeout} ] && return 1
|
[ ${i} -ge ${timeout} ] && return 1
|
||||||
done
|
done
|
||||||
return 1
|
return 1
|
||||||
@@ -347,7 +347,7 @@ iwconfig_scan()
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
i=$((${i} + 1))
|
: $(( i += 1 ))
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ -z "${scan}" ]; then
|
if [ -z "${scan}" ]; then
|
||||||
@@ -377,7 +377,7 @@ iwconfig_scan()
|
|||||||
for line; do
|
for line; do
|
||||||
case "${line}" in
|
case "${line}" in
|
||||||
*Address:*)
|
*Address:*)
|
||||||
APS=$((${APS} + 1))
|
: $(( APS += 1 ))
|
||||||
eval MAC_${APS}="\""$(echo "${line#*: }" | tr '[:lower:]' '[:upper:]')"\""
|
eval MAC_${APS}="\""$(echo "${line#*: }" | tr '[:lower:]' '[:upper:]')"\""
|
||||||
eval QUALITY_${APS}=0
|
eval QUALITY_${APS}=0
|
||||||
;;
|
;;
|
||||||
@@ -427,7 +427,7 @@ iwconfig_scan()
|
|||||||
# Sort based on quality
|
# Sort based on quality
|
||||||
local i=0 k=1 a= b= x= t=
|
local i=0 k=1 a= b= x= t=
|
||||||
while [ ${i} -lt ${APS} ]; do
|
while [ ${i} -lt ${APS} ]; do
|
||||||
k=$((${i} + 1))
|
: $(( k = i + 1 ))
|
||||||
while [ ${k} -le ${APS} ]; do
|
while [ ${k} -le ${APS} ]; do
|
||||||
eval a=\$QUALITY_${i}
|
eval a=\$QUALITY_${i}
|
||||||
[ -z "${a}" ] && break
|
[ -z "${a}" ] && break
|
||||||
@@ -439,15 +439,15 @@ iwconfig_scan()
|
|||||||
eval ${x}_${k}=\$t
|
eval ${x}_${k}=\$t
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
k=$((${k} + 1))
|
: $(( k += 1 ))
|
||||||
done
|
done
|
||||||
i=$((${i} + 1))
|
: $(( i += 1 ))
|
||||||
done
|
done
|
||||||
|
|
||||||
# Strip any duplicates
|
# Strip any duplicates
|
||||||
local i=0 k=1 a= b=
|
local i=0 k=1 a= b=
|
||||||
while [ ${i} -lt ${APS} ]; do
|
while [ ${i} -lt ${APS} ]; do
|
||||||
k=$((${i} + 1))
|
: $(( k = i + 1 ))
|
||||||
while [ ${k} -le ${APS} ]; do
|
while [ ${k} -le ${APS} ]; do
|
||||||
eval a=\$MAC_${i}
|
eval a=\$MAC_${i}
|
||||||
eval b=\$MAC_${k}
|
eval b=\$MAC_${k}
|
||||||
@@ -459,9 +459,9 @@ iwconfig_scan()
|
|||||||
[ -n "${a}" -a -n "${b}" ] && [ "${a}" -lt "${b}" ] && u=${i}
|
[ -n "${a}" -a -n "${b}" ] && [ "${a}" -lt "${b}" ] && u=${i}
|
||||||
unset MAC_${u} SSID_${u} MODE_${u} CHAN_${u} QUALITY_${u} ENC_${u}
|
unset MAC_${u} SSID_${u} MODE_${u} CHAN_${u} QUALITY_${u} ENC_${u}
|
||||||
fi
|
fi
|
||||||
k=$((${k} + 1))
|
: $(( k += 1 ))
|
||||||
done
|
done
|
||||||
i=$((${i} + 1))
|
: $(( i += 1 ))
|
||||||
done
|
done
|
||||||
|
|
||||||
local i=0 e= m= s=
|
local i=0 e= m= s=
|
||||||
@@ -469,7 +469,7 @@ iwconfig_scan()
|
|||||||
while [ ${i} -le ${APS} ]; do
|
while [ ${i} -le ${APS} ]; do
|
||||||
eval x=\$MAC_${i}
|
eval x=\$MAC_${i}
|
||||||
if [ -z "${x}" ]; then
|
if [ -z "${x}" ]; then
|
||||||
i=$((${i} + 1))
|
: $(( i += 1 ))
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -506,7 +506,7 @@ iwconfig_scan()
|
|||||||
unset SSID_${i} MAC_${i} ${MODE}_${i} CHAN_${i} QUALITY_${i} ENC_${i}
|
unset SSID_${i} MAC_${i} ${MODE}_${i} CHAN_${i} QUALITY_${i} ENC_${i}
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
i=$((${i} + 1))
|
: $(( i += 1 ))
|
||||||
done
|
done
|
||||||
eoutdent
|
eoutdent
|
||||||
}
|
}
|
||||||
@@ -526,7 +526,7 @@ iwconfig_force_preferred()
|
|||||||
found_AP=true
|
found_AP=true
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
i=$((${i} + 1))
|
: $(( i += 1 ))
|
||||||
done
|
done
|
||||||
if ! ${found_AP}; then
|
if ! ${found_AP}; then
|
||||||
SSID=${ssid}
|
SSID=${ssid}
|
||||||
@@ -559,7 +559,7 @@ iwconfig_connect_preferred()
|
|||||||
iwconfig_associate "${mode}" "${mac}" "${enc}" "${freq}" \
|
iwconfig_associate "${mode}" "${mac}" "${enc}" "${freq}" \
|
||||||
"${chan}" && return 0
|
"${chan}" && return 0
|
||||||
fi
|
fi
|
||||||
i=$((${i} + 1))
|
: $(( i += 1 ))
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
|
||||||
@@ -593,7 +593,7 @@ iwconfig_connect_not_preferred()
|
|||||||
"${chan}" && return 0
|
"${chan}" && return 0
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
i=$((${i} + 1))
|
: $(( i += 1 ))
|
||||||
done
|
done
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
macchanger_depend()
|
macchanger_depend()
|
||||||
{
|
{
|
||||||
before macnet
|
before macnet
|
||||||
|
# no program 'macchanger', as we have partial functionality without it
|
||||||
}
|
}
|
||||||
|
|
||||||
_config_vars="$_config_vars mac"
|
_config_vars="$_config_vars mac"
|
||||||
|
|||||||
53
net/macvlan.sh
Normal file
53
net/macvlan.sh
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
# 2011-09-22 Stef Simoens <stef@bgs.org>
|
||||||
|
# based on vlan.sh & tuntap.sh
|
||||||
|
# Copyright (c) 2007-2008 Roy Marples <roy@marples.name>
|
||||||
|
# All rights reserved. Released under the 2-clause BSD license.
|
||||||
|
|
||||||
|
macvlan_depend()
|
||||||
|
{
|
||||||
|
program ip
|
||||||
|
after interface
|
||||||
|
before dhcp macchanger
|
||||||
|
}
|
||||||
|
|
||||||
|
_is_macvlan()
|
||||||
|
{
|
||||||
|
[ -n "$(export RC_SVCNAME="net.${IFACE}"; service_get_value macvlan)" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
macvlan_pre_start()
|
||||||
|
{
|
||||||
|
# MAC-VLAN needs an existing interface to link to
|
||||||
|
local macvlan=
|
||||||
|
eval macvlan=\$macvlan_${IFVAR}
|
||||||
|
[ -z "${macvlan}" ] && return 0
|
||||||
|
|
||||||
|
case " ${MODULES} " in
|
||||||
|
*" ifconfig "*)
|
||||||
|
eerror "sys-apps/iproute2 is required to configure MACVLANs"
|
||||||
|
return 1 ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# optional mode, default to "private"
|
||||||
|
local mode=
|
||||||
|
eval mode=\$mode_${IFVAR}
|
||||||
|
[ -z "${mode}" ] && mode="private"
|
||||||
|
|
||||||
|
ebegin "Creating MAC-VLAN ${IFACE} to ${macvlan}"
|
||||||
|
e="$(ip link add link "${macvlan}" name "${IFACE}" type macvlan mode "${mode}" 2>&1 1>/dev/null)"
|
||||||
|
if [ -n "${e}" ]; then
|
||||||
|
eend 1 "${e}"
|
||||||
|
else
|
||||||
|
eend 0 && _up && service_set_value macvlan "${macvlan}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
macvlan_post_stop()
|
||||||
|
{
|
||||||
|
_is_macvlan || return 0
|
||||||
|
|
||||||
|
ebegin "Removing MAC-VLAN ${IFACE}"
|
||||||
|
ip link delete "${IFACE}" type macvlan >/dev/null
|
||||||
|
eend $?
|
||||||
|
}
|
||||||
@@ -74,7 +74,7 @@ netplugd_pre_start()
|
|||||||
fi
|
fi
|
||||||
sleep 1
|
sleep 1
|
||||||
[ ${timeout} -eq 0 ] && continue
|
[ ${timeout} -eq 0 ] && continue
|
||||||
i=$((${i} + 1))
|
: $(( i += 1 ))
|
||||||
[ ${i} -ge ${timeout} ] && break
|
[ ${i} -ge ${timeout} ] && break
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ pppd_pre_start()
|
|||||||
if ! ${hasdefaultmetric}; then
|
if ! ${hasdefaultmetric}; then
|
||||||
local m=
|
local m=
|
||||||
eval m=\$metric_${IFVAR}
|
eval m=\$metric_${IFVAR}
|
||||||
[ -z "${m}" ] && m=$((${metric} + $(_ifindex)))
|
[ -z "${m}" ] && : $(( m = metric + $(_ifindex) ))
|
||||||
opts="${opts} defaultmetric ${m}"
|
opts="${opts} defaultmetric ${m}"
|
||||||
fi
|
fi
|
||||||
if [ -n "${mtu}" ]; then
|
if [ -n "${mtu}" ]; then
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ system_depend()
|
|||||||
|
|
||||||
_system_dns()
|
_system_dns()
|
||||||
{
|
{
|
||||||
local servers= domain= search= sortlist= options= x=
|
local servers= domain= search= sortlist= options= x= imetric=
|
||||||
|
|
||||||
eval servers=\$dns_servers_${IFVAR}
|
eval servers=\$dns_servers_${IFVAR}
|
||||||
[ -z "${servers}" ] && servers=${dns_servers}
|
[ -z "${servers}" ] && servers=${dns_servers}
|
||||||
@@ -46,7 +46,12 @@ _system_dns()
|
|||||||
|
|
||||||
# Support resolvconf if we have it.
|
# Support resolvconf if we have it.
|
||||||
if [ -x /sbin/resolvconf ]; then
|
if [ -x /sbin/resolvconf ]; then
|
||||||
printf "${buffer}" | resolvconf -a "${IFACE}"
|
x="-a ${IFACE}"
|
||||||
|
eval imetric=\${metric_${IFVAR}}
|
||||||
|
if [ -n "${imetric}" ]; then
|
||||||
|
x="${x} -m ${imetric}"
|
||||||
|
fi
|
||||||
|
printf "${buffer}" | resolvconf ${x}
|
||||||
else
|
else
|
||||||
printf "${buffer}" > /etc/resolv.conf
|
printf "${buffer}" > /etc/resolv.conf
|
||||||
chmod 644 /etc/resolv.conf
|
chmod 644 /etc/resolv.conf
|
||||||
|
|||||||
@@ -4,9 +4,10 @@
|
|||||||
tuntap_depend()
|
tuntap_depend()
|
||||||
{
|
{
|
||||||
before bridge interface macchanger
|
before bridge interface macchanger
|
||||||
|
program ip openvpn tunctl
|
||||||
}
|
}
|
||||||
|
|
||||||
_config_vars="$_config_vars tunctl"
|
_config_vars="$_config_vars iproute2 openvpn tunctl"
|
||||||
|
|
||||||
_is_tuntap()
|
_is_tuntap()
|
||||||
{
|
{
|
||||||
@@ -16,6 +17,7 @@ _is_tuntap()
|
|||||||
tuntap_pre_start()
|
tuntap_pre_start()
|
||||||
{
|
{
|
||||||
local tuntap=
|
local tuntap=
|
||||||
|
local rc=
|
||||||
eval tuntap=\$tuntap_${IFVAR}
|
eval tuntap=\$tuntap_${IFVAR}
|
||||||
|
|
||||||
[ -z "${tuntap}" ] && return 0
|
[ -z "${tuntap}" ] && return 0
|
||||||
@@ -30,7 +32,7 @@ tuntap_pre_start()
|
|||||||
local timeout=10
|
local timeout=10
|
||||||
while [ ! -e /dev/net/tun -a ${timeout} -gt 0 ]; do
|
while [ ! -e /dev/net/tun -a ${timeout} -gt 0 ]; do
|
||||||
sleep 1
|
sleep 1
|
||||||
timeout=$((${timeout} - 1))
|
: $(( timeout -= 1 ))
|
||||||
done
|
done
|
||||||
if [ ! -e /dev/net/tun ]; then
|
if [ ! -e /dev/net/tun ]; then
|
||||||
eerror "TUN/TAP support present but /dev/net/tun is not"
|
eerror "TUN/TAP support present but /dev/net/tun is not"
|
||||||
@@ -44,27 +46,42 @@ tuntap_pre_start()
|
|||||||
# Set the base metric to 1000
|
# Set the base metric to 1000
|
||||||
metric=1000
|
metric=1000
|
||||||
|
|
||||||
local o_opts= t_opts= do_openvpn=false do_tunctl=false
|
local i_opts= o_opts= t_opts=
|
||||||
|
local do_iproute2=false do_openvpn=false do_tunctl=false
|
||||||
|
eval i_opts=\$iproute2_${IFVAR}
|
||||||
eval o_opts=\$openvpn_${IFVAR}
|
eval o_opts=\$openvpn_${IFVAR}
|
||||||
eval t_opts=\$tunctl_${IFVAR}
|
eval t_opts=\$tunctl_${IFVAR}
|
||||||
|
|
||||||
if [ -n "${o_opts}" ] && type openvpn >/dev/null 2>&1; then
|
if [ -n "${i_opts}" ] && type ip >/dev/null 2>&1; then
|
||||||
|
do_iproute2=true
|
||||||
|
elif [ -n "${o_opts}" ] && type openvpn >/dev/null 2>&1; then
|
||||||
do_openvpn=true
|
do_openvpn=true
|
||||||
elif [ -n "${t_opts}" ] && type tunctl >/dev/null 2>&1; then
|
elif [ -n "${t_opts}" ] && type tunctl >/dev/null 2>&1; then
|
||||||
do_tunctl=true
|
do_tunctl=true
|
||||||
|
elif type ip >/dev/null 2>&1; then
|
||||||
|
do_iproute2=true
|
||||||
elif type openvpn >/dev/null 2>&1; then
|
elif type openvpn >/dev/null 2>&1; then
|
||||||
do_openvpn=true
|
do_openvpn=true
|
||||||
else
|
elif type tunctl >/dev/null 2>&1; then
|
||||||
do_tunctl=true
|
do_tunctl=true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ${do_openvpn}; then
|
if ${do_iproute2}; then
|
||||||
|
ip tuntap add dev "${IFACE}" mode "${tuntap}" ${i_opts}
|
||||||
|
rc=$?
|
||||||
|
elif ${do_openvpn}; then
|
||||||
openvpn --mktun --dev-type "${tuntap}" --dev "${IFACE}" \
|
openvpn --mktun --dev-type "${tuntap}" --dev "${IFACE}" \
|
||||||
${o_opts} >/dev/null
|
${o_opts} >/dev/null
|
||||||
else
|
rc=$?
|
||||||
|
elif ${do_tunctl}; then
|
||||||
tunctl ${t_opts} -t "${IFACE}" >/dev/null
|
tunctl ${t_opts} -t "${IFACE}" >/dev/null
|
||||||
|
rc=$?
|
||||||
|
else
|
||||||
|
eerror "Neither iproute2, openvpn nor tunctl has been found, please install"
|
||||||
|
eerror "either \"iproute2\" \"openvpn\" or \"usermode-utilities\"."
|
||||||
|
rc=1
|
||||||
fi
|
fi
|
||||||
eend $? && _up && service_set_value tuntap "${tuntap}"
|
eend $rc && _up && service_set_value tuntap "${tuntap}"
|
||||||
}
|
}
|
||||||
|
|
||||||
tuntap_post_stop()
|
tuntap_post_stop()
|
||||||
@@ -72,7 +89,9 @@ tuntap_post_stop()
|
|||||||
_is_tuntap || return 0
|
_is_tuntap || return 0
|
||||||
|
|
||||||
ebegin "Destroying Tun/Tap interface ${IFACE}"
|
ebegin "Destroying Tun/Tap interface ${IFACE}"
|
||||||
if type tunctl >/dev/null 2>&1; then
|
if type ip > /dev/null 2>&1; then
|
||||||
|
ip tuntap del dev ${IFACE} mode $(service_get_value tuntap)
|
||||||
|
elif type tunctl >/dev/null 2>&1; then
|
||||||
tunctl -d "${IFACE}" >/dev/null
|
tunctl -d "${IFACE}" >/dev/null
|
||||||
else
|
else
|
||||||
openvpn --rmtun \
|
openvpn --rmtun \
|
||||||
|
|||||||
35
net/vlan.sh
35
net/vlan.sh
@@ -1,18 +1,9 @@
|
|||||||
# Copyright (c) 2007-2008 Roy Marples <roy@marples.name>
|
# Copyright (c) 2007-2008 Roy Marples <roy@marples.name>
|
||||||
# Released under the 2-clause BSD license.
|
# Released under the 2-clause BSD license.
|
||||||
|
|
||||||
_ip()
|
|
||||||
{
|
|
||||||
if [ -x /bin/ip ]; then
|
|
||||||
echo /bin/ip
|
|
||||||
else
|
|
||||||
echo /sbin/ip
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
vlan_depend()
|
vlan_depend()
|
||||||
{
|
{
|
||||||
program $(_ip)
|
program ip
|
||||||
after interface
|
after interface
|
||||||
before dhcp
|
before dhcp
|
||||||
}
|
}
|
||||||
@@ -51,6 +42,14 @@ vlan_pre_start()
|
|||||||
eerror "You must convert your vconfig_ VLAN entries to vlan${N} entries."
|
eerror "You must convert your vconfig_ VLAN entries to vlan${N} entries."
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
local vlans=
|
||||||
|
eval vlans=\$vlans_${IFVAR}
|
||||||
|
[ -z "$vlans" ] && return 0
|
||||||
|
case " ${MODULES} " in
|
||||||
|
*" ifconfig "*)
|
||||||
|
eerror "sys-apps/iproute2 is required to configure VLANs"
|
||||||
|
return 1 ;;
|
||||||
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
vlan_post_start()
|
vlan_post_start()
|
||||||
@@ -77,7 +76,17 @@ vlan_post_start()
|
|||||||
eval vegress=\$vlan${vlan}_egress
|
eval vegress=\$vlan${vlan}_egress
|
||||||
[ -z "${vegress}" ] || vegress="egress-qos-map ${vegress}"
|
[ -z "${vegress}" ] || vegress="egress-qos-map ${vegress}"
|
||||||
|
|
||||||
e="$(ip link add link "${IFACE}" name "${vname}" type vlan id "${vlan}" ${vflags} ${vingress} ${vegress} 2>&1 1>/dev/null)"
|
local txqueuelen=
|
||||||
|
eval txqueuelen=\$txqueuelen_vlan${vlan}
|
||||||
|
local mac=
|
||||||
|
eval mac=\$mac_vlan${vlan}
|
||||||
|
local broadcast=
|
||||||
|
eval broadcast=\$broadcast_vlan${vlan}
|
||||||
|
local mtu=
|
||||||
|
eval mtu=\$mtu_vlan${vlan}
|
||||||
|
local opts="${txqueuelen:+txqueuelen} ${txqueuelen} ${mac:+address} ${mac} ${broadcast:+broadcast} ${broadcast} ${mtu:+mtu} ${mtu}"
|
||||||
|
|
||||||
|
e="$(ip link add link "${IFACE}" name "${vname}" ${opts} type vlan id "${vlan}" ${vflags} ${vingress} ${vegress} 2>&1 1>/dev/null)"
|
||||||
if [ -n "${e}" ]; then
|
if [ -n "${e}" ]; then
|
||||||
eend 1 "${e}"
|
eend 1 "${e}"
|
||||||
continue
|
continue
|
||||||
@@ -101,10 +110,12 @@ vlan_post_start()
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
vlan_post_stop()
|
vlan_pre_stop()
|
||||||
{
|
{
|
||||||
local vlan=
|
local vlan=
|
||||||
|
|
||||||
|
_exists || return 0
|
||||||
|
|
||||||
for vlan in $(_get_vlans); do
|
for vlan in $(_get_vlans); do
|
||||||
einfo "Removing VLAN ${vlan##*.} from ${IFACE}"
|
einfo "Removing VLAN ${vlan##*.} from ${IFACE}"
|
||||||
(
|
(
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ _get_ssid()
|
|||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
sleep 1
|
sleep 1
|
||||||
timeout=$((timeout - 1))
|
: $(( timeout -= 1 ))
|
||||||
done
|
done
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
BOOT= bootmisc fsck hostname localmount network \
|
BOOT= bootmisc fsck hostname localmount \
|
||||||
root staticroute swap sysctl urandom
|
root swap sysctl urandom ${BOOT-${OS}}
|
||||||
DEFAULT= local netmount
|
DEFAULT= local netmount
|
||||||
SHUTDOWN= savecache
|
SHUTDOWN= savecache ${SHUTDOWN-${OS}}
|
||||||
|
SYSINIT= ${SYSINIT-${OS}}
|
||||||
|
|
||||||
LEVELDIR= ${DESTDIR}/${SYSCONFDIR}/runlevels
|
LEVELDIR= ${DESTDIR}/${SYSCONFDIR}/runlevels
|
||||||
SYSINITDIR= ${LEVELDIR}/sysinit
|
SYSINITDIR= ${LEVELDIR}/sysinit
|
||||||
@@ -9,13 +10,30 @@ BOOTDIR= ${LEVELDIR}/boot
|
|||||||
DEFAULTDIR= ${LEVELDIR}/default
|
DEFAULTDIR= ${LEVELDIR}/default
|
||||||
SHUTDOWNDIR= ${LEVELDIR}/shutdown
|
SHUTDOWNDIR= ${LEVELDIR}/shutdown
|
||||||
|
|
||||||
INITDIR= ../init.d
|
|
||||||
|
|
||||||
MK= ../mk
|
MK= ../mk
|
||||||
include ${MK}/sys.mk
|
include ${MK}/sys.mk
|
||||||
include ${MK}/os.mk
|
include ${MK}/os.mk
|
||||||
include ${MK}/gitignore.mk
|
include ${MK}/gitignore.mk
|
||||||
include Makefile.${OS}
|
|
||||||
|
BOOT-${OS}=
|
||||||
|
SHUTDOWN-${OS}=
|
||||||
|
SYSINIT-${OS}=
|
||||||
|
|
||||||
|
BOOT-BSD= hostid newsyslog savecore syslogd swap-blk
|
||||||
|
|
||||||
|
# Generic BSD stuff
|
||||||
|
BOOT-FreeBSD= hostid net.lo0 newsyslog savecore syslogd
|
||||||
|
# FreeBSD specific stuff
|
||||||
|
BOOT-FreeBSD+= adjkerntz dumpon syscons
|
||||||
|
|
||||||
|
BOOT-Linux= hwclock keymaps modules mtab net.lo procfs termencoding
|
||||||
|
SHUTDOWN-Linux= killprocs mount-ro
|
||||||
|
SYSINIT-Linux= devfs dmesg
|
||||||
|
|
||||||
|
# Generic BSD stuff
|
||||||
|
BOOT-NetBSD= hostid net.lo0 newsyslog savecore syslogd
|
||||||
|
# NetBSD specific stuff
|
||||||
|
BOOT-NetBSD+= devdb swap-blk ttys wscons
|
||||||
|
|
||||||
all:
|
all:
|
||||||
|
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
BOOT+= hostid newsyslog savecore syslogd swap-blk
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
# Generic BSD stuff
|
|
||||||
BOOT+= hostid net.lo0 newsyslog savecore syslogd
|
|
||||||
|
|
||||||
# FreeBSD specific stuff
|
|
||||||
BOOT+= adjkerntz dumpon syscons
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
SYSINIT+= devfs dmesg
|
|
||||||
BOOT+= hwclock keymaps modules mtab procfs termencoding
|
|
||||||
SHUTDOWN+= killprocs mount-ro
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
# Generic BSD stuff
|
|
||||||
BOOT+= hostid net.lo0 newsyslog savecore syslogd
|
|
||||||
|
|
||||||
# NetBSD specific stuff
|
|
||||||
BOOT+= devdb swap-blk ttys wscons
|
|
||||||
@@ -3,14 +3,14 @@
|
|||||||
# Copyright (c) 2007-2009 Roy Marples <roy@marples.name>
|
# Copyright (c) 2007-2009 Roy Marples <roy@marples.name>
|
||||||
|
|
||||||
# Exit 0 if on AC power, 1 if not and 255 if we don't know how to work it out
|
# Exit 0 if on AC power, 1 if not and 255 if we don't know how to work it out
|
||||||
if [ -f /proc/acpi/ac_adapter/AC*/state ]; then
|
if [ -f /proc/acpi/ac_adapter/*/state ]; then
|
||||||
cat /proc/acpi/ac_adapter/AC*/state | while read line; do
|
cat /proc/acpi/ac_adapter/*/state | while read line; do
|
||||||
case "$line" in
|
case "$line" in
|
||||||
"state:"*"off-line") exit 128;;
|
"state:"*"off-line") exit 128;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
elif [ -f /sys/class/power_supply/AC*/online ]; then
|
elif [ -f /sys/class/power_supply/*/online ]; then
|
||||||
cat /sys/class/power_supply/AC*/online | while read line; do
|
cat /sys/class/power_supply/*/online | while read line; do
|
||||||
[ "${line}" = 0 ] && exit 128
|
[ "${line}" = 0 ] && exit 128
|
||||||
done
|
done
|
||||||
elif [ -f /proc/pmu/info ]; then
|
elif [ -f /proc/pmu/info ]; then
|
||||||
|
|||||||
20
sh/Makefile
20
sh/Makefile
@@ -1,16 +1,28 @@
|
|||||||
DIR= ${LIBEXECDIR}/sh
|
DIR= ${LIBEXECDIR}/sh
|
||||||
SRCS= functions.sh.in gendepends.sh.in init-common-post.sh.in \
|
SRCS= init.sh.in functions.sh.in gendepends.sh.in init-common-post.sh.in \
|
||||||
rc-functions.sh.in runscript.sh.in
|
rc-functions.sh.in runscript.sh.in ${SRCS-${OS}}
|
||||||
INC= init-common-post.sh rc-mount.sh functions.sh rc-functions.sh
|
INC= init-common-post.sh rc-mount.sh functions.sh rc-functions.sh
|
||||||
BIN= gendepends.sh init.sh runscript.sh
|
BIN= gendepends.sh init.sh runscript.sh ${BIN-${OS}}
|
||||||
|
|
||||||
INSTALLAFTER= _installafter
|
INSTALLAFTER= _installafter
|
||||||
|
|
||||||
MK= ../mk
|
MK= ../mk
|
||||||
include ${MK}/os.mk
|
include ${MK}/os.mk
|
||||||
include Makefile.${OS}
|
|
||||||
|
SRCS-FreeBSD=
|
||||||
|
BIN-FreeBSD=
|
||||||
|
|
||||||
|
SRCS-Linux= cgroup-release-agent.sh.in init-early.sh.in udhcpc-hook.sh.in
|
||||||
|
BIN-Linux= cgroup-release-agent.sh init-early.sh udhcpc-hook.sh
|
||||||
|
|
||||||
|
SRCS-NetBSD= ifwatchd-carrier.sh.in ifwatchd-nocarrier.sh.in
|
||||||
|
BIN-NetBSD= ifwatchd-carrier.sh ifwatchd-nocarrier.sh
|
||||||
|
|
||||||
include ${MK}/scripts.mk
|
include ${MK}/scripts.mk
|
||||||
|
|
||||||
|
%.sh: %.sh${SFX}
|
||||||
|
${SED} ${SED_REPLACE} ${SED_EXTRA} $< > $@
|
||||||
|
|
||||||
_installafter:
|
_installafter:
|
||||||
${INSTALL} -d ${DESTDIR}/${INITDIR}
|
${INSTALL} -d ${DESTDIR}/${INITDIR}
|
||||||
@# Put functions.sh into init for backwards compat
|
@# Put functions.sh into init for backwards compat
|
||||||
|
|||||||
@@ -1,6 +0,0 @@
|
|||||||
SRCS+= init.sh.in
|
|
||||||
|
|
||||||
.SUFFIXES: .sh.BSD.in
|
|
||||||
.sh.BSD.in.sh:
|
|
||||||
${SED} ${SED_REPLACE} ${SED_EXTRA} $< > $@
|
|
||||||
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user