Compare commits
50 Commits
funtoo-ope
...
openrc-0.8
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2d14b172fa | ||
|
|
03cd55aa19 | ||
|
|
85827d474c | ||
|
|
8e925368b7 | ||
|
|
15660dbbfc | ||
|
|
07db27d220 | ||
|
|
16f7e90c6c | ||
|
|
c7c278dfd4 | ||
|
|
73c862b792 | ||
|
|
46e67badd2 | ||
|
|
67640d2d97 | ||
|
|
8a45d5e24e | ||
|
|
6e1239795f | ||
|
|
7c1a2defb6 | ||
|
|
1d63e85794 | ||
|
|
25049d3e80 | ||
|
|
b875abd1a5 | ||
|
|
c020454c84 | ||
|
|
60d8d4f5bb | ||
|
|
c9912942f0 | ||
|
|
9f5eb03e5e | ||
|
|
d7e48fe643 | ||
|
|
87302487d2 | ||
|
|
0f3d6a01c7 | ||
|
|
3fca6bd027 | ||
|
|
202fa20cbc | ||
|
|
dfd42d1393 | ||
|
|
22918ccf51 | ||
|
|
20480048ca | ||
|
|
683a21b0a0 | ||
|
|
b512d0db98 | ||
|
|
73d1a8698e | ||
|
|
bae0a693a9 | ||
|
|
35d38c3561 | ||
|
|
c0aa27ef32 | ||
|
|
11fcb0217e | ||
|
|
c8b5078660 | ||
|
|
7bc920ab56 | ||
|
|
ebd79394a3 | ||
|
|
04379b2de9 | ||
|
|
43678fd2c4 | ||
|
|
db6d680765 | ||
|
|
a2e9cde737 | ||
|
|
aaaea44d22 | ||
|
|
19037cbd83 | ||
|
|
21c5a022af | ||
|
|
cca7e9f7e1 | ||
|
|
c2529c1ed6 | ||
|
|
fa1fefb2bc | ||
|
|
10ce67886d |
21
Makefile
21
Makefile
@@ -4,23 +4,18 @@
|
||||
|
||||
include Makefile.inc
|
||||
|
||||
SUBDIR= conf.d etc init.d man scripts sh src
|
||||
SUBDIR= conf.d etc init.d local.d man scripts sh src
|
||||
|
||||
# Build our old net foo or not
|
||||
_OLDNET_SH= case "${MKOLDNET}" in \
|
||||
[Yy][Ee][Ss]) echo "net doc";; \
|
||||
*) echo "";; \
|
||||
esac
|
||||
_OLDNET!= ${_OLDNET_SH}
|
||||
SUBDIR+= ${_OLDNET}$(shell ${_OLDNET_SH})
|
||||
ifeq (${MKOLDNET},yes)
|
||||
SUBDIR+= net doc
|
||||
endif
|
||||
|
||||
# Build pkgconfig or not
|
||||
_PKGCONFIG_SH= case "${MKPKGCONFIG}" in \
|
||||
[Yy][Ee][Ss]|"") echo "pkgconfig";; \
|
||||
*) echo "";; \
|
||||
esac
|
||||
_PKGCONFIG!= ${_PKGCONFIG_SH}
|
||||
SUBDIR+= ${_PKGCONFIG}$(shell ${_PKGCONFIG_SH})
|
||||
MKPKGCONFIG?= yes
|
||||
ifeq (${MKPKGCONFIG},yes)
|
||||
SUBDIR+= pkgconfig
|
||||
endif
|
||||
|
||||
# We need to ensure that runlevels is done last
|
||||
SUBDIR+= runlevels
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
NAME= openrc
|
||||
VERSION= 0.7.0
|
||||
VERSION= 0.8.1
|
||||
PKG= ${NAME}-${VERSION}
|
||||
|
||||
90
README
90
README
@@ -1,11 +1,10 @@
|
||||
OpenRC README
|
||||
=============
|
||||
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
make install
|
||||
Yup, that simple. Works with GNU make and BSD make.
|
||||
Yup, that simple. Works with GNU make.
|
||||
|
||||
You may wish to tweak the installation with the below arguments
|
||||
PROGLDFLAGS=-static
|
||||
@@ -13,6 +12,8 @@ LIBNAME=lib64
|
||||
DESTDIR=/tmp/openrc-image
|
||||
MKPAM=pam
|
||||
MKPKGCONFIG=no
|
||||
MKRCSYS=prefix
|
||||
MKSELINUX=yes
|
||||
MKTERMCAP=ncurses
|
||||
MKTERMCAP=termcap
|
||||
MKOLDNET=yes
|
||||
@@ -33,6 +34,20 @@ LOCAL_PREFIX should be set when to where user maintained packages are.
|
||||
Only set LOCAL_PREFIX if different from PKG_PREFIX.
|
||||
PREFIX should be set when OpenRC is not installed to /.
|
||||
|
||||
MKRCSYS should be set only if you need to specify a default system
|
||||
subtype. The subtype should be set to match the type of environment the
|
||||
file is installed into, not the virtualization the environment is
|
||||
capable of handling. Here is a list of subtypes and their meanings.
|
||||
|
||||
jail FreeBSD jail
|
||||
lxc Linux container
|
||||
openvz Linux OpenVZ
|
||||
prefix Linux and *BSD prefix system
|
||||
uml UsermodeLinux
|
||||
vserver Linux vserver
|
||||
xen0 Linux and NetBSD xen0 Domain
|
||||
xenU Linux and NetBSD xenU Domain
|
||||
|
||||
If any of the following files exist then we do not overwrite them
|
||||
/etc/devd.conf
|
||||
/etc/rc
|
||||
@@ -52,54 +67,31 @@ 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
|
||||
of the system.
|
||||
|
||||
|
||||
Reporting Bugs
|
||||
--------------
|
||||
Bugs should go to the Gentoo Bugzilla:
|
||||
http://bugs.gentoo.org/
|
||||
You'll want the "Gentoo Linux" product and the "baselayout" 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 Daniel Robbins
|
||||
---------------------------
|
||||
History - by Roy Marples
|
||||
------------------------
|
||||
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.
|
||||
|
||||
The Gentoo modular network scripts were created by Daniel Robbins for
|
||||
Gentoo Linux 1.0_rc6, in development during most of 2001 and released
|
||||
in September 2001. After their development, the dependency-based initscript
|
||||
system was maintained by a number of senior developers (add names here....
|
||||
need to look at baselayout cvs logs.)
|
||||
At the start of 2007, baselayout-2 is announced to the world, re-writing the
|
||||
core of baselayout in C and allowing POSIX sh init scripts instead of
|
||||
forcing the use of bash. By Mid 2007 I have re-written everything, including
|
||||
init scripts, and alpha and pre baselayout-2 snapshots where put into Gentoo.
|
||||
Towards the end of 2007 I retired as a Gentoo developer for reasons I won't
|
||||
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.
|
||||
|
||||
excerpt from http://www.gentoo.org/news/en/gwn/20040426-newsletter.xml
|
||||
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.
|
||||
As such, the Gentoo Council have allowed the creation of OpenRC under the
|
||||
2 clause BSD license, managed by me as an external project.
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
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
|
||||
---------------------
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
DIR= ${CONFDIR}
|
||||
CONF= bootmisc fsck hostname local localmount network staticroute urandom
|
||||
CONF= bootmisc fsck hostname localmount network staticroute urandom
|
||||
|
||||
TARGETS+= network staticroute
|
||||
CLEANFILES+= network staticroute
|
||||
|
||||
@@ -9,6 +9,14 @@ clock="UTC"
|
||||
# You normally don't need to do this if you run a ntp daemon.
|
||||
clock_systohc="NO"
|
||||
|
||||
# If you want to set the system time to the current hardware clock
|
||||
# during bootup, then say "YES" here. You do not need this if you are
|
||||
# running a modern kernel with CONFIG_RTC_HCTOSYS set to y.
|
||||
# Also, be aware that if you set this to "NO", the system time will
|
||||
# never be saved to the hardware clock unless you set
|
||||
# clock_systohc="YES" above.
|
||||
clock_hctosys="YES"
|
||||
|
||||
# If you wish to pass any other arguments to hwclock during bootup,
|
||||
# you may do so here. Alpha users may wish to use --arc or --srm here.
|
||||
clock_args=""
|
||||
|
||||
@@ -4,6 +4,8 @@ keymap="us"
|
||||
|
||||
# Should we first load the 'windowkeys' console keymap? Most x86 users will
|
||||
# say "yes" here. Note that non-x86 users should leave it as "no".
|
||||
# Loading this keymap will enable VT switching (like ALT+Left/Right)
|
||||
# using the special windows keys on the linux console.
|
||||
windowkeys="NO"
|
||||
|
||||
# The maps to load for extended keyboards. Most users will leave this as is.
|
||||
|
||||
18
conf.d/local
18
conf.d/local
@@ -1,18 +0,0 @@
|
||||
# Here is where you can put anything you need to start
|
||||
# that there is not an init script for.
|
||||
|
||||
local_start() {
|
||||
# This is a good place to load any misc programs
|
||||
# on startup (use &>/dev/null to hide output)
|
||||
|
||||
# We should always return 0
|
||||
return 0
|
||||
}
|
||||
|
||||
local_stop() {
|
||||
# This is a good place to unload any misc.
|
||||
# programs you started above.
|
||||
|
||||
# We should always return 0
|
||||
return 0
|
||||
}
|
||||
@@ -67,10 +67,12 @@
|
||||
# If a specified module fails (like dhcp - see below), you can specify a
|
||||
# fallback like so
|
||||
#fallback_eth0="192.168.0.2 netmask 255.255.255.0"
|
||||
#fallback_route_eth0="default via 192.168.0.1"
|
||||
#fallback_routes_eth0="default via 192.168.0.1"
|
||||
|
||||
# NOTE: fallback entry must match the entry location in config_eth0
|
||||
# As such you can only have one fallback route.
|
||||
# Also, if you do not set a fallback_routes entry for an interface, the
|
||||
# routes entry will be used if that is set.
|
||||
|
||||
# Some users may need to alter the MTU - here's how
|
||||
#mtu_eth0="1500"
|
||||
@@ -357,6 +359,15 @@
|
||||
# manager like resolvconf-gentoo to manage this file for you. All packages
|
||||
# that baselayout supports use resolvconf-gentoo if installed.
|
||||
|
||||
# If you run any services on net.lo which need localmount, either the
|
||||
# services or net.lo should explicitly bring in localmount.
|
||||
# If you do not do this, openrc will try to bring up net.lo as soon as
|
||||
# possible, which may be too early for your services.
|
||||
# If you use network file systems for your core system this may
|
||||
# interfere.
|
||||
# Also, you may need this if 127.0.0.1 is in your /etc/resolv.conf.
|
||||
#rc_net_lo0_need="localmount"
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Cable in/out detection
|
||||
# Sometimes the cable is in, others it's out. Obviously you don't want to
|
||||
|
||||
@@ -94,10 +94,12 @@
|
||||
# If a specified module fails (like dhcp - see below), you can specify a
|
||||
# fallback like so
|
||||
#fallback_eth0="192.168.0.2/24"
|
||||
#fallback_route_eth0="default via 192.168.0.1"
|
||||
#fallback_routes_eth0="default via 192.168.0.1"
|
||||
|
||||
# NOTE: fallback entry must match the entry location in config_eth0
|
||||
# As such you can only have one fallback route.
|
||||
# Also, if you do not set a fallback_routes entry for an interface, the
|
||||
# routes entry will be used if that is set.
|
||||
|
||||
# Some users may need to alter the MTU - here's how
|
||||
#mtu_eth0="1500"
|
||||
@@ -527,7 +529,8 @@
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# VLAN (802.1q support)
|
||||
# For VLAN support, emerge net-misc/vconfig
|
||||
# For VLAN support, emerge sys-apps/iproute2
|
||||
# The old vconfig based VLAN support is no longer available.
|
||||
|
||||
# Specify the VLAN numbers for the interface like so
|
||||
# Please ensure your VLAN IDs are NOT zero-padded
|
||||
@@ -537,10 +540,27 @@
|
||||
# need it up.
|
||||
#config_eth0="null"
|
||||
|
||||
# You can also configure the VLAN - see for vconfig man page for more details
|
||||
#vconfig_eth0="set_name_type VLAN_PLUS_VID_NO_PAD"
|
||||
#vconfig_vlan1="set_flag 1
|
||||
#set_egress_map 2 6"
|
||||
# You can also configure the VLAN - see for ip man page for more details
|
||||
# To change the vlan interface name. If not set, the standard "iface.vlanid"
|
||||
# will be used. This is the replacement for the old 'vconfig set_name_type'
|
||||
# functionality.
|
||||
#vlan1_name="vlan1"
|
||||
#vlan2_name="eth0.2"
|
||||
|
||||
# The following shows the old set_name_type setting and what new option to set:
|
||||
# Using eth9 & VLAN VID 26 as an example.
|
||||
# VLAN_PLUS_VID vlan26_name="vlan0026"
|
||||
# VLAN_PLUS_VID_NO_PAD vlan26_name="vlan26"
|
||||
# DEV_PLUS_VID vlan26_name="eth9.0026"
|
||||
# DEV_PLUS_VID_NO_PAD vlan26_name="eth9.26"
|
||||
|
||||
# Set the vlan flags
|
||||
#vlan1_flags="reorder_hdr off gvrp on loose_binding on"
|
||||
|
||||
# Configure in/egress maps
|
||||
#vlan1_ingress="2:6 3:5"
|
||||
#vlan1_egress="1:2"
|
||||
|
||||
#config_vlan1="172.16.3.1/23"
|
||||
#config_vlan2="172.16.2.1/23"
|
||||
|
||||
@@ -553,8 +573,7 @@
|
||||
# This means you do not need to create init scripts in /etc/init.d for each
|
||||
# vlan, you must need to create one for the physical interface.
|
||||
# If you wish to control the configuration of each vlan through a separate
|
||||
# script, or wish to rename the vlan interface to something that vconfig
|
||||
# cannot then you need to do this.
|
||||
# script then you need to do this.
|
||||
#vlan_start_eth0="no"
|
||||
|
||||
# If you do the above then you may want to depend on eth0 like so
|
||||
@@ -943,6 +962,15 @@
|
||||
# manager like resolvconf-gentoo to manage this file for you. All packages
|
||||
# that baselayout supports use resolvconf-gentoo if installed.
|
||||
|
||||
# If you run any services on net.lo which need localmount, either the
|
||||
# services or net.lo should explicitly bring in localmount.
|
||||
# If you do not do this, openrc will try to bring up net.lo as soon as
|
||||
# possible, which may be too early for your services.
|
||||
# If you use network file systems for your core system this may
|
||||
# interfere.
|
||||
# Also, you may need this if 127.0.0.1 is in your /etc/resolv.conf.
|
||||
#rc_net_lo_need="localmount"
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Cable in/out detection
|
||||
# Sometimes the cable is in, others it's out. Obviously you don't want to
|
||||
@@ -973,6 +1001,72 @@
|
||||
#ifplugd_eth0="--api-mode=wlan"
|
||||
# man ifplugd for more options
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Interface hardware tuning & configuration via ethtool
|
||||
# If you need to change explicit hardware settings on your network card prior
|
||||
# to bringing the interface up, the following is available.
|
||||
#
|
||||
# For a full listing of settings, please consulting ethtool(8) and the output
|
||||
# of "ethtool --help".
|
||||
#
|
||||
# Multiple entries (seperated by newlines) are supported in all of the
|
||||
# variables as some settings cannot be changed at the same time.
|
||||
#
|
||||
# Valid variable name fragments: change pause coalesce ring offload
|
||||
# change_eeprom identify nfc flash rxfh_indir ntuple
|
||||
|
||||
# Set Wake-On-Lan to listen for SecureOn MagicPacket(tm), the message level to
|
||||
# notify us of WOL changes, and the SecureOn password to 'DE:AD:BE:EF:CA:FE'.
|
||||
#ethtool_change_eth0="wol gs
|
||||
#msglvl wol on
|
||||
#sopass DE:AD:BE:EF:CA:FE"
|
||||
|
||||
# Disable pause auto-negotiation and explicitly enable RX and TX pause.
|
||||
#ethtool_pause_eth0="autoneg off
|
||||
#rx on tx on"
|
||||
|
||||
# Enasble adaptive RX and TX coalescing
|
||||
#ethtool_coalesce_eth0="adaptive-rx on adaptive-tx on"
|
||||
|
||||
# Change ring buffer settings
|
||||
#ethtool_ring_eth0=""
|
||||
|
||||
# Enable all offload settings
|
||||
#ethtool_offload_eth0="rx on tx on sg on tso on ufo on gso on gro on lro on"
|
||||
|
||||
# Change specific bytes in the EEPROM
|
||||
#ethtool_change_eeprom_eth0=""
|
||||
|
||||
# Run the identify sequence on the interface for 1 second (does not return until completion)
|
||||
#ethtool_identify_eth0="1"
|
||||
|
||||
# Configure receive network flow classification
|
||||
#ethtool_nfc_eth0="
|
||||
#rx-flow-hash tcp4 f
|
||||
#rx-flow-hash udp4 s"
|
||||
|
||||
# Flash firmware to all regions
|
||||
#ethtool_flash_eth0="/some/path/firmware1 0"
|
||||
|
||||
# Flash firmware to region 1
|
||||
#ethtool_flash_eth0="/some/path/firmware2 1"
|
||||
|
||||
# Set receive flow hash indirection table for even balancing between N receive queues
|
||||
#ethtool_rxfh_indir_eth0="equal 4"
|
||||
|
||||
# Configure Rx ntuple filters and actions
|
||||
#ethtool_ntuple_eth0=""
|
||||
|
||||
# Additionally, there is a special control variable, if you need to change the
|
||||
# order of option processing. The default order is:
|
||||
# flash change-eeprom change pause coalesce ring offload identify nfc rxfh-indir ntuple
|
||||
|
||||
# Set global order to default
|
||||
#ethtool_order="flash change-eeprom change pause coalesce ring offload identify nfc rxfh-indir ntuple"
|
||||
|
||||
# Hypothetical network card that requires a change-eeprom toggle to enable flashing
|
||||
#ethtool_order_eth0="change-eeprom flash change pause coalesce ring offload nfc rxfh-indir ntuple"
|
||||
|
||||
##############################################################################
|
||||
# ADVANCED CONFIGURATION
|
||||
#
|
||||
|
||||
@@ -8,5 +8,14 @@ include ${MK}/os.mk
|
||||
include Makefile.${OS}
|
||||
include ${MK}/scripts.mk
|
||||
|
||||
# We can't use "ifndef" here because that treats set-but-empty
|
||||
# as not-set which is not what we want
|
||||
MKRCSYS ?= automagicplease
|
||||
ifeq ($(MKRCSYS),automagicplease)
|
||||
# If the user isn't picking a default, then have the
|
||||
# config go with runtime automagic detection #357247
|
||||
rc.conf: SED_EXTRA += -e '/^rc_sys=""/s:^:\#:'
|
||||
MKRCSYS =
|
||||
endif
|
||||
rc.conf: rc.conf.in rc.conf.${OS}
|
||||
${SED} ${SED_REPLACE} ${SED_EXTRA} $^ > $@
|
||||
|
||||
@@ -2,11 +2,10 @@
|
||||
# "" - nothing special
|
||||
# "jail" - FreeBSD jails
|
||||
# "prefix" - Prefix
|
||||
# If unset, the old automagic detection code will be triggered. Said old code
|
||||
# is deprecated and will be removed not later than 2011/03/01.
|
||||
# If this is commented out, automatic detection will be attempted.
|
||||
# Note that automatic detection does not work in a prefix environment.
|
||||
#
|
||||
# This should be set to the value representing what environment this file is
|
||||
# PRESENTLY in, not what virtualization the environment is capable of.
|
||||
# See the OpenRC migration guide for more details.
|
||||
rc_sys=""
|
||||
# This should be set to the value representing the environment this file is
|
||||
# PRESENTLY in, not the virtualization the environment is capable of.
|
||||
rc_sys="@RC_SYS_DEFAULT@"
|
||||
|
||||
|
||||
@@ -7,13 +7,13 @@
|
||||
# "vserver" - Linux vserver
|
||||
# "xen0" - Xen0 Domain
|
||||
# "xenU" - XenU Domain
|
||||
# If unset, the old automagic detection code will be triggered. Said old code
|
||||
# is deprecated and will be removed not later than 2011/03/01.
|
||||
# If this is commented out, automatic detection will be attempted.
|
||||
# Note that autodetection will not work in a prefix environment or in a
|
||||
# linux container.
|
||||
#
|
||||
# This should be set to the value representing what environment this file is
|
||||
# PRESENTLY in, not what virtualization the environment is capable of.
|
||||
# See the OpenRC migration guide for more details.
|
||||
rc_sys=""
|
||||
# This should be set to the value representing the environment this file is
|
||||
# PRESENTLY in, not the virtualization the environment is capable of.
|
||||
rc_sys="@RC_SYS_DEFAULT@"
|
||||
|
||||
##############################################################################
|
||||
# LINUX SPECIFIC OPTIONS
|
||||
|
||||
@@ -3,11 +3,10 @@
|
||||
# "prefix" - Prefix
|
||||
# "xen0" - Xen0 Domain
|
||||
# "xenU" - XenU Domain
|
||||
# If unset, the old automagic detection code will be triggered. Said old code
|
||||
# is deprecated and will be removed not later than 2011/03/01.
|
||||
# If this is commented out, automatic detection will be attempted.
|
||||
# Note that automatic detection does not work in a prefix environment.
|
||||
#
|
||||
# This should be set to the value representing what environment this file is
|
||||
# PRESENTLY in, not what virtualization the environment is capable of.
|
||||
# See the OpenRC migration guide for more details.
|
||||
rc_sys=""
|
||||
# This should be set to the value representing the environment this file is
|
||||
# PRESENTLY in, not the virtualization the environment is capable of.
|
||||
rc_sys="@RC_SYS_DEFAULT@"
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
# Linux users could specify /sbin/sulogin
|
||||
#rc_shell=/bin/sh
|
||||
|
||||
# Do we allow any started service in the runlevel to satisfy the depedency
|
||||
# Do we allow any started service in the runlevel to satisfy the dependency
|
||||
# or do we want all of them regardless of state? For example, if net.eth0
|
||||
# and net.eth1 are in the default runlevel then with rc_depend_strict="NO"
|
||||
# both will be started, but services that depend on 'net' will work if either
|
||||
|
||||
@@ -5,12 +5,10 @@ SRCS= bootmisc.in fsck.in hostname.in local.in localmount.in netmount.in \
|
||||
BIN= ${OBJS}
|
||||
|
||||
# Build our old net foo or not
|
||||
_OLDNET_SH= case "${MKOLDNET}" in \
|
||||
[Yy][Ee][Ss]) echo "net.lo";; \
|
||||
*) echo "";; \
|
||||
esac
|
||||
_OLDNET!= ${_OLDNET_SH}
|
||||
_NET_LO= ${_OLDNET}$(shell ${_OLDNET_SH})
|
||||
ifeq (${MKOLDNET},yes)
|
||||
_OLDNET= net.lo
|
||||
endif
|
||||
_NET_LO= ${_OLDNET}
|
||||
|
||||
INSTALLAFTER= _installafter_${_NET_LO}
|
||||
CLEANFILES+= ${_NET_LO}
|
||||
|
||||
@@ -7,7 +7,7 @@ depend()
|
||||
need localmount
|
||||
before logger
|
||||
after clock sysctl
|
||||
keyword -prefix
|
||||
keyword -prefix -timeout
|
||||
}
|
||||
|
||||
dir_writeable()
|
||||
@@ -26,14 +26,15 @@ cleanup_tmp_dir()
|
||||
fi
|
||||
dir_writeable "$dir" || return 1
|
||||
chmod a+rwt "$dir" 2> /dev/null
|
||||
cd "$dir"
|
||||
cd "$dir" || return 1
|
||||
if yesno $wipe_tmp; then
|
||||
ebegin "Wiping $dir directory"
|
||||
local startopts="-x . -depth"
|
||||
[ "$RC_UNAME" = Linux ] && startopts=". -xdev -depth"
|
||||
|
||||
# Faster than find
|
||||
rm -rf -- [^ajlq\.]*
|
||||
# Faster than raw find
|
||||
if ! rm -rf -- [^ajlq\.]* 2>/dev/null ; then
|
||||
# Blah, too many files
|
||||
find . -maxdepth 1 -name '[^ajlq\.]*' -exec rm -rf -- {} +
|
||||
fi
|
||||
|
||||
# pam_mktemp creates a .private directory within which
|
||||
# each user gets a private directory with immutable
|
||||
@@ -41,27 +42,23 @@ cleanup_tmp_dir()
|
||||
# remove it.
|
||||
[ -d /tmp/.private ] && chattr -R -a /tmp/.private 2> /dev/null
|
||||
|
||||
find $startopts ! -name . \
|
||||
! -path "./lost+found" \
|
||||
! -path "./lost+found/*" \
|
||||
! -path "./quota.user" \
|
||||
! -path "./quota.user/*" \
|
||||
! -path "./aquota.user" \
|
||||
! -path "./aquota.user/*" \
|
||||
! -path "./quota.group" \
|
||||
! -path "./quota.group/*" \
|
||||
! -path "./aquota.group" \
|
||||
! -path "./aquota.group/*" \
|
||||
! -path "./journal" \
|
||||
! -path "./journal/*" \
|
||||
-exec rm -rf {} \;
|
||||
# Prune the paths that are left
|
||||
find . -maxdepth 1 \
|
||||
! -name . \
|
||||
! -name lost+found \
|
||||
! -name quota.user \
|
||||
! -name aquota.user \
|
||||
! -name quota.group \
|
||||
! -name aquota.group \
|
||||
! -name journal \
|
||||
-exec rm -rf -- {} +
|
||||
eend 0
|
||||
else
|
||||
ebegin "Cleaning $dir directory"
|
||||
rm -rf -- "$dir"/.X*-lock "$dir"/esrv* "$dir"/kio* \
|
||||
"$dir"/jpsock.* "$dir"/.fam* "$dir"/.esd* \
|
||||
"$dir"/orbit-* "$dir"/ssh-* "$dir"/ksocket-* \
|
||||
"$dir"/.*-unix
|
||||
rm -rf -- .X*-lock esrv* kio* \
|
||||
jpsock.* .fam* .esd* \
|
||||
orbit-* ssh-* ksocket-* \
|
||||
.*-unix
|
||||
eend 0
|
||||
fi
|
||||
}
|
||||
@@ -71,7 +68,7 @@ mkutmp()
|
||||
: >"$1"
|
||||
# Not all systems have the utmp group
|
||||
chgrp utmp "$1" 2>/dev/null
|
||||
chmod 0660 "$1"
|
||||
chmod 0664 "$1"
|
||||
}
|
||||
|
||||
start()
|
||||
|
||||
@@ -61,12 +61,6 @@ start()
|
||||
done
|
||||
cp "$font" "$RC_LIBEXECDIR"/console
|
||||
echo "${font##*/}" >"$RC_LIBEXECDIR"/console/font
|
||||
if yesno ${unicode:-${UNICODE}}; then
|
||||
echo "" > "$RC_LIBEXECDIR"/console/unicode
|
||||
else
|
||||
rm -f "$RC_LIBEXECDIR"/console/unicode
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
return $retval
|
||||
|
||||
@@ -91,10 +91,14 @@ start()
|
||||
# If setting UTC, don't bother to run hwclock when first booting
|
||||
# as that's the default
|
||||
if [ "$PREVLEVEL" != N -o \
|
||||
"$utc_cmd}" != --utc -o \
|
||||
"$utc_cmd" != --utc -o \
|
||||
-n "$clock_args" ];
|
||||
then
|
||||
_hwclock --hctosys $utc_cmd $clock_args
|
||||
if yesno $clock_hctosys; then
|
||||
_hwclock --hctosys $utc_cmd $clock_args
|
||||
else
|
||||
_hwclock --systz $utc_cmd $clock_args
|
||||
fi
|
||||
retval=$(($retval + $?))
|
||||
fi
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# Copyright (c) 2007-2008 Roy Marples <roy@marples.name>
|
||||
# All rights reserved. Released under the 2-clause BSD license.
|
||||
|
||||
description="Executes user commands in /etc/conf.d/local"
|
||||
description="Executes user programs in @SYSCONFDIR@/local.d"
|
||||
|
||||
depend()
|
||||
{
|
||||
@@ -12,22 +12,40 @@ depend()
|
||||
|
||||
start()
|
||||
{
|
||||
ebegin "Starting local"
|
||||
einfo "Starting local"
|
||||
|
||||
local file
|
||||
for file in @SYSCONFDIR@/local.d/*.start ; do
|
||||
[ -x "$file" ] && "$file"
|
||||
done
|
||||
|
||||
if type local_start >/dev/null 2>&1; then
|
||||
ewarn "@SYSCONFDIR@/conf.d/local should be removed."
|
||||
ewarn "Please move the code from the local_start function"
|
||||
ewarn "to scripts with an .start extension"
|
||||
ewarn "in @SYSCONFDIR@/local.d"
|
||||
local_start
|
||||
fi
|
||||
|
||||
eend $? "Failed to start local"
|
||||
return 0
|
||||
}
|
||||
|
||||
stop()
|
||||
{
|
||||
ebegin "Stopping local"
|
||||
einfo "Stopping local"
|
||||
|
||||
local file
|
||||
for file in @SYSCONFDIR@/local.d/*.stop; do
|
||||
[ -x "$file" ] && "$file"
|
||||
done
|
||||
|
||||
if type local_start >/dev/null 2>&1; then
|
||||
ewarn "@SYSCONFDIR@/conf.d/local should be removed."
|
||||
ewarn "Please move the code from the local_stop function"
|
||||
ewarn "to scripts with an .stop extension"
|
||||
ewarn "in @SYSCONFDIR@/local.d"
|
||||
local_stop
|
||||
fi
|
||||
|
||||
eend $? "Failed to stop local"
|
||||
return 0
|
||||
}
|
||||
|
||||
@@ -58,8 +58,8 @@ stop()
|
||||
|
||||
. "$RC_LIBEXECDIR"/sh/rc-mount.sh
|
||||
|
||||
# Umount loopback devices
|
||||
einfo "Unmounting loopback devices"
|
||||
# Umount loop devices
|
||||
einfo "Unmounting loop devices"
|
||||
eindent
|
||||
do_unmount "umount -d" --skip-point-regex "$no_umounts_r" \
|
||||
--node-regex "^/dev/loop"
|
||||
|
||||
@@ -18,14 +18,12 @@ depend()
|
||||
local IFACE=${RC_SVCNAME#*.}
|
||||
local IFVAR=$(shell_var "${IFACE}")
|
||||
|
||||
need localmount
|
||||
after bootmisc
|
||||
provide net
|
||||
keyword -jail -prefix -vserver
|
||||
|
||||
case "${IFACE}" in
|
||||
lo|lo0);;
|
||||
*) after net.lo net.lo0;;
|
||||
lo|lo0) before mtab ; need root ;;
|
||||
*) after bootmisc net.lo net.lo0 ; need localmount ;;
|
||||
esac
|
||||
|
||||
if [ "$(command -v "depend_${IFVAR}")" = "depend_${IFVAR}" ]; then
|
||||
@@ -476,7 +474,7 @@ interface_down()
|
||||
|
||||
start()
|
||||
{
|
||||
local IFACE=${RC_SVCNAME#*.} oneworked=false module=
|
||||
local IFACE=${RC_SVCNAME#*.} oneworked=false fallback=false module=
|
||||
local IFVAR=$(shell_var "${IFACE}") cmd= our_metric=
|
||||
local metric=0
|
||||
|
||||
@@ -563,6 +561,7 @@ start()
|
||||
else
|
||||
eval config=\$fallback_${config_index}
|
||||
if [ -n "${config}" ]; then
|
||||
fallback=true
|
||||
eoutdent
|
||||
ewarn "Trying fallback configuration ${config}"
|
||||
eindent
|
||||
@@ -585,8 +584,13 @@ start()
|
||||
return 1
|
||||
fi
|
||||
|
||||
local hidefirstroute=false first=true
|
||||
local routes="$(_get_array "routes_${IFVAR}")"
|
||||
local hidefirstroute=false first=true routes=
|
||||
if ${fallback}; then
|
||||
routes="$(_get_array "fallback_routes_${IFVAR}")"
|
||||
fi
|
||||
if [ -z "${routes}" ]; then
|
||||
routes="$(_get_array "routes_${IFVAR}")"
|
||||
fi
|
||||
if [ "${IFACE}" = "lo" -o "${IFACE}" = "lo0" ]; then
|
||||
if [ "${config_0}" != "null" ]; then
|
||||
routes="127.0.0.0/8 via 127.0.0.1
|
||||
@@ -684,7 +688,11 @@ stop()
|
||||
|
||||
# Only delete addresses for interfaces that exist
|
||||
if _exists; then
|
||||
_delete_addresses "${IFACE}"
|
||||
# PPP can manage it's own addresses when IN_BACKGROUND
|
||||
# Important in case "demand" set on the ppp link
|
||||
if ! (yesno ${IN_BACKGROUND} && is_ppp) ; then
|
||||
_delete_addresses "${IFACE}"
|
||||
fi
|
||||
fi
|
||||
|
||||
for module in ${MODULES}; do
|
||||
|
||||
@@ -8,17 +8,22 @@ start()
|
||||
{
|
||||
if [ -e "$RC_SVCDIR"/clock-skewed ]; then
|
||||
ewarn "WARNING: clock skew detected!"
|
||||
if ! yesno "savecache_skewed"; then
|
||||
if ! yesno "${RC_GOINGDOWN}"; then
|
||||
eerror "Not saving deptree cache"
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
ebegin "Saving dependency cache"
|
||||
local rc=
|
||||
if [ ! -d "$RC_LIBEXECDIR"/cache ]; then
|
||||
rm -rf "$RC_LIBEXECDIR"/cache
|
||||
if ! mkdir "$RC_LIBEXECDIR"/cache; then
|
||||
eend $?
|
||||
return $?
|
||||
rc=$?
|
||||
if yesno "${RC_GOINGDOWN}"; then
|
||||
rc=0
|
||||
fi
|
||||
eend $rc
|
||||
return $rc
|
||||
fi
|
||||
fi
|
||||
local save=
|
||||
@@ -28,5 +33,9 @@ start()
|
||||
if [ -n "$save" ]; then
|
||||
cp -p $save "$RC_LIBEXECDIR"/cache 2>/dev/null
|
||||
fi
|
||||
eend $?
|
||||
rc=$?
|
||||
if yesno "${RC_GOINGDOWN}"; then
|
||||
rc=0
|
||||
fi
|
||||
eend $rc
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ do_routes()
|
||||
*) family=;;
|
||||
esac
|
||||
fi
|
||||
route $famly $xtra $2 -$args
|
||||
route $family $xtra $2 -$args
|
||||
;;
|
||||
esac
|
||||
veend $?
|
||||
|
||||
@@ -10,6 +10,7 @@ ttyn=${rc_tty_number:-${RC_TTY_NUMBER:-12}}
|
||||
depend()
|
||||
{
|
||||
keyword -openvz -prefix -uml -vserver -xenu
|
||||
need root
|
||||
}
|
||||
|
||||
start()
|
||||
@@ -31,5 +32,16 @@ start()
|
||||
printf "\033%s" "$termencoding" >$ttydev$n
|
||||
n=$(($n + 1))
|
||||
done
|
||||
|
||||
# Save the encoding for use immediately at boot
|
||||
if [ -w "$RC_LIBEXECDIR" ]; then
|
||||
mkdir -p "$RC_LIBEXECDIR"/console
|
||||
if yesno ${unicode:-${UNICODE}}; then
|
||||
echo "" > "$RC_LIBEXECDIR"/console/unicode
|
||||
else
|
||||
rm -f "$RC_LIBEXECDIR"/console/unicode
|
||||
fi
|
||||
fi
|
||||
|
||||
eend 0
|
||||
}
|
||||
|
||||
6
local.d/Makefile
Normal file
6
local.d/Makefile
Normal file
@@ -0,0 +1,6 @@
|
||||
DIR= ${LOCALDIR}
|
||||
CONF= README
|
||||
|
||||
MK= ../mk
|
||||
include ${MK}/os.mk
|
||||
include ${MK}/scripts.mk
|
||||
9
local.d/README
Normal file
9
local.d/README
Normal file
@@ -0,0 +1,9 @@
|
||||
This directory should contain programs or scripts which are to be run
|
||||
when the local service is started or stopped.
|
||||
|
||||
If a file in this directory is executable and it has a .start extension,
|
||||
it will be run when the local service is started. If a file is
|
||||
executable and it has a .stop extension, it will be run when the local
|
||||
service is stopped.
|
||||
|
||||
All files are processed in lexical order.
|
||||
@@ -148,7 +148,8 @@ have this keyword.
|
||||
Don't stop this service when changing runlevels, even if not present.
|
||||
This includes shutting the system down.
|
||||
.It Dv -timeout
|
||||
Do not time out waiting for that service.
|
||||
Other services should wait indefinitely for this service to start. Use
|
||||
this keyword if your service may take longer than 60 seconds to start.
|
||||
.It Dv -jail
|
||||
When in a jail, exclude this service from any dependencies. The service can
|
||||
still be run directly. Set via
|
||||
|
||||
10
mk/cc.mk
10
mk/cc.mk
@@ -5,9 +5,9 @@ CFLAGS?= -O2
|
||||
|
||||
# Default to using the C99 standard
|
||||
CSTD?= c99
|
||||
_CSTD_SH= if test -n "${CSTD}"; then echo "-std=${CSTD}"; else echo ""; fi
|
||||
_CSTD!= ${_CSTD_SH}
|
||||
CFLAGS+= ${_CSTD}$(shell ${_CSTD_SH})
|
||||
ifneq (${CSTD},)
|
||||
CFLAGS+= -std=${CSTD}
|
||||
endif
|
||||
|
||||
# Try and use some good cc flags if we're building from git
|
||||
# We don't use -pedantic as it will warn about our perfectly valid
|
||||
@@ -29,5 +29,5 @@ _CC_FLAGS_SH= for f in ${_CCFLAGS}; do \
|
||||
${CC} $$f -S -xc -o /dev/null - ; \
|
||||
then printf "%s" "$$f "; fi \
|
||||
done;
|
||||
_CC_FLAGS!= ${_CC_FLAGS_SH}
|
||||
CFLAGS+= ${_CC_FLAGS}$(shell ${_CC_FLAGS_SH})
|
||||
_CC_FLAGS:= $(shell ${_CC_FLAGS_SH})
|
||||
CFLAGS+= ${_CC_FLAGS}
|
||||
|
||||
12
mk/debug.mk
12
mk/debug.mk
@@ -3,14 +3,14 @@
|
||||
# All rights reserved. Released under the 2-clause BSD license.
|
||||
|
||||
_RC_DEBUG_SH= case "${DEBUG}" in "") echo "";; *) echo "-DRC_DEBUG";; esac
|
||||
_RC_DEBUG!= ${_RC_DEBUG_SH}
|
||||
CPPFLAGS+= ${_RC_DEBUG}$(shell ${_RC_DEBUG_SH})
|
||||
_RC_DEBUG:= $(shell ${_RC_DEBUG_SH})
|
||||
CPPFLAGS+= ${_RC_DEBUG}
|
||||
|
||||
# Should we enable this with a different flag?
|
||||
_LD_DEBUG_SH= case "${DEBUG}" in "") echo "";; *) echo "-Wl,--rpath=../librc -Wl,--rpath=../libeinfo";; esac
|
||||
_LD_DEBUG!= ${_LD_DEBUG_SH}
|
||||
LDFLAGS+= ${_LD_DEBUG}$(shell ${_LD_DEBUG_SH})
|
||||
_LD_DEBUG:= $(shell ${_LD_DEBUG_SH})
|
||||
LDFLAGS+= ${_LD_DEBUG}
|
||||
|
||||
_GGDB_SH= case "${DEBUG}" in "") echo "";; *) echo "-ggdb";; esac
|
||||
_GGDB!= ${_GGDB_SH}
|
||||
CFLAGS+= ${_GGDB}$(shell ${_GGDB_SH})
|
||||
_GGDB:= $(shell ${_GGDB_SH})
|
||||
CFLAGS+= ${_GGDB}
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
# This space left intentionally blank because gmake does not load .depend
|
||||
# by default
|
||||
@@ -1,3 +0,0 @@
|
||||
# Tell gmake to include the optional dependency file.
|
||||
# This sucks, but I don't know any other way of portably making this work.
|
||||
-include .depend
|
||||
@@ -10,9 +10,4 @@ IGNOREFILES+= .depend
|
||||
|
||||
depend: .depend extra_depend
|
||||
|
||||
# Nasty hack. depend-.mk is a blank file, depend-gmake.mk has a gmake specific
|
||||
# command to optionally include .depend.
|
||||
# Someone should patch gmake to optionally include .depend if it exists.
|
||||
_INC_DEP= $(shell if ${MAKE} --version | grep -q "^GNU "; then \
|
||||
echo "gmake"; else echo ""; fi)
|
||||
include ${MK}/depend-${_INC_DEP}.mk
|
||||
-include .depend
|
||||
|
||||
@@ -9,8 +9,8 @@ DISTFILE?= ${DISTPREFIX}.tar.bz2
|
||||
CLEANFILES+= ${NAME}-*.tar.bz2
|
||||
|
||||
_SNAP_SH= date -u +%Y%m%d%H%M
|
||||
_SNAP!= ${_SNAP_SH}
|
||||
SNAP= ${_SNAP}$(shell ${_SNAP_SH})
|
||||
_SNAP:= $(shell ${_SNAP_SH})
|
||||
SNAP= ${_SNAP}
|
||||
SNAPDIR= ${DISTPREFIX}-${SNAP}
|
||||
SNAPFILE= ${SNAPDIR}.tar.bz2
|
||||
|
||||
|
||||
@@ -4,5 +4,5 @@ _GITVER_SH= if git rev-parse --short HEAD >/dev/null 2>&1; then \
|
||||
else \
|
||||
echo ""; \
|
||||
fi
|
||||
_GITVER!= ${_GITVER_SH}
|
||||
GITVER= ${_GITVER}$(shell ${_GITVER_SH})
|
||||
_GITVER:= $(shell ${_GITVER_SH})
|
||||
GITVER= ${_GITVER}
|
||||
|
||||
@@ -31,8 +31,6 @@ lib${LIB}.a: ${OBJS} ${STATICOBJS}
|
||||
|
||||
${SHLIB_NAME}: ${VERSION_MAP}
|
||||
LDFLAGS+= -Wl,--version-script=${VERSION_MAP}
|
||||
# We need to ensure we use libraries in /lib
|
||||
LDFLAGS+= -L/${LIBNAME} -Wl,-rpath=/${LIBNAME}
|
||||
|
||||
${SHLIB_NAME}: ${SOBJS}
|
||||
@${ECHO} building shared library $@
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
LIBTERMCAP?= -lncurses
|
||||
CPPFLAGS+= -DHAVE_TERMCAP
|
||||
LDADD+= ${LIBTERMCAP}
|
||||
4
mk/os.mk
4
mk/os.mk
@@ -4,8 +4,8 @@
|
||||
# Generic definitions
|
||||
|
||||
_OS_SH= uname -s
|
||||
_OS!= ${_OS_SH}
|
||||
OS?= ${_OS}$(shell ${_OS_SH})
|
||||
_OS:= $(shell ${_OS_SH})
|
||||
OS?= ${_OS}
|
||||
include ${MK}/os-${OS}.mk
|
||||
|
||||
RC_LIB= /$(LIBNAME)/rc
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
ifeq (${MKPAM},pam)
|
||||
LIBPAM?= -lpam
|
||||
CPPFLAGS+= -DHAVE_PAM
|
||||
LDADD+= ${LIBPAM}
|
||||
|
||||
PAMDIR?= /etc/pam.d
|
||||
PAMMODE?= 0644
|
||||
else ifneq (${MKPAM},)
|
||||
$(error if MKPAM is defined, it must be "pam")
|
||||
endif
|
||||
|
||||
@@ -15,8 +15,8 @@ _DYNLINK_SH= if test "${PREFIX}" = "" && test -e /libexec/ld.elf_so; then \
|
||||
else \
|
||||
echo ""; \
|
||||
fi
|
||||
_DYNLINK!= ${_DYNLINK_SH}
|
||||
LDFLAGS+= ${_DYNLINK}$(shell ${_DYNLINK_SH})
|
||||
_DYNLINK:= $(shell ${_DYNLINK_SH})
|
||||
LDFLAGS+= ${_DYNLINK}
|
||||
LDFLAGS+= -Wl,-rpath=${PREFIX}/${LIBNAME}
|
||||
LDFLAGS+= ${PROGLDFLAGS}
|
||||
|
||||
|
||||
@@ -8,11 +8,11 @@ include ${MK}/os.mk
|
||||
OBJS+= ${SRCS:.in=}
|
||||
|
||||
_PKG_SED_SH= if test "${PREFIX}" = "${PKG_PREFIX}"; then echo "-e 's:@PKG_PREFIX@::g'"; else echo "-e 's:@PKG_PREFIX@:${PKG_PREFIX}:g'"; fi
|
||||
_PKG_SED!= ${_PKG_SED_SH}
|
||||
_PKG_SED:= $(shell ${_PKG_SED_SH})
|
||||
_LCL_SED_SH= if test "${PREFIX}" = "${LOCAL_PREFIX}"; then echo "-e 's:@LOCAL_PREFIX@::g'"; else echo "-e 's:@LOCAL_PREFIX@:${LOCAL_PREFIX}:g'"; fi
|
||||
_LCL_SED!= ${_LCL_SED_SH}
|
||||
_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' ${_PKG_SED}$(shell ${_PKG_SED_SH}) ${_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}
|
||||
|
||||
# Tweak our shell scripts
|
||||
.SUFFIXES: .sh.in .in
|
||||
|
||||
@@ -12,8 +12,8 @@ SH= /bin/sh
|
||||
|
||||
PREFIX?=
|
||||
_UPREFIX_SH= case "${PREFIX}" in "") echo /usr;; *) echo "${PREFIX}";; esac
|
||||
_UPREFIX!= ${_UPREFIX_SH}
|
||||
UPREFIX= ${_UPREFIX}$(shell ${_UPREFIX_SH})
|
||||
_UPREFIX:= $(shell ${_UPREFIX_SH})
|
||||
UPREFIX= ${_UPREFIX}
|
||||
LOCAL_PREFIX= /usr/local
|
||||
|
||||
PICFLAG?= -fPIC
|
||||
@@ -21,6 +21,7 @@ PICFLAG?= -fPIC
|
||||
SYSCONFDIR?= ${PREFIX}/etc
|
||||
INITDIR?= ${SYSCONFDIR}/init.d
|
||||
CONFDIR?= ${SYSCONFDIR}/conf.d
|
||||
LOCALDIR?= ${SYSCONFDIR}/local.d
|
||||
|
||||
BINDIR?= ${PREFIX}/sbin
|
||||
BINMODE?= 0755
|
||||
@@ -29,8 +30,8 @@ INCDIR?= ${UPREFIX}/include
|
||||
INCMODE?= 0444
|
||||
|
||||
_LIBNAME_SH= case `readlink /lib` in /lib64|lib64) echo "lib64";; *) echo "lib";; esac
|
||||
_LIBNAME!= ${_LIBNAME_SH}
|
||||
LIBNAME?= ${_LIBNAME}$(shell ${_LIBNAME_SH})
|
||||
_LIBNAME:= $(shell ${_LIBNAME_SH})
|
||||
LIBNAME?= ${_LIBNAME}
|
||||
LIBDIR?= ${UPREFIX}/${LIBNAME}
|
||||
LIBMODE?= 0444
|
||||
SHLIBDIR?= ${PREFIX}/${LIBNAME}
|
||||
|
||||
@@ -1,3 +1,11 @@
|
||||
ifeq (${MKTERMCAP},ncurses)
|
||||
LIBTERMCAP?= -lncurses
|
||||
CPPFLAGS+= -DHAVE_TERMCAP
|
||||
LDADD+= ${LIBTERMCAP}
|
||||
else ifeq (${MKTERMCAP},termcap)
|
||||
LIBTERMCAP?= -ltermcap
|
||||
CPPFLAGS+= -DHAVE_TERMCAP
|
||||
LDADD+= ${LIBTERMCAP}
|
||||
else ifneq (${MKTERMCAP},)
|
||||
$(error If MKTERMCAP is defined, it must be ncurses or termcap)
|
||||
endif
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
SRCS+= iwconfig.sh.in
|
||||
INC+= adsl.sh apipa.sh arping.sh bonding.sh br2684ctl.sh bridge.sh \
|
||||
ccwgroup.sh clip.sh iproute2.sh ifplugd.sh ip6to4.sh ipppd.sh \
|
||||
iwconfig.sh netplugd.sh pppd.sh pump.sh tuntap.sh udhcpc.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
|
||||
|
||||
@@ -100,9 +100,9 @@ bonding_pre_start()
|
||||
if [ -n "${primary}" ]; then
|
||||
echo "+${primary}" >/sys/class/net/"${IFACE}"/bonding/slaves
|
||||
echo "${primary}" >/sys/class/net/"${IFACE}"/bonding/primary
|
||||
slaves="${slaves/${primary}/}"
|
||||
fi
|
||||
for s in ${slaves}; do
|
||||
[ "${s}" = "${primary}" ] && continue
|
||||
echo "+${s}" >/sys/class/net/"${IFACE}"/bonding/slaves
|
||||
done
|
||||
else
|
||||
|
||||
@@ -45,8 +45,8 @@ bridge_pre_start()
|
||||
eval bridge_unset=\${bridge_${IFVAR}-y\}
|
||||
eval brctl_unset=\${brctl_${IFVAR}-y\}
|
||||
|
||||
if [ -z "${brif}" -a "${brctl_unset}" == 'y' ]; then
|
||||
if [ -z "${ports}" -a "${bridge_unset}" == "y" ]; then
|
||||
if [ -z "${brif}" -a "${brctl_unset}" = 'y' ]; then
|
||||
if [ -z "${ports}" -a "${bridge_unset}" = "y" ]; then
|
||||
#eerror "Misconfigured static bridge detected (see net.example)"
|
||||
return 0
|
||||
fi
|
||||
|
||||
54
net/ethtool.sh
Normal file
54
net/ethtool.sh
Normal file
@@ -0,0 +1,54 @@
|
||||
# Copyright (c) 2011 by Gentoo Foundation
|
||||
# All rights reserved. Released under the 2-clause BSD license.
|
||||
|
||||
_ethtool() {
|
||||
echo /usr/sbin/ethtool
|
||||
}
|
||||
|
||||
ethtool_depend()
|
||||
{
|
||||
program $(_ethtool)
|
||||
before interface
|
||||
}
|
||||
|
||||
# This is just to trim whitespace, do not add any quoting!
|
||||
_trim() {
|
||||
echo $*
|
||||
}
|
||||
|
||||
ethtool_pre_start() {
|
||||
local order opt OFS="${OIFS}"
|
||||
eval order=\$ethtool_order_${IFVAR}
|
||||
[ -z "${order}" ] && eval order=\$ethtool_order
|
||||
[ -z "${order}" ] && order="flash change-eeprom change pause coalesce ring offload identify nfc rxfh-indir ntuple"
|
||||
# ethtool options not used: --driver, --register-dump, --eeprom-dump, --negotiate, --test, --statistics
|
||||
eindent
|
||||
for opt in ${order} ; do
|
||||
local args
|
||||
eval args=\$ethtool_$(echo $opt | tr - _)_${IFVAR}
|
||||
|
||||
# Skip everything if no arguments
|
||||
[ -z "${args}" ] && continue
|
||||
|
||||
# Split on \n
|
||||
local IFS="$__IFS"
|
||||
|
||||
for p in ${args} ; do
|
||||
IFS="${OIFS}"
|
||||
local args_pretty="$(_trim "${p}")"
|
||||
# Do nothing if empty
|
||||
[ -z "${args_pretty}" ] && continue
|
||||
args_pretty="--${opt} $IFACE ${args_pretty}"
|
||||
args="--${opt} $IFACE ${args}"
|
||||
ebegin "ethtool ${args_pretty}"
|
||||
$(_ethtool) ${args}
|
||||
rc=$?
|
||||
eend $rc "ethtool exit code $rc"
|
||||
# TODO: ethtool has MANY different exit codes, with no
|
||||
# documentation as to which ones are fatal or not. For now we
|
||||
# simply print the exit code and don't stop the start sequence.
|
||||
done
|
||||
IFS="${OIFS}"
|
||||
done
|
||||
eoutdent
|
||||
}
|
||||
@@ -221,7 +221,7 @@ _ip_rule_runner() {
|
||||
local IFS="$__IFS"
|
||||
for ru in $rules ; do
|
||||
unset IFS
|
||||
ruN="$(trim "${ru}")"
|
||||
ruN="$(_trim "${ru}")"
|
||||
[ -z "${ruN}" ] && continue
|
||||
vebegin "${cmd} ${ruN}"
|
||||
ip rule ${cmd} ${ru}
|
||||
@@ -239,9 +239,14 @@ iproute2_pre_start()
|
||||
if [ -n "${tunnel}" ]; then
|
||||
# Set our base metric to 1000
|
||||
metric=1000
|
||||
# Bug#347657: If the mode is 'ipip6' or 'ip6ip6', the -6 must be passed
|
||||
# to iproute2 during tunnel creation.
|
||||
local ipproto=''
|
||||
[ "${tunnel##mode ipip6}" != "${tunnel}" ] && ipproto='-6'
|
||||
[ "${tunnel##mode ip6ip6}" != "${tunnel}" ] && ipproto='-6'
|
||||
|
||||
ebegin "Creating tunnel ${IFVAR}"
|
||||
ip tunnel add ${tunnel} name "${IFACE}"
|
||||
ip ${ipproto} tunnel add ${tunnel} name "${IFACE}"
|
||||
eend $? || return 1
|
||||
_up
|
||||
fi
|
||||
|
||||
58
net/vlan.sh
58
net/vlan.sh
@@ -1,9 +1,18 @@
|
||||
# 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
|
||||
}
|
||||
|
||||
vlan_depend()
|
||||
{
|
||||
program /sbin/vconfig
|
||||
program $(_ip)
|
||||
after interface
|
||||
before dhcp
|
||||
}
|
||||
@@ -36,31 +45,12 @@ _check_vlan()
|
||||
|
||||
vlan_pre_start()
|
||||
{
|
||||
local vc="$(_get_array "vconfig_${IFVAR}")"
|
||||
[ -z "${vc}" ] && return 0
|
||||
|
||||
_check_vlan || return 1
|
||||
_exists || return 1
|
||||
|
||||
local v= x= e=
|
||||
local IFS="$__IFS"
|
||||
for v in ${vc}; do
|
||||
unset IFS
|
||||
case "${v}" in
|
||||
set_name_type" "*) x=${v};;
|
||||
*)
|
||||
set -- ${v}
|
||||
x="$1 ${IFACE}"
|
||||
shift
|
||||
x="${x} $@"
|
||||
;;
|
||||
esac
|
||||
|
||||
e="$(vconfig ${x} 2>&1 1>/dev/null)"
|
||||
[ -z "${e}" ] && continue
|
||||
eerror "${e}"
|
||||
local vconfig
|
||||
eval vconfig=\$vconfig_${IFVAR}
|
||||
if [ -n "${vconfig}" ]; then
|
||||
eerror "You must convert your vconfig_ VLAN entries to vlan${N} entries."
|
||||
return 1
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
vlan_post_start()
|
||||
@@ -72,10 +62,22 @@ vlan_post_start()
|
||||
_check_vlan || return 1
|
||||
_exists || return 1
|
||||
|
||||
local vlan= e= s=
|
||||
local vlan= e= s= vname= vflags= vingress= vegress=
|
||||
for vlan in ${vlans}; do
|
||||
einfo "Adding VLAN ${vlan} to ${IFACE}"
|
||||
e="$(vconfig add "${IFACE}" "${vlan}" 2>&1 1>/dev/null)"
|
||||
# We need to gather all interface configuration options
|
||||
# 1) naming. Default to the standard "${IFACE}.${vlan}" but it can be anything
|
||||
eval vname=\$vlan${vlan}_name
|
||||
[ -z "${vname}" ] && vname="${IFACE}.${vlan}"
|
||||
# 2) flags
|
||||
eval vflags=\$vlan${vlan}_flags
|
||||
# 3) ingress/egress map
|
||||
eval vingress=\$vlan${vlan}_ingress
|
||||
[ -z "${vingress}" ] || vingress="ingress-qos-map ${vingress}"
|
||||
eval vegress=\$vlan${vlan}_egress
|
||||
[ -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)"
|
||||
if [ -n "${e}" ]; then
|
||||
eend 1 "${e}"
|
||||
continue
|
||||
@@ -110,7 +112,7 @@ vlan_post_stop()
|
||||
stop
|
||||
) && {
|
||||
mark_service_stopped "net.${vlan}"
|
||||
vconfig rem "${vlan}" >/dev/null
|
||||
ip link delete "${vlan}" type vlan >/dev/null
|
||||
}
|
||||
done
|
||||
|
||||
|
||||
@@ -65,27 +65,21 @@ mount_svcdir()
|
||||
# By default VServer already has /proc mounted, but OpenVZ does not!
|
||||
# However, some of our users have an old proc image in /proc
|
||||
# NFC how they managed that, but the end result means we have to test if
|
||||
# /proc actually works or not. We to this by comparing two reads of
|
||||
# /proc/self/stat. They will not match, because at least the minor fault count
|
||||
# field (field 10) should have changed.
|
||||
#
|
||||
# We can use any file here that fills the following requirements:
|
||||
# - changes between sequential reads
|
||||
# - is world-readable (not blocked in hardened kernel)
|
||||
# - Is only a single line (ergo entire check is doable with no forks)
|
||||
# /proc actually works or not. We do this by comparing two reads of
|
||||
# /proc/self/environ for which we have set the variable VAR to two
|
||||
# different values. If the comparison comes back equal, we know that
|
||||
# /proc is not working.
|
||||
mountproc=true
|
||||
f=/proc/self/stat
|
||||
f=/proc/self/environ
|
||||
if [ -e $f ]; then
|
||||
exec 9<$f ; read a <&9 ; exec 9<&-
|
||||
exec 9<$f ; read b <&9 ; exec 9<&-
|
||||
if [ "$a" = "$b" ]; then
|
||||
if [ "$(VAR=a cat $f)" = "$(VAR=b cat $f)" ]; then
|
||||
eerror "You have cruft in /proc that should be deleted"
|
||||
else
|
||||
einfo "/proc is already mounted, skipping"
|
||||
mountproc=false
|
||||
fi
|
||||
fi
|
||||
unset a b f
|
||||
unset f
|
||||
|
||||
if $mountproc; then
|
||||
procfs="proc"
|
||||
|
||||
@@ -10,4 +10,4 @@ MK= ../../mk
|
||||
include ${MK}/lib.mk
|
||||
include ${MK}/cc.mk
|
||||
include ${MK}/debug.mk
|
||||
include ${MK}/${MKTERMCAP}.mk
|
||||
include ${MK}/termcap.mk
|
||||
|
||||
@@ -19,21 +19,26 @@ SED_CMD= -e 's:@PREFIX@:${PREFIX}:g'
|
||||
SED_CMD+= -e 's:@LIB@:${LIBNAME}:g'
|
||||
SED_CMD+= -e 's:@SYSCONFDIR@:${SYSCONFDIR}:g'
|
||||
SED_CMD+= -e 's:@LIBEXECDIR@:${LIBEXECDIR}:g'
|
||||
_PKG_PREFIX_SH= if test -n "${PKG_PREFIX}" && test "${PKG_PREFIX}" != "/" && test "${PKG_PREFIX}" != "${PREFIX}"; then \
|
||||
echo "-e 's:@PKG_PREFIX@:${PKG_PREFIX}:g'"; \
|
||||
else \
|
||||
echo "-e 's:.*@PKG_PREFIX@.*:\#undef RC_PKG_PREFIX:g'"; \
|
||||
fi
|
||||
_PKG_PREFIX!= ${_PKG_PREFIX_SH}
|
||||
SED_CMD+= ${_PKG_PREFIX}$(shell ${_PKG_PREFIX_SH})
|
||||
|
||||
_LCL_PREFIX_SH= if test -n "${LOCAL_PREFIX}" && test "${LOCAL_PREFIX}" != "/" && test "${LOCAL_PREFIX}" != "${PREFIX}"; then \
|
||||
echo "-e 's:@LOCAL_PREFIX@:${LOCAL_PREFIX}:g'"; \
|
||||
else \
|
||||
echo "-e 's:@LOCAL_PREFIX@::g'"; \
|
||||
fi
|
||||
_LCL_PREFIX!= ${_LCL_PREFIX_SH}
|
||||
SED_CMD+= ${_LCL_PREFIX}$(shell ${_LCL_PREFIX_SH})
|
||||
_PKG_PREFIX= -e 's:.*@PKG_PREFIX@.*:\#undef RC_PKG_PREFIX:g'
|
||||
ifneq (${PKG_PREFIX},)
|
||||
ifneq (${PKG_PREFIX},/)
|
||||
ifneq (${PKG_PREFIX},${PREFIX})
|
||||
_PKG_PREFIX= -e 's:@PKG_PREFIX@:${PKG_PREFIX}:g'
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
SED_CMD+= ${_PKG_PREFIX}
|
||||
|
||||
_LCL_PREFIX= -e 's:@LOCAL_PREFIX@::g'
|
||||
ifneq (${LOCAL_PREFIX},)
|
||||
ifneq (${LOCAL_PREFIX},/)
|
||||
ifneq (${LOCAL_PREFIX},${PREFIX})
|
||||
_LCL_PREFIX= -e 's:@LOCAL_PREFIX@:${LOCAL_PREFIX}:g'
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
SED_CMD+= ${_LCL_PREFIX}
|
||||
|
||||
.SUFFIXES: .h.in .h
|
||||
.h.in.h:
|
||||
|
||||
@@ -924,7 +924,7 @@ rc_deptree_update(void)
|
||||
if (strcmp(deptype->type, "ineed") == 0) {
|
||||
fprintf (stderr,
|
||||
"Service `%s' needs non"
|
||||
" existant service `%s'\n",
|
||||
" existent service `%s'\n",
|
||||
depinfo->service, s->value);
|
||||
dt = get_deptype(depinfo, "broken");
|
||||
if (!dt) {
|
||||
|
||||
@@ -41,9 +41,25 @@ include ${MK}/prog.mk
|
||||
include ${MK}/git.mk
|
||||
include ${MK}/cc.mk
|
||||
|
||||
include ${MK}/${MKTERMCAP}.mk
|
||||
include ${MK}/termcap.mk
|
||||
LDADD+= ${LIBDL} ${LIBKVM}
|
||||
include ${MK}/${MKPAM}.mk
|
||||
include ${MK}/pam.mk
|
||||
|
||||
# create symlinks to rc if not an SELINUX system, otherwise create a wrapper
|
||||
# script to call rc with the proper name of the applet to execute.
|
||||
# $1 is a list of the links
|
||||
# $2 is the path+name of the target to link to (usually 'rc' or '/sbin/rc')
|
||||
# $3 is the path where the links are created
|
||||
define make-links
|
||||
for x in $(1); do \
|
||||
if test -n "${MKSELINUX}"; then \
|
||||
printf '#!/bin/sh\nexec ${2} --applet %s "$$@"\n' $$x >${3}/$$x; \
|
||||
chmod ${BINMODE} ${3}/$$x; \
|
||||
else \
|
||||
ln -sf ${2} ${3}/$$x; \
|
||||
fi; \
|
||||
done;
|
||||
endef
|
||||
|
||||
${SRCS}: version.h
|
||||
|
||||
@@ -61,13 +77,13 @@ install: all
|
||||
${INSTALL} -d ${DESTDIR}${SBINDIR}
|
||||
${INSTALL} -m ${BINMODE} ${PROG} ${DESTDIR}${SBINDIR}
|
||||
${INSTALL} -d ${DESTDIR}${BINDIR}
|
||||
for x in ${BINLINKS}; do ln -fs ${SBINDIR}/${PROG} ${DESTDIR}${BINDIR}/$$x; done
|
||||
$(call make-links,${BINLINKS},${SBINDIR}/${PROG},${DESTDIR}${BINDIR})
|
||||
${INSTALL} -d ${DESTDIR}${SBINDIR}
|
||||
for x in ${SBINLINKS}; do ln -fs ${PROG} ${DESTDIR}${SBINDIR}/$$x; done
|
||||
$(call make-links,${SBINLINKS},${SBINDIR}/${PROG},${DESTDIR}${SBINDIR})
|
||||
${INSTALL} -d ${DESTDIR}${LINKDIR}/bin
|
||||
for x in $(RC_BINLINKS); do ln -fs ${SBINDIR}/${PROG} ${DESTDIR}${LINKDIR}/bin/$$x; done
|
||||
$(call make-links,${RC_BINLINKS},${SBINDIR}/${PROG},${DESTDIR}${LINKDIR}/bin)
|
||||
${INSTALL} -d ${DESTDIR}${LINKDIR}/sbin
|
||||
for x in ${RC_SBINLINKS}; do ln -fs ${SBINDIR}/${PROG} ${DESTDIR}${LINKDIR}/sbin/$$x; done
|
||||
$(call make-links, ${RC_SBINLINKS},${SBINDIR}/${PROG},${DESTDIR}${LINKDIR}/sbin)
|
||||
if test "${MKPAM}" = pam; then \
|
||||
${INSTALL} -d ${DESTDIR}${PAMDIR}; \
|
||||
${INSTALL} -m ${PAMMODE} start-stop-daemon.pam ${DESTDIR}${PAMDIR}/start-stop-daemon; \
|
||||
@@ -76,4 +92,4 @@ install: all
|
||||
check test::
|
||||
|
||||
links: rc
|
||||
for l in ${ALL_LINKS}; do ln -sf rc $$l || exit $$? ; done
|
||||
$(call make-links,${ALL_LINKS},rc,.)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright (c) 2007-2008 Roy Marples <roy@marples.name>
|
||||
* All rights reserved
|
||||
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
@@ -24,6 +24,8 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "version.h"
|
||||
|
||||
#if lint
|
||||
# define _noreturn
|
||||
#endif
|
||||
@@ -33,6 +35,22 @@
|
||||
# define _noreturn
|
||||
#endif
|
||||
|
||||
_noreturn static void
|
||||
show_version(void)
|
||||
{
|
||||
const char *bootlevel = NULL;
|
||||
|
||||
printf("%s (OpenRC", applet);
|
||||
if ((bootlevel = rc_sys()))
|
||||
printf(" [%s]", bootlevel);
|
||||
printf(") %s", VERSION);
|
||||
#ifdef BRANDING
|
||||
printf(" (%s)", BRANDING);
|
||||
#endif
|
||||
printf("\n");
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
_noreturn static void
|
||||
usage(int exit_status)
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright (c) 2007-2008 Roy Marples <roy@marples.name>
|
||||
* All rights reserved
|
||||
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
@@ -24,11 +24,12 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#define getoptstring_COMMON "Chqv"
|
||||
#define getoptstring_COMMON "ChqVv"
|
||||
|
||||
#define longopts_COMMON \
|
||||
{ "help", 0, NULL, 'h'}, \
|
||||
{ "nocolor", 0, NULL, 'C'}, \
|
||||
{ "version", 0, NULL, 'V'}, \
|
||||
{ "verbose", 0, NULL, 'v'}, \
|
||||
{ "quiet", 0, NULL, 'q'}, \
|
||||
{ NULL, 0, NULL, 0 }
|
||||
@@ -36,11 +37,13 @@
|
||||
#define longopts_help_COMMON \
|
||||
"Display this help output", \
|
||||
"Disable color output", \
|
||||
"Display software version", \
|
||||
"Run verbosely", \
|
||||
"Run quietly"
|
||||
|
||||
#define case_RC_COMMON_getopt_case_C setenv ("EINFO_COLOR", "NO", 1);
|
||||
#define case_RC_COMMON_getopt_case_h usage (EXIT_SUCCESS);
|
||||
#define case_RC_COMMON_getopt_case_V if (argc == 2) show_version();
|
||||
#define case_RC_COMMON_getopt_case_v setenv ("EINFO_VERBOSE", "YES", 1);
|
||||
#define case_RC_COMMON_getopt_case_q setenv ("EINFO_QUIET", "YES", 1);
|
||||
#define case_RC_COMMON_getopt_default usage (EXIT_FAILURE);
|
||||
@@ -48,6 +51,7 @@
|
||||
#define case_RC_COMMON_GETOPT \
|
||||
case 'C': case_RC_COMMON_getopt_case_C; break; \
|
||||
case 'h': case_RC_COMMON_getopt_case_h; break; \
|
||||
case 'V': case_RC_COMMON_getopt_case_V; break; \
|
||||
case 'v': case_RC_COMMON_getopt_case_v; break; \
|
||||
case 'q': case_RC_COMMON_getopt_case_q; break; \
|
||||
default: case_RC_COMMON_getopt_default; break;
|
||||
|
||||
@@ -429,6 +429,17 @@ run_applets(int argc, char **argv)
|
||||
char *p;
|
||||
pid_t pid = 0;
|
||||
|
||||
/* Bug 351712: We need an extra way to explicitly select an applet OTHER
|
||||
* than trusting argv[0], as argv[0] is not going to be the applet value if
|
||||
* we are doing SELinux context switching. For this, we allow calls such as
|
||||
* 'rc --applet APPLET', and shift ALL of argv down by two array items. */
|
||||
if (strcmp(applet, "rc") == 0 && argc >= 3 &&
|
||||
(strcmp(argv[1],"--applet") == 0 || strcmp(argv[1], "-a") == 0)) {
|
||||
applet = argv[2];
|
||||
argv += 2;
|
||||
argc -= 2;
|
||||
}
|
||||
|
||||
/* These are designed to be applications in their own right */
|
||||
if (strcmp(applet, "fstabinfo") == 0)
|
||||
exit(fstabinfo(argc, argv));
|
||||
|
||||
38
src/rc/rc.c
38
src/rc/rc.c
@@ -773,14 +773,16 @@ handle_bad_signal(int sig)
|
||||
#endif
|
||||
|
||||
#include "_usage.h"
|
||||
#define getoptstring "o:s:S" getoptstring_COMMON
|
||||
#define getoptstring "a:o:s:S" getoptstring_COMMON
|
||||
static const struct option longopts[] = {
|
||||
{ "applet", 1, NULL, 'a' },
|
||||
{ "override", 1, NULL, 'o' },
|
||||
{ "service", 1, NULL, 's' },
|
||||
{ "sys", 0, NULL, 'S' },
|
||||
longopts_COMMON
|
||||
};
|
||||
static const char * const longopts_help[] = {
|
||||
"runs the applet specified by the next argument",
|
||||
"override the next runlevel to change into\n"
|
||||
"when leaving single user or boot runlevels",
|
||||
"runs the service specified with the rest\nof the arguments",
|
||||
@@ -817,38 +819,12 @@ main(int argc, char **argv)
|
||||
signal_setup(SIGSEGV, handle_bad_signal);
|
||||
#endif
|
||||
|
||||
/* Bug 351712: We need an extra way to explicitly select an applet OTHER
|
||||
* than trusting argv[0], as argv[0] is not going to be the applet value if
|
||||
* we are doing SELinux context switching. For this, we allow calls such as
|
||||
* 'rc --applet APPLET', and shift ALL of argv down by two array items. */
|
||||
if (strcmp(basename_c(argv[0]), "rc") == 0 && argc > 1 && strcmp(argv[1], "--applet") == 0) {
|
||||
if (argc == 2)
|
||||
eerrorx("applet argument required");
|
||||
for (i = 2; i < argc; i++)
|
||||
argv[i - 2] = argv[i];
|
||||
argv[argc - 2] = NULL;
|
||||
argv[argc - 1] = NULL;
|
||||
argc -= 2;
|
||||
}
|
||||
/* Now we can trust our applet value in argv[0] */
|
||||
applet = basename_c(argv[0]);
|
||||
LIST_INIT(&service_pids);
|
||||
atexit(cleanup);
|
||||
if (!applet)
|
||||
eerrorx("arguments required");
|
||||
|
||||
if (argc > 1 && (strcmp(argv[1], "--version") == 0)) {
|
||||
printf("%s (OpenRC", applet);
|
||||
if ((bootlevel = rc_sys()))
|
||||
printf(" [%s]", bootlevel);
|
||||
printf(") " VERSION
|
||||
#ifdef BRANDING
|
||||
" (" BRANDING ")"
|
||||
#endif
|
||||
"\n");
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
/* Run our built in applets. If we ran one, we don't return. */
|
||||
run_applets(argc, argv);
|
||||
|
||||
@@ -870,6 +846,10 @@ main(int argc, char **argv)
|
||||
longopts, (int *) 0)) != -1)
|
||||
{
|
||||
switch (opt) {
|
||||
case 'a':
|
||||
/* Do nothing, actual logic in run_applets, this
|
||||
* is a placeholder */
|
||||
break;
|
||||
case 'o':
|
||||
if (*optarg == '\0')
|
||||
optarg = NULL;
|
||||
@@ -905,8 +885,8 @@ main(int argc, char **argv)
|
||||
}
|
||||
exit(EXIT_SUCCESS);
|
||||
/* NOTREACHED */
|
||||
case_RC_COMMON_GETOPT
|
||||
}
|
||||
case_RC_COMMON_GETOPT
|
||||
}
|
||||
}
|
||||
|
||||
newlevel = argv[optind++];
|
||||
|
||||
@@ -57,6 +57,7 @@ sed -n '/^librc_hidden_proto/s:.*(\(.*\))$:\1:p' ${librc_srcdir}/librc.h \
|
||||
| LC_ALL=C sort -u \
|
||||
> librc.funcs.hidden.list
|
||||
readelf -Wr $(grep -l '#include[[:space:]]"librc\.h"' ${librc_srcdir}/*.c | sed 's:\.c$:.o:') \
|
||||
| egrep -v -e 'R_PARISC_(DP|SEG)REL' \
|
||||
| awk '$5 ~ /^rc_/ {print $5}' \
|
||||
| LC_ALL=C sort -u \
|
||||
| egrep -v '^rc_environ_fd$' \
|
||||
|
||||
Reference in New Issue
Block a user