Compare commits

..

22 Commits

Author SHA1 Message Date
Daniel Robbins
7cd9ea5eff merging latest gentoo stuff 2011-07-02 20:31:33 -06:00
Daniel Robbins
7146e99855 Revert "Unprivileged users (such as services for example) should not be able view who is logged into system."
This reverts commit 62bd337494.

It's a bit too restrictive for a default install, as it also prevents "who" from working on user accounts.
2011-06-20 22:14:53 -06:00
Daniel Robbins
e65ce9e301 Merge remote-tracking branch 'gentoo/master' 2011-06-04 17:04:04 -06:00
Daniel Robbins
6a5e6f1ee0 openrc-0.7.0 upstream merge 2011-01-20 14:00:29 -07:00
Piotr Karbowski
d8ce5dccb2 openrc-0.6.8 2010-12-16 11:17:34 +01:00
Piotr Karbowski
62bd337494 Unprivileged users (such as services for example) should not be able view who is logged into system. 2010-12-16 10:04:46 +01:00
Jory A. Pratt
06c8bd0156 Fix for make-3.82 breakage. 2010-12-03 20:06:34 -07:00
Daniel Robbins
33803219d4 openrc-0.6.5 2010-11-26 17:02:16 -07:00
Jory A. Pratt
18c08a9d4d remove 'use hostname' bug 340991, Thanks Diego 2010-11-26 16:59:28 -07:00
William Hubbs
2406dc4f3e allow net_fs_list to be extended but not replaced
This fixes bug #342825.
2010-11-26 16:59:18 -07:00
Diego Elio Pettenò
8e6d461a7f Allow cleaning up of pam_mktemp-based temporary directories.
This was blacklisted before, so the .private directories never had their
content cleaned up, even if WIPE_TMP was set to yes.
2010-11-26 16:57:37 -07:00
William Hubbs
472a3bb99c remove support for local.start and local.stop for bug #343709
The openrc ebuild now migrates these files to /etc/conf.d/local, so we
do not need to support them.
2010-11-26 16:53:54 -07:00
William Hubbs
c9a2085699 add warnings about local.start and local.stop for bug #343709
We need to warn users that they should be using /etc/conf.d/local
instead of /etc/conf.d/local.start and /etc/conf.d/local.stop. This adds
those warnings.
2010-11-26 16:53:50 -07:00
William Hubbs
69169b7e95 update documentation for rc_interactive
rc_interactive is automatically disabled if rc_parallel is set to YES.
Update the documentation in rc.conf to reflect this.
This fixes bug #327305.
2010-11-26 16:53:37 -07:00
William Hubbs
3a11f8af34 remove "use hostname" from sysctl for bsd systems 2010-11-26 16:51:42 -07:00
William Hubbs
e2e5b27d85 do not mount local file systems with the _netdev option in fstab
This fixes #344947.
2010-11-26 16:51:20 -07:00
Daniel Robbins
f343360741 0.6.4 release 2010-10-27 23:43:30 -06:00
Brant Gurganus
694fd2027f correction for unmounting volumes with weird characters 2010-10-24 13:08:38 -04:00
Daniel Robbins
ca76764743 Merge branch 'master' of github.com:funtoo/openrc 2010-10-20 19:21:48 -06:00
Jory A. Pratt
19bd9923d7 surpress output of loadkeys, fix setfont path check 2010-10-20 19:21:02 -06:00
Brant Gurganus
2a844e1122 corrected a typo 2010-10-20 16:26:01 -04:00
Daniel Robbins
5135412978 fixing history, one step at a time 2010-08-16 19:09:26 -06:00
130 changed files with 641 additions and 903 deletions

View File

@@ -4,7 +4,12 @@
include Makefile.inc include Makefile.inc
SUBDIR= conf.d doc etc init.d local.d man net scripts sh src SUBDIR= conf.d etc init.d local.d man 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

View File

@@ -1,3 +1,3 @@
NAME= openrc NAME= openrc
VERSION= 0.9.6 VERSION= 0.8.3
PKG= ${NAME}-${VERSION} PKG= ${NAME}-${VERSION}

76
README
View File

@@ -1,8 +1,9 @@
OpenRC README OpenRC README
=============
Installation Installation
------------ ------------
make install make install
Yup, that simple. Works with GNU make. Yup, that simple. Works with GNU make.
@@ -14,9 +15,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
@@ -67,33 +68,54 @@ init.d.misc is not installed by default as the scripts will need
tweaking on a per distro basis. They are also non essential to the operation tweaking on a per distro basis. They are also non essential to the operation
of the system. of the system.
Reporting Bugs Reporting Bugs
--------------
Since Gentoo Linux is hosting OpenRC development, Bugs should go to
the Gentoo Bugzilla:
http://bugs.gentoo.org/
They should be filed under the "Gentoo Hosted Projects" product and
the "openrc" component.
If you installed OpenRC from your chosen distribution, you should report
bugs directly to them. For example, if you use Gentoo and emerged OpenRC
then you should reports bugs to http://bugs.gentoo.org.
History - by Roy Marples History - by Daniel Robbins
------------------------ ---------------------------
I became a Gentoo/Linux developer in 2004 and wrote the modular network
scripts for the Gentoo baselayout package. baselayout is a collection of
bash scripts to bring up your computer and its services.
Then towards the end of 2005 I found myself as the primary maintainer
for baselayout.
At the start of 2007, baselayout-2 is announced to the world, re-writing the The Gentoo modular network scripts were created by Daniel Robbins for
core of baselayout in C and allowing POSIX sh init scripts instead of Gentoo Linux 1.0_rc6, in development during most of 2001 and released
forcing the use of bash. By Mid 2007 I have re-written everything, including in September 2001. After their development, the dependency-based initscript
init scripts, and alpha and pre baselayout-2 snapshots where put into Gentoo. system was maintained by a number of senior developers, primarily Martin
Towards the end of 2007 I retired as a Gentoo developer for reasons I won't Schlemmer (azarah).
go into here. baselayout-2 was still in the pre stage, and aside from the
fbsd users, it was masked everywhere. However, I also desired to keep the
baselayout-2 project alive, but outside of Gentoo and into other projects
such as FreeBSD.
As such, the Gentoo Council have allowed the creation of OpenRC under the excerpt from http://www.gentoo.org/news/en/gwn/20040426-newsletter.xml
2 clause BSD license, managed by me as an external project. by Grant Goodyear:
"My recollection is that one of woodchip's more impressive early feats was the
complete replacement of all of the init scripts in Portage for Gentoo Linux
1.0_rc6. Through 1.0_rc5 Gentoo had used fairly standard rc scripts modified
from Stampede Linux, but for 1.0_rc6 Daniel Robbins (drobbins) and Martin
Schlemmer (azarah) had created a new dependency-based init script system that
is still used today. Within a span of days Donny rewrote every single init
script in the Portage tree and committed new masked packages to await the
release of 1.0_rc6. Thanks to woodchip (and drobbins and azarah, of course) the
transition to the new init scripts was nearly painless."
Roy Marples became a Gentoo/Linux developer in 2004 and maintained the modular
network scripts for the Gentoo baselayout package. Then towards the end of
2005, he became the the primary maintainer for baselayout.
At the start of 2007, Roy Marples announced the ongoing development of
baselayout-2, containing a rewritten initscript code in C and allowing POSIX sh
init scripts instead of forcing the use of bash. By Mid 2007 Roy Marples had
re-implemented the Gentoo initscript design created by Daniel Robbins, using an
entirely new code base. Alpha and pre-release baselayout-2 snapshots were
added to Gentoo's Portage tree as an optional component.
Towards the end of 2007, Roy Marples retired as a Gentoo developer Baselayout-2
was still in the pre stage, and aside from the fbsd users, it was masked
everywhere. However, Roy Marples desired to keep the baselayout-2 project
alive, but outside of Gentoo and into other projects such as FreeBSD.
As such, the Gentoo Council permitted Roy Marples to release OpenRC under the 2
clause BSD license, managed by him as an external project. Around mid-2010, Roy
Marples decided to no longer maintain OpenRC. At this point, he transferred
development back to Gentoo, which continues to maintain the scripts. In
addition, Daniel Robbins continues to maintain an independent version OpenRC
for Funtoo Linux, which includes a Funtoo-specific network configuration
system.

40
README.newnet Normal file
View File

@@ -0,0 +1,40 @@
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.

51
STYLE
View File

@@ -32,54 +32,3 @@ void foo(int c)
return ret; return ret;
} }
##################
# COMMIT MESSAGES #
##################
The following is an example of a correctly formatted git commit message
for this repository. Most of this information came from this blog post
[1], so I would like to thank the author.
### cut here ###
Capitalized, short (50 chars or less) summary
More detailed explanatory text, if necessary. Wrap it to about 72
characters or so. In some contexts, the first line is treated as the
subject of an email and the rest of the text as the body. The blank
line separating the summary from the body is critical (unless you omit
the body entirely); tools like rebase can get confused if you run the
two together.
Write your commit message in the present tense: "Fix bug" and not "Fixed
bug." This convention matches up with commit messages generated by
commands like git merge and git revert.
Further paragraphs come after blank lines.
- Bullet points are okay, too
- Typically a hyphen or asterisk is used for the bullet, preceded by a
single space, with blank lines in between, but conventions vary here
- Use a hanging indent
Reported-by: User Name <email>
X-[Distro]-Bug: BugID
X-[Distro]-Bug-URL: URL for the bug (on the distribution's web site typically)
### cut here ###
If you did not write the code and the patch does not include authorship
information in a format git can use, please use the --author option of the
git commit command to make the authorship correct.
The Reported-by tag is required if the person who reported the bug is
different from the author and committer.
The X-[Distro]-Bug/Bug-URL tags are required if this commit is related
to a bug reported to us by a specific distribution of linux or a
*BSD. Also, [Distro] should be replaced with the name of the
distribution, e.g. X-Gentoo-Bug.
[1] http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html

View File

@@ -1,23 +1,19 @@
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
network: network.in network${SFX} SOS?= BSD
cat $^ > $@
staticroute: staticroute${SFX} network: network.in network.${SOS}
cp $@${SFX} $@ cp $@.in $@
[ -e $@.${SOS} ] && cat $@.${SOS} >> $@ || true
staticroute: staticroute.${SOS}
cp $@.${SOS} $@

1
conf.d/Makefile.FreeBSD Normal file
View File

@@ -0,0 +1 @@
CONF+= ipfw moused powerd rarpd savecore syscons

2
conf.d/Makefile.Linux Normal file
View File

@@ -0,0 +1,2 @@
CONF+= consolefont dmesg hwclock keymaps killprocs modules
SOS= Linux

1
conf.d/Makefile.NetBSD Normal file
View File

@@ -0,0 +1 @@
CONF+= moused rarpd savecore

View File

@@ -4,7 +4,3 @@ 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"

View File

@@ -13,13 +13,6 @@
#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.

View File

@@ -1,10 +1,8 @@
# You can define a list modules for a specific kernel version, # You can define a list modules for a specific kernel version,
# a released kernel version, a main kernel version or just a list. # a released kernel version, a main kernel version or just a list.
# The most specific versioned variable will take precedence.
#modules_2_6_23_gentoo_r5="ieee1394 ohci1394" #modules_2_6_23_gentoo_r5="ieee1394 ohci1394"
#modules_2_6_23="tun ieee1394" #modules_2_6_23="tun ieee1394"
#modules_2_6="tun" #modules_2_6="tun"
#modules_2="ipv6"
#modules="ohci1394" #modules="ohci1394"
# You can give modules a different name when they load - the new name # You can give modules a different name when they load - the new name
@@ -12,12 +10,10 @@
#modules="dummy:dummy1" #modules="dummy:dummy1"
# Give the modules some arguments if needed, per version if necessary. # Give the modules some arguments if needed, per version if necessary.
# Again, the most specific versioned variable will take precedence.
#module_ieee1394_args="debug" #module_ieee1394_args="debug"
#module_ieee1394_args_2_6_23_gentoo_r5="debug2" #module_ieee1394_args_2_6_23_gentoo_r5="ieee1394 ohci1394"
#module_ieee1394_args_2_6_23="debug3" #module_ieee1394_args_2_6_23="tun ieee1394"
#module_ieee1394_args_2_6="debug4" #module_ieee1394_args_2_6="tun"
#module_ieee1394_args_2="debug5"
# You should consult your kernel documentation and configuration # You should consult your kernel documentation and configuration
# for a list of modules and their options. # for a list of modules and their options.

View File

@@ -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 :]!).

View File

@@ -1,11 +1,7 @@
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

5
doc/Makefile.FreeBSD Normal file
View File

@@ -0,0 +1,5 @@
SRCS+= net.example.in
.SUFFIXES: .BSD.in
.BSD.in:
${CP} $< $@

5
doc/Makefile.Linux Normal file
View File

@@ -0,0 +1,5 @@
SRCS+= net.example.in
.SUFFIXES: .Linux.in
.Linux.in:
${CP} $< $@

5
doc/Makefile.NetBSD Normal file
View File

@@ -0,0 +1,5 @@
SRCS+= net.example.in
.SUFFIXES: .BSD.in
.BSD.in:
${CP} $< $@

View File

@@ -350,7 +350,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 it to wait, you can specify how long in seconds. # If you would like to, so 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,18 +581,6 @@
# 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
@@ -839,9 +827,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 15 #brctl_br0="setfd 0
#sethello 2 #sethello 0
#stp on" #stp off"
# 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

View File

@@ -1,33 +1,17 @@
DIR= ${SYSCONFDIR} DIR= ${SYSCONFDIR}
SRCS= rc.conf.in rc.in rc.shutdown.in CONF= rc.conf
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:^:\#:'

4
etc/Makefile.FreeBSD Normal file
View File

@@ -0,0 +1,4 @@
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

2
etc/Makefile.Linux Normal file
View File

@@ -0,0 +1,2 @@
SED_EXTRA= -e 's:@TERM@:wsvt25:g'
SRCS+= rc.conf.in rc.in rc.shutdown.in

3
etc/Makefile.NetBSD Normal file
View File

@@ -0,0 +1,3 @@
SED_EXTRA= -e 's:@TERM@:wsvt25:g'
SRCS+= rc.conf.in rc.in rc.shutdown.in
BIN+= rc rc.shutdown

View File

@@ -47,10 +47,6 @@
# logging can take place and as such cannot log the sysinit runlevel. # logging can take place and as such cannot log the sysinit runlevel.
#rc_logger="YES" #rc_logger="YES"
# Through rc_log_path you can specify a custom log file.
# The default value is: /var/log/rc.log
#rc_log_path="/var/log/rc.log"
# By default we filter the environment for our running scripts. To allow other # By default we filter the environment for our running scripts. To allow other
# variables through, add them here. Use a * to allow all variables through. # variables through, add them here. Use a * to allow all variables through.
#rc_env_allow="VAR1 VAR2" #rc_env_allow="VAR1 VAR2"

View File

@@ -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}

View File

@@ -0,0 +1 @@
PKG_PREFIX?= /usr/local

View File

@@ -0,0 +1 @@
PKG_PREFIX?=/usr

View File

@@ -0,0 +1 @@
PKG_PREFIX?= /usr/pkg

View File

@@ -1,42 +1,25 @@
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 ${SRCS-${OS}} sysctl.in urandom.in
BIN= ${OBJS} BIN= ${OBJS}
INSTALLAFTER= _installafter_net.lo # Build our old net foo or not
CLEANFILES+= net.lo ifeq (${MKOLDNET},yes)
TARGETS+= net.lo _OLDNET= 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 migrate-run.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-${OS}} ${INSTALL} -m ${BINMODE} net.lo ${DESTDIR}/${INITDIR}/${NET_LO}

13
init.d/Makefile.FreeBSD Normal file
View File

@@ -0,0 +1,13 @@
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} $< > $@

9
init.d/Makefile.Linux Normal file
View File

@@ -0,0 +1,9 @@
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} $< > $@

12
init.d/Makefile.NetBSD Normal file
View File

@@ -0,0 +1,12 @@
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} $< > $@

View File

@@ -10,13 +10,12 @@ depend()
keyword -prefix -timeout keyword -prefix -timeout
} }
dir_writable() dir_writeable()
{ {
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()
{ {
@@ -25,7 +24,7 @@ cleanup_tmp_dir()
if ! [ -d "$dir" ]; then if ! [ -d "$dir" ]; then
mkdir -p "$dir" || return $? mkdir -p "$dir" || return $?
fi fi
dir_writable "$dir" || return 1 dir_writeable "$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
@@ -89,7 +88,7 @@ start()
fi fi
done done
if dir_writable /var/run; then if dir_writeable /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
@@ -131,7 +130,7 @@ start()
cleanup_tmp_dir "$tmp" cleanup_tmp_dir "$tmp"
done done
if dir_writable /tmp; then if dir_writeable /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
@@ -143,13 +142,11 @@ start()
fi fi
fi fi
if yesno $log_dmesg; then if $logw || dir_writeable /var/log; then
if $logw || dir_writable /var/log; then # Create an 'after-boot' dmesg log
# Create an 'after-boot' dmesg log if [ "$RC_SYS" != VSERVER -a "$RC_SYS" != OPENVZ ]; then
if [ "$RC_SYS" != VSERVER -a "$RC_SYS" != OPENVZ ]; then dmesg > /var/log/dmesg
dmesg > /var/log/dmesg chmod 640 /var/log/dmesg
chmod 640 /var/log/dmesg
fi
fi fi
fi fi

View File

@@ -49,7 +49,7 @@ start()
retval=1 retval=1
break break
fi fi
: $(( x += 1 )) x=$(($x + 1))
done done
eend $retval eend $retval

View File

@@ -11,7 +11,7 @@ depend()
start() start()
{ {
ebegin "Building the dev database" ebegin "Bulding the dev database"
if [ /var/run/dev.db -nt /dev ]; then if [ /var/run/dev.db -nt /dev ]; then
: :
else else

View File

@@ -19,7 +19,7 @@ start() {
} }
stop() { stop() {
ebegin "Deactivating kernel core dump device" ebegin "Deactiving kernel core dump device"
dumpon off dumpon off
eend $? eend $?
} }

View File

@@ -48,13 +48,8 @@ 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
@@ -63,16 +58,10 @@ 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" -a -z "$fsck_mnt" ]; then if [ -z "$fsck_passno" ]; 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.$$
@@ -102,7 +91,7 @@ start()
_reboot _reboot
fi;; fi;;
8) ewend 1 "Operational error"; return 0;; 8) ewend 1 "Operational error"; return 0;;
12) ewend 1 "fsck interrupted";; 12) ewend 1 "fsck interupted";;
*) eend 2 "Filesystems couldn't be fixed";; *) eend 2 "Filesystems couldn't be fixed";;
esac esac
_abort || return 1 _abort || return 1

View File

@@ -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"

View File

@@ -59,7 +59,7 @@ start() {
return 1 return 1
fi fi
# Use a stateful firewall # Use a statefull 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 stateful filter is a bit aggressive, and will cause some # The statefull filter is a bit agressive, 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

View File

@@ -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 += 1 )) n=$(($n + 1))
done done
eend 0 eend 0

View File

@@ -16,7 +16,7 @@ start()
{ {
# Mount local filesystems in /etc/fstab. # Mount local filesystems in /etc/fstab.
local types="noproc" x= no_netdev= local types="noproc" x= no_netdev=
for x in $net_fs_list $extra_net_fs_list; do for x in $net_fs_list; do
types="${types},${x}" types="${types},${x}"
done done
@@ -34,17 +34,19 @@ 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}"
# Bug 381783 no_umounts_r="${no_umounts_r}|/bin|/sbin|/lib|/libexec"
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 OIFS=$IFS SIFS=${IFS-y}
IFS=$IFS:
for x in $no_umounts $RC_NO_UMOUNTS; do for x in $no_umounts $RC_NO_UMOUNTS; do
no_umounts_r="$no_umounts_r|$x" no_umounts_r="$no_umounts_r|$x"
done done
if [ "$SIFS" = y ]; then
IFS=$OIFS
else
unset IFS
fi
if [ "$RC_UNAME" = Linux ]; then if [ "$RC_UNAME" = Linux ]; then
no_umounts_r="$no_umounts_r|/proc|/proc/.*|/run|/sys|/sys/.*" no_umounts_r="$no_umounts_r|/proc|/proc/.*|/run|/sys|/sys/.*"
@@ -68,12 +70,12 @@ stop()
einfo "Unmounting filesystems" einfo "Unmounting filesystems"
eindent eindent
local fs= local fs=
for x in $net_fs_list $extra_net_fs_list; do for x in $net_fs_list; do
fs="$fs${fs:+|}$x" fs="$fs${fs:+|}$x"
done done
[ -n "$fs" ] && fs="^($fs)$" [ -n "$fs" ] && fs="^($fs)$"
do_unmount umount --skip-point-regex "$no_umounts_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

View File

@@ -1,28 +0,0 @@
#!@PREFIX@/sbin/runscript
# Copyright 1999-2011 Gentoo Foundation
# Released under the 2-clause BSD license.
description="Migrate /var/run and /var/lock to /run"
depend()
{
before *
after localmount
}
start()
{
return 0
}
stop()
{
if [ -d /run -a ! -L /var/lock -a ! -L /var/run ]; then
ebegin "Migrating /var/lock and /var/run to /run"
rm -rf /var/lock /var/run
ln -s /var/lock /run/lock
ln -s /var/run /run
eend 0
fi
return 0
}

View File

@@ -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

View File

@@ -16,21 +16,18 @@ start()
# support compiled in ... # support compiled in ...
[ ! -f /proc/modules ] && return 0 [ ! -f /proc/modules ] && return 0
local KV x y kv_variant_list local KV=$(uname -r)
KV=$(uname -r) local KV_MAJOR=${KV%%.*}
# full $KV local x=${KV#*.}
kv_variant_list="${KV}" local KV_MINOR=${x%%.*}
# remove any KV_EXTRA options to just get the full version x=${KV#*.*.}
x=${KV%%-*} local KV_MICRO=${x%%-*}
# now slowly strip them
while [ -n "$x" ] && [ "$x" != "$y" ]; do
kv_variant_list="${kv_variant_list} $x"
y=$x
x=${x%.*}
done
local list= x= xx= y= args= mpargs= cnt=0 a= local list= x= xx= y= args= mpargs= cnt=0 a=
for x in $kv_variant_list ; do for x in "$KV" \
$KV_MAJOR.$KV_MINOR.$KV_MICRO \
$KV_MAJOR.$KV_MINOR \
; do
eval list=\$modules_$(shell_var "$x") eval list=\$modules_$(shell_var "$x")
[ -n "$list" ] && break [ -n "$list" ] && break
done done
@@ -48,7 +45,10 @@ start()
fi fi
aa=$(shell_var "$a") aa=$(shell_var "$a")
xx=$(shell_var "$x") xx=$(shell_var "$x")
for y in $kv_variant_list ; do for y in "$KV" \
$KV_MAJOR.$KV_MINOR.$KV_MICRO \
$KV_MAJOR.$KV_MINOR \
; do
eval args=\$module_${aa}_args_$(shell_var "$y") eval args=\$module_${aa}_args_$(shell_var "$y")
[ -n "${args}" ] && break [ -n "${args}" ] && break
eval args=\$module_${xx}_args_$(shell_var "$y") eval args=\$module_${xx}_args_$(shell_var "$y")
@@ -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 += 1 )) eend $? "Failed to load $x" && cnt=$(($cnt + 1))
done done
einfo "Autoloaded $cnt module(s)" einfo "Autoloaded $cnt module(s)"
} }

View File

@@ -19,26 +19,28 @@ 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=
# Bug 381783 m="$m|/bin|/sbin|/lib|/libexec"
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 OIFS=$IFS SIFS=${IFS-y} IFS=$IFS
IFS=$IFS:
for x in $no_umounts $RC_NO_UMOUNTS; do for x in $no_umounts $RC_NO_UMOUNTS; do
m="$m|$x" m="$m|$x"
done done
if [ "$SIFS" = y ]; then
IFS=$OIFS
else
unset IFS
fi
m="^($m)$" m="^($m)$"
fs= fs=
for x in $net_fs_list $extra_net_fs_list; do for x in $net_fs_list; do
fs="$fs${fs:+|}$x" fs="$fs${fs:+|}$x"
done done
[ -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 $?
} }

View File

@@ -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

View File

@@ -12,9 +12,9 @@ depend()
start() start()
{ {
if [ -L /etc/mtab ] # /etc/mtab could be a symlink to /proc/mounts
then if [ ! -w /etc/mtab -a -L /etc/mtab ]; then
einfo "Skipping mtab update (mtab is a symbolic link)" eeinfo "Skipping mtab update (non writeable symlink)"
return 0 return 0
fi fi

View File

@@ -42,25 +42,12 @@ 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=
if [ -n "${BASH}" ]; then if [ -n "${BASH}" ]; then
case "$(declare -p "$1" 2>/dev/null)" in case "$(declare -p "$1" 2>/dev/null)" in
"declare -a "*) "declare -a "*)
ewarn "You are using a bash array for $1."
ewarn "This feature will be removed in the future."
ewarn "Please see net.example for the correct format for $1."
eval "set -- \"\${$1[@]}\"" eval "set -- \"\${$1[@]}\""
for _a; do for _a; do
printf "%s\n" "${_a}" printf "%s\n" "${_a}"
@@ -70,7 +57,10 @@ _get_array()
esac esac
fi fi
_array_helper $1 eval _a=\$$1
printf "%s" "${_a}"
printf "\n"
[ -n "${_a}" ]
} }
# Flatten bash arrays to simple strings # Flatten bash arrays to simple strings
@@ -79,9 +69,6 @@ _flatten_array()
if [ -n "${BASH}" ]; then if [ -n "${BASH}" ]; then
case "$(declare -p "$1" 2>/dev/null)" in case "$(declare -p "$1" 2>/dev/null)" in
"declare -a "*) "declare -a "*)
ewarn "You are using a bash array for $1."
ewarn "This feature will be removed in the future."
ewarn "Please see net.example for the correct format for $1."
eval "set -- \"\${$1[@]}\"" eval "set -- \"\${$1[@]}\""
for x; do for x; do
printf "'%s' " "$(printf "$x" | sed "s:':'\\\'':g")" printf "'%s' " "$(printf "$x" | sed "s:':'\\\'':g")"
@@ -91,7 +78,10 @@ _flatten_array()
esac esac
fi fi
_array_helper $1 eval _a=\$$1
printf "%s" "${_a}"
printf "\n"
[ -n "${_a}" ]
} }
_wait_for_carrier() _wait_for_carrier()
@@ -115,7 +105,7 @@ _wait_for_carrier()
eend 0 eend 0
return 0 return 0
fi fi
: $(( timeout -= 1 )) timeout=$((${timeout} - 1))
[ "${efunc}" = "einfon" ] && printf "." [ "${efunc}" = "einfon" ] && printf "."
done done
@@ -144,9 +134,9 @@ _netmask2cidr()
local i= len= local i= len=
local IFS=. local IFS=.
for i in $1; do for i in $1; do
while [ ${i} -ne 0 ]; do while [ ${i} != "0" ]; do
: $(( len += i % 2 )) len=$((${len} + ${i} % 2))
: $(( i >>= 1 )) i=$((${i} >> 1))
done done
done done
@@ -277,7 +267,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 += 1 )) i=$((${i} + 1))
done done
echo "module_${i}=" >> "${MODULESLIST}" echo "module_${i}=" >> "${MODULESLIST}"
) )
@@ -304,7 +294,7 @@ _load_modules()
local i=-1 x= mod= f= provides= local i=-1 x= mod= f= provides=
while true; do while true; do
: $(( i += 1 )) i=$((${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
@@ -438,7 +428,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 += 1 )) config_index=$((${config_index} + 1))
done done
# Terminate the list # Terminate the list
eval config_${config_index}= eval config_${config_index}=
@@ -446,7 +436,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 += 1 )) config_index=$((${config_index} + 1))
done done
# Terminate the list # Terminate the list
eval fallback_${config_index}= eval fallback_${config_index}=
@@ -541,7 +531,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 += $(_ifindex) )) metric=$((${metric} + $(_ifindex)))
fi fi
while true; do while true; do
@@ -549,9 +539,7 @@ start()
[ -z "${config}" ] && break [ -z "${config}" ] && break
set -- ${config} set -- ${config}
if [ "$1" != "null" -a "$1" != "noop" ]; then ebegin "$1"
ebegin "$1"
fi
eindent eindent
case "$1" in case "$1" in
noop) noop)
@@ -581,11 +569,11 @@ start()
eindent eindent
eval config_${config_index}=\$config eval config_${config_index}=\$config
unset fallback_${config_index} unset fallback_${config_index}
: $(( config_index -= 1 )) config_index=$((${config_index} - 1))
fi fi
fi fi
eoutdent eoutdent
: $(( config_index += 1 )) config_index=$((${config_index} + 1))
done done
if ! ${oneworked}; then if ! ${oneworked}; then

View File

@@ -44,7 +44,7 @@ start()
[ -x @SYSCONFDIR@/init.d/rpcbind ] && pmap="rpcbind" [ -x @SYSCONFDIR@/init.d/rpcbind ] && pmap="rpcbind"
local x= fs= rc= local x= fs= rc=
for x in $net_fs_list $extra_net_fs_list; do for x in $net_fs_list; do
case "$x" in case "$x" in
nfs|nfs4) nfs|nfs4)
# If the nfsmount script took care of the nfs # If the nfsmount script took care of the nfs
@@ -81,7 +81,7 @@ stop()
ebegin "Unmounting network filesystems" ebegin "Unmounting network filesystems"
. "$RC_LIBEXECDIR"/sh/rc-mount.sh . "$RC_LIBEXECDIR"/sh/rc-mount.sh
for x in $net_fs_list $extra_net_fs_list; do for x in $net_fs_list; do
fs="$fs${fs:+,}$x" fs="$fs${fs:+,}$x"
done done
if [ -n "$fs" ]; then if [ -n "$fs" ]; then
@@ -90,7 +90,7 @@ stop()
eindent eindent
fs= fs=
for x in $net_fs_list $extra_net_fs_list; do for x in $net_fs_list; do
fs="$fs${fs:+|}$x" fs="$fs${fs:+|}$x"
done done
[ -n "$fs" ] && fs="^($fs)$" [ -n "$fs" ] && fs="^($fs)$"

View File

@@ -219,12 +219,6 @@ 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
@@ -287,7 +281,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 -= 1 )) r=$(($r - 1))
done done
if [ $r != 5 ]; then if [ $r != 5 ]; then
[ $r != 0 ] [ $r != 0 ]

View File

@@ -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 += 1 )) i=$(($i + 1))
done done
return $retval return $retval

View File

@@ -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 -a ! -e /proc/sys/fs/binfmt_misc/register ]; then if [ -d /proc/sys/fs/binfmt_misc ] \
&& ! 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
if eend $? ; then eend $?
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

View File

@@ -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

View File

@@ -93,11 +93,6 @@ 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"
} }

View File

@@ -16,9 +16,7 @@ depend()
start() start()
{ {
ebegin "Setting the local clock based on last shutdown time" ebegin "Setting the local clock based on last shutdown time"
if ! swclock 2> /dev/null; then swclock --warn
swclock --warn @PREFIX@/sbin/runscript
fi
eend $? eend $?
} }

View File

@@ -50,37 +50,6 @@ 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
# Setup Kernel Support for cgroup
if [ -d /sys/fs/cgroup ]; then
if grep -qs cgroup /proc/filesystems && \
! mountinfo -q /sys/fs/cgroup; then
ebegin "Mounting cgroup filesystem"
mount -n -t tmpfs -o nodev,noexec,nosuid \
cgroup /sys/fs/cgroup
eend $?
fi
if ! mountinfo -q /sys/fs/cgroup/openrc; then
ebegin "creating openrc control group"
mkdir /sys/fs/cgroup/openrc
mount -n -t cgroup -o nodev,noexec,nosuid \
openrc /sys/fs/cgroup/openrc
echo 1 > /sys/fs/cgroup/openrc/notify_on_release
echo @LIBEXECDIR@/sh/cgroup-release-agent.sh \
> /sys/fs/cgroup/openrc/release_agent
eend
fi
fi
} }
start() start()

View File

@@ -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 += 1 )) n=$(($n + 1))
done done
# Save the encoding for use immediately at boot # Save the encoding for use immediately at boot

View File

@@ -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

View File

@@ -105,7 +105,8 @@ and
respectively, but only work when respectively, but only work when
.Va EINFO_VERBOSE .Va EINFO_VERBOSE
is true. You can also make the is true. You can also make the
.Fn einfo .Fn einfo ,
.Fn ewarn ,
and and
.Fn ebegin .Fn ebegin
functions silent by setting functions silent by setting

View File

@@ -93,9 +93,6 @@ 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
@@ -449,7 +446,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
@@ -465,6 +462,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.

View File

@@ -8,22 +8,18 @@ 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}
_LIBS+= lib${LIB}.a SOBJS+= ${OBJS:.o=.So}
endif _LIBS= lib${LIB}.a ${SHLIB_NAME}
_LIBS+= ${SHLIB_NAME}
CLEANFILES+= ${OBJS} ${SOBJS} ${_LIBS} ${SHLIB_LINK} CLEANFILES+= ${OBJS} ${SOBJS} ${_LIBS} ${SHLIB_LINK}
%.o: %.c .SUFFIXES: .So
.c.o:
${CC} ${CFLAGS} ${CPPFLAGS} -c $< -o $@ ${CC} ${CFLAGS} ${CPPFLAGS} -c $< -o $@
%.So: %.c .c.So:
${CC} ${PICFLAG} -DPIC ${CPPFLAGS} ${CFLAGS} -c $< -o $@ ${CC} ${PICFLAG} -DPIC ${CPPFLAGS} ${CFLAGS} -c $< -o $@
all: depend ${_LIBS} all: depend ${_LIBS}
@@ -45,10 +41,8 @@ ${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}

View File

@@ -3,7 +3,4 @@
# Generic definitions # Generic definitions
PKG_PREFIX?= /usr/local
SFX= .BSD.in
LIBKVM?= -lkvm LIBKVM?= -lkvm

View File

@@ -1,8 +1,5 @@
# 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

View File

@@ -9,3 +9,4 @@ OS?= ${_OS}
include ${MK}/os-${OS}.mk include ${MK}/os-${OS}.mk
RC_LIB= /$(LIBNAME)/rc RC_LIB= /$(LIBNAME)/rc

View File

@@ -24,7 +24,7 @@ CLEANFILES+= ${OBJS} ${PROG}
all: depend ${PROG} all: depend ${PROG}
%.o: %.c .c.o:
${CC} ${CFLAGS} ${CPPFLAGS} -c $< -o $@ ${CC} ${CFLAGS} ${CPPFLAGS} -c $< -o $@
${PROG}: ${SCRIPTS} ${OBJS} ${PROG}: ${SCRIPTS} ${OBJS}

View File

@@ -15,10 +15,11 @@ _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
%.sh: %.sh.in .SUFFIXES: .sh.in .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}

View File

@@ -1,24 +1,9 @@
DIR= ${LIBEXECDIR}/net DIR= ${LIBEXECDIR}/net
SRCS= ifconfig.sh.in ${SRCS-${OS}} SRCS= ifconfig.sh.in
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 ${INC-${OS}} ssidnet.sh system.sh wpa_supplicant.sh
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

6
net/Makefile.FreeBSD Normal file
View File

@@ -0,0 +1,6 @@
SRCS+= iwconfig.sh.in
INC+= iwconfig.sh
.SUFFIXES: .sh.BSD.in
.sh.BSD.in.sh:
${CP} $< $@

9
net/Makefile.Linux Normal file
View File

@@ -0,0 +1,9 @@
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} $< $@

5
net/Makefile.NetBSD Normal file
View File

@@ -0,0 +1,5 @@
INC+= ifwatchd.sh
.SUFFIXES: .sh.BSD.in
.sh.BSD.in.sh:
${CP} $< $@

View File

@@ -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 -= 1 )) config_index=$((${config_index} - 1))
veend 0 veend 0
eoutdent eoutdent
return 0 return 0
fi fi
: $(( i += 1 )) i=$((${i} + 1))
done done
eerror "No free address found!" eerror "No free address found!"

View File

@@ -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 -= 1 )) w=$((${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

View File

@@ -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 -= 1 )) nleftretries=$((${nleftretries} - 1))
emsg="$(atmarp -s "${peerip}" "${ifvpivci}" "$@" 2>&1)" emsg="$(atmarp -s "${peerip}" "${ifvpivci}" "$@" 2>&1)"
ecode=$? && break ecode=$? && break
sleep 2 sleep 2

View File

@@ -29,9 +29,8 @@ ethtool_pre_start() {
# Skip everything if no arguments # Skip everything if no arguments
[ -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
@@ -39,7 +38,6 @@ 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}"

View File

@@ -38,7 +38,7 @@ _ifindex()
echo "${x#/dev/net}" echo "${x#/dev/net}"
return 0 return 0
fi fi
: $(( i += 1 )) i=$((${i} + 1))
done done
;; ;;
default) default)
@@ -47,7 +47,7 @@ _ifindex()
echo "${i}" echo "${i}"
return 0 return 0
fi fi
: $(( i += 1 )) i=$((${i} + 1))
done done
;; ;;
esac esac

View File

@@ -26,7 +26,7 @@ _ifindex()
{ {
local line= i=-2 local line= i=-2
while read line; do while read line; do
: $(( i += 1 )) i=$((${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 += 1 )) i=$((${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 += 1 )) i=$((${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 -= 1 )) octets=$((${octets} - 1))
: $(( done += 1 )) done=$((${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 += cur )) sum=$((${sum} + ${cur}))
: $(( cur /= 2 )) cur=$((${cur} / 2))
: $(( i += 1 )) i=$((${i} + 1))
done done
netmask="${netmask}.${sum}" netmask="${netmask}.${sum}"
: $(( done += 1 )) done=$((${done} + 1))
while [ ${done} -lt 4 ]; do while [ ${done} -lt 4 ]; do
netmask="${netmask}.0" netmask="${netmask}.0"
: $(( done += 1 )) done=$((${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

View File

@@ -72,7 +72,7 @@ ifplugd_pre_start()
fi fi
sleep 1 sleep 1
[ ${timeout} -eq 0 ] && continue [ ${timeout} -eq 0 ] && continue
: $(( i += 1 )) i=$((${i} + 1))
[ ${i} -ge ${timeout} ] && break [ ${i} -ge ${timeout} ] && break
done done

View File

@@ -51,7 +51,7 @@ ip6to4_start()
case "${ip}" in case "${ip}" in
172.${i}.*) break;; 172.${i}.*) break;;
esac esac
: $(( i += 1 )) i=$((${i} + 1))
done done
[ ${i} -lt 32 ] && continue [ ${i} -lt 32 ] && continue
;; ;;
@@ -90,7 +90,7 @@ ip6to4_start()
# Now apply our config # Now apply our config
eval config_${config_index}=\'"${new}"\' eval config_${config_index}=\'"${new}"\'
: $(( config_index -= 1 )) config_index=$((${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}")

View File

@@ -36,7 +36,7 @@ _ifindex()
{ {
local line= i=-2 local line= i=-2
while read line; do while read line; do
: $(( i += 1 )) i=$((${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 +44,7 @@ _ifindex()
done < /proc/net/dev done < /proc/net/dev
# Return the next available index # Return the next available index
: $(( i += 1 )) i=$((${i} + 1))
echo "${i}" echo "${i}"
return 1 return 1
} }
@@ -111,32 +111,38 @@ _add_address()
return 0 return 0
fi fi
local address netmask broadcast peer anycast label scope # Convert an ifconfig line to iproute2
local valid_lft preferred_lft home nodad if [ "$2" = "netmask" ]; then
address="$1" ; shift local one="$1" three="$3"
while [ -n "$*" ]; do shift; shift; shift
case "$1" in set -- "${one}/$(_netmask2cidr "${three}")" "$@"
netmask) fi
netmask="/$(_netmask2cidr "$2")" ; shift ; shift ;;
broadcast|brd) # tunnel keyword is 'peer' in iproute2, but 'pointopoint' in ifconfig.
broadcast="broadcast $2" ; shift ; shift ;; if [ "$2" = "pointopoint" ]; then
pointopoint|pointtopoint|peer) local one="$1"
peer="peer $2" ; shift ; shift ;; shift; shift
anycast|label|scope|valid_lft|preferred_lft) set -- "${one}" "peer" "$@"
eval "$1=$2" ; shift ; shift ;; fi
home|nodad)
eval "$1=$1" ; shift ;;
esac
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" set -- "$@" "scope" "host"
fi fi
set -- "${address}${netmask}" $peer $broadcast $anycast $label $scope dev "${IFACE}" $valid_lft $preferred_lft $home $nodad # IPv4 specifics
veinfo ip addr add "$@" case "$1" in
ip addr add "$@" *.*.*.*)
case "$@" in
*" brd "*);;
*" broadcast "*);;
*) set -- "$@" brd +;;
esac
;;
esac
veinfo ip addr add "$@" dev "${IFACE}"
ip addr add "$@" dev "${IFACE}"
} }
_add_route() _add_route()
@@ -290,7 +296,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 -= 1 )) n=$(($n - 1))
done done
[ $n -ge 0 ] [ $n -ge 0 ]
eend $? eend $?
@@ -308,11 +314,7 @@ iproute2_post_stop()
einfo "Removing RPDB rules" einfo "Removing RPDB rules"
_ip_rule_runner del "${rules}" _ip_rule_runner del "${rules}"
fi fi
ip route flush table cache dev "${IFACE}"
# Only do something if the interface actually exist
if _exists; then
ip route flush table cache dev "${IFACE}"
fi
fi fi
# Don't delete sit0 as it's a special tunnel # Don't delete sit0 as it's a special tunnel

View File

@@ -218,7 +218,7 @@ iwconfig_associate()
sleep 1 sleep 1
[ ${timeout} -eq 0 ] && continue [ ${timeout} -eq 0 ] && continue
: $(( i += 1 )) i=$((${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 += 1 )) i=$((${i} + 1))
done done
APS=-1 APS=-1
eval set -- ${scan} eval set -- ${scan}
for line in "$@" ; do for line in "$@" ; do
: $(( APS += 1 )) APS=$((${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 += 1 )) k=$((${k} + 1))
done done
: $(( i += 1 )) i=$((${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 += 1 )) k=$((${k} + 1))
done done
: $(( i += 1 )) i=$((${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 += 1 )) i=$((${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 += 1 )) i=$((${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 += 1 )) i=$((${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 += 1 )) i=$((${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 += 1 )) i=$((${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 += 1 )) i=$((${i} + 1))
done done
return 1 return 1

View File

@@ -39,7 +39,7 @@ _get_ssid()
return 0 return 0
fi fi
sleep 1 sleep 1
: $(( i -= 1 )) i=$((${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 += 1 )) i=$((${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 += 1 )) i=$((${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 += 1 )) APS=$((${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 += 1 )) k=$((${k} + 1))
done done
: $(( i += 1 )) i=$((${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 += 1 )) k=$((${k} + 1))
done done
: $(( i += 1 )) i=$((${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 += 1 )) i=$((${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 += 1 )) i=$((${i} + 1))
done done
eoutdent eoutdent
} }
@@ -526,7 +526,7 @@ iwconfig_force_preferred()
found_AP=true found_AP=true
break break
fi fi
: $(( i += 1 )) i=$((${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 += 1 )) i=$((${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 += 1 )) i=$((${i} + 1))
done done
return 1 return 1

View File

@@ -1,69 +0,0 @@
# 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.
_ip()
{
if [ -x /bin/ip ]; then
echo /bin/ip
else
echo /sbin/ip
fi
}
macvlan_depend()
{
program $(_ip)
after interface
before dhcp macchanger
}
_is_macvlan()
{
[ -n "$(export RC_SVCNAME="net.${IFACE}"; service_get_value macvlan)" ]
}
_check_macvlan()
{
if [ ! -d /sys/module/macvlan ]; then
modprobe macvlan
if [ ! -d /sys/module/macvlan ]; then
eerror "MAC-VLAN support is not present in this kernel"
return 1
fi
fi
}
macvlan_pre_start()
{
# MAC-VLAN needs an existing interface to link to
local macvlan=
eval macvlan=\$macvlan_${IFVAR}
[ -z "${macvlan}" ] && return 0
_check_macvlan || return 1
# 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 && 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 $?
}

View File

@@ -74,7 +74,7 @@ netplugd_pre_start()
fi fi
sleep 1 sleep 1
[ ${timeout} -eq 0 ] && continue [ ${timeout} -eq 0 ] && continue
: $(( i += 1 )) i=$((${i} + 1))
[ ${i} -ge ${timeout} ] && break [ ${i} -ge ${timeout} ] && break
done done

View File

@@ -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

View File

@@ -13,7 +13,7 @@ system_depend()
_system_dns() _system_dns()
{ {
local servers= domain= search= sortlist= options= x= imetric= local servers= domain= search= sortlist= options= x=
eval servers=\$dns_servers_${IFVAR} eval servers=\$dns_servers_${IFVAR}
[ -z "${servers}" ] && servers=${dns_servers} [ -z "${servers}" ] && servers=${dns_servers}
@@ -46,12 +46,7 @@ _system_dns()
# Support resolvconf if we have it. # Support resolvconf if we have it.
if [ -x /sbin/resolvconf ]; then if [ -x /sbin/resolvconf ]; then
x="-a ${IFACE}" printf "${buffer}" | resolvconf -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

View File

@@ -30,7 +30,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 -= 1 )) timeout=$((${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"
@@ -54,18 +54,15 @@ tuntap_pre_start()
do_tunctl=true do_tunctl=true
elif type openvpn >/dev/null 2>&1; then elif type openvpn >/dev/null 2>&1; then
do_openvpn=true do_openvpn=true
elif type tunctl >/dev/null 2>&1; then else
do_tunctl=true do_tunctl=true
fi fi
if ${do_openvpn}; then if ${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
elif ${do_tunctl}; then
tunctl ${t_opts} -t "${IFACE}" >/dev/null
else else
eerror "Neither openvpn nor tunctl has been found, please install" tunctl ${t_opts} -t "${IFACE}" >/dev/null
eerror "either \"openvpn\" or \"usermode-utilities\"."
fi fi
eend $? && _up && service_set_value tuntap "${tuntap}" eend $? && _up && service_set_value tuntap "${tuntap}"
} }

View File

@@ -77,17 +77,7 @@ 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}"
local txqueuelen= e="$(ip link add link "${IFACE}" name "${vname}" type vlan id "${vlan}" ${vflags} ${vingress} ${vegress} 2>&1 1>/dev/null)"
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
@@ -111,12 +101,10 @@ vlan_post_start()
return 0 return 0
} }
vlan_pre_stop() vlan_post_stop()
{ {
local vlan= local vlan=
_exists || return 1
for vlan in $(_get_vlans); do for vlan in $(_get_vlans); do
einfo "Removing VLAN ${vlan##*.} from ${IFACE}" einfo "Removing VLAN ${vlan##*.} from ${IFACE}"
( (

View File

@@ -34,7 +34,7 @@ _get_ssid()
return 0 return 0
fi fi
sleep 1 sleep 1
: $(( timeout -= 1 )) timeout=$((timeout - 1))
done done
return 1 return 1

View File

@@ -1,8 +1,7 @@
BOOT= bootmisc fsck hostname localmount \ BOOT= bootmisc fsck hostname localmount network \
root swap sysctl urandom ${BOOT-${OS}} root staticroute swap sysctl urandom
DEFAULT= local netmount DEFAULT= local netmount
SHUTDOWN= savecache ${SHUTDOWN-${OS}} SHUTDOWN= savecache
SYSINIT= ${SYSINIT-${OS}}
LEVELDIR= ${DESTDIR}/${SYSCONFDIR}/runlevels LEVELDIR= ${DESTDIR}/${SYSCONFDIR}/runlevels
SYSINITDIR= ${LEVELDIR}/sysinit SYSINITDIR= ${LEVELDIR}/sysinit
@@ -10,30 +9,13 @@ 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 migrate-run
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
runlevels/Makefile.BSD Normal file
View File

@@ -0,0 +1 @@
BOOT+= hostid newsyslog savecore syslogd swap-blk

View File

@@ -0,0 +1,5 @@
# Generic BSD stuff
BOOT+= hostid net.lo0 newsyslog savecore syslogd
# FreeBSD specific stuff
BOOT+= adjkerntz dumpon syscons

3
runlevels/Makefile.Linux Normal file
View File

@@ -0,0 +1,3 @@
SYSINIT+= devfs dmesg
BOOT+= hwclock keymaps modules mtab procfs termencoding
SHUTDOWN+= killprocs mount-ro

View File

@@ -0,0 +1,5 @@
# Generic BSD stuff
BOOT+= hostid net.lo0 newsyslog savecore syslogd
# NetBSD specific stuff
BOOT+= devdb swap-blk ttys wscons

View File

@@ -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/*/state ]; then if [ -f /proc/acpi/ac_adapter/AC*/state ]; then
cat /proc/acpi/ac_adapter/*/state | while read line; do cat /proc/acpi/ac_adapter/AC*/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/*/online ]; then elif [ -f /sys/class/power_supply/AC*/online ]; then
cat /sys/class/power_supply/*/online | while read line; do cat /sys/class/power_supply/AC*/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

View File

@@ -1,28 +1,16 @@
DIR= ${LIBEXECDIR}/sh DIR= ${LIBEXECDIR}/sh
SRCS= init.sh.in functions.sh.in gendepends.sh.in init-common-post.sh.in \ SRCS= functions.sh.in gendepends.sh.in init-common-post.sh.in \
rc-functions.sh.in runscript.sh.in ${SRCS-${OS}} rc-functions.sh.in runscript.sh.in
INC= init-common-post.sh rc-mount.sh functions.sh rc-functions.sh INC= init-common-post.sh rc-mount.sh functions.sh rc-functions.sh
BIN= gendepends.sh init.sh runscript.sh ${BIN-${OS}} BIN= gendepends.sh init.sh runscript.sh
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

6
sh/Makefile.FreeBSD Normal file
View File

@@ -0,0 +1,6 @@
SRCS+= init.sh.in
.SUFFIXES: .sh.BSD.in
.sh.BSD.in.sh:
${SED} ${SED_REPLACE} ${SED_EXTRA} $< > $@

7
sh/Makefile.Linux Normal file
View File

@@ -0,0 +1,7 @@
SRCS+= init.sh.in init-early.sh.in udhcpc-hook.sh.in
BIN+= init-early.sh udhcpc-hook.sh
.SUFFIXES: .sh.Linux.in
.sh.Linux.in.sh:
${SED} ${SED_REPLACE} ${SED_EXTRA} $< > $@

Some files were not shown because too many files have changed in this diff Show More