Rewrite the core parts in C. We now provide librc so other programs can
query runlevels, services and state without using bash. We also provide libeinfo so other programs can easily use our informational functions. As such, we have dropped the requirement of using bash as the init script shell. We now use /bin/sh and have strived to make the scripts as portable as possible. Shells that work are bash and dash. busybox works provided you disable s-s-d. If you have WIPE_TMP set to yes in conf.d/bootmisc you should disable find too. zsh and ksh do not work at this time. Networking support is currently being re-vamped also as it was heavily bash array based. As such, a new config format is available like so config_eth0="1.2.3.4/24 5.6.7.8/16" or like so config_eth0="'1.2.3.4 netmask 255.255.255.0' '5.6.7.8 netmask 255.255.0.0'" We will still support the old bash array format provided that /bin/sh IS a link it bash. ChangeLog for baselayout-1 can be found in our SVN repo.
This commit is contained in:
commit
5af58b4514
26
ChangeLog
Normal file
26
ChangeLog
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
# ChangeLog for Gentoo System Intialization ("rc") scripts
|
||||||
|
# Copyright 1999-2007 Gentoo Foundation; Distributed under the GPLv2
|
||||||
|
|
||||||
|
05 Apr 2007; Roy Marples <uberlord@gentoo.org>:
|
||||||
|
|
||||||
|
Rewrite the core parts in C. We now provide librc so other programs can
|
||||||
|
query runlevels, services and state without using bash. We also provide
|
||||||
|
libeinfo so other programs can easily use our informational functions.
|
||||||
|
|
||||||
|
As such, we have dropped the requirement of using bash as the init script
|
||||||
|
shell. We now use /bin/sh and have strived to make the scripts as portable
|
||||||
|
as possible. Shells that work are bash and dash. busybox works provided
|
||||||
|
you disable s-s-d. If you have WIPE_TMP set to yes in conf.d/bootmisc you
|
||||||
|
should disable find too.
|
||||||
|
zsh and ksh do not work at this time.
|
||||||
|
|
||||||
|
Networking support is currently being re-vamped also as it was heavily bash
|
||||||
|
array based. As such, a new config format is available like so
|
||||||
|
config_eth0="1.2.3.4/24 5.6.7.8/16"
|
||||||
|
or like so
|
||||||
|
config_eth0="'1.2.3.4 netmask 255.255.255.0' '5.6.7.8 netmask 255.255.0.0'"
|
||||||
|
|
||||||
|
We will still support the old bash array format provided that /bin/sh IS
|
||||||
|
a link it bash.
|
||||||
|
|
||||||
|
ChangeLog for baselayout-1 can be found in our SVN repo.
|
108
Makefile
Normal file
108
Makefile
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
# baselayout Makefile
|
||||||
|
# Copyright 2006-2007 Gentoo Foundation
|
||||||
|
# Distributed under the terms of the GNU General Public License v2
|
||||||
|
#
|
||||||
|
# We've moved the installation logic from Gentoo ebuild into a generic
|
||||||
|
# Makefile so that the ebuild is much smaller and more simple.
|
||||||
|
# It also has the added bonus of being easier to install on systems
|
||||||
|
# without an ebuild style package manager.
|
||||||
|
|
||||||
|
SUBDIRS = conf.d etc init.d man net sh share src
|
||||||
|
|
||||||
|
NAME = baselayout
|
||||||
|
#VERSION = 2.0.0_alpha1
|
||||||
|
VERSION = 1.13.99
|
||||||
|
|
||||||
|
PKG = $(NAME)-$(VERSION)
|
||||||
|
|
||||||
|
ARCH = x86
|
||||||
|
ifeq ($(OS),)
|
||||||
|
OS=$(shell uname -s)
|
||||||
|
ifneq ($(OS),Linux)
|
||||||
|
OS=BSD
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
BASE_DIRS = /$(LIB)/rcscripts/init.d /$(LIB)/rcscripts/tmp
|
||||||
|
KEEP_DIRS = /boot /home /mnt /root \
|
||||||
|
/usr/local/bin /usr/local/sbin /usr/local/share/doc /usr/local/share/man \
|
||||||
|
/var/lock /var/run
|
||||||
|
|
||||||
|
ifeq ($(OS),Linux)
|
||||||
|
KEEP_DIRS += /dev /sys
|
||||||
|
NET_LO = net.lo
|
||||||
|
endif
|
||||||
|
ifneq ($(OS),Linux)
|
||||||
|
NET_LO = net.lo0
|
||||||
|
endif
|
||||||
|
|
||||||
|
TOPDIR = .
|
||||||
|
include $(TOPDIR)/default.mk
|
||||||
|
|
||||||
|
install::
|
||||||
|
# These dirs may not exist from prior versions
|
||||||
|
for x in $(BASE_DIRS) ; do \
|
||||||
|
$(INSTALL_DIR) $(DESTDIR)$$x || exit $$? ; \
|
||||||
|
touch $(DESTDIR)$$x/.keep || exit $$? ; \
|
||||||
|
done
|
||||||
|
# Don't install runlevels if they already exist
|
||||||
|
if ! test -d $(DESTDIR)/etc/runlevels ; then \
|
||||||
|
(cd runlevels; $(MAKE) install) ; \
|
||||||
|
test -d runlevels.$(OS) && (cd runlevels.$(OS); $(MAKE) install) ; \
|
||||||
|
$(INSTALL_DIR) $(DESTDIR)/etc/runlevels/single || exit $$? ; \
|
||||||
|
$(INSTALL_DIR) $(DESTDIR)/etc/runlevels/nonetwork || exit $$? ; \
|
||||||
|
fi
|
||||||
|
ln -snf ../../$(LIB)/rcscripts/sh/net.sh $(DESTDIR)/etc/init.d/$(NET_LO) || exit $$?
|
||||||
|
ln -snf ../../$(LIB)/rcscripts/sh/functions.sh $(DESTDIR)/etc/init.d || exit $$?
|
||||||
|
# Handle lib correctly
|
||||||
|
if test $(LIB) != "lib" ; then \
|
||||||
|
sed -i'.bak' -e 's,/lib/,/$(LIB)/,g' $(DESTDIR)/$(LIB)/rcscripts/sh/functions.sh || exit $$? ; \
|
||||||
|
rm -f $(DESTDIR)/$(LIB)/rcscripts/sh/functions.sh.bak ; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
.PHONY: all clean install
|
||||||
|
|
||||||
|
layout:
|
||||||
|
# Create base filesytem layout
|
||||||
|
for x in $(KEEP_DIRS) ; do \
|
||||||
|
$(INSTALL_DIR) $(DESTDIR)$$x || exit $$? ; \
|
||||||
|
touch $(DESTDIR)$$x/.keep || exit $$? ; \
|
||||||
|
done
|
||||||
|
# Special dirs
|
||||||
|
install -m 0700 -d $(DESTDIR)/root || exit $$?
|
||||||
|
touch $(DESTDIR)/root/.keep || exit $$?
|
||||||
|
install -m 1777 -d $(DESTDIR)/var/tmp || exit $$?
|
||||||
|
touch $(DESTDIR)/var/tmp/.keep || exit $$?
|
||||||
|
install -m 1777 -d $(DESTDIR)/tmp || exit $$?
|
||||||
|
touch $(DESTDIR)/tmp/.keep || exit $$?
|
||||||
|
# FHS compatibility symlinks stuff
|
||||||
|
ln -snf /var/tmp $(DESTDIR)/usr/tmp || exit $$?
|
||||||
|
ln -snf share/man $(DESTDIR)/usr/local/man || exit $$?
|
||||||
|
|
||||||
|
distcheck:
|
||||||
|
if test -d .svn ; then \
|
||||||
|
svnfiles=`svn status 2>&1 | egrep -v '^(U|P)'` ; \
|
||||||
|
if test "x$$svnfiles" != "x" ; then \
|
||||||
|
echo "Refusing to package tarball until svn is in sync:" ; \
|
||||||
|
echo "$$svnfiles" ; \
|
||||||
|
echo "make distforce to force packaging" ; \
|
||||||
|
exit 1 ; \
|
||||||
|
fi \
|
||||||
|
fi
|
||||||
|
|
||||||
|
distforce:
|
||||||
|
install -d /tmp/$(PKG)
|
||||||
|
cp -PRp . /tmp/$(PKG)
|
||||||
|
`which find` /tmp/$(PKG) -depth -path "*/.svn/*" -delete
|
||||||
|
`which find` /tmp/$(PKG) -depth -path "*/.svn" -delete
|
||||||
|
rm -rf /tmp/$(PKG)/src/core /tmp/$(PKG)/po
|
||||||
|
$(MAKE) -C /tmp/$(PKG) clean
|
||||||
|
sed -i'.bak' -e '/-Wl,-rpath ./ s/^/#/g' /tmp/$(PKG)/src/Makefile
|
||||||
|
rm -f /tmp/$(PKG)/src/Makefile.bak
|
||||||
|
tar -C /tmp -cvjpf /tmp/$(PKG).tar.bz2 $(PKG)
|
||||||
|
rm -Rf /tmp/$(PKG)
|
||||||
|
du /tmp/$(PKG).tar.bz2
|
||||||
|
|
||||||
|
dist: distcheck distforce
|
||||||
|
|
||||||
|
# vim: set ts=4 :
|
53
STYLE
Normal file
53
STYLE
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
This is the rc-scripts style manual. It governs the coding style
|
||||||
|
of rc-scripts. Everything here might as well have been spoken by
|
||||||
|
God. If you find any issues, please talk to base-system@gentoo.org
|
||||||
|
or #gentoo-base on irc.freenode.net.
|
||||||
|
|
||||||
|
#############
|
||||||
|
# VARIABLES #
|
||||||
|
#############
|
||||||
|
- User Variables -
|
||||||
|
Variables must always be enclosed by {}
|
||||||
|
e.g. ${foo} ${bar}
|
||||||
|
- Internal Shell Variables -
|
||||||
|
Do not use {} with internal variables unless appropriate
|
||||||
|
e.g. case $1 in
|
||||||
|
e.g. foo=$IFS
|
||||||
|
e.g. echo "blah${1}123"
|
||||||
|
- Assigning with Quotes -
|
||||||
|
When assigning to a variable from another variable, you should
|
||||||
|
not need quotes. However, you do when assigning from a subshell.
|
||||||
|
e.g. foo=${bar}
|
||||||
|
e.g. foo="$(uname -a)"
|
||||||
|
|
||||||
|
#########
|
||||||
|
# TESTS #
|
||||||
|
#########
|
||||||
|
- Brackets -
|
||||||
|
Always use the [ ... ] form instead of [[ ... ]] as the later only really
|
||||||
|
works in bash, and we should support as many shells as we can.
|
||||||
|
- Quoting -
|
||||||
|
When dealing with strings, you should quote both sides.
|
||||||
|
|
||||||
|
###############
|
||||||
|
# CODE BLOCKS #
|
||||||
|
###############
|
||||||
|
- Structure -
|
||||||
|
Use the more compact form
|
||||||
|
e.g. if ... ; then
|
||||||
|
e.g. while ... ; do
|
||||||
|
Do not use the older form
|
||||||
|
e.g. if ...
|
||||||
|
then
|
||||||
|
- Functions -
|
||||||
|
Use the more compact form
|
||||||
|
e.g. foo() {
|
||||||
|
Do not lead with 'function '
|
||||||
|
e.g. function foo() {
|
||||||
|
|
||||||
|
############
|
||||||
|
# COMMENTS #
|
||||||
|
############
|
||||||
|
- General -
|
||||||
|
Try to include a comment block before sections
|
||||||
|
of code to explain what you're attempting
|
5
conf.d.BSD/Makefile
Normal file
5
conf.d.BSD/Makefile
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
DIR = /etc/conf.d
|
||||||
|
FILES = localmount net.example wireless.example
|
||||||
|
|
||||||
|
TOPDIR = ..
|
||||||
|
include $(TOPDIR)/default.mk
|
31
conf.d.BSD/localmount
Normal file
31
conf.d.BSD/localmount
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
# /etc/conf.d/localmount
|
||||||
|
|
||||||
|
# Kernel core dump options for FreeBSD kernel.
|
||||||
|
# Unless you're a FreeBSD kernel developer or driver writer then this won't
|
||||||
|
# be of any interest to you at all.
|
||||||
|
|
||||||
|
# The following options allow to configure the kernel's core dump
|
||||||
|
# facilities. Please read
|
||||||
|
# http://www.freebsd.org/doc/en_US.ISO8859-1/books/developers-handbook/kerneldebug.html
|
||||||
|
# for more information about Kernel core dumps and kernel debugging.
|
||||||
|
|
||||||
|
# KERNEL_DUMP_DEVICE variable is used to specify which device will be
|
||||||
|
# used by the kernel to write the dump down. This has to be a swap
|
||||||
|
# partition, and has to be at least big enough to contain the whole
|
||||||
|
# physical memory (see hw.physmem sysctl(8) variable).
|
||||||
|
# When the variable is commented out, no core dump will be enabled for
|
||||||
|
# the kernel.
|
||||||
|
#KERNEL_DUMP_DEVICE="/dev/ad0s1b"
|
||||||
|
|
||||||
|
# KERNEL_DUMP_DIR variable is used to tell savecore(8) utility where
|
||||||
|
# to save the kernel core dump once it's restored from the dump
|
||||||
|
# device. If unset, /var/crash will be used, as the default of
|
||||||
|
# FreeBSD.
|
||||||
|
#KERNEL_DUMP_DIR="/var/crash"
|
||||||
|
|
||||||
|
# KERNEL_DUMP_COMPRESS variable decide whether to compress with
|
||||||
|
# gzip(1) the dump or leave it of its original size (the size of the
|
||||||
|
# physical memory present on the system). If set to yes, the -z option
|
||||||
|
# will be passed to savecore(8) that will proceed on compressing the
|
||||||
|
# dump.
|
||||||
|
#KERNEL_DUMP_COMPRESS="no"
|
309
conf.d.BSD/net.example
Normal file
309
conf.d.BSD/net.example
Normal file
@ -0,0 +1,309 @@
|
|||||||
|
# BSD NOTE: Network functionality support is still being written and
|
||||||
|
# many parts here are missing compared to Gentoo/Linux
|
||||||
|
# Feel free to write the needed modules and submit them to us :)
|
||||||
|
#
|
||||||
|
##############################################################################
|
||||||
|
# QUICK-START
|
||||||
|
#
|
||||||
|
# The quickest start is if you want to use DHCP.
|
||||||
|
# In that case, everything should work out of the box, no configuration
|
||||||
|
# necessary, though the startup script will warn you that you haven't
|
||||||
|
# specified anything.
|
||||||
|
|
||||||
|
# WARNING :- some examples have a mixture of IPv4 (ie 192.168.0.1) and IPv6
|
||||||
|
# (ie 4321:0:1:2:3:4:567:89ab) internet addresses. They only work if you have
|
||||||
|
# the relevant kernel option enabled. So if you don't have an IPv6 enabled
|
||||||
|
# kernel then remove the IPv6 address from your config.
|
||||||
|
|
||||||
|
# If you want to use a static address or use DHCP explicitly, jump
|
||||||
|
# down to the section labelled INTERFACE HANDLERS.
|
||||||
|
#
|
||||||
|
# If you want to do anything more fancy, you should take the time to
|
||||||
|
# read through the rest of this file.
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
# MODULES
|
||||||
|
#
|
||||||
|
# We now support modular networking scripts which means we can easily
|
||||||
|
# add support for new interface types and modules while keeping
|
||||||
|
# compatability with existing ones.
|
||||||
|
#
|
||||||
|
# Modules load by default if the package they need is installed. If
|
||||||
|
# you specify a module here that doesn't have it's package installed
|
||||||
|
# then you get an error stating which package you need to install.
|
||||||
|
# Ideally, you only use the modules setting when you have two or more
|
||||||
|
# packages installed that supply the same service.
|
||||||
|
#
|
||||||
|
# In other words, you probably should DO NOTHING HERE...
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
# INTERFACE HANDLERS
|
||||||
|
|
||||||
|
# For a static configuration, use something like this
|
||||||
|
# (They all do exactly the same thing btw)
|
||||||
|
#config_eth0="192.168.0.2/24"
|
||||||
|
#config_eth0="'192.168.0.2 netmask 255.255.255.0'"
|
||||||
|
|
||||||
|
# We can also specify a broadcast
|
||||||
|
#config_eth0="'192.168.0.2/24 brd 192.168.0.255'"
|
||||||
|
#config_eth0="'192.168.0.2 netmask 255.255.255.0 broadcast 192.168.0.255'"
|
||||||
|
|
||||||
|
# If you need more than one address, you can use something like this
|
||||||
|
# NOTE: ifconfig creates an aliased device for each extra IPv4 address
|
||||||
|
# (eth0:1, eth0:2, etc)
|
||||||
|
# iproute2 does not do this as there is no need to
|
||||||
|
#config_eth0="'192.168.0.2/24' '192.168.0.3/24' '192.168.0.4/24'"
|
||||||
|
# Or you can use sequence expressions
|
||||||
|
#config_eth0="'192.168.0.{2..4}/24'" FIXME - may not work with baselayout2
|
||||||
|
# which does the same as above. Be careful though as if you use this and
|
||||||
|
# fallbacks, you have to ensure that both end up with the same number of
|
||||||
|
# values otherwise your fallback won't work correctly.
|
||||||
|
|
||||||
|
# You can also use IPv6 addresses
|
||||||
|
# (you should always specify a prefix length with IPv6 here)
|
||||||
|
#config_eth0="192.168.0.2/24 \
|
||||||
|
#4321:0:1:2:3:4:567:89ab/64 \
|
||||||
|
#4321:0:1:2:3:4:567:89ac/64"
|
||||||
|
|
||||||
|
# If you wish to keep existing addresses + routing and the interface is up,
|
||||||
|
# you can specify a noop (no operation). If the interface is down or there
|
||||||
|
# are no addresses assigned, then we move onto the next step (default dhcp)
|
||||||
|
# This is useful when configuring your interface with a kernel command line
|
||||||
|
# or similar
|
||||||
|
#config_eth0="noop 192.168.0.2/24"
|
||||||
|
|
||||||
|
# If you don't want ANY address (only useful when calling for advanced stuff)
|
||||||
|
#config_eth0="null"
|
||||||
|
|
||||||
|
# Here's how to do routing if you need it
|
||||||
|
# We add an IPv4 default route, IPv4 subnet route and an IPv6 unicast route
|
||||||
|
#routes_eth0=" \
|
||||||
|
# 'default via 192.168.0.1' \
|
||||||
|
# '10.0.0.0/8 via 192.168.0.1' \
|
||||||
|
# '::/0' \
|
||||||
|
#"
|
||||||
|
|
||||||
|
# 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'"
|
||||||
|
|
||||||
|
# NOTE: fallback entry must match the entry location in config_eth0
|
||||||
|
# As such you can only have one fallback route.
|
||||||
|
|
||||||
|
# Some users may need to alter the MTU - here's how
|
||||||
|
#mtu_eth0="1500"
|
||||||
|
|
||||||
|
# Most drivers that report carrier status function correctly, but some do not
|
||||||
|
# One of these faulty drivers is for the Intel e1000 network card, but only
|
||||||
|
# at boot time. To get around this you may alter the carrier_timeout value for
|
||||||
|
# the interface. -1 is disable, 0 is infinite and any other number of seconds
|
||||||
|
# is how long we wait for carrier. The current default is 3 seconds
|
||||||
|
#carrier_timeout_eth0=-1
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
# OPTIONAL MODULES
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
# WIRELESS (802.11 support)
|
||||||
|
# Wireless can be provided by BSDs ifconfig or wpa_supplicant
|
||||||
|
|
||||||
|
# ifconfig support is a one shot script - wpa_supplicant is daemon that
|
||||||
|
# scans, assoicates and re-configures if assocation is lost.
|
||||||
|
# wpa_supplicant is preferred
|
||||||
|
# See wireless.example for details about using ifconfig for wireless
|
||||||
|
|
||||||
|
# emerge net-wireless/wpa-supplicant
|
||||||
|
# Wireless options are held in /etc/wpa_supplicant/wpa_supplicant.conf
|
||||||
|
# Console the wpa_supplicant.conf.example that is installed in
|
||||||
|
# /usr/share/doc/wpa_supplicant
|
||||||
|
|
||||||
|
# By default we don't wait for wpa_suppliant to associate and authenticate.
|
||||||
|
# If you would like to, so can specify how long in seconds
|
||||||
|
#associate_timeout_eth0=60
|
||||||
|
# A value of 0 means wait forever.
|
||||||
|
|
||||||
|
# You can also override any settings found here per SSID - which is very
|
||||||
|
# handy if you use different networks a lot. See below for using the SSID
|
||||||
|
# in our variables
|
||||||
|
#config_SSID="dhcp"
|
||||||
|
# See the System module below for setting dns/nis/ntp per SSID
|
||||||
|
|
||||||
|
# You can also override any settings found here per MAC address of the AP
|
||||||
|
# in case you use Access Points with the same SSID but need different
|
||||||
|
# networking configs. Below is an example - of course you use the same
|
||||||
|
# method with other variables
|
||||||
|
#mac_config_001122334455="dhcp"
|
||||||
|
#mac_dns_servers_001122334455="192.168.0.1 192.168.0.2"
|
||||||
|
|
||||||
|
# When an interface has been associated with an Access Point, a global
|
||||||
|
# variable called SSID is set to the Access Point's SSID for use in the
|
||||||
|
# pre/post user functions below (although it's not available in preup as you
|
||||||
|
# won't have associated then)
|
||||||
|
|
||||||
|
# If you're using anything else to configure wireless on your interface AND
|
||||||
|
# you have installed wpa_supplicant, you need to disable wpa_supplicant
|
||||||
|
#modules="!iwconfig !wpa_supplicant"
|
||||||
|
#or
|
||||||
|
#modules="!wireless"
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
# WIRELESS SSID IN VARIABLES
|
||||||
|
##############################################################################
|
||||||
|
# Remember to change SSID to your SSID.
|
||||||
|
# Say that your SSID is My NET - the line
|
||||||
|
# #key_SSID="s:passkey"
|
||||||
|
# becomes
|
||||||
|
# #key_My_NET="s:passkey"
|
||||||
|
# Notice that the space has changed to an underscore - do the same with all
|
||||||
|
# characters not in a-z A-Z (English alphabet) 0-9. This only applies to
|
||||||
|
# variables and not values.
|
||||||
|
#
|
||||||
|
# Any SSID's in values like essid_eth0="My NET" may need to be escaped
|
||||||
|
# This means placing the character \ before the character
|
||||||
|
# \" need to be escaped for example
|
||||||
|
# So if your SSID is
|
||||||
|
# My "\ NET
|
||||||
|
# it becomes
|
||||||
|
# My \"\\ NET
|
||||||
|
# for example
|
||||||
|
# #essid_eth0="My\"\\NET"
|
||||||
|
#
|
||||||
|
# So using the above we can use
|
||||||
|
# #dns_domain_My____NET="My\"\\NET"
|
||||||
|
# which is an invalid dns domain, but shows the how to use the variable
|
||||||
|
# structure
|
||||||
|
#########################################################
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
# DHCP
|
||||||
|
# DHCP can be provided by dhclient.
|
||||||
|
#
|
||||||
|
# dhcpcd: emerge net-misc/dhcpcd
|
||||||
|
# dhclient: emerge net-misc/dhcp
|
||||||
|
|
||||||
|
# Regardless of which DHCP client you prefer, you configure them the
|
||||||
|
# same way using one of following depending on which interface modules
|
||||||
|
# you're using.
|
||||||
|
#config_eth0="dhcp"
|
||||||
|
|
||||||
|
# For passing custom options to dhcpcd use something like the following. This
|
||||||
|
# example reduces the timeout for retrieving an address from 60 seconds (the
|
||||||
|
# default) to 10 seconds.
|
||||||
|
#dhcpcd_eth0="-t 10"
|
||||||
|
|
||||||
|
# GENERIC DHCP OPTIONS
|
||||||
|
# Set generic DHCP options like so
|
||||||
|
#dhcp_eth0="release nodns nontp nonis nogateway nosendhost"
|
||||||
|
|
||||||
|
# This tells the dhcp client to release it's lease when it stops, not to
|
||||||
|
# overwrite dns, ntp and nis settings, not to set a default route and not to
|
||||||
|
# send the current hostname to the dhcp server and when it starts.
|
||||||
|
# You can use any combination of the above options - the default is not to
|
||||||
|
# use any of them.
|
||||||
|
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
# System
|
||||||
|
# For configuring system specifics such as domain, dns, ntp and nis servers
|
||||||
|
# It's rare that you would need todo this, but you can anyway.
|
||||||
|
# This is most benefit to wireless users who don't use DHCP so they can change
|
||||||
|
# their configs based on SSID. See above for more details
|
||||||
|
|
||||||
|
# Setting name/domain server causes /etc/resolv.conf to be overwritten
|
||||||
|
# Note that if DHCP is used, and you want this to take precedence then
|
||||||
|
# set dhcp_SSID="nodns"
|
||||||
|
# To use dns settings such as these, dns_servers_eth0 must be set!
|
||||||
|
# If you omit the _eth0 suffix, then it applies to all interfaces unless
|
||||||
|
# overridden by the interface suffix.
|
||||||
|
#dns_domain_eth0="your.domain"
|
||||||
|
#dns_servers_eth0="192.168.0.2 192.168.0.3"
|
||||||
|
#dns_search_eth0="this.domain that.domain"
|
||||||
|
#dns_options_eth0="'timeout 1' 'rotate'"
|
||||||
|
#dns_sortlist_eth0="130.155.160.0/255.255.240.0 130.155.0.0"
|
||||||
|
# See the man page for resolv.conf for details about the options and sortlist
|
||||||
|
# directives
|
||||||
|
|
||||||
|
#ntp_servers_eth0="192.168.0.2 192.168.0.3"
|
||||||
|
|
||||||
|
#nis_domain_eth0="domain"
|
||||||
|
#nis_servers_eth0="192.168.0.2 192.168.0.3"
|
||||||
|
|
||||||
|
# NOTE: Setting any of these will stamp on the files in question. So if you
|
||||||
|
# don't specify dns_servers but you do specify dns_domain then no nameservers
|
||||||
|
# will be listed in /etc/resolv.conf even if there were any there to start
|
||||||
|
# with.
|
||||||
|
# If this is an issue for you then maybe you should look into a resolv.conf
|
||||||
|
# manager like resolvconf-gentoo to manage this file for you. All packages
|
||||||
|
# that baselayout supports use resolvconf-gentoo if installed.
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
# Cable in/out detection
|
||||||
|
# Sometimes the cable is in, others it's out. Obviously you don't want to
|
||||||
|
# restart net.eth0 every time when you plug it in either.
|
||||||
|
# BSD has the Device State Change Daemon - or devd for short
|
||||||
|
# To enable this, simple add devd to the boot runlevel
|
||||||
|
#rc-update add devd boot
|
||||||
|
#rc
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
# ADVANCED CONFIGURATION
|
||||||
|
#
|
||||||
|
# Four functions can be defined which will be called surrounding the
|
||||||
|
# start/stop operations. The functions are called with the interface
|
||||||
|
# name first so that one function can control multiple adapters. An extra two
|
||||||
|
# functions can be defined when an interface fails to start or stop.
|
||||||
|
#
|
||||||
|
# The return values for the preup and predown functions should be 0
|
||||||
|
# (success) to indicate that configuration or deconfiguration of the
|
||||||
|
# interface can continue. If preup returns a non-zero value, then
|
||||||
|
# interface configuration will be aborted. If predown returns a
|
||||||
|
# non-zero value, then the interface will not be allowed to continue
|
||||||
|
# deconfiguration.
|
||||||
|
#
|
||||||
|
# The return values for the postup, postdown, failup and faildown functions are
|
||||||
|
# ignored since there's nothing to do if they indicate failure.
|
||||||
|
#
|
||||||
|
# ${IFACE} is set to the interface being brought up/down
|
||||||
|
# ${IFVAR} is ${IFACE} converted to variable name bash allows
|
||||||
|
|
||||||
|
#preup() {
|
||||||
|
# # Remember to return 0 on success
|
||||||
|
# return 0
|
||||||
|
#}
|
||||||
|
|
||||||
|
#predown() {
|
||||||
|
# # The default in the script is to test for NFS root and disallow
|
||||||
|
# # downing interfaces in that case. Note that if you specify a
|
||||||
|
# # predown() function you will override that logic. Here it is, in
|
||||||
|
# # case you still want it...
|
||||||
|
# if is_net_fs /; then
|
||||||
|
# eerror "root filesystem is network mounted -- can't stop ${IFACE}"
|
||||||
|
# return 1
|
||||||
|
# fi
|
||||||
|
#
|
||||||
|
# # Remember to return 0 on success
|
||||||
|
# return 0
|
||||||
|
#}
|
||||||
|
|
||||||
|
#postup() {
|
||||||
|
# # This function could be used, for example, to register with a
|
||||||
|
# # dynamic DNS service. Another possibility would be to
|
||||||
|
# # send/receive mail once the interface is brought up.
|
||||||
|
|
||||||
|
#}
|
||||||
|
|
||||||
|
#postdown() {
|
||||||
|
# # Return 0 always
|
||||||
|
# return 0
|
||||||
|
#}
|
||||||
|
|
||||||
|
#failup() {
|
||||||
|
# # This function is mostly here for completeness... I haven't
|
||||||
|
# # thought of anything nifty to do with it yet ;-)
|
||||||
|
#}
|
||||||
|
|
||||||
|
#faildown() {
|
||||||
|
# # This function is mostly here for completeness... I haven't
|
||||||
|
# # thought of anything nifty to do with it yet ;-)
|
||||||
|
#}
|
190
conf.d.BSD/wireless.example
Normal file
190
conf.d.BSD/wireless.example
Normal file
@ -0,0 +1,190 @@
|
|||||||
|
# /etc/conf.d/wireless:
|
||||||
|
# Global wireless config file for net.* rc-scripts
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
# HINTS
|
||||||
|
##############################################################################
|
||||||
|
# see net.example for using ESSID in variable names
|
||||||
|
#
|
||||||
|
# Most users will just need to set the following options
|
||||||
|
# key_ESSID1="s:yourkeyhere enc open" # s: means a text key
|
||||||
|
# key_ESSID2="aaaa-bbbb-cccc-dd" # no s: means a hex key
|
||||||
|
# preferred_aps="'ESSID1' 'ESSID2'"
|
||||||
|
#
|
||||||
|
# Clear? Good. Now configure your wireless network below
|
||||||
|
#############################################################################
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
# SETTINGS
|
||||||
|
##############################################################################
|
||||||
|
# Hard code an ESSID to an interface - leave this unset if you wish the driver
|
||||||
|
# to scan for available Access Points
|
||||||
|
# I would only set this as a last resort really - use the preferred_aps
|
||||||
|
# setting at the bottom of this file
|
||||||
|
#essid_eth0='foo'
|
||||||
|
|
||||||
|
# Some drivers/hardware don't scan all that well. We have no control over this
|
||||||
|
# but we can say how many scans we want to do to try and get a better sweep of
|
||||||
|
# the area. The default is 1.
|
||||||
|
#scans_eth0="1"
|
||||||
|
|
||||||
|
#Channel can be set (1-14), but defaults to 3 if not set.
|
||||||
|
#
|
||||||
|
# The below is taken verbatim from the BSD wavelan documentation found at
|
||||||
|
# http://www.netbsd.org/Documentation/network/wavelan.html
|
||||||
|
# There are 14 channels possible; We are told that channels 1-11 are legal for
|
||||||
|
# North America, channels 1-13 for most of Europe, channels 10-13 for France,
|
||||||
|
# and only channel 14 for Japan. If in doubt, please refer to the documentation
|
||||||
|
# that came with your card or access point. Make sure that the channel you
|
||||||
|
# select is the same channel your access point (or the other card in an ad-hoc
|
||||||
|
# network) is on. The default for cards sold in North America and most of Europe
|
||||||
|
# is 3; the default for cards sold in France is 11, and the default for cards
|
||||||
|
# sold in Japan is 14.
|
||||||
|
#channel_eth0="3"
|
||||||
|
|
||||||
|
# Setup any other config commands. This is basically the ifconfig argument
|
||||||
|
# without the ifconfig $iface.
|
||||||
|
#ifconfig_eth0=""
|
||||||
|
# You can do the same per ESSID too.
|
||||||
|
#ifconfig_ESSID=""
|
||||||
|
|
||||||
|
# Seconds to wait until associated. The default is to wait 10 seconds.
|
||||||
|
# 0 means wait indefinitely. WARNING: this can cause an infinite delay when
|
||||||
|
# booting.
|
||||||
|
#associate_timeout_eth0="5"
|
||||||
|
|
||||||
|
# Define a WEP key per ESSID or MAC address (of the AP, not your card)
|
||||||
|
# The encryption type (open or restricted) must match the
|
||||||
|
# encryption type on the Access Point.
|
||||||
|
# To set a hex key, prefix with 0x
|
||||||
|
#key_ESSID="0x12341234123412341234123456"
|
||||||
|
# or you can use strings. Passphrase IS NOT supported
|
||||||
|
#key_ESSID="foobar"
|
||||||
|
#key_ESSID="foobar"
|
||||||
|
|
||||||
|
# WEP key for the AP with MAC address 001122334455
|
||||||
|
#mac_key_001122334455="foobar"
|
||||||
|
|
||||||
|
# You can also override the interface settings found in /etc/conf.d/net
|
||||||
|
# per ESSID - which is very handy if you use different networks a lot
|
||||||
|
#config_ESSID="dhcp"
|
||||||
|
#routes_ESSID=
|
||||||
|
#fallback_ESSID=
|
||||||
|
|
||||||
|
# Setting name/domain server causes /etc/resolv.conf to be overwritten
|
||||||
|
# Note that if DHCP is used, and you want this to take precedence then
|
||||||
|
# please put -R in your dhcpcd options
|
||||||
|
#dns_servers_ESSID="192.168.0.1 192.168.0.2"
|
||||||
|
#dns_domain_ESSID="some.domain"
|
||||||
|
#dns_search_path_ESSID="search.this.domain search.that.domain"
|
||||||
|
# Please check the man page for resolv.conf for more information
|
||||||
|
# as domain and search (searchdomains) are mutually exclusive and
|
||||||
|
# searchdomains takes precedence
|
||||||
|
|
||||||
|
# You can also set any of the /etc/conf.d/net variables per MAC address
|
||||||
|
# incase you use Access Points with the same ESSID but need different
|
||||||
|
# networking configs. Below is an example - of course you use the same
|
||||||
|
# method with other variables
|
||||||
|
#config_001122334455="dhcp"
|
||||||
|
#dns_servers_001122334455="192.168.0.1 192.168.0.2"
|
||||||
|
|
||||||
|
# Map a MAC address to an ESSID
|
||||||
|
# This is used when the Access Point is not broadcasting it's ESSID
|
||||||
|
# WARNING: This will override the ESSID being broadcast due to some
|
||||||
|
# Access Points sending an ESSID even when they have been configured
|
||||||
|
# not to!
|
||||||
|
# Change 001122334455 to the MAC address and ESSID to the ESSID
|
||||||
|
# it should map to
|
||||||
|
#mac_essid_001122334455="ESSID"
|
||||||
|
|
||||||
|
# This lists the preferred ESSIDs to connect to in order
|
||||||
|
# ESSID's can contain any characters here as they must match the broadcast
|
||||||
|
# ESSID exactly.
|
||||||
|
# Surround each ESSID with the " character and seperate them with a space
|
||||||
|
# If the first ESSID isn't found then it moves onto the next
|
||||||
|
# If this isn't defined then it connects to the first one found
|
||||||
|
#preferred_aps="'ESSID 1' 'ESSID 2'"
|
||||||
|
|
||||||
|
# You can also define a preferred_aps list per interface
|
||||||
|
#preferred_aps_eth0="'ESSID 3' 'ESSID 4'"
|
||||||
|
|
||||||
|
# You can also say whether we only connect to preferred APs or not
|
||||||
|
# Values are "any", "preferredonly", "forcepreferred", "forcepreferredonly"
|
||||||
|
# and "forceany"
|
||||||
|
# "any" means it will connect to visible APs in the preferred list and then
|
||||||
|
# any other available AP
|
||||||
|
# "preferredonly" means it will only connect to visible APs in the preferred
|
||||||
|
# list
|
||||||
|
# "forcepreferred" means it will forceably connect to APs in order if it does
|
||||||
|
# not find them in a scan
|
||||||
|
# "forcepreferredonly" means it forceably connects to the APs in order and
|
||||||
|
# does not bother to scan
|
||||||
|
# "forceany" does the same as forcepreferred + connects to any other
|
||||||
|
# available AP
|
||||||
|
# Default is "any"
|
||||||
|
#associate_order="any"
|
||||||
|
#associate_order_eth0="any"
|
||||||
|
|
||||||
|
# You can define blacklisted Access Points in the same way
|
||||||
|
#blacklist_aps="'ESSID 1' 'ESSID 2'"
|
||||||
|
#blacklist_aps_eth0="'ESSID 3' 'ESSID 4'"
|
||||||
|
|
||||||
|
# If you have more than one wireless card, you can say if you want
|
||||||
|
# to allow each card to associate with the same Access Point or not
|
||||||
|
# Values are "yes" and "no"
|
||||||
|
# Default is "yes"
|
||||||
|
#unique_ap="yes"
|
||||||
|
#unique_ap_eth0="yes"
|
||||||
|
|
||||||
|
# IMPORTANT: preferred_only, blacklisted_aps and unique_ap only work when
|
||||||
|
# essid_eth0 is not set and your card is capable of scanning
|
||||||
|
|
||||||
|
# NOTE: preferred_aps list ignores blacklisted_aps - so if you have
|
||||||
|
# the same ESSID in both, well, you're a bit silly :p
|
||||||
|
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
# ADVANCED CONFIGURATION
|
||||||
|
#
|
||||||
|
# Two functions can be defined which will be called surrounding the
|
||||||
|
# associate function. The functions are called with the interface
|
||||||
|
# name first so that one function can control multiple adapters.
|
||||||
|
#
|
||||||
|
# The return values for the preassociate function should be 0
|
||||||
|
# (success) to indicate that configuration or deconfiguration of the
|
||||||
|
# interface can continue. If preassociate returns a non-zero value, then
|
||||||
|
# interface configuration will be aborted.
|
||||||
|
#
|
||||||
|
# The return value for the postassociate function is ignored
|
||||||
|
# since there's nothing to do if it indicates failure.
|
||||||
|
|
||||||
|
#preassociate() {
|
||||||
|
# # The below adds two configuration variables leap_user_ESSID
|
||||||
|
# # and leap_pass_ESSID. When they are both confiugred for the ESSID
|
||||||
|
# # being connected to then we run the CISCO LEAP script
|
||||||
|
#
|
||||||
|
# local user pass
|
||||||
|
# eval user=\"\$\{leap_user_${ESSIDVAR}\}\"
|
||||||
|
# eval pass=\"\$\{leap_pass_${ESSIDVAR}\}\"
|
||||||
|
#
|
||||||
|
# if [ -n "${user}" -a -n "${pass}" ]; then
|
||||||
|
# if [ ! -x /opt/cisco/bin/leapscript ]; then
|
||||||
|
# eend "For LEAP support, please emerge net-misc/cisco-aironet-client-utils"
|
||||||
|
# return 1
|
||||||
|
# fi
|
||||||
|
# einfo "Waiting for LEAP Authentication on \"${ESSID}\""
|
||||||
|
# if /opt/cisco/bin/leapscript ${user} ${pass} | grep -q 'Login incorrect'; then
|
||||||
|
# ewarn "Login Failed for ${user}"
|
||||||
|
# return 1
|
||||||
|
# fi
|
||||||
|
# fi
|
||||||
|
#
|
||||||
|
# return 0
|
||||||
|
#}
|
||||||
|
|
||||||
|
#postassociate() {
|
||||||
|
# # This function is mostly here for completeness... I haven't
|
||||||
|
# # thought of anything nifty to do with it yet ;-)
|
||||||
|
# # Return 0 always
|
||||||
|
# return 0
|
||||||
|
#}
|
7
conf.d.Linux/Makefile
Normal file
7
conf.d.Linux/Makefile
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
DIR = /etc/conf.d
|
||||||
|
FILES = net.example wireless.example
|
||||||
|
FILES_APPEND = clock rc
|
||||||
|
FILES_NOEXIST = consolefont keymaps volumes
|
||||||
|
|
||||||
|
TOPDIR = ..
|
||||||
|
include $(TOPDIR)/default.mk
|
31
conf.d.Linux/clock
Normal file
31
conf.d.Linux/clock
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
|
||||||
|
# If you wish to pass any other arguments to hwclock during bootup,
|
||||||
|
# you may do so here.
|
||||||
|
|
||||||
|
CLOCK_OPTS=""
|
||||||
|
|
||||||
|
# If you want to set the Hardware Clock to the current System Time
|
||||||
|
# during shutdown, then say "yes" here.
|
||||||
|
|
||||||
|
CLOCK_SYSTOHC="no"
|
||||||
|
|
||||||
|
# Newer FHS specs say this file should live in /var/lib rather than
|
||||||
|
# /etc. If you care about such things, feel free to change this value.
|
||||||
|
# Note that a blank value means that you do not wish to even use the
|
||||||
|
# adjtime facility. This is the default behavior as adjtime can be
|
||||||
|
# very fragile. If the clock is updated without updating the adjtime
|
||||||
|
# file (which is common when using services such as ntp), then the
|
||||||
|
# clock can be screwed up when it gets updated at next boot.
|
||||||
|
|
||||||
|
#CLOCK_ADJTIME="/var/lib/adjtime"
|
||||||
|
#CLOCK_ADJTIME="/etc/adjtime"
|
||||||
|
CLOCK_ADJTIME=""
|
||||||
|
|
||||||
|
|
||||||
|
### ALPHA SPECIFIC OPTIONS ###
|
||||||
|
|
||||||
|
# If your alpha uses the SRM console, set this to "yes".
|
||||||
|
SRM="no"
|
||||||
|
|
||||||
|
# If your alpha uses the ARC console, set this to "yes".
|
||||||
|
ARC="no"
|
19
conf.d.Linux/consolefont
Normal file
19
conf.d.Linux/consolefont
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
# /etc/conf.d/consolefont
|
||||||
|
|
||||||
|
# CONSOLEFONT specifies the default font that you'd like Linux to use on the
|
||||||
|
# console. You can find a good selection of fonts in /usr/share/consolefonts;
|
||||||
|
# you shouldn't specify the trailing ".psf.gz", just the font name below.
|
||||||
|
# To use the default console font, comment out the CONSOLEFONT setting below.
|
||||||
|
# This setting is used by the /etc/init.d/consolefont script (NOTE: if you do
|
||||||
|
# not want to use it, run "rc-update del consolefont" as root).
|
||||||
|
CONSOLEFONT="default8x16"
|
||||||
|
|
||||||
|
# CONSOLETRANSLATION is the charset map file to use. Leave commented to use
|
||||||
|
# the default one. Have a look in /usr/share/consoletrans for a selection of
|
||||||
|
# map files you can use.
|
||||||
|
#CONSOLETRANSLATION="8859-1_to_uni"
|
||||||
|
|
||||||
|
# UNICODEMAP is the unicode map file to use. Leave commented to use the
|
||||||
|
# default one. Have a look in /usr/share/unimaps for a selection of map files
|
||||||
|
# you can use.
|
||||||
|
#UNICODEMAP="iso01"
|
26
conf.d.Linux/keymaps
Normal file
26
conf.d.Linux/keymaps
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
# /etc/conf.d/keymaps
|
||||||
|
|
||||||
|
# Use KEYMAP to specify the default console keymap. There is a complete tree
|
||||||
|
# of keymaps in /usr/share/keymaps to choose from.
|
||||||
|
|
||||||
|
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".
|
||||||
|
|
||||||
|
SET_WINDOWKEYS="no"
|
||||||
|
|
||||||
|
|
||||||
|
# The maps to load for extended keyboards. Most users will leave this as is.
|
||||||
|
|
||||||
|
EXTENDED_KEYMAPS=""
|
||||||
|
#EXTENDED_KEYMAPS="backspace keypad euro"
|
||||||
|
|
||||||
|
|
||||||
|
# Tell dumpkeys(1) to interpret character action codes to be
|
||||||
|
# from the specified character set.
|
||||||
|
# This only matters if you set UNICODE="yes" in /etc/rc.conf.
|
||||||
|
# For a list of valid sets, run `dumpkeys --help`
|
||||||
|
|
||||||
|
DUMPKEYS_CHARSET=""
|
846
conf.d.Linux/net.example
Normal file
846
conf.d.Linux/net.example
Normal file
@ -0,0 +1,846 @@
|
|||||||
|
##############################################################################
|
||||||
|
# QUICK-START
|
||||||
|
#
|
||||||
|
# The quickest start is if you want to use DHCP.
|
||||||
|
# In that case, everything should work out of the box, no configuration
|
||||||
|
# necessary, though the startup script will warn you that you haven't
|
||||||
|
# specified anything.
|
||||||
|
|
||||||
|
# WARNING :- some examples have a mixture of IPv4 (ie 192.168.0.1) and IPv6
|
||||||
|
# (ie 4321:0:1:2:3:4:567:89ab) internet addresses. They only work if you have
|
||||||
|
# the relevant kernel option enabled. So if you don't have an IPv6 enabled
|
||||||
|
# kernel then remove the IPv6 address from your config.
|
||||||
|
|
||||||
|
# If you want to use a static address or use DHCP explicitly, jump
|
||||||
|
# down to the section labelled INTERFACE HANDLERS.
|
||||||
|
#
|
||||||
|
# If you want to do anything more fancy, you should take the time to
|
||||||
|
# read through the rest of this file.
|
||||||
|
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
# VARIABLES
|
||||||
|
#
|
||||||
|
# We've changed from using arrays to evaluated strings.
|
||||||
|
# This has the benefit of being slightly more readable but more importantly it
|
||||||
|
# works across all shells.
|
||||||
|
# OLD
|
||||||
|
# config_eth0=( "192.168.0.24 netmask 255.255.255.0" "192.168.0.25/24" )
|
||||||
|
# NEW
|
||||||
|
# config_eth0="'192.168.0.24 netmask 255.255.255.0' 192.168.0.25/24"
|
||||||
|
# INVALID
|
||||||
|
# config_eth0='192.168.0.24 netmask 255.255.255.0'
|
||||||
|
#
|
||||||
|
# As the 1st value has spaces in it, it needs additional quoting. The 2nd
|
||||||
|
# value has no spaces, therefore no additional quoting is required.
|
||||||
|
# The last statement is invalid because when it is evaluated, it only has one
|
||||||
|
# set of quotes.
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
# MODULES
|
||||||
|
#
|
||||||
|
# We now support modular networking scripts which means we can easily
|
||||||
|
# add support for new interface types and modules while keeping
|
||||||
|
# compatability with existing ones.
|
||||||
|
#
|
||||||
|
# Modules load by default if the package they need is installed. If
|
||||||
|
# you specify a module here that doesn't have it's package installed
|
||||||
|
# then you get an error stating which package you need to install.
|
||||||
|
# Ideally, you only use the modules setting when you have two or more
|
||||||
|
# packages installed that supply the same service.
|
||||||
|
#
|
||||||
|
# In other words, you probably should DO NOTHING HERE...
|
||||||
|
|
||||||
|
# Prefer ifconfig over iproute2
|
||||||
|
#modules="ifconfig"
|
||||||
|
|
||||||
|
# You can also specify other modules for an interface
|
||||||
|
# In this case we prefer udhcpc over dhcpcd
|
||||||
|
#modules_eth0="udhcpc"
|
||||||
|
|
||||||
|
# You can also specify which modules not to use - for example you may be
|
||||||
|
# using a supplicant or linux-wlan-ng to control wireless configuration but
|
||||||
|
# you still want to configure network settings per SSID associated with.
|
||||||
|
#modules="!iwconfig !wpa_supplicant"
|
||||||
|
# IMPORTANT: If you need the above, please disable modules in that order
|
||||||
|
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
# INTERFACE HANDLERS
|
||||||
|
#
|
||||||
|
# We provide two interface handlers presently: ifconfig and iproute2.
|
||||||
|
# You need one of these to do any kind of network configuration.
|
||||||
|
# For ifconfig support, emerge sys-apps/net-tools
|
||||||
|
# For iproute2 support, emerge sys-apps/iproute2
|
||||||
|
|
||||||
|
# If you don't specify an interface then we prefer iproute2 if it's installed
|
||||||
|
# To prefer ifconfig over iproute2
|
||||||
|
#modules="ifconfig"
|
||||||
|
|
||||||
|
# For a static configuration, use something like this
|
||||||
|
# (They all do exactly the same thing btw)
|
||||||
|
#config_eth0="192.168.0.2/24"
|
||||||
|
#config_eth0="'192.168.0.2 netmask 255.255.255.0'"
|
||||||
|
|
||||||
|
# We can also specify a broadcast
|
||||||
|
#config_eth0="'192.168.0.2/24 brd 192.168.0.255'"
|
||||||
|
#config_eth0="'192.168.0.2 netmask 255.255.255.0 broadcast 192.168.0.255'"
|
||||||
|
|
||||||
|
# If you need more than one address, you can use something like this
|
||||||
|
# NOTE: ifconfig creates an aliased device for each extra IPv4 address
|
||||||
|
# (eth0:1, eth0:2, etc)
|
||||||
|
# iproute2 does not do this as there is no need to
|
||||||
|
#config_eth0="'192.168.0.2/24' '192.168.0.3/24' '192.168.0.4/24'"
|
||||||
|
# Or you can use sequence expressions
|
||||||
|
#config_eth0="192.168.0.{2..4}/24" # FIXME - does it work?
|
||||||
|
# which does the same as above. Be careful though as if you use this and
|
||||||
|
# fallbacks, you have to ensure that both end up with the same number of
|
||||||
|
# values otherwise your fallback won't work correctly.
|
||||||
|
|
||||||
|
# You can also use IPv6 addresses
|
||||||
|
# (you should always specify a prefix length with IPv6 here)
|
||||||
|
#config_eth0="192.168.0.2/24 \
|
||||||
|
#4321:0:1:2:3:4:567:89ab/64 \
|
||||||
|
#4321:0:1:2:3:4:567:89ac/64"
|
||||||
|
#)
|
||||||
|
|
||||||
|
# If you wish to keep existing addresses + routing and the interface is up,
|
||||||
|
# you can specify a noop (no operation). If the interface is down or there
|
||||||
|
# are no addresses assigned, then we move onto the next step (default dhcp)
|
||||||
|
# This is useful when configuring your interface with a kernel command line
|
||||||
|
# or similar
|
||||||
|
#config_eth0="noop 192.168.0.2/24"
|
||||||
|
|
||||||
|
# If you don't want ANY address (only useful when calling for advanced stuff)
|
||||||
|
#config_eth0="null"
|
||||||
|
|
||||||
|
# Here's how to do routing if you need it
|
||||||
|
# We add an IPv4 default route, IPv4 subnet route and an IPv6 unicast route
|
||||||
|
#routes_eth0=" \
|
||||||
|
# 'default via 192.168.0.1' \
|
||||||
|
# '10.0.0.0/8 via 192.168.0.1' \
|
||||||
|
# '::/0' \
|
||||||
|
#"
|
||||||
|
|
||||||
|
# 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'"
|
||||||
|
|
||||||
|
# NOTE: fallback entry must match the entry location in config_eth0
|
||||||
|
# As such you can only have one fallback route.
|
||||||
|
|
||||||
|
# Some users may need to alter the MTU - here's how
|
||||||
|
#mtu_eth0="1500"
|
||||||
|
|
||||||
|
# Each module described below can set a default base metric, lower is
|
||||||
|
# preferred over higher. This is so we can prefer a wired route over a
|
||||||
|
# wireless route automaticaly. You can override this by setting
|
||||||
|
#metric_eth0="100"
|
||||||
|
# or on a global basis
|
||||||
|
#metric="100"
|
||||||
|
# The only downside of the global setting is that you have to ensure that
|
||||||
|
# there are no conflicting routes yourself. For users with large routing
|
||||||
|
# tables you may have to set a global metric as the due to a simple read of
|
||||||
|
# the routing table taking over a minute at a time.
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
# OPTIONAL MODULES
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
# WIRELESS (802.11 support)
|
||||||
|
# Wireless can be provided by iwconfig or wpa_supplicant
|
||||||
|
|
||||||
|
# iwconfig
|
||||||
|
# emerge net-wireless/wireless-tools
|
||||||
|
# Wireless options are held in /etc/conf.d/wireless - but could be here too
|
||||||
|
# Consult the sample file /etc/conf.d/wireless.example for instructions
|
||||||
|
# wpa_supplicant is the default if it is installed
|
||||||
|
|
||||||
|
# wpa_supplicant
|
||||||
|
# emerge net-wireless/wpa-supplicant
|
||||||
|
# Wireless options are held in /etc/wpa_supplicant/wpa_supplicant.conf
|
||||||
|
# Console the wpa_supplicant.conf.example that is installed in
|
||||||
|
# /usr/share/doc/wpa_supplicant
|
||||||
|
# To configure wpa_supplicant
|
||||||
|
#wpa_supplicant_ath0="-Dmadwifi" # For Atheros based cards
|
||||||
|
# Consult wpa_supplicant for more drivers - the default is -Dwext which should
|
||||||
|
# work for most cards.
|
||||||
|
|
||||||
|
# By default we don't wait for wpa_suppliant to associate and authenticate.
|
||||||
|
# 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.
|
||||||
|
# If you would like to, so can specify how long in seconds.
|
||||||
|
#associate_timeout_eth0=60
|
||||||
|
# A value of 0 means wait forever.
|
||||||
|
|
||||||
|
# You can also override any settings found here per SSID - which is very
|
||||||
|
# handy if you use different networks a lot. See below for using the SSID
|
||||||
|
# in our variables
|
||||||
|
#config_SSID="dhcp"
|
||||||
|
# See the System module below for setting dns/nis/ntp per SSID
|
||||||
|
|
||||||
|
# You can also override any settings found here per MAC address of the AP
|
||||||
|
# in case you use Access Points with the same SSID but need different
|
||||||
|
# networking configs. Below is an example - of course you use the same
|
||||||
|
# method with other variables
|
||||||
|
#mac_config_001122334455="dhcp"
|
||||||
|
#mac_dns_servers_001122334455="192.168.0.1 192.168.0.2"
|
||||||
|
|
||||||
|
# When an interface has been associated with an Access Point, a global
|
||||||
|
# variable called SSID is set to the Access Point's SSID for use in the
|
||||||
|
# pre/post user functions below (although it's not available in preup as you
|
||||||
|
# won't have associated then)
|
||||||
|
|
||||||
|
# If you're using anything else to configure wireless on your interface AND
|
||||||
|
# you have installed wpa_supplicant, you need to disable wpa_supplicant
|
||||||
|
#modules="!iwconfig !wpa_supplicant"
|
||||||
|
#or
|
||||||
|
#modules="!wireless"
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
# WIRELESS SSID IN VARIABLES
|
||||||
|
##############################################################################
|
||||||
|
# Remember to change SSID to your SSID.
|
||||||
|
# Say that your SSID is My NET - the line
|
||||||
|
# #key_SSID="s:passkey"
|
||||||
|
# becomes
|
||||||
|
# #key_My_NET="s:passkey"
|
||||||
|
# Notice that the space has changed to an underscore - do the same with all
|
||||||
|
# characters not in a-z A-Z (English alphabet) 0-9. This only applies to
|
||||||
|
# variables and not values.
|
||||||
|
#
|
||||||
|
# Any SSID's in values like essid_eth0="My NET" may need to be escaped
|
||||||
|
# This means placing the character \ before the character
|
||||||
|
# \" need to be escaped for example
|
||||||
|
# So if your SSID is
|
||||||
|
# My "\ NET
|
||||||
|
# it becomes
|
||||||
|
# My \"\\ NET
|
||||||
|
# for example
|
||||||
|
# #essid_eth0="My\"\\NET"
|
||||||
|
#
|
||||||
|
# So using the above we can use
|
||||||
|
# #dns_domain_My____NET="My\"\\NET"
|
||||||
|
# which is an invalid dns domain, but shows the how to use the variable
|
||||||
|
# structure
|
||||||
|
#########################################################
|
||||||
|
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
# DHCP
|
||||||
|
# DHCP can be provided by dhclient, dhcpcd, pump or udhcpc.
|
||||||
|
#
|
||||||
|
# dhclient: emerge net-misc/dhcp
|
||||||
|
# dhcpcd: emerge net-misc/dhcpcd
|
||||||
|
# pump: emerge net-misc/pump
|
||||||
|
# udhcpc: emerge net-misc/udhcp
|
||||||
|
|
||||||
|
# If you have more than one DHCP client installed, you need to specify which
|
||||||
|
# one to use - otherwise we default to dhcpcd if available.
|
||||||
|
#modules=( "dhclient" ) # to select dhclient over dhcpcd
|
||||||
|
#
|
||||||
|
# Notes:
|
||||||
|
# - All clients send the current hostname to the DHCP server by default
|
||||||
|
# - dhcpcd does not daemonize when the lease time is infinite
|
||||||
|
# - udhcp-0.9.3-r3 and earlier do not support getting NTP servers
|
||||||
|
# - pump does not support getting NIS servers
|
||||||
|
# - DHCP tends to erase any existing device information - so add
|
||||||
|
# static addresses after dhcp if you need them
|
||||||
|
# - dhclient and udhcpc can set other resolv.conf options such as "option"
|
||||||
|
# and "sortlist"- see the System module for more details
|
||||||
|
|
||||||
|
# Regardless of which DHCP client you prefer, you configure them the
|
||||||
|
# same way using one of following depending on which interface modules
|
||||||
|
# you're using.
|
||||||
|
#config_eth0="dhcp"
|
||||||
|
|
||||||
|
# For passing custom options to dhcpcd use something like the following. This
|
||||||
|
# example reduces the timeout for retrieving an address from 60 seconds (the
|
||||||
|
# default) to 10 seconds.
|
||||||
|
#dhcpcd_eth0="-t 10"
|
||||||
|
|
||||||
|
# dhclient, udhcpc and pump don't have many runtime options
|
||||||
|
# You can pass options to them in a similar manner to dhcpcd though
|
||||||
|
#dhclient_eth0="..."
|
||||||
|
#udhcpc_eth0="..."
|
||||||
|
#pump_eth0="..."
|
||||||
|
|
||||||
|
# GENERIC DHCP OPTIONS
|
||||||
|
# Set generic DHCP options like so
|
||||||
|
#dhcp_eth0="release nodns nontp nonis nogateway nosendhost"
|
||||||
|
|
||||||
|
# This tells the dhcp client to release it's lease when it stops, not to
|
||||||
|
# overwrite dns, ntp and nis settings, not to set a default route and not to
|
||||||
|
# send the current hostname to the dhcp server and when it starts.
|
||||||
|
# You can use any combination of the above options - the default is not to
|
||||||
|
# use any of them.
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
# For APIPA support, emerge net-misc/iputils or net-analyzer/arping
|
||||||
|
|
||||||
|
# APIPA is a module that tries to find a free address in the range
|
||||||
|
# 169.254.0.0-169.254.255.255 by arping a random address in that range on the
|
||||||
|
# interface. If no reply is found then we assign that address to the interface
|
||||||
|
|
||||||
|
# This is only useful for LANs where there is no DHCP server and you don't
|
||||||
|
# connect directly to the internet.
|
||||||
|
#config_eth0="dhcp"
|
||||||
|
#fallback_eth0="apipa"
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
# ARPING Gateway configuration
|
||||||
|
# and
|
||||||
|
# Automatic Private IP Addressing (APIPA)
|
||||||
|
# For arpingnet / apipa support, emerge net-misc/iputils or net-analyzer/arping
|
||||||
|
#
|
||||||
|
# This is a module that tries to find a gateway IP. If it exists then we use
|
||||||
|
# that gateways configuration for our own. For the configuration variables
|
||||||
|
# simply ensure that each octet is zero padded and the dots are removed.
|
||||||
|
# Below is an example.
|
||||||
|
#
|
||||||
|
#gateways_eth0="192.168.0.1 10.0.0.1"
|
||||||
|
#config_192168000001="192.168.0.2/24"
|
||||||
|
#routes_192168000001="'default via 192.168.0.1'"
|
||||||
|
#dns_servers_192168000001="192.168.0.1"
|
||||||
|
#config_010000000001="10.0.0.254/8"
|
||||||
|
#routes_010000000001="default via 10.0.0.1"
|
||||||
|
#dns_servers_010000000001="10.0.0.1"
|
||||||
|
|
||||||
|
# We can also specify a specific MAC address for each gateway if different
|
||||||
|
# networks have the same gateway.
|
||||||
|
#gateways_eth0="192.168.0.1,00:11:22:AA:BB:CC 10.0.0.1,33:44:55:DD:EE:FF"
|
||||||
|
#config_192168000001_001122AABBCC="192.168.0.2/24"
|
||||||
|
#routes_192168000001_001122AABBCC="default via 192.168.0.1"
|
||||||
|
#dns_servers_192168000001_001122AABBCC="192.168.0.1"
|
||||||
|
#config_010000000001_334455DDEEFF="10.0.0.254/8"
|
||||||
|
#routes_010000000001_334455DDEEFF="default via 10.0.0.1"
|
||||||
|
#dns_servers_010000000001_334455DDEEFF="10.0.0.1"
|
||||||
|
|
||||||
|
# If we don't find any gateways (or there are none configured) then we try and
|
||||||
|
# use APIPA to find a free address in the range 169.254.0.0-169.254.255.255
|
||||||
|
# by arping a random address in that range on the interface. If no reply is
|
||||||
|
# found then we assign that address to the interface.
|
||||||
|
|
||||||
|
# This is only useful for LANs where there is no DHCP server.
|
||||||
|
#config_eth0="arping"
|
||||||
|
|
||||||
|
# or if no DHCP server can be found
|
||||||
|
#config_eth0="dhcp"
|
||||||
|
#fallback_eth0="arping"
|
||||||
|
|
||||||
|
# NOTE: We default to sleeping for 1 second the first time we attempt an
|
||||||
|
# arping to give the interface time to settle on the LAN. This appears to
|
||||||
|
# be a good default for most instances, but if not you can alter it here.
|
||||||
|
#arping_sleep=5
|
||||||
|
#arping_sleep_lan=7
|
||||||
|
|
||||||
|
# NOTE: We default to waiting 3 seconds to get an arping response. You can
|
||||||
|
# change the default wait like so.
|
||||||
|
#arping_wait=3
|
||||||
|
#arping_wait_lan=2
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
# VLAN (802.1q support)
|
||||||
|
# For VLAN support, emerge net-misc/vconfig
|
||||||
|
|
||||||
|
# Specify the VLAN numbers for the interface like so
|
||||||
|
# Please ensure your VLAN IDs are NOT zero-padded
|
||||||
|
#vlans_eth0="1 2"
|
||||||
|
|
||||||
|
# You may not want to assign an IP the the physical interface, but we still
|
||||||
|
# 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'"
|
||||||
|
#config_vlan1="'172.16.3.1 netmask 255.255.254.0'"
|
||||||
|
#config_vlan2="'172.16.2.1 netmask 255.255.254.0'"
|
||||||
|
|
||||||
|
# NOTE: Vlans can be configured with a . in their interface names
|
||||||
|
# When configuring vlans with this name type, you need to replace . with a _
|
||||||
|
#config_eth0.1="dhcp" - does not work
|
||||||
|
#config_eth0_1="dhcp" - does work
|
||||||
|
|
||||||
|
# NOTE: Vlans are controlled by their physical interface and not per vlan
|
||||||
|
# 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.
|
||||||
|
#vlan_start_eth0="no"
|
||||||
|
|
||||||
|
# If you do the above then you may want to depend on eth0 like so
|
||||||
|
# RC_NEED_vlan1="net.eth0"
|
||||||
|
# NOTE: depend functions only work in /etc/conf.d/net
|
||||||
|
# and not in profile configs such as /etc/conf.d/net.foo
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
# Bonding
|
||||||
|
# For link bonding/trunking emerge net-misc/ifenslave
|
||||||
|
|
||||||
|
# To bond interfaces together
|
||||||
|
#slaves_bond0="eth0 eth1 eth2"
|
||||||
|
#config_bond0="null" # You may not want to assign an IP the the bond
|
||||||
|
|
||||||
|
# If any of the slaves require extra configuration - for example wireless or
|
||||||
|
# ppp devices - we need to depend function on the bonded interfaces
|
||||||
|
#RC_NEED_bond0="net.eth0 net.eth1"
|
||||||
|
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
# Classical IP over ATM
|
||||||
|
# For CLIP support emerge net-dialup/linux-atm
|
||||||
|
|
||||||
|
# Ensure that you have /etc/atmsigd.conf setup correctly
|
||||||
|
# Now setup each clip interface like so
|
||||||
|
#clip_atm0=( "peer_ip [if.]vpi.vci [opts]" ... )
|
||||||
|
# where "peer_ip" is the IP address of a PVC peer (in case of an ATM connection
|
||||||
|
# with your ISP, your only peer is usually the ISP gateway closest to you),
|
||||||
|
# "if" is the number of the ATM interface which will carry the PVC, "vpi.vci"
|
||||||
|
# is the ATM VC address, and "opts" may optionally specify VC parameters like
|
||||||
|
# qos, pcr, and the like (see "atmarp -s" for further reference). Please also
|
||||||
|
# note quoting: it is meant to distinguish the VCs you want to create. You may,
|
||||||
|
# in example, create an atm0 interface to more peers, like this:
|
||||||
|
#clip_atm0="'1.1.1.254 0.8.35' 1.1.1.253 1.8.35'"
|
||||||
|
|
||||||
|
# By default, the PVC will use the LLC/SNAP encapsulation. If you rather need a
|
||||||
|
# null encapsulation (aka "VC mode"), please add the keyword "null" to opts.
|
||||||
|
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
# PPP
|
||||||
|
# For PPP support, emerge net-dialup/ppp
|
||||||
|
# PPP is used for most dialup connections, including ADSL.
|
||||||
|
# The older ADSL module is documented below, but you are encouraged to try
|
||||||
|
# this module first.
|
||||||
|
#
|
||||||
|
# You need to create the PPP net script yourself. Make it like so
|
||||||
|
#ln -s net.lo /etc/init.d/net.ppp0
|
||||||
|
#
|
||||||
|
# We have to instruct ppp0 to actually use ppp
|
||||||
|
#config_ppp0="ppp"
|
||||||
|
#
|
||||||
|
# Each PPP interface requires an interface to use as a "Link"
|
||||||
|
#link_ppp0="/dev/ttyS0" # Most PPP links will use a serial port
|
||||||
|
#link_ppp0="eth0" # PPPoE requires an ethernet interface
|
||||||
|
#link_ppp0="[itf.]vpi.vci" # PPPoA requires the ATM VC's address
|
||||||
|
#link_ppp0="/dev/null" # ISDN links should have this
|
||||||
|
#link_ppp0="pty 'your_link_command'" # PPP links over ssh, rsh, etc
|
||||||
|
#
|
||||||
|
# Here you should specify what pppd plugins you want to use
|
||||||
|
# Available plugins are: pppoe, pppoa, capi, dhcpc, minconn, radius,
|
||||||
|
# radattr, radrealms and winbind
|
||||||
|
#plugins_ppp0="pppoe" # Required plugin for PPPoE
|
||||||
|
#plugins_ppp0="pppoa vc-encaps" # Required plugin for PPPoA with an option
|
||||||
|
#plugins_ppp0="capi" # Required plugin for ISDN
|
||||||
|
#
|
||||||
|
# PPP requires at least a username. You can optionally set a password here too
|
||||||
|
# If you don't, then it will use the password specified in /etc/ppp/*-secrets
|
||||||
|
# against the specified username
|
||||||
|
#username_ppp0='user'
|
||||||
|
#password_ppp0='password'
|
||||||
|
# NOTE: You can set a blank password like so
|
||||||
|
#password_ppp0=
|
||||||
|
#
|
||||||
|
# The PPP daemon has many options you can specify - although there are many
|
||||||
|
# and may seem daunting, it is recommended that you read the pppd man page
|
||||||
|
# before enabling any of them
|
||||||
|
#pppd_ppp0=(
|
||||||
|
# "maxfail 0" # WARNING: It's not recommended you use this
|
||||||
|
# # if you don't specify maxfail then we assume 0
|
||||||
|
# "updetach" # If not set, "/etc/init.d/net.ppp0 start" will return
|
||||||
|
# # immediately, without waiting the link to come up
|
||||||
|
# # for the first time.
|
||||||
|
# # Do not use it for dial-on-demand links!
|
||||||
|
# "debug" # Enables syslog debugging
|
||||||
|
# "noauth" # Do not require the peer to authenticate itself
|
||||||
|
# "defaultroute" # Make this PPP interface the default route
|
||||||
|
# "usepeerdns" # Use the DNS settings provided by PPP
|
||||||
|
#
|
||||||
|
# On demand options
|
||||||
|
# "demand" # Enable dial on demand
|
||||||
|
# "idle 30" # Link goes down after 30 seconds of inactivity
|
||||||
|
# "10.112.112.112:10.112.112.113" # Phony IP addresses
|
||||||
|
# "ipcp-accept-remote" # Accept the peers idea of remote address
|
||||||
|
# "ipcp-accept-local" # Accept the peers idea of local address
|
||||||
|
# "holdoff 3" # Wait 3 seconds after link dies before re-starting
|
||||||
|
#
|
||||||
|
# Dead peer detection
|
||||||
|
# "lcp-echo-interval 15" # Send a LCP echo every 15 seconds
|
||||||
|
# "lcp-echo-failure 3" # Make peer dead after 3 consective
|
||||||
|
# # echo-requests
|
||||||
|
#
|
||||||
|
# Compression options - use these to completely disable compression
|
||||||
|
# noaccomp noccp nobsdcomp nodeflate nopcomp novj novjccomp
|
||||||
|
#
|
||||||
|
# Dial-up settings
|
||||||
|
# "lock" # Lock serial port
|
||||||
|
# "115200" # Set the serial port baud rate
|
||||||
|
# "modem crtscts" # Enable hardware flow control
|
||||||
|
# "192.168.0.1:192.168.0.2" # Local and remote IP addresses
|
||||||
|
#)
|
||||||
|
#
|
||||||
|
# Dial-up PPP users need to specify at least one telephone number
|
||||||
|
#phone_number_ppp0=( "12345689" ) # Maximum 2 phone numbers are supported
|
||||||
|
# They will also need a chat script - here's a good one
|
||||||
|
#chat_ppp0=(
|
||||||
|
# 'ABORT' 'BUSY'
|
||||||
|
# 'ABORT' 'ERROR'
|
||||||
|
# 'ABORT' 'NO ANSWER'
|
||||||
|
# 'ABORT' 'NO CARRIER'
|
||||||
|
# 'ABORT' 'NO DIALTONE'
|
||||||
|
# 'ABORT' 'Invalid Login'
|
||||||
|
# 'ABORT' 'Login incorrect'
|
||||||
|
# 'TIMEOUT' '5'
|
||||||
|
# '' 'ATZ'
|
||||||
|
# 'OK' 'AT' # Put your modem initialization string here
|
||||||
|
# 'OK' 'ATDT\T'
|
||||||
|
# 'TIMEOUT' '60'
|
||||||
|
# 'CONNECT' ''
|
||||||
|
# 'TIMEOUT' '5'
|
||||||
|
# '~--' ''
|
||||||
|
#)
|
||||||
|
|
||||||
|
# If the link require extra configuration - for example wireless or
|
||||||
|
# RFC 268 bridge - we need to depend on the bridge so they get
|
||||||
|
# configured correctly.
|
||||||
|
#RC_NEED_ppp0="net.nas0"
|
||||||
|
|
||||||
|
#WARNING: if MTU of the PPP interface is less than 1500 and you use this
|
||||||
|
#machine as a router, you should add the following rule to your firewall
|
||||||
|
#
|
||||||
|
#iptables -I FORWARD 1 -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
# ADSL
|
||||||
|
# For ADSL support, emerge net-dialup/rp-pppoe
|
||||||
|
# WARNING: This ADSL module is being deprecated in favour of the PPP module
|
||||||
|
# above.
|
||||||
|
# You should make the following settings and also put your
|
||||||
|
# username/password information in /etc/ppp/pap-secrets
|
||||||
|
|
||||||
|
# Configure the interface to use ADSL
|
||||||
|
#config_eth0="adsl"
|
||||||
|
|
||||||
|
# You probably won't need to edit /etc/ppp/pppoe.conf if you set this
|
||||||
|
#adsl_user_eth0="my-adsl-username"
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
# ISDN
|
||||||
|
# For ISDN support, emerge net-dialup/isdn4k-utils
|
||||||
|
# You should make the following settings and also put your
|
||||||
|
# username/password information in /etc/ppp/pap-secrets
|
||||||
|
|
||||||
|
# Configure the interface to use ISDN
|
||||||
|
#config_ippp0="dhcp"
|
||||||
|
# It's important to specify dhcp if you need it!
|
||||||
|
#config_ippp0="192.168.0.1/24"
|
||||||
|
# Otherwise, you can use a static IP
|
||||||
|
|
||||||
|
# NOTE: The interface name must be either ippp or isdn followed by a number
|
||||||
|
|
||||||
|
# You may need this option to set the default route
|
||||||
|
#ipppd_eth0="defaultroute"
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
# MAC changer
|
||||||
|
# To set a specific MAC address
|
||||||
|
#mac_eth0="00:11:22:33:44:55"
|
||||||
|
|
||||||
|
# For changing MAC addresses using the below, emerge net-analyzer/macchanger
|
||||||
|
# - to randomize the last 3 bytes only
|
||||||
|
#mac_eth0="random-ending"
|
||||||
|
# - to randomize between the same physical type of connection (e.g. fibre,
|
||||||
|
# copper, wireless) , all vendors
|
||||||
|
#mac_eth0="random-samekind"
|
||||||
|
# - to randomize between any physical type of connection (e.g. fibre, copper,
|
||||||
|
# wireless) , all vendors
|
||||||
|
#mac_eth0="random-anykind"
|
||||||
|
# - full randomization - WARNING: some MAC addresses generated by this may NOT
|
||||||
|
# act as expected
|
||||||
|
#mac_eth0="random-full"
|
||||||
|
# custom - passes all parameters directly to net-analyzer/macchanger
|
||||||
|
#mac_eth0="some custom set of parameters"
|
||||||
|
|
||||||
|
# You can also set other options based on the MAC address of your network card
|
||||||
|
# Handy if you use different docking stations with laptops
|
||||||
|
#config_001122334455="dhcp"
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
# TUN/TAP
|
||||||
|
# For TUN/TAP support emerge net-misc/openvpn or sys-apps/usermode-utilities
|
||||||
|
#
|
||||||
|
# You must specify if we're a tun or tap device. Then you can give it any
|
||||||
|
# name you like - such as vpn
|
||||||
|
#tuntap_vpn="tun"
|
||||||
|
#config_vpn="192.168.0.1/24"
|
||||||
|
|
||||||
|
# Or stick wit the generic names - like tap0
|
||||||
|
#tuntap_tap0="tap"
|
||||||
|
#config_tap0="192.168.0.1/24"
|
||||||
|
|
||||||
|
# For passing custom options to tunctl use something like the following. This
|
||||||
|
# example sets the owner to adm
|
||||||
|
#tunctl_tun1="-u adm"
|
||||||
|
# When using openvpn, there are no options
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
# Bridging (802.1d)
|
||||||
|
# For bridging support emerge net-misc/bridge-utils
|
||||||
|
|
||||||
|
# To add ports to bridge br0
|
||||||
|
#bridge_br0="eth0 eth1"
|
||||||
|
# or dynamically add them when the interface comes up
|
||||||
|
#bridge_add_eth0="br0"
|
||||||
|
#bridge_add_eth1="br0"
|
||||||
|
|
||||||
|
# You need to configure the ports to null values so dhcp does not get started
|
||||||
|
#config_eth0="null"
|
||||||
|
#config_eth1="null"
|
||||||
|
|
||||||
|
# Finally give the bridge an address - dhcp or a static IP
|
||||||
|
#config_br0="dhcp" # may not work when adding ports dynamically
|
||||||
|
#config_br0="192.168.0.1/24"
|
||||||
|
|
||||||
|
# If any of the ports require extra configuration - for example wireless or
|
||||||
|
# ppp devices - we need to depend on them like so.
|
||||||
|
#RC_NEED_br0="net.eth0 net.eth1"
|
||||||
|
|
||||||
|
# Below is an example of configuring the bridge
|
||||||
|
# Consult "man brctl" for more details
|
||||||
|
#brctl_br0="'setfd 0' 'sethello 0' 'stp off'"
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
# RFC 2684 Bridge Support
|
||||||
|
# For RFC 2684 bridge support emerge net-misc/br2684ctl
|
||||||
|
|
||||||
|
# Interface names have to be of the form nas0, nas1, nas2, etc.
|
||||||
|
# You have to specify a VPI and VCI for the interface like so
|
||||||
|
#br2684ctl_nas0="-a 0.38" # UK VPI and VCI
|
||||||
|
|
||||||
|
# You may want to configure the encapsulation method as well by adding the -e
|
||||||
|
# option to the command above (may need to be before the -a command)
|
||||||
|
# -e 0 # LLC (default)
|
||||||
|
# -e 1 # VC mux
|
||||||
|
|
||||||
|
# Then you can configure the interface as normal
|
||||||
|
#config_nas0="'192.168.0.1/24'"
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
# Tunnelling
|
||||||
|
# WARNING: For tunnelling it is highly recommended that you
|
||||||
|
# emerge sys-apps/iproute2
|
||||||
|
#
|
||||||
|
# For GRE tunnels
|
||||||
|
#iptunnel_vpn0="mode gre remote 207.170.82.1 key 0xffffffff ttl 255"
|
||||||
|
|
||||||
|
# For IPIP tunnels
|
||||||
|
#iptunnel_vpn0="mode ipip remote 207.170.82.2 ttl 255"
|
||||||
|
|
||||||
|
# To configure the interface
|
||||||
|
#config_vpn0="'192.168.0.2 pointopoint 192.168.1.2'" # ifconfig style
|
||||||
|
#config_vpn0="'192.168.0.2 peer 192.168.1.1'" # iproute2 style
|
||||||
|
|
||||||
|
# 6to4 Tunnels allow IPv6 to work over IPv4 addresses, provided you
|
||||||
|
# have a non-private address configured on an interface.
|
||||||
|
# link_6to4="eth0" # Interface to base it's addresses on
|
||||||
|
# config_6to4="ip6to4"
|
||||||
|
# You may want to depend on eth0 like so
|
||||||
|
#RC_NEED_6to4="net.eth0"
|
||||||
|
# To ensure that eth0 is configured before 6to4. Of course, the tunnel could be
|
||||||
|
# any name and this also works for any configured interface.
|
||||||
|
# NOTE: If you're not using iproute2 then your 6to4 tunnel has to be called
|
||||||
|
# sit0 - otherwise use a different name like 6to4 in the example above.
|
||||||
|
|
||||||
|
# You can also specify a relay and suffix if you like.
|
||||||
|
# The default relay is 192.88.99.1 and the defualt suffix is :1
|
||||||
|
#relay_6to4="192.168.3.2"
|
||||||
|
#suffix_6to4=":ff"
|
||||||
|
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
# System
|
||||||
|
# For configuring system specifics such as domain, dns, ntp and nis servers
|
||||||
|
# It's rare that you would need todo this, but you can anyway.
|
||||||
|
# This is most benefit to wireless users who don't use DHCP so they can change
|
||||||
|
# their configs based on SSID. See wireless.example for more details
|
||||||
|
|
||||||
|
# To use dns settings such as these, dns_servers_eth0 must be set!
|
||||||
|
# If you omit the _eth0 suffix, then it applies to all interfaces unless
|
||||||
|
# overridden by the interface suffix.
|
||||||
|
#dns_domain_eth0="your.domain"
|
||||||
|
#dns_servers_eth0="192.168.0.2 192.168.0.3"
|
||||||
|
#dns_search_eth0="this.domain that.domain"
|
||||||
|
#dns_options_eth0="'timeout 1' rotate"
|
||||||
|
#dns_sortlist_eth0="130.155.160.0/255.255.240.0 130.155.0.0"
|
||||||
|
# See the man page for resolv.conf for details about the options and sortlist
|
||||||
|
# directives
|
||||||
|
|
||||||
|
#ntp_servers_eth0="192.168.0.2 192.168.0.3"
|
||||||
|
|
||||||
|
#nis_domain_eth0="domain"
|
||||||
|
#nis_servers_eth0="192.168.0.2 192.168.0.3"
|
||||||
|
|
||||||
|
# NOTE: Setting any of these will stamp on the files in question. So if you
|
||||||
|
# don't specify dns_servers but you do specify dns_domain then no nameservers
|
||||||
|
# will be listed in /etc/resolv.conf even if there were any there to start
|
||||||
|
# with.
|
||||||
|
# If this is an issue for you then maybe you should look into a resolv.conf
|
||||||
|
# manager like resolvconf-gentoo to manage this file for you. All packages
|
||||||
|
# that baselayout supports use resolvconf-gentoo if installed.
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
# Cable in/out detection
|
||||||
|
# Sometimes the cable is in, others it's out. Obviously you don't want to
|
||||||
|
# restart net.eth0 every time when you plug it in either.
|
||||||
|
#
|
||||||
|
# netplug is a package that detects this and requires no extra configuration
|
||||||
|
# on your part.
|
||||||
|
# emerge sys-apps/netplug
|
||||||
|
# or
|
||||||
|
# emerge sys-apps/ifplugd
|
||||||
|
# and you're done :)
|
||||||
|
|
||||||
|
# By default we don't wait for netplug/ifplugd to configure the interface.
|
||||||
|
# If you would like it to wait so that other services now that network is up
|
||||||
|
# then you can specify a timeout here.
|
||||||
|
#plug_timeout="10"
|
||||||
|
# A value of 0 means wait forever.
|
||||||
|
|
||||||
|
# If you don't want to use netplug on a specific interface but you have it
|
||||||
|
# installed, you can disable it for that interface via the modules statement
|
||||||
|
#modules_eth0="!netplugd"
|
||||||
|
# You can do the same for ifplugd
|
||||||
|
#
|
||||||
|
# You can disable them both with the generic plug
|
||||||
|
#modules_eth0="!plug"
|
||||||
|
|
||||||
|
# To use specific ifplugd options, fex specifying wireless mode
|
||||||
|
#ifplugd_eth0="--api-mode=wlan"
|
||||||
|
# man ifplugd for more options
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
# ADVANCED CONFIGURATION
|
||||||
|
#
|
||||||
|
# Four functions can be defined which will be called surrounding the
|
||||||
|
# start/stop operations. The functions are called with the interface
|
||||||
|
# name first so that one function can control multiple adapters. An extra two
|
||||||
|
# functions can be defined when an interface fails to start or stop.
|
||||||
|
#
|
||||||
|
# The return values for the preup and predown functions should be 0
|
||||||
|
# (success) to indicate that configuration or deconfiguration of the
|
||||||
|
# interface can continue. If preup returns a non-zero value, then
|
||||||
|
# interface configuration will be aborted. If predown returns a
|
||||||
|
# non-zero value, then the interface will not be allowed to continue
|
||||||
|
# deconfiguration.
|
||||||
|
#
|
||||||
|
# The return values for the postup, postdown, failup and faildown functions are
|
||||||
|
# ignored since there's nothing to do if they indicate failure.
|
||||||
|
#
|
||||||
|
# ${IFACE} is set to the interface being brought up/down
|
||||||
|
# ${IFVAR} is ${IFACE} converted to variable name bash allows
|
||||||
|
|
||||||
|
#preup() {
|
||||||
|
# # Test for link on the interface prior to bringing it up. This
|
||||||
|
# # only works on some network adapters and requires the mii-diag
|
||||||
|
# # package to be installed.
|
||||||
|
# if mii-tool "${IFACE}" 2> /dev/null | grep -q 'no link'; then
|
||||||
|
# ewarn "No link on ${IFACE}, aborting configuration"
|
||||||
|
# return 1
|
||||||
|
# fi
|
||||||
|
#
|
||||||
|
# # Test for link on the interface prior to bringing it up. This
|
||||||
|
# # only works on some network adapters and requires the ethtool
|
||||||
|
# # package to be installed.
|
||||||
|
# if ethtool "${IFACE}" | grep -q 'Link detected: no'; then
|
||||||
|
# ewarn "No link on ${IFACE}, aborting configuration"
|
||||||
|
# return 1
|
||||||
|
# fi
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# # Remember to return 0 on success
|
||||||
|
# return 0
|
||||||
|
#}
|
||||||
|
|
||||||
|
#predown() {
|
||||||
|
# # The default in the script is to test for NFS root and disallow
|
||||||
|
# # downing interfaces in that case. Note that if you specify a
|
||||||
|
# # predown() function you will override that logic. Here it is, in
|
||||||
|
# # case you still want it...
|
||||||
|
# if is_net_fs /; then
|
||||||
|
# eerror "root filesystem is network mounted -- can't stop ${IFACE}"
|
||||||
|
# return 1
|
||||||
|
# fi
|
||||||
|
#
|
||||||
|
# # Remember to return 0 on success
|
||||||
|
# return 0
|
||||||
|
#}
|
||||||
|
|
||||||
|
#postup() {
|
||||||
|
# # This function could be used, for example, to register with a
|
||||||
|
# # dynamic DNS service. Another possibility would be to
|
||||||
|
# # send/receive mail once the interface is brought up.
|
||||||
|
|
||||||
|
# # Here is an example that allows the use of iproute rules
|
||||||
|
# # which have been configured using the rules_eth0 variable.
|
||||||
|
# #rules_eth0=" \
|
||||||
|
# # 'from 24.80.102.112/32 to 192.168.1.0/24 table localnet priority 100' \
|
||||||
|
# # 'from 216.113.223.51/32 to 192.168.1.0/24 table localnet priority 100' \
|
||||||
|
# #"
|
||||||
|
# eval set -- $\rules_${IFVAR}
|
||||||
|
# if [ -n "$@" ] ; then
|
||||||
|
# einfo "Adding IP policy routing rules"
|
||||||
|
# eindent
|
||||||
|
# # Ensure that the kernel supports policy routing
|
||||||
|
# if ! ip rule list | grep -q "^" ; then
|
||||||
|
# eerror "You need to enable IP Policy Routing (CONFIG_IP_MULTIPLE_TABLES)"
|
||||||
|
# eerror "in your kernel to use ip rules"
|
||||||
|
# else
|
||||||
|
# for x in "$@" ; do
|
||||||
|
# ebegin "${x}"
|
||||||
|
# ip rule add ${x} dev "${IFACE}"
|
||||||
|
# eend $?
|
||||||
|
# done
|
||||||
|
# fi
|
||||||
|
# eoutdent
|
||||||
|
# # Flush the cache
|
||||||
|
# ip route flush cache dev "${IFACE}"
|
||||||
|
# fi
|
||||||
|
|
||||||
|
#}
|
||||||
|
|
||||||
|
#postdown() {
|
||||||
|
# # Enable Wake-On-LAN for every interface except for lo
|
||||||
|
# # Probably a good idea to set RC_DOWN_INTERFACE="no" in /etc/conf.d/rc
|
||||||
|
# # as well ;)
|
||||||
|
# [[ ${IFACE} != "lo" ]] && ethtool -s "${IFACE}" wol g
|
||||||
|
|
||||||
|
# Automatically erase any ip rules created in the example postup above
|
||||||
|
# if interface_exists "${IFACE}" ; then
|
||||||
|
# # Remove any rules for this interface
|
||||||
|
# local rule
|
||||||
|
# ip rule list | grep " iif ${IFACE}[ ]*" | {
|
||||||
|
# while read rule ; do
|
||||||
|
# rule="${rule#*:}"
|
||||||
|
# ip rule del ${rule}
|
||||||
|
# done
|
||||||
|
# }
|
||||||
|
# # Flush the route cache
|
||||||
|
# ip route flush cache dev "${IFACE}"
|
||||||
|
# fi
|
||||||
|
|
||||||
|
# # Return 0 always
|
||||||
|
# return 0
|
||||||
|
#}
|
||||||
|
|
||||||
|
#failup() {
|
||||||
|
# # This function is mostly here for completeness... I haven't
|
||||||
|
# # thought of anything nifty to do with it yet ;-)
|
||||||
|
#}
|
||||||
|
|
||||||
|
#faildown() {
|
||||||
|
# # This function is mostly here for completeness... I haven't
|
||||||
|
# # thought of anything nifty to do with it yet ;-)
|
||||||
|
#}
|
34
conf.d.Linux/rc
Normal file
34
conf.d.Linux/rc
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
|
||||||
|
##############################################################################
|
||||||
|
# LINUX SPECIFIC OPTIONS
|
||||||
|
|
||||||
|
# This is the number of tty's used in most of the rc-scripts (like
|
||||||
|
# consolefont, numlock, etc ...)
|
||||||
|
RC_TTY_NUMBER=11
|
||||||
|
|
||||||
|
# RC_DOWN_INTERFACE allows you to specify if RC will bring the interface
|
||||||
|
# completely down when it stops. The default is yes, but there are some
|
||||||
|
# instances where you may not want this to happen such as using Wake On LAN.
|
||||||
|
RC_DOWN_INTERFACE="yes"
|
||||||
|
|
||||||
|
# RC_DOWN_HARDDISK allows you to specify if RC will put harddisks to
|
||||||
|
# standby mode when it stops.
|
||||||
|
RC_DOWN_HARDDISK="yes"
|
||||||
|
|
||||||
|
# Use this variable to control the /dev management behavior.
|
||||||
|
# auto - let the scripts figure out what's best at boot
|
||||||
|
# devfs - use devfs (requires sys-fs/devfsd)
|
||||||
|
# udev - use udev (requires sys-fs/udev)
|
||||||
|
# static - let the user manage /dev (YOU need to create ALL device nodes)
|
||||||
|
RC_DEVICES="auto"
|
||||||
|
|
||||||
|
# UDEV OPTION:
|
||||||
|
# Set to "yes" if you want to save /dev to a tarball on shutdown
|
||||||
|
# and restore it on startup. This is useful if you have a lot of
|
||||||
|
# custom device nodes that udev does not handle/know about.
|
||||||
|
RC_DEVICE_TARBALL="no"
|
||||||
|
|
||||||
|
# RC_DMESG_LEVEL sets the level at which logging of messages is done to the
|
||||||
|
# console. See dmesg(8) for more info.
|
||||||
|
RC_DMESG_LEVEL="1"
|
||||||
|
|
15
conf.d.Linux/volumes
Normal file
15
conf.d.Linux/volumes
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
# IMPORTANT
|
||||||
|
# volumes dependancy order is specified here so users can move it before
|
||||||
|
# checkroot so that it can create the needed nodes in /dev.
|
||||||
|
# By default it comes after modules in case the volume required modules
|
||||||
|
# are not compiled into the kernel.
|
||||||
|
|
||||||
|
#RC_BEFORE="checkroot"
|
||||||
|
RC_NEED="checkroot"
|
||||||
|
RC_USE="modules"
|
||||||
|
|
||||||
|
# VOLUME_ORDER allows you to specify, or even remove the volume setup
|
||||||
|
# for various volume managers (MD, EVMS2, LVM, DM, etc). Note that they are
|
||||||
|
# stopped in reverse order.
|
||||||
|
|
||||||
|
#VOLUME_ORDER="raid evms lvm dm"
|
266
conf.d.Linux/wireless.example
Normal file
266
conf.d.Linux/wireless.example
Normal file
@ -0,0 +1,266 @@
|
|||||||
|
# /etc/conf.d/wireless:
|
||||||
|
# Global wireless config file for net.* rc-scripts
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
# IMPORTANT
|
||||||
|
# linux-wlan-ng is not supported as they have their own configuration program
|
||||||
|
# ensure that /etc/conf.d/net has the entry "!iwconfig" in it's modules line
|
||||||
|
# Try and use an alternative driver if you need to use this - hostap-driver
|
||||||
|
# supports non-usb linux-wlan-ng driven devices
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
# HINTS
|
||||||
|
##############################################################################
|
||||||
|
# see net.example for using SSID in variable names
|
||||||
|
#
|
||||||
|
# Most users will just need to set the following options
|
||||||
|
# key_SSID1="s:yourkeyhere enc open" # s: means a text key
|
||||||
|
# key_SSID2="aaaa-bbbb-cccc-dd" # no s: means a hex key
|
||||||
|
# preferred_aps="'SSID 1' 'SSID 2'"
|
||||||
|
#
|
||||||
|
# Clear? Good. Now configure your wireless network below
|
||||||
|
#############################################################################
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
# SETTINGS
|
||||||
|
##############################################################################
|
||||||
|
# Hard code an SSID to an interface - leave this unset if you wish the driver
|
||||||
|
# to scan for available Access Points
|
||||||
|
# Set to "any" to connect to any SSID - the driver picks an Access Point
|
||||||
|
# This needs to be done when the driver doesn't support scanning
|
||||||
|
# This may work for drivers that don't support scanning but you need automatic
|
||||||
|
# AP association
|
||||||
|
# I would only set this as a last resort really - use the preferred_aps
|
||||||
|
# setting at the bottom of this file
|
||||||
|
|
||||||
|
# However, using ad-hoc (without scanning for APs) and master mode
|
||||||
|
# do require the SSID to be set - do this here
|
||||||
|
#essid_eth0="any"
|
||||||
|
|
||||||
|
# Set the mode of the interface (managed, ad-hoc, master or auto)
|
||||||
|
# The default is auto
|
||||||
|
# If it's ad-hoc or master you also may need to specify the channel below
|
||||||
|
#mode_eth0="auto"
|
||||||
|
|
||||||
|
# If managed mode fails, drop to ad-hoc mode with the below SSID?
|
||||||
|
#adhoc_essid_eth0="WLAN"
|
||||||
|
|
||||||
|
# Some drivers/hardware don't scan all that well. We have no control over this
|
||||||
|
# but we can say how many scans we want to do to try and get a better sweep of
|
||||||
|
# the area. The default is 1.
|
||||||
|
#scans_eth0="1"
|
||||||
|
|
||||||
|
#Channel can be set (1-14), but defaults to 3 if not set.
|
||||||
|
#
|
||||||
|
# The below is taken verbatim from the BSD wavelan documentation found at
|
||||||
|
# http://www.netbsd.org/Documentation/network/wavelan.html
|
||||||
|
# There are 14 channels possible; We are told that channels 1-11 are legal for
|
||||||
|
# North America, channels 1-13 for most of Europe, channels 10-13 for France,
|
||||||
|
# and only channel 14 for Japan. If in doubt, please refer to the documentation
|
||||||
|
# that came with your card or access point. Make sure that the channel you
|
||||||
|
# select is the same channel your access point (or the other card in an ad-hoc
|
||||||
|
# network) is on. The default for cards sold in North America and most of Europe
|
||||||
|
# is 3; the default for cards sold in France is 11, and the default for cards
|
||||||
|
# sold in Japan is 14.
|
||||||
|
#channel_eth0="3"
|
||||||
|
|
||||||
|
# Setup any other config commands. This is basically the iwconfig argument
|
||||||
|
# without the iwconfig $iface.
|
||||||
|
#iwconfig_eth0=""
|
||||||
|
|
||||||
|
# Set private driver ioctls. This is basically the iwpriv argument without
|
||||||
|
# the iwpriv $iface. If you use the rt2500 driver (not the rt2x00 one) then
|
||||||
|
# you can set WPA here, below is an example.
|
||||||
|
#iwpriv_eth0=""
|
||||||
|
#iwpriv_SSID=" \
|
||||||
|
# 'set AuthMode=WPAPSK' \
|
||||||
|
# 'set EncrypType=TKIP' \
|
||||||
|
# 'set WPAPSK=yourpasskey' \
|
||||||
|
#"
|
||||||
|
#NOTE: Even though you can use WPA like so, you may have to set a WEP key
|
||||||
|
#if your driver claims the AP is encrypted. The WEP key itself will not be
|
||||||
|
#used though.
|
||||||
|
|
||||||
|
# Seconds to wait before scanning
|
||||||
|
# Some drivers need to wait until they have finished "loading"
|
||||||
|
# before they can scan - otherwise they error and claim that they cannot scan
|
||||||
|
# or resource is unavailable. The default is to wait zero seconds
|
||||||
|
#sleep_scan_eth0="1"
|
||||||
|
|
||||||
|
# Seconds to wait until associated. The default is to wait 10 seconds.
|
||||||
|
# 0 means wait indefinitely. WARNING: this can cause an infinite delay when
|
||||||
|
# booting.
|
||||||
|
#associate_timeout_eth0="5"
|
||||||
|
|
||||||
|
# By default a successful association in Managed mode sets the MAC
|
||||||
|
# address of the AP connected to. However, some drivers (namely
|
||||||
|
# the ipw2100) don't set an invalid MAC address when association
|
||||||
|
# fails - so we need to check on link quality which some drivers
|
||||||
|
# don't report properly either.
|
||||||
|
# So if you have connection problems try flipping this setting
|
||||||
|
# Valid options are MAC, quality and all - defaults to MAC
|
||||||
|
#associate_test_eth0="MAC"
|
||||||
|
|
||||||
|
# Some driver/card combinations need to scan in Ad-Hoc mode
|
||||||
|
# After scanning, the mode is reset to the one defined above
|
||||||
|
#scan_mode_eth0="Ad-Hoc"
|
||||||
|
|
||||||
|
# Below you can define private ioctls to run before and after scanning
|
||||||
|
# Format is the same as the iwpriv_eth0 above
|
||||||
|
# This is needed for the HostAP drivers
|
||||||
|
#iwpriv_scan_pre_eth0="'host_roaming 2'"
|
||||||
|
#iwpriv_scan_post_eth0="'host_roaming 0'"
|
||||||
|
|
||||||
|
# Define a WEP key per SSID or MAC address (of the AP, not your card)
|
||||||
|
# The encryption type (open or restricted) must match the
|
||||||
|
# encryption type on the Access Point
|
||||||
|
# You can't use "any" for an SSID here
|
||||||
|
#key_SSID="1234-1234-1234-1234-1234-1234-56"
|
||||||
|
# or you can use strings. Passphrase IS NOT supported
|
||||||
|
# To use a string, prefix it with s:
|
||||||
|
# Note - this example also sets the encryption method to open
|
||||||
|
# which is regarded as more secure than restricted
|
||||||
|
#key_SSID="s:foobar enc open"
|
||||||
|
#key_SSID="s:foobar enc restricted"
|
||||||
|
|
||||||
|
# If you have whitespace in your key, here's how to set it and use other
|
||||||
|
# commands like using open encryption.
|
||||||
|
#key_SSID="s:'foo bar' enc open"
|
||||||
|
|
||||||
|
# WEP key for the AP with MAC address 001122334455
|
||||||
|
#mac_key_001122334455="s:foobar"
|
||||||
|
|
||||||
|
# Here are some more examples of keys as some users find others work
|
||||||
|
# and some don't where they should all do the same thing
|
||||||
|
#key_SSID="open s:foobar"
|
||||||
|
#key_SSID="open 1234-5678-9012"
|
||||||
|
#key_SSID="s:foobar enc open"
|
||||||
|
#key_SSID="1234-5678-9012 enc open"
|
||||||
|
|
||||||
|
# You may want to set muliple keys - here's an example
|
||||||
|
# It sets 4 keys on the card and instructs to use key 2 by default
|
||||||
|
#key_SSID="[1] s:passkey1 key [2] s:passkey2 key [3] s:passkey3 key [4] s:passkey4 key [2]"
|
||||||
|
|
||||||
|
# You can also override the interface settings found in /etc/conf.d/net
|
||||||
|
# per SSID - which is very handy if you use different networks a lot
|
||||||
|
#config_SSID="dhcp"
|
||||||
|
#dhcpcd_SSID="-t 5"
|
||||||
|
#routes_SSID=
|
||||||
|
#fallback_SSID=
|
||||||
|
|
||||||
|
# Setting name/domain server causes /etc/resolv.conf to be overwritten
|
||||||
|
# Note that if DHCP is used, and you want this to take precedence then
|
||||||
|
# please put -R in your dhcpcd options
|
||||||
|
#dns_servers_SSID="192.168.0.1 192.168.0.2"
|
||||||
|
#dns_domain_SSID="some.domain"
|
||||||
|
#dns_search_path_SSID="search.this.domain search.that.domain"
|
||||||
|
# Please check the man page for resolv.conf for more information
|
||||||
|
# as domain and search (searchdomains) are mutually exclusive and
|
||||||
|
# searchdomains takes precedence
|
||||||
|
|
||||||
|
# You can also set any of the /etc/conf.d/net variables per MAC address
|
||||||
|
# incase you use Access Points with the same SSID but need different
|
||||||
|
# networking configs. Below is an example - of course you use the same
|
||||||
|
# method with other variables
|
||||||
|
#config_001122334455="dhcp"
|
||||||
|
#dhcpcd_001122334455="-t 10"
|
||||||
|
#dns_servers_001122334455="192.168.0.1 192.168.0.2"
|
||||||
|
|
||||||
|
# Map a MAC address to an SSID
|
||||||
|
# This is used when the Access Point is not broadcasting it's SSID
|
||||||
|
# WARNING: This will override the SSID being broadcast due to some
|
||||||
|
# Access Points sending an SSID even when they have been configured
|
||||||
|
# not to!
|
||||||
|
# Change 001122334455 to the MAC address and SSID to the SSID
|
||||||
|
# it should map to
|
||||||
|
#mac_essid_001122334455="SSID"
|
||||||
|
|
||||||
|
# This lists the preferred SSIDs to connect to in order
|
||||||
|
# SSID's can contain any characters here as they must match the broadcast
|
||||||
|
# SSID exactly.
|
||||||
|
# Surround each SSID with the " character and seperate them with a space
|
||||||
|
# If the first SSID isn't found then it moves onto the next
|
||||||
|
# If this isn't defined then it connects to the first one found
|
||||||
|
#preferred_aps="'SSID 1' 'SSID 2'"
|
||||||
|
|
||||||
|
# You can also define a preferred_aps list per interface
|
||||||
|
#preferred_aps_eth0="'SSID 3' 'SSID 4'"
|
||||||
|
|
||||||
|
# You can also say whether we only connect to preferred APs or not
|
||||||
|
# Values are "any", "preferredonly", "forcepreferred", "forcepreferredonly" and "forceany"
|
||||||
|
# "any" means it will connect to visible APs in the preferred list and then any
|
||||||
|
# other available AP
|
||||||
|
# "preferredonly" means it will only connect to visible APs in the preferred list
|
||||||
|
# "forcepreferred" means it will forceably connect to APs in order if it does not find
|
||||||
|
# them in a scan
|
||||||
|
# "forcepreferredonly" means it forceably connects to the APs in order and does not bother
|
||||||
|
# to scan
|
||||||
|
# "forceany" does the same as forcepreferred + connects to any other available AP
|
||||||
|
# Default is "any"
|
||||||
|
#associate_order="any"
|
||||||
|
#associate_order_eth0="any"
|
||||||
|
|
||||||
|
# You can define blacklisted Access Points in the same way
|
||||||
|
#blacklist_aps="'SSID 1' 'SSID 2'"
|
||||||
|
#blacklist_aps_eth0="'SSID 3' 'SSID 4'"
|
||||||
|
|
||||||
|
# If you have more than one wireless card, you can say if you want
|
||||||
|
# to allow each card to associate with the same Access Point or not
|
||||||
|
# Values are "yes" and "no"
|
||||||
|
# Default is "yes"
|
||||||
|
#unique_ap="yes"
|
||||||
|
#unique_ap_eth0="yes"
|
||||||
|
|
||||||
|
# IMPORTANT: preferred_only, blacklisted_aps and unique_ap only work when
|
||||||
|
# essid_eth0 is not set and your card is capable of scanning
|
||||||
|
|
||||||
|
# NOTE: preferred_aps list ignores blacklisted_aps - so if you have
|
||||||
|
# the same SSID in both, well, you're a bit silly :p
|
||||||
|
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
# ADVANCED CONFIGURATION
|
||||||
|
#
|
||||||
|
# Two functions can be defined which will be called surrounding the
|
||||||
|
# associate function. The functions are called with the interface
|
||||||
|
# name first so that one function can control multiple adapters.
|
||||||
|
#
|
||||||
|
# The return values for the preassociate function should be 0
|
||||||
|
# (success) to indicate that configuration or deconfiguration of the
|
||||||
|
# interface can continue. If preassociate returns a non-zero value, then
|
||||||
|
# interface configuration will be aborted.
|
||||||
|
#
|
||||||
|
# The return value for the postassociate function is ignored
|
||||||
|
# since there's nothing to do if it indicates failure.
|
||||||
|
|
||||||
|
#preassociate() {
|
||||||
|
# # The below adds two configuration variables leap_user_SSID
|
||||||
|
# # and leap_pass_SSID. When they are both confiugred for the SSID
|
||||||
|
# # being connected to then we run the CISCO LEAP script
|
||||||
|
#
|
||||||
|
# local user pass
|
||||||
|
# eval user=\"\$\{leap_user_${SSIDVAR}\}\"
|
||||||
|
# eval pass=\"\$\{leap_pass_${SSIDVAR}\}\"
|
||||||
|
#
|
||||||
|
# if [ -n "${user}" -a -n "${pass}" ]; then
|
||||||
|
# if [ ! -x /opt/cisco/bin/leapscript ]; then
|
||||||
|
# eend "For LEAP support, please emerge net-misc/cisco-aironet-client-utils"
|
||||||
|
# return 1
|
||||||
|
# fi
|
||||||
|
# einfo "Waiting for LEAP Authentication on \"${SSID//\\\\//}\""
|
||||||
|
# if /opt/cisco/bin/leapscript ${user} ${pass} | grep -q 'Login incorrect'; then
|
||||||
|
# ewarn "Login Failed for ${user}"
|
||||||
|
# return 1
|
||||||
|
# fi
|
||||||
|
# fi
|
||||||
|
#
|
||||||
|
# return 0
|
||||||
|
#}
|
||||||
|
|
||||||
|
#postassociate() {
|
||||||
|
# # This function is mostly here for completeness... I haven't
|
||||||
|
# # thought of anything nifty to do with it yet ;-)
|
||||||
|
# # Return 0 always
|
||||||
|
# return 0
|
||||||
|
#}
|
6
conf.d/Makefile
Normal file
6
conf.d/Makefile
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
DIR = /etc/conf.d
|
||||||
|
FILES_NOEXIST = bootmisc checkfs clock env_whitelist hostname \
|
||||||
|
local.start local.stop net rc
|
||||||
|
|
||||||
|
TOPDIR = ..
|
||||||
|
include $(TOPDIR)/default.mk
|
12
conf.d/bootmisc
Normal file
12
conf.d/bootmisc
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
# /etc/conf.d/bootmisc
|
||||||
|
|
||||||
|
# Put a nologin file in /etc to prevent people from logging in before
|
||||||
|
# system startup is complete
|
||||||
|
|
||||||
|
DELAYLOGIN="no"
|
||||||
|
|
||||||
|
|
||||||
|
# Should we completely wipe out /tmp or just selectively remove known
|
||||||
|
# locks / files / etc... ?
|
||||||
|
|
||||||
|
WIPE_TMP="yes"
|
8
conf.d/checkfs
Normal file
8
conf.d/checkfs
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
# FSCK_SHUTDOWN causes checkfs to trigger during shutdown as well as startup.
|
||||||
|
# The end result of this is that if any periodic non-root filesystem checks are
|
||||||
|
# scheduled, under normal circumstances the actual check will happen during
|
||||||
|
# shutdown rather than at next boot.
|
||||||
|
# This is useful when periodic filesystem checks are causing undesirable
|
||||||
|
# delays at startup, but such delays at shutdown are acceptable.
|
||||||
|
|
||||||
|
FSCK_SHUTDOWN="no"
|
16
conf.d/clock
Normal file
16
conf.d/clock
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
# /etc/conf.d/clock
|
||||||
|
|
||||||
|
# Set CLOCK to "UTC" if your system clock is set to UTC (also known as
|
||||||
|
# Greenwich Mean Time). If your clock is set to the local time, then
|
||||||
|
# set CLOCK to "local". Note that if you dual boot with Windows, then
|
||||||
|
# you should set it to "local".
|
||||||
|
|
||||||
|
CLOCK="UTC"
|
||||||
|
|
||||||
|
# Select the proper timezone. For valid values, peek inside of the
|
||||||
|
# /usr/share/zoneinfo/ directory. For example, some common values are
|
||||||
|
# "America/New_York" or "EST5EDT" or "Europe/Berlin". If you want to
|
||||||
|
# manage /etc/localtime yourself, set this to "".
|
||||||
|
|
||||||
|
#TIMEZONE="Factory"
|
||||||
|
|
6
conf.d/env_whitelist
Normal file
6
conf.d/env_whitelist
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
# /etc/conf.d/env_whitelist: Environment whitelist for rc-system
|
||||||
|
|
||||||
|
# Specify which variables are allowed to be passed from the environment to the
|
||||||
|
# rc-system. If it is not set by the environment, then the variable will be
|
||||||
|
# taken from /etc/profile.env - meaning, if you need to set LANG or such,
|
||||||
|
# do it in a /etc/env.d/99myownstuff file for example, and run env-update.
|
4
conf.d/hostname
Normal file
4
conf.d/hostname
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
# /etc/conf.d/hostname
|
||||||
|
|
||||||
|
# Set to the hostname of this machine
|
||||||
|
HOSTNAME="localhost"
|
5
conf.d/local.start
Normal file
5
conf.d/local.start
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
# /etc/conf.d/local.start
|
||||||
|
|
||||||
|
# This is a good place to load any misc programs
|
||||||
|
# on startup (use &>/dev/null to hide output)
|
||||||
|
|
8
conf.d/local.stop
Normal file
8
conf.d/local.stop
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
# /etc/conf.d/local.stop
|
||||||
|
|
||||||
|
# This is a good place to unload any misc.
|
||||||
|
# programs you started above.
|
||||||
|
# For example, if you are using OSS and have
|
||||||
|
# "/usr/local/bin/soundon" above, put
|
||||||
|
# "/usr/local/bin/soundoff" here.
|
||||||
|
|
4
conf.d/net
Normal file
4
conf.d/net
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
# This blank configuration will automatically use DHCP for any net.*
|
||||||
|
# scripts in /etc/init.d. To create a more complete configuration,
|
||||||
|
# please review /etc/conf.d/net.example and save your configuration
|
||||||
|
# in /etc/conf.d/net (this file :]!).
|
87
conf.d/rc
Normal file
87
conf.d/rc
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
# /etc/conf.d/rc: Global config file for the Gentoo RC System
|
||||||
|
|
||||||
|
# Set to "yes" if you want the rc system to try and start services
|
||||||
|
# in parallel for a slight speed improvement. NOTE: When enabled
|
||||||
|
# init script output is buffered and displayed in one go when finished.
|
||||||
|
RC_PARALLEL_STARTUP="no"
|
||||||
|
|
||||||
|
# Set RC_INTERACTIVE to "yes" and you'll be able to press the I key during
|
||||||
|
# boot so you can choose to start specific services. Set to "no" to disable
|
||||||
|
# this feature.
|
||||||
|
RC_INTERACTIVE="yes"
|
||||||
|
|
||||||
|
# RC_VERBOSE will make init scripts more verbose and adds
|
||||||
|
# "Service FOO starting/started/stopping/stopped" messages around each
|
||||||
|
# init script.
|
||||||
|
RC_VERBOSE="no"
|
||||||
|
|
||||||
|
# RC_QUIET on the other hand will make init scripts quiet and produce no
|
||||||
|
# output.
|
||||||
|
RC_QUIET="no"
|
||||||
|
|
||||||
|
|
||||||
|
# Do we allow any started service in the runlevel to satisfy the depedency
|
||||||
|
# or do we want all of them regardless of state? For example, if net.eth0
|
||||||
|
# and net.eth0 are in the default runlevel then with RC_STRICT_DEPEND="no"
|
||||||
|
# both will be started, but services that depend on 'net' will work if either
|
||||||
|
# one comes up. With RC_STRICT_DEPEND="yes" we would require them both to
|
||||||
|
# come up.
|
||||||
|
RC_STRICT_DEPEND="no"
|
||||||
|
|
||||||
|
# Do we allow services to be hotplugged? If not, set to RC_HOTPLUG="no"
|
||||||
|
# NOTE: This does not affect anything hotplug/udev/devd related, just the
|
||||||
|
# starting/stopping of the init.d service triggered by it.
|
||||||
|
RC_HOTPLUG="yes"
|
||||||
|
|
||||||
|
# Dynamic /dev managers can trigger coldplug events which cause services to
|
||||||
|
# start before we are ready for them. If this happens, we can defer these
|
||||||
|
# services to start in the boot runlevel. Set RC_COLDPLUG="no" if you don't
|
||||||
|
# want this.
|
||||||
|
# NOTE: This also affects module coldplugging in udev-096 and higher
|
||||||
|
# If you want module coldplugging but not coldplugging of services then you
|
||||||
|
# can set RC_COLDPLUG="yes" and RC_PLUG_SERVICES="!*"
|
||||||
|
RC_COLDPLUG="yes"
|
||||||
|
|
||||||
|
# Some people want a finer grain over hotplug/coldplug. RC_PLUG_SERVICES is a
|
||||||
|
# list of services that are matched in order, either allowing or not. By
|
||||||
|
# default we allow services through as RC_COLDPLUG/RC_HOTPLUG has to be yes
|
||||||
|
# anyway.
|
||||||
|
# Example - RC_PLUG_SERVICES="net.wlan !net.*"
|
||||||
|
# This allows net.wlan and any service not matching net.* to be plugged.
|
||||||
|
RC_PLUG_SERVICES=""
|
||||||
|
|
||||||
|
# Define network fstypes. Below is the default.
|
||||||
|
#RC_NET_FS_LIST="afs cifs coda davfs fuse gfs ncpfs nfs nfs4 ocfs2 shfs smbfs"
|
||||||
|
|
||||||
|
# RC_FORCE_AUTO tries its best to prevent user interaction during the boot and
|
||||||
|
# shutdown process. For example, fsck will automatically be run or volumes
|
||||||
|
# remounted to create proper directory trees. This feature can be dangerous
|
||||||
|
# and is meant ONLY for headless machines where getting a physical console
|
||||||
|
# hooked up is a huge pita.
|
||||||
|
RC_FORCE_AUTO="no"
|
||||||
|
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
# SERVICE CONFIGURATION VARIABLES
|
||||||
|
# These variables are documented here, but should be configured in
|
||||||
|
# /etc/conf.d/foo for service foo and NOT enabled here unless you
|
||||||
|
# really want them to work on a global basis.
|
||||||
|
|
||||||
|
# Some daemons are started and stopped via start-stop-daemon.
|
||||||
|
# We can launch them through other daemons here, for example valgrind.
|
||||||
|
# This is only useful for serious debugging of the daemon
|
||||||
|
# WARNING: If the script's "stop" function does not supply a PID file then
|
||||||
|
# all processes using the same daemon will be killed.
|
||||||
|
#RC_DAEMON="/usr/bin/valgrind --tool=memcheck --log-file=/tmp/valgrind.syslog-ng"
|
||||||
|
|
||||||
|
# strace needs to be prefixed with --background as it does not detach when
|
||||||
|
# it's following
|
||||||
|
#RC_DAEMON="--background /usr/sbin/strace -f -o /tmp/strace.syslog-ng"
|
||||||
|
|
||||||
|
# Pass ulimit parameters
|
||||||
|
#RC_ULIMIT="-u 30"
|
||||||
|
|
||||||
|
# It's possible to define extra dependencies for services like so
|
||||||
|
#RC_NEED="openvpn"
|
||||||
|
#RC_USE="net.eth0"
|
||||||
|
|
54
default.mk
Normal file
54
default.mk
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
# Common makefile settings
|
||||||
|
# Copyright 2006-2007 Gentoo Foundation
|
||||||
|
|
||||||
|
DESTDIR = /
|
||||||
|
ROOT = /
|
||||||
|
LIB = lib
|
||||||
|
|
||||||
|
#
|
||||||
|
# Recursive rules
|
||||||
|
#
|
||||||
|
|
||||||
|
SUBDIRS_ALL = $(patsubst %,%_all,$(SUBDIRS))
|
||||||
|
SUBDIRS_CLEAN = $(patsubst %,%_clean,$(SUBDIRS))
|
||||||
|
SUBDIRS_INSTALL = $(patsubst %,%_install,$(SUBDIRS))
|
||||||
|
|
||||||
|
all:: $(SUBDIRS_ALL)
|
||||||
|
clean:: $(SUBDIRS_CLEAN)
|
||||||
|
install:: $(SUBDIRS_INSTALL)
|
||||||
|
|
||||||
|
# Hmm ... possible to combine these three and not be ugly ?
|
||||||
|
%_all:
|
||||||
|
$(MAKE) -C $(patsubst %_all,%,$@) all
|
||||||
|
if test -d $(patsubst %_all,%,$@).$(OS) ; then $(MAKE) -C $(patsubst %_all,%,$@).$(OS) all ; fi
|
||||||
|
%_clean:
|
||||||
|
$(MAKE) -C $(patsubst %_clean,%,$@) clean
|
||||||
|
if test -d $(patsubst %_clean,%,$@).$(OS) ; then $(MAKE) -C $(patsubst %_clean,%,$@).$(OS) clean ; fi
|
||||||
|
%_install:
|
||||||
|
$(MAKE) -C $(patsubst %_install,%,$@) install
|
||||||
|
if test -d $(patsubst %_install,%,$@).$(OS) ; then $(MAKE) -C $(patsubst %_install,%,$@).$(OS) install ; fi
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Install rules
|
||||||
|
#
|
||||||
|
|
||||||
|
INSTALL_DIR = install -m 0755 -d
|
||||||
|
INSTALL_EXE = install -m 0755
|
||||||
|
INSTALL_FILE = install -m 0644
|
||||||
|
INSTALL_SECURE = install -m 0600
|
||||||
|
|
||||||
|
install:: $(EXES) $(FILES) $(FILES_NOEXIST) $(MANS)
|
||||||
|
test -n $(DIR) && $(INSTALL_DIR) $(DESTDIR)$(DIR)
|
||||||
|
for x in $(EXES) ; do $(INSTALL_EXE) $$x $(DESTDIR)$(DIR) || exit $$? ; done
|
||||||
|
for x in $(FILES) ; do $(INSTALL_FILE) $$x $(DESTDIR)$(DIR) || exit $$? ; done
|
||||||
|
for x in $(FILES_APPEND) ; do if test -e $(DESTDIR)$(DIR)/$$x ; then cat $$x >> $(DESTDIR)$(DIR)/$$x || exit $$? ; else $(INSTALL_FILE) $$x $(DESTDIR)$(DIR) || exit $$? ; fi ; done
|
||||||
|
for x in $(FILES_NOEXIST) ; do if ! test -e $(DESTDIR)$(DIR)/$$x ; then $(INSTALL_FILE) $$x $(DESTDIR)$(DIR) || exit $$? ; fi ; done
|
||||||
|
for x in $(FILES_SECURE) ; do $(INSTALL_SECURE) $$x $(DESTDIR)$(DIR) || exit $$? ; done
|
||||||
|
for x in $(MANS) ; do \
|
||||||
|
ext=`echo $$x | sed -e 's/^.*\\.//'` ; \
|
||||||
|
$(INSTALL_DIR) $(DESTDIR)$(DIR)/man$$ext || exit $$? ; \
|
||||||
|
$(INSTALL_FILE) $$x $(DESTDIR)$(DIR)/man$$ext || exit $$? ; \
|
||||||
|
done
|
||||||
|
|
||||||
|
.PHONY: all clean install
|
2
etc.BSD/COPYRIGHT
Normal file
2
etc.BSD/COPYRIGHT
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
Copyright 1996-2007 Gentoo Foundation
|
||||||
|
Copyright 1992-2007 The FreeBSD Project
|
5
etc.BSD/Makefile
Normal file
5
etc.BSD/Makefile
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
DIR = /etc
|
||||||
|
FILES = COPYRIGHT issue issue.logo login.conf rc rc.shutdown
|
||||||
|
|
||||||
|
TOPDIR = ..
|
||||||
|
include $(TOPDIR)/default.mk
|
3
etc.BSD/issue
Normal file
3
etc.BSD/issue
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
|
||||||
|
This is %h (%s %m %r) %d
|
||||||
|
|
13
etc.BSD/issue.logo
Normal file
13
etc.BSD/issue.logo
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
[0;35;40m .
|
||||||
|
[0;35;40m .vir. d$b
|
||||||
|
[0;35;40m .d$$$$$$b. .cd$$b. .d$$b. d$$$$$$$$$$$b .d$$b. .d$$b.
|
||||||
|
[0;35;40m $$$$( )$$$b d$$$()$$$. d$$$$$$$b Q$$$$$$$P$$$P.$$$$$$$b. .$$$$$$$b.
|
||||||
|
[0;35;40m Q$$$$$$$$$$B$$$$$$$$P" d$$$PQ$$$$b. $$$$. .$$$P' `$$$ .$$$P' `$$$
|
||||||
|
[0;35;40m "$$$$$$$P Q$$$$$$$b d$$$P Q$$$$b $$$$b $$$$b..d$$$ $$$$b..d$$$
|
||||||
|
[0;35;40m d$$$$$$P" "$$$$$$$$ Q$$$ Q$$$$ $$$$$ `Q$$$$$$$P `Q$$$$$$$P
|
||||||
|
[0;35;40m $$$$$$$P `""""" "" "" Q$$$P "Q$$$P" "Q$$$P"
|
||||||
|
[0;35;40m `Q$$P" """
|
||||||
|
[0;37;40m
|
||||||
|
|
||||||
|
This is %h (%s %m %r) %d
|
||||||
|
|
65
etc.BSD/login.conf
Normal file
65
etc.BSD/login.conf
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
# login.conf - login class capabilities database.
|
||||||
|
#
|
||||||
|
# Remember to rebuild the database after each change to this file:
|
||||||
|
#
|
||||||
|
# cap_mkdb /etc/login.conf
|
||||||
|
#
|
||||||
|
# This file controls resource limits, accounting limits and
|
||||||
|
# default user environment settings.
|
||||||
|
|
||||||
|
# defaults
|
||||||
|
# These settings are used by login(1) by default for classless users
|
||||||
|
# Note that entries like "cputime" set both "cputime-cur" and "cputime-max"
|
||||||
|
|
||||||
|
default:\
|
||||||
|
:passwd_format=md5:\
|
||||||
|
:copyright=/etc/COPYRIGHT:\
|
||||||
|
:welcome=/etc/motd:\
|
||||||
|
:setenv=FTP_PASSIVE_MODE=YES:\
|
||||||
|
:path=/sbin /bin /usr/sbin /usr/bin /usr/local/sbin /usr/local/bin ~/bin:\
|
||||||
|
:nologin=/etc/nologin:\
|
||||||
|
:cputime=unlimited:\
|
||||||
|
:datasize=unlimited:\
|
||||||
|
:stacksize=unlimited:\
|
||||||
|
:memorylocked=unlimited:\
|
||||||
|
:memoryuse=unlimited:\
|
||||||
|
:filesize=unlimited:\
|
||||||
|
:coredumpsize=unlimited:\
|
||||||
|
:openfiles=unlimited:\
|
||||||
|
:maxproc=unlimited:\
|
||||||
|
:sbsize=unlimited:\
|
||||||
|
:vmemoryuse=unlimited:\
|
||||||
|
:priority=0:\
|
||||||
|
:ignoretime@:\
|
||||||
|
:umask=022:
|
||||||
|
|
||||||
|
#
|
||||||
|
# Root can always login
|
||||||
|
#
|
||||||
|
# N.B. login_getpwclass(3) will use this entry for the root account,
|
||||||
|
# in preference to 'default'.
|
||||||
|
root:\
|
||||||
|
:ignorenologin:\
|
||||||
|
:tc=default:
|
||||||
|
|
||||||
|
#
|
||||||
|
# A collection of common class names - forward them all to 'default'
|
||||||
|
# (login would normally do this anyway, but having a class name
|
||||||
|
# here suppresses the diagnostic)
|
||||||
|
#
|
||||||
|
standard:\
|
||||||
|
:tc=default:
|
||||||
|
xuser:\
|
||||||
|
:tc=default:
|
||||||
|
daemon:\
|
||||||
|
:tc=default:
|
||||||
|
news:\
|
||||||
|
:tc=default:
|
||||||
|
|
||||||
|
#
|
||||||
|
# Russian Users Accounts. Setup proper environment variables.
|
||||||
|
#
|
||||||
|
#russian|Russian Users Accounts:\
|
||||||
|
# :charset=KOI8-R:\
|
||||||
|
# :lang=ru_RU.KOI8-R:\
|
||||||
|
# :tc=default:
|
14
etc.BSD/rc
Normal file
14
etc.BSD/rc
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# Copyright 2006-2007 Gentoo Foundation
|
||||||
|
# Distributed under the terms of the GNU General Public License v2
|
||||||
|
|
||||||
|
# Ensure we are called by init
|
||||||
|
[ "$PPID" = "1" ] || exit 0
|
||||||
|
|
||||||
|
# BSD's init works somewhat differently to sysvinit.
|
||||||
|
# This block should 'translate' from the way init calls it to the way it would
|
||||||
|
# be called by sysvinit on linux.
|
||||||
|
|
||||||
|
RUNLEVEL="1" /sbin/rc sysinit || exit 1
|
||||||
|
RUNLEVEL="1" /sbin/rc boot || exit 1
|
||||||
|
/sbin/rc default || exit 1
|
17
etc.BSD/rc.shutdown
Normal file
17
etc.BSD/rc.shutdown
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# Copyright 2006-2007 Gentoo Foundation
|
||||||
|
# Distributed under the terms of the GNU General Public License v2
|
||||||
|
|
||||||
|
# Ensure we are called by init
|
||||||
|
[ "$PPID" = "1" ] || exit 0
|
||||||
|
|
||||||
|
# Try and use stuff in /lib over anywhere else so we can shutdown
|
||||||
|
# local mounts correctly.
|
||||||
|
LD_LIBRARY_PATH="/lib${LD_LIBRARY_PATH:+:}${LDLIBRARY_PATH}"
|
||||||
|
export LD_LIBRARY_PATH
|
||||||
|
|
||||||
|
# BSD's init works somewhat differently to sysvinit.
|
||||||
|
# This block should 'translate' from the way init calls it to the way it would
|
||||||
|
# be called by sysvinit on linux.
|
||||||
|
export RUNLEVEL=S
|
||||||
|
exec /sbin/rc "$1"
|
7
etc.Linux/Makefile
Normal file
7
etc.Linux/Makefile
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
SUBDIRS = modules.d modules.autoload.d
|
||||||
|
DIR = /etc
|
||||||
|
FILES = filesystems inputrc issue issue.logo
|
||||||
|
FILES_NOEXIST = sysctl.conf
|
||||||
|
|
||||||
|
TOPDIR = ..
|
||||||
|
include $(TOPDIR)/default.mk
|
14
etc.Linux/filesystems
Normal file
14
etc.Linux/filesystems
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
# /etc/filesystems
|
||||||
|
#
|
||||||
|
# This file defines the filesystems search order used by a
|
||||||
|
# 'mount -t auto' command.
|
||||||
|
#
|
||||||
|
|
||||||
|
# Uncomment the following line if your modular kernel has vfat
|
||||||
|
# support and you want mount to try vfat.
|
||||||
|
#vfat
|
||||||
|
|
||||||
|
# Keep the last '*' intact as it directs mount to use the
|
||||||
|
# filesystems list available at /proc/filesystems also.
|
||||||
|
# Don't remove it unless you REALLY know what you are doing!
|
||||||
|
*
|
67
etc.Linux/inputrc
Normal file
67
etc.Linux/inputrc
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
# /etc/inputrc: initialization file for readline
|
||||||
|
#
|
||||||
|
# For more information on how this file works, please see the
|
||||||
|
# INITIALIZATION FILE section of the readline(3) man page
|
||||||
|
#
|
||||||
|
# Quick dirty little note:
|
||||||
|
# To get the key sequence for binding, you can abuse bash.
|
||||||
|
# While running bash, hit CTRL+V, and then type the key sequence.
|
||||||
|
# So, typing 'ALT + left arrow' in Konsole gets you back:
|
||||||
|
# ^[[1;3D
|
||||||
|
# The readline entry to make this skip back a word will then be:
|
||||||
|
# "\e[1;3D" backward-word
|
||||||
|
#
|
||||||
|
|
||||||
|
# do not bell on tab-completion
|
||||||
|
#set bell-style none
|
||||||
|
|
||||||
|
set meta-flag on
|
||||||
|
set input-meta on
|
||||||
|
set convert-meta off
|
||||||
|
set output-meta on
|
||||||
|
|
||||||
|
# Completed names which are symbolic links to
|
||||||
|
# directories have a slash appended.
|
||||||
|
set mark-symlinked-directories on
|
||||||
|
|
||||||
|
$if mode=emacs
|
||||||
|
|
||||||
|
# for linux console and RH/Debian xterm
|
||||||
|
"\e[1~": beginning-of-line
|
||||||
|
"\e[4~": end-of-line
|
||||||
|
#"\e[5~": beginning-of-history
|
||||||
|
#"\e[6~": end-of-history
|
||||||
|
"\e[5~": history-search-backward
|
||||||
|
"\e[6~": history-search-forward
|
||||||
|
"\e[3~": delete-char
|
||||||
|
"\e[2~": quoted-insert
|
||||||
|
|
||||||
|
# gnome-terminal (escape + arrow key)
|
||||||
|
"\e[5C": forward-word
|
||||||
|
"\e[5D": backward-word
|
||||||
|
# konsole / xterm / rxvt (escape + arrow key)
|
||||||
|
"\e\e[C": forward-word
|
||||||
|
"\e\e[D": backward-word
|
||||||
|
# konsole (alt + arrow key)
|
||||||
|
"\e[1;3C": forward-word
|
||||||
|
"\e[1;3D": backward-word
|
||||||
|
# aterm / eterm (control + arrow key)
|
||||||
|
"\eOc": forward-word
|
||||||
|
"\eOd": backward-word
|
||||||
|
|
||||||
|
$if term=rxvt
|
||||||
|
"\e[8~": end-of-line
|
||||||
|
$endif
|
||||||
|
|
||||||
|
# for non RH/Debian xterm, can't hurt for RH/Debian xterm
|
||||||
|
"\eOH": beginning-of-line
|
||||||
|
"\eOF": end-of-line
|
||||||
|
|
||||||
|
# for freebsd console
|
||||||
|
"\e[H": beginning-of-line
|
||||||
|
"\e[F": end-of-line
|
||||||
|
$endif
|
||||||
|
|
||||||
|
# fix Home and End for German users
|
||||||
|
"\e[7~": beginning-of-line
|
||||||
|
"\e[8~": end-of-line
|
3
etc.Linux/issue
Normal file
3
etc.Linux/issue
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
|
||||||
|
This is \n.\O (\s \m \r) \t
|
||||||
|
|
13
etc.Linux/issue.logo
Normal file
13
etc.Linux/issue.logo
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
[0;35;40m .
|
||||||
|
[0;35;40m .vir. d$b
|
||||||
|
[0;35;40m .d$$$$$$b. .cd$$b. .d$$b. d$$$$$$$$$$$b .d$$b. .d$$b.
|
||||||
|
[0;35;40m $$$$( )$$$b d$$$()$$$. d$$$$$$$b Q$$$$$$$P$$$P.$$$$$$$b. .$$$$$$$b.
|
||||||
|
[0;35;40m Q$$$$$$$$$$B$$$$$$$$P" d$$$PQ$$$$b. $$$$. .$$$P' `$$$ .$$$P' `$$$
|
||||||
|
[0;35;40m "$$$$$$$P Q$$$$$$$b d$$$P Q$$$$b $$$$b $$$$b..d$$$ $$$$b..d$$$
|
||||||
|
[0;35;40m d$$$$$$P" "$$$$$$$$ Q$$$ Q$$$$ $$$$$ `Q$$$$$$$P `Q$$$$$$$P
|
||||||
|
[0;35;40m $$$$$$$P `""""" "" "" Q$$$P "Q$$$P" "Q$$$P"
|
||||||
|
[0;35;40m `Q$$P" """
|
||||||
|
[0;37;40m
|
||||||
|
|
||||||
|
This is \n.\O (\s \m \r) \t
|
||||||
|
|
5
etc.Linux/modules.autoload.d/Makefile
Normal file
5
etc.Linux/modules.autoload.d/Makefile
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
DIR = /etc/modules.autoload.d
|
||||||
|
FILES_NOEXIST = kernel-2.4 kernel-2.6
|
||||||
|
|
||||||
|
TOPDIR = ../..
|
||||||
|
include $(TOPDIR)/default.mk
|
11
etc.Linux/modules.autoload.d/kernel-2.4
Normal file
11
etc.Linux/modules.autoload.d/kernel-2.4
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
# /etc/modules.autoload.d/kernel-2.4: kernel modules to load when system boots.
|
||||||
|
#
|
||||||
|
# Note that this file is for 2.4 kernels. If you need different modules
|
||||||
|
# for a 2.6 kernel, you can create /etc/modules.autoload.d/kernel-2.6
|
||||||
|
#
|
||||||
|
# Add the names of modules that you'd like to load when the system
|
||||||
|
# starts into this file, one per line. Comments begin with # and
|
||||||
|
# are ignored. Read man modules.autoload for additional details.
|
||||||
|
|
||||||
|
# For example:
|
||||||
|
# aic7xxx
|
10
etc.Linux/modules.autoload.d/kernel-2.6
Normal file
10
etc.Linux/modules.autoload.d/kernel-2.6
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
# /etc/modules.autoload.d/kernel-2.6: kernel modules to load when system boots.
|
||||||
|
#
|
||||||
|
# Note that this file is for 2.6 kernels.
|
||||||
|
#
|
||||||
|
# Add the names of modules that you'd like to load when the system
|
||||||
|
# starts into this file, one per line. Comments begin with # and
|
||||||
|
# are ignored. Read man modules.autoload for additional details.
|
||||||
|
|
||||||
|
# For example:
|
||||||
|
# aic7xxx
|
5
etc.Linux/modules.d/Makefile
Normal file
5
etc.Linux/modules.d/Makefile
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
DIR = /etc/modules.d
|
||||||
|
FILES_NOEXIST = aliases i386
|
||||||
|
|
||||||
|
TOPDIR = ../..
|
||||||
|
include $(TOPDIR)/default.mk
|
42
etc.Linux/modules.d/aliases
Normal file
42
etc.Linux/modules.d/aliases
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
# Aliases to tell insmod/modprobe which modules to use
|
||||||
|
|
||||||
|
# Uncomment the network protocols you don't want loaded:
|
||||||
|
# alias net-pf-1 off # Unix
|
||||||
|
# alias net-pf-2 off # IPv4
|
||||||
|
# alias net-pf-3 off # Amateur Radio AX.25
|
||||||
|
# alias net-pf-4 off # IPX
|
||||||
|
# alias net-pf-5 off # DDP / appletalk
|
||||||
|
# alias net-pf-6 off # Amateur Radio NET/ROM
|
||||||
|
# alias net-pf-9 off # X.25
|
||||||
|
# alias net-pf-10 off # IPv6
|
||||||
|
# alias net-pf-11 off # ROSE / Amateur Radio X.25 PLP
|
||||||
|
# alias net-pf-19 off # Acorn Econet
|
||||||
|
|
||||||
|
alias char-major-10-175 agpgart
|
||||||
|
alias char-major-10-200 tun
|
||||||
|
alias char-major-81 bttv
|
||||||
|
alias char-major-108 ppp_generic
|
||||||
|
alias /dev/ppp ppp_generic
|
||||||
|
alias tty-ldisc-3 ppp_async
|
||||||
|
alias tty-ldisc-14 ppp_synctty
|
||||||
|
alias ppp-compress-21 bsd_comp
|
||||||
|
alias ppp-compress-24 ppp_deflate
|
||||||
|
alias ppp-compress-26 ppp_deflate
|
||||||
|
|
||||||
|
# Crypto modules (see http://www.kerneli.org/)
|
||||||
|
alias loop-xfer-gen-0 loop_gen
|
||||||
|
alias loop-xfer-3 loop_fish2
|
||||||
|
alias loop-xfer-gen-10 loop_gen
|
||||||
|
alias cipher-2 des
|
||||||
|
alias cipher-3 fish2
|
||||||
|
alias cipher-4 blowfish
|
||||||
|
alias cipher-6 idea
|
||||||
|
alias cipher-7 serp6f
|
||||||
|
alias cipher-8 mars6
|
||||||
|
alias cipher-11 rc62
|
||||||
|
alias cipher-15 dfc2
|
||||||
|
alias cipher-16 rijndael
|
||||||
|
alias cipher-17 rc5
|
||||||
|
|
||||||
|
# Support for i2c and lm_sensors
|
||||||
|
alias char-major-89 i2c-dev
|
4
etc.Linux/modules.d/i386
Normal file
4
etc.Linux/modules.d/i386
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
alias parport_lowlevel parport_pc
|
||||||
|
alias char-major-10-144 nvram
|
||||||
|
alias binfmt-0064 binfmt_aout
|
||||||
|
alias char-major-10-135 rtc
|
54
etc.Linux/sysctl.conf
Normal file
54
etc.Linux/sysctl.conf
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
# /etc/sysctl.conf
|
||||||
|
#
|
||||||
|
# For more information on how this file works, please see
|
||||||
|
# the manpages sysctl(8) and sysctl.conf(5).
|
||||||
|
#
|
||||||
|
# In order for this file to work properly, you must first
|
||||||
|
# enable 'Sysctl support' in the kernel.
|
||||||
|
#
|
||||||
|
# Look in /proc/sys/ for all the things you can setup.
|
||||||
|
#
|
||||||
|
|
||||||
|
# Disables packet forwarding
|
||||||
|
#net.ipv4.ip_forward = 0
|
||||||
|
# Disables IP dynaddr
|
||||||
|
#net.ipv4.ip_dynaddr = 0
|
||||||
|
# Disable ECN
|
||||||
|
#net.ipv4.tcp_ecn = 0
|
||||||
|
# Enables source route verification
|
||||||
|
net.ipv4.conf.default.rp_filter = 1
|
||||||
|
# Enable reverse path
|
||||||
|
net.ipv4.conf.all.rp_filter = 1
|
||||||
|
|
||||||
|
# Enable SYN cookies (yum!)
|
||||||
|
# http://cr.yp.to/syncookies.html
|
||||||
|
#net.ipv4.tcp_syncookies = 1
|
||||||
|
|
||||||
|
# Disable source route
|
||||||
|
#net.ipv4.conf.all.accept_source_route = 0
|
||||||
|
#net.ipv4.conf.default.accept_source_route = 0
|
||||||
|
|
||||||
|
# Disable redirects
|
||||||
|
#net.ipv4.conf.all.accept_redirects = 0
|
||||||
|
#net.ipv4.conf.default.accept_redirects = 0
|
||||||
|
|
||||||
|
# Disable secure redirects
|
||||||
|
#net.ipv4.conf.all.secure_redirects = 0
|
||||||
|
#net.ipv4.conf.default.secure_redirects = 0
|
||||||
|
|
||||||
|
# Ignore ICMP broadcasts
|
||||||
|
#net.ipv4.icmp_echo_ignore_broadcasts = 1
|
||||||
|
|
||||||
|
# Disables the magic-sysrq key
|
||||||
|
#kernel.sysrq = 0
|
||||||
|
# When the kernel panics, automatically reboot in 3 seconds
|
||||||
|
#kernel.panic = 3
|
||||||
|
# Allow for more PIDs (cool factor!); may break some programs
|
||||||
|
#kernel.pid_max = 999999
|
||||||
|
|
||||||
|
# You should compile nfsd into the kernel or add it
|
||||||
|
# to modules.autoload for this to work properly
|
||||||
|
# TCP Port for lock manager
|
||||||
|
#fs.nfs.nlm_tcpport = 0
|
||||||
|
# UDP Port for lock manager
|
||||||
|
#fs.nfs.nlm_udpport = 0
|
7
etc/Makefile
Normal file
7
etc/Makefile
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
SUBDIRS = env.d
|
||||||
|
|
||||||
|
DIR = /etc
|
||||||
|
FILES = hosts networks profile protocols rc.conf services shells
|
||||||
|
|
||||||
|
TOPDIR = ..
|
||||||
|
include $(TOPDIR)/default.mk
|
10
etc/env.d/00basic
Normal file
10
etc/env.d/00basic
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
# /etc/env.d/00basic
|
||||||
|
|
||||||
|
PATH="/opt/bin"
|
||||||
|
ROOTPATH="/opt/bin"
|
||||||
|
LDPATH="/usr/local/lib"
|
||||||
|
MANPATH="/usr/local/share/man:/usr/share/man"
|
||||||
|
INFOPATH="/usr/share/info"
|
||||||
|
CVS_RSH="ssh"
|
||||||
|
PAGER="/usr/bin/less"
|
||||||
|
LESSOPEN="|lesspipe.sh %s"
|
5
etc/env.d/Makefile
Normal file
5
etc/env.d/Makefile
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
DIR = /etc/env.d
|
||||||
|
FILES = 00basic
|
||||||
|
|
||||||
|
TOPDIR = ../..
|
||||||
|
include $(TOPDIR)/default.mk
|
31
etc/hosts
Normal file
31
etc/hosts
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
# /etc/hosts: Local Host Database
|
||||||
|
#
|
||||||
|
# This file describes a number of aliases-to-address mappings for the for
|
||||||
|
# local hosts that share this file.
|
||||||
|
#
|
||||||
|
# In the presence of the domain name service or NIS, this file may not be
|
||||||
|
# consulted at all; see /etc/host.conf for the resolution order.
|
||||||
|
#
|
||||||
|
|
||||||
|
# IPv4 and IPv6 localhost aliases
|
||||||
|
127.0.0.1 localhost
|
||||||
|
::1 localhost
|
||||||
|
|
||||||
|
#
|
||||||
|
# Imaginary network.
|
||||||
|
#10.0.0.2 myname
|
||||||
|
#10.0.0.3 myfriend
|
||||||
|
#
|
||||||
|
# According to RFC 1918, you can use the following IP networks for private
|
||||||
|
# nets which will never be connected to the Internet:
|
||||||
|
#
|
||||||
|
# 10.0.0.0 - 10.255.255.255
|
||||||
|
# 172.16.0.0 - 172.31.255.255
|
||||||
|
# 192.168.0.0 - 192.168.255.255
|
||||||
|
#
|
||||||
|
# In case you want to be able to connect directly to the Internet (i.e. not
|
||||||
|
# behind a NAT, ADSL router, etc...), you need real official assigned
|
||||||
|
# numbers. Do not try to invent your own network numbers but instead get one
|
||||||
|
# from your network provider (if any) or from your regional registry (ARIN,
|
||||||
|
# APNIC, LACNIC, RIPE NCC, or AfriNIC.)
|
||||||
|
#
|
8
etc/networks
Normal file
8
etc/networks
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
# /etc/networks
|
||||||
|
#
|
||||||
|
# This file describes a number of netname-to-adress
|
||||||
|
# mappings for the TCP/IP subsytem. It is mostly
|
||||||
|
# used at boot time, when no name servers are running.
|
||||||
|
#
|
||||||
|
|
||||||
|
loopback 127.0.0.0
|
67
etc/profile
Normal file
67
etc/profile
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
# /etc/profile: login shell setup
|
||||||
|
#
|
||||||
|
# That this file is used by any Bourne-shell derivative to setup the
|
||||||
|
# environment for login shells.
|
||||||
|
#
|
||||||
|
|
||||||
|
# Load environment settings from profile.env, which is created by
|
||||||
|
# env-update from the files in /etc/env.d
|
||||||
|
if [ -e /etc/profile.env ] ; then
|
||||||
|
. /etc/profile.env
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 077 would be more secure, but 022 is generally quite realistic
|
||||||
|
umask 022
|
||||||
|
|
||||||
|
# Set up PATH depending on whether we're root or a normal user.
|
||||||
|
# There's no real reason to exclude sbin paths from the normal user,
|
||||||
|
# but it can make tab-completion easier when they aren't in the
|
||||||
|
# user's PATH to pollute the executable namespace.
|
||||||
|
#
|
||||||
|
# It is intentional in the following line to use || instead of -o.
|
||||||
|
# This way the evaluation can be short-circuited and calling whoami is
|
||||||
|
# avoided.
|
||||||
|
if [ "$EUID" = "0" ] || [ "$USER" = "root" ] ; then
|
||||||
|
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:${ROOTPATH}"
|
||||||
|
else
|
||||||
|
PATH="/usr/local/bin:/usr/bin:/bin:${PATH}"
|
||||||
|
fi
|
||||||
|
export PATH
|
||||||
|
unset ROOTPATH
|
||||||
|
|
||||||
|
# Extract the value of EDITOR
|
||||||
|
[ -z "$EDITOR" ] && EDITOR="`. /etc/rc.conf 2>/dev/null; echo $EDITOR`"
|
||||||
|
[ -z "$EDITOR" ] && EDITOR="/bin/nano"
|
||||||
|
export EDITOR
|
||||||
|
|
||||||
|
if [ -n "${BASH_VERSION}" ] ; then
|
||||||
|
# Newer bash ebuilds include /etc/bash/bashrc which will setup PS1
|
||||||
|
# including color. We leave out color here because not all
|
||||||
|
# terminals support it.
|
||||||
|
if [ -f /etc/bash/bashrc ] ; then
|
||||||
|
# Bash login shells run only /etc/profile
|
||||||
|
# Bash non-login shells run only /etc/bash/bashrc
|
||||||
|
# Since we want to run /etc/bash/bashrc regardless, we source it
|
||||||
|
# from here. It is unfortunate that there is no way to do
|
||||||
|
# this *after* the user's .bash_profile runs (without putting
|
||||||
|
# it in the user's dot-files), but it shouldn't make any
|
||||||
|
# difference.
|
||||||
|
. /etc/bash/bashrc
|
||||||
|
else
|
||||||
|
PS1='\u@\h \w \$ '
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
# Setup a bland default prompt. Since this prompt should be useable
|
||||||
|
# on color and non-color terminals, as well as shells that don't
|
||||||
|
# understand sequences such as \h, don't put anything special in it.
|
||||||
|
if type whoami >/dev/null 2>/dev/null && \
|
||||||
|
type cut >/dev/null 2>/dev/null && \
|
||||||
|
type uname >/dev/null 2>/dev/null ; then
|
||||||
|
PS1="`whoami`@`uname -n | cut -f1 -d.` \$ "
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
for sh in /etc/profile.d/*.sh ; do
|
||||||
|
[ -r "$sh" ] && . "$sh"
|
||||||
|
done
|
||||||
|
unset sh
|
147
etc/protocols
Normal file
147
etc/protocols
Normal file
@ -0,0 +1,147 @@
|
|||||||
|
#
|
||||||
|
# Internet protocols
|
||||||
|
#
|
||||||
|
# $FreeBSD: src/etc/protocols,v 1.20 2005/02/22 13:04:02 glebius Exp $
|
||||||
|
# from: @(#)protocols 5.1 (Berkeley) 4/17/89
|
||||||
|
#
|
||||||
|
# See also http://www.iana.org/assignments/protocol-numbers
|
||||||
|
#
|
||||||
|
ip 0 IP # internet protocol, pseudo protocol number
|
||||||
|
#hopopt 0 HOPOPT # hop-by-hop options for ipv6
|
||||||
|
icmp 1 ICMP # internet control message protocol
|
||||||
|
igmp 2 IGMP # internet group management protocol
|
||||||
|
ggp 3 GGP # gateway-gateway protocol
|
||||||
|
ipencap 4 IP-ENCAP # IP encapsulated in IP (officially ``IP'')
|
||||||
|
st2 5 ST2 # ST2 datagram mode (RFC 1819)
|
||||||
|
tcp 6 TCP # transmission control protocol
|
||||||
|
cbt 7 CBT # CBT, Tony Ballardie <A.Ballardie@cs.ucl.ac.uk>
|
||||||
|
egp 8 EGP # exterior gateway protocol
|
||||||
|
igp 9 IGP # any private interior gateway (Cisco: for IGRP)
|
||||||
|
bbn-rcc 10 BBN-RCC-MON # BBN RCC Monitoring
|
||||||
|
nvp 11 NVP-II # Network Voice Protocol
|
||||||
|
pup 12 PUP # PARC universal packet protocol
|
||||||
|
argus 13 ARGUS # ARGUS
|
||||||
|
emcon 14 EMCON # EMCON
|
||||||
|
xnet 15 XNET # Cross Net Debugger
|
||||||
|
chaos 16 CHAOS # Chaos
|
||||||
|
udp 17 UDP # user datagram protocol
|
||||||
|
mux 18 MUX # Multiplexing protocol
|
||||||
|
dcn 19 DCN-MEAS # DCN Measurement Subsystems
|
||||||
|
hmp 20 HMP # host monitoring protocol
|
||||||
|
prm 21 PRM # packet radio measurement protocol
|
||||||
|
xns-idp 22 XNS-IDP # Xerox NS IDP
|
||||||
|
trunk-1 23 TRUNK-1 # Trunk-1
|
||||||
|
trunk-2 24 TRUNK-2 # Trunk-2
|
||||||
|
leaf-1 25 LEAF-1 # Leaf-1
|
||||||
|
leaf-2 26 LEAF-2 # Leaf-2
|
||||||
|
rdp 27 RDP # "reliable datagram" protocol
|
||||||
|
irtp 28 IRTP # Internet Reliable Transaction Protocol
|
||||||
|
iso-tp4 29 ISO-TP4 # ISO Transport Protocol Class 4
|
||||||
|
netblt 30 NETBLT # Bulk Data Transfer Protocol
|
||||||
|
mfe-nsp 31 MFE-NSP # MFE Network Services Protocol
|
||||||
|
merit-inp 32 MERIT-INP # MERIT Internodal Protocol
|
||||||
|
sep 33 SEP # Sequential Exchange Protocol
|
||||||
|
3pc 34 3PC # Third Party Connect Protocol
|
||||||
|
idpr 35 IDPR # Inter-Domain Policy Routing Protocol
|
||||||
|
xtp 36 XTP # Xpress Tranfer Protocol
|
||||||
|
ddp 37 DDP # Datagram Delivery Protocol
|
||||||
|
idpr-cmtp 38 IDPR-CMTP # IDPR Control Message Transport Proto
|
||||||
|
tp++ 39 TP++ # TP++ Transport Protocol
|
||||||
|
il 40 IL # IL Transport Protocol
|
||||||
|
ipv6 41 IPV6 # ipv6
|
||||||
|
sdrp 42 SDRP # Source Demand Routing Protocol
|
||||||
|
ipv6-route 43 IPV6-ROUTE # routing header for ipv6
|
||||||
|
ipv6-frag 44 IPV6-FRAG # fragment header for ipv6
|
||||||
|
idrp 45 IDRP # Inter-Domain Routing Protocol
|
||||||
|
rsvp 46 RSVP # Resource ReSerVation Protocol
|
||||||
|
gre 47 GRE # Generic Routing Encapsulation
|
||||||
|
mhrp 48 MHRP # Mobile Host Routing Protocol
|
||||||
|
bna 49 BNA # BNA
|
||||||
|
esp 50 ESP # encapsulating security payload
|
||||||
|
ah 51 AH # authentication header
|
||||||
|
i-nlsp 52 I-NLSP # Integrated Net Layer Security TUBA
|
||||||
|
swipe 53 SWIPE # IP with Encryption
|
||||||
|
narp 54 NARP # NBMA Address Resolution Protocol
|
||||||
|
mobile 55 MOBILE # IP Mobility
|
||||||
|
tlsp 56 TLSP # Transport Layer Security Protocol
|
||||||
|
skip 57 SKIP # SKIP
|
||||||
|
ipv6-icmp 58 IPV6-ICMP icmp6 # ICMP for IPv6
|
||||||
|
ipv6-nonxt 59 IPV6-NONXT # no next header for ipv6
|
||||||
|
ipv6-opts 60 IPV6-OPTS # destination options for ipv6
|
||||||
|
# 61 # any host internal protocol
|
||||||
|
cftp 62 CFTP # CFTP
|
||||||
|
# 63 # any local network
|
||||||
|
sat-expak 64 SAT-EXPAK # SATNET and Backroom EXPAK
|
||||||
|
kryptolan 65 KRYPTOLAN # Kryptolan
|
||||||
|
rvd 66 RVD # MIT Remote Virtual Disk Protocol
|
||||||
|
ippc 67 IPPC # Internet Pluribus Packet Core
|
||||||
|
# 68 # any distributed filesystem
|
||||||
|
sat-mon 69 SAT-MON # SATNET Monitoring
|
||||||
|
visa 70 VISA # VISA Protocol
|
||||||
|
ipcv 71 IPCV # Internet Packet Core Utility
|
||||||
|
cpnx 72 CPNX # Computer Protocol Network Executive
|
||||||
|
cphb 73 CPHB # Computer Protocol Heart Beat
|
||||||
|
wsn 74 WSN # Wang Span Network
|
||||||
|
pvp 75 PVP # Packet Video Protocol
|
||||||
|
br-sat-mon 76 BR-SAT-MON # Backroom SATNET Monitoring
|
||||||
|
sun-nd 77 SUN-ND # SUN ND PROTOCOL-Temporary
|
||||||
|
wb-mon 78 WB-MON # WIDEBAND Monitoring
|
||||||
|
wb-expak 79 WB-EXPAK # WIDEBAND EXPAK
|
||||||
|
iso-ip 80 ISO-IP # ISO Internet Protocol
|
||||||
|
vmtp 81 VMTP # Versatile Message Transport
|
||||||
|
secure-vmtp 82 SECURE-VMTP # SECURE-VMTP
|
||||||
|
vines 83 VINES # VINES
|
||||||
|
ttp 84 TTP # TTP
|
||||||
|
nsfnet-igp 85 NSFNET-IGP # NSFNET-IGP
|
||||||
|
dgp 86 DGP # Dissimilar Gateway Protocol
|
||||||
|
tcf 87 TCF # TCF
|
||||||
|
eigrp 88 EIGRP # Enhanced Interior Routing Protocol (Cisco)
|
||||||
|
ospf 89 OSPFIGP # Open Shortest Path First IGP
|
||||||
|
sprite-rpc 90 Sprite-RPC # Sprite RPC Protocol
|
||||||
|
larp 91 LARP # Locus Address Resolution Protocol
|
||||||
|
mtp 92 MTP # Multicast Transport Protocol
|
||||||
|
ax.25 93 AX.25 # AX.25 Frames
|
||||||
|
ipip 94 IPIP # Yet Another IP encapsulation
|
||||||
|
micp 95 MICP # Mobile Internetworking Control Pro.
|
||||||
|
scc-sp 96 SCC-SP # Semaphore Communications Sec. Pro.
|
||||||
|
etherip 97 ETHERIP # Ethernet-within-IP Encapsulation
|
||||||
|
encap 98 ENCAP # Yet Another IP encapsulation
|
||||||
|
# 99 # any private encryption scheme
|
||||||
|
gmtp 100 GMTP # GMTP
|
||||||
|
ifmp 101 IFMP # Ipsilon Flow Management Protocol
|
||||||
|
pnni 102 PNNI # PNNI over IP
|
||||||
|
pim 103 PIM # Protocol Independent Multicast
|
||||||
|
aris 104 ARIS # ARIS
|
||||||
|
scps 105 SCPS # SCPS
|
||||||
|
qnx 106 QNX # QNX
|
||||||
|
a/n 107 A/N # Active Networks
|
||||||
|
ipcomp 108 IPComp # IP Payload Compression Protocol
|
||||||
|
snp 109 SNP # Sitara Networks Protocol
|
||||||
|
compaq-peer 110 Compaq-Peer # Compaq Peer Protocol
|
||||||
|
ipx-in-ip 111 IPX-in-IP # IPX in IP
|
||||||
|
carp 112 CARP vrrp # Common Address Redundancy Protocol
|
||||||
|
pgm 113 PGM # PGM Reliable Transport Protocol
|
||||||
|
# 114 # any 0-hop protocol
|
||||||
|
l2tp 115 L2TP # Layer Two Tunneling Protocol
|
||||||
|
ddx 116 DDX # D-II Data Exchange
|
||||||
|
iatp 117 IATP # Interactive Agent Transfer Protocol
|
||||||
|
st 118 ST # Schedule Transfer
|
||||||
|
srp 119 SRP # SpectraLink Radio Protocol
|
||||||
|
uti 120 UTI # UTI
|
||||||
|
smp 121 SMP # Simple Message Protocol
|
||||||
|
sm 122 SM # SM
|
||||||
|
ptp 123 PTP # Performance Transparency Protocol
|
||||||
|
isis 124 ISIS # ISIS over IPv4
|
||||||
|
fire 125 FIRE
|
||||||
|
crtp 126 CRTP # Combat Radio Transport Protocol
|
||||||
|
crudp 127 CRUDP # Combat Radio User Datagram
|
||||||
|
sscopmce 128 SSCOPMCE
|
||||||
|
iplt 129 IPLT
|
||||||
|
sps 130 SPS # Secure Packet Shield
|
||||||
|
pipe 131 PIPE # Private IP Encapsulation within IP
|
||||||
|
sctp 132 SCTP # Stream Control Transmission Protocol
|
||||||
|
fc 133 FC # Fibre Channel
|
||||||
|
# 134-254 # Unassigned
|
||||||
|
pfsync 240 PFSYNC # PF Synchronization
|
||||||
|
# 255 # Reserved
|
||||||
|
divert 258 DIVERT # Divert pseudo-protocol [non IANA]
|
37
etc/rc.conf
Normal file
37
etc/rc.conf
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
# /etc/rc.conf: Global startup script configuration settings
|
||||||
|
|
||||||
|
# UNICODE specifies whether you want to have UNICODE support in the console.
|
||||||
|
# If you set to yes, please make sure to set a UNICODE aware CONSOLEFONT and
|
||||||
|
# KEYMAP in the /etc/conf.d/consolefont and /etc/conf.d/keymaps config files.
|
||||||
|
|
||||||
|
UNICODE="no"
|
||||||
|
|
||||||
|
# Set EDITOR to your preferred editor.
|
||||||
|
# You may use something other than what is listed here.
|
||||||
|
|
||||||
|
EDITOR="/bin/nano"
|
||||||
|
#EDITOR="/usr/bin/vim"
|
||||||
|
#EDITOR="/usr/bin/emacs"
|
||||||
|
|
||||||
|
# XSESSION is a new variable to control what window manager to start
|
||||||
|
# default with X if run with xdm, startx or xinit. The default behavior
|
||||||
|
# is to look in /etc/X11/Sessions/ and run the script in matching the
|
||||||
|
# value that XSESSION is set to. The support scripts are smart enough to
|
||||||
|
# look in all bin directories if it cant find a match in /etc/X11/Sessions/,
|
||||||
|
# so setting it to "enlightenment" can also work. This is basically used
|
||||||
|
# as a way for the system admin to configure a default system wide WM,
|
||||||
|
# allthough it will work if the user export XSESSION in his .bash_profile, etc.
|
||||||
|
#
|
||||||
|
# NOTE: 1) this behaviour is overridden when a ~/.xinitrc exists, and startx
|
||||||
|
# is called.
|
||||||
|
# 2) even if ~/.xsession exists, if XSESSION can be resolved, it will
|
||||||
|
# be executed rather than ~/.xsession, else KDM breaks ...
|
||||||
|
#
|
||||||
|
# Defaults depending on what you install currently include:
|
||||||
|
#
|
||||||
|
# Gnome - will start gnome-session
|
||||||
|
# kde-<version> - will start startkde (look in /etc/X11/Sessions/)
|
||||||
|
# Xsession - will start a terminal and a few other nice apps
|
||||||
|
# Xfce4 - will start a XFCE4 session
|
||||||
|
|
||||||
|
#XSESSION="Gnome"
|
1178
etc/services
Normal file
1178
etc/services
Normal file
File diff suppressed because it is too large
Load Diff
10
etc/shells
Normal file
10
etc/shells
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
# /etc/shells: valid login shells
|
||||||
|
/bin/bash
|
||||||
|
/bin/csh
|
||||||
|
/bin/esh
|
||||||
|
/bin/fish
|
||||||
|
/bin/ksh
|
||||||
|
/bin/sash
|
||||||
|
/bin/sh
|
||||||
|
/bin/tcsh
|
||||||
|
/bin/zsh
|
5
init.d.BSD/Makefile
Normal file
5
init.d.BSD/Makefile
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
DIR = /etc/init.d
|
||||||
|
EXES = clock
|
||||||
|
|
||||||
|
TOPDIR = ..
|
||||||
|
include $(TOPDIR)/default.mk
|
41
init.d.BSD/clock
Executable file
41
init.d.BSD/clock
Executable file
@ -0,0 +1,41 @@
|
|||||||
|
#!/sbin/runscript
|
||||||
|
# Copyright 1999-2007 Gentoo Foundation
|
||||||
|
# Distributed under the terms of the GNU General Public License v2
|
||||||
|
|
||||||
|
depend() {
|
||||||
|
# BSD adjkerntz needs to be able to write to /etc
|
||||||
|
if [ "${CLOCK}" = "UTC" -a -e /etc/wall_cmos_clock ] ||
|
||||||
|
[ "${CLOCK}" != "UTC" -a ! -e /etc/wall_cmos_clock ] ; then
|
||||||
|
need checkroot
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
start() {
|
||||||
|
if [ "${TIMEZONE-Factory}" = "Factory" ] ; then
|
||||||
|
ewarn "Your TIMEZONE in /etc/conf.d/clock is still set to Factory!"
|
||||||
|
fi
|
||||||
|
|
||||||
|
local TBLURB="Local Time"
|
||||||
|
[ "${CLOCK}" = "UTC" ] && TBLURB="UTC"
|
||||||
|
ebegin "Starting the System Clock Adjuster [${TBLURB}]"
|
||||||
|
if [ "${CLOCK}" != "UTC" ] ; then
|
||||||
|
touch /etc/wall_cmos_clock
|
||||||
|
start-stop-daemon --start --exec /sbin/adjkerntz -- -i
|
||||||
|
else
|
||||||
|
rm -f /etc/wall_cmos_clock
|
||||||
|
/sbin/adjkerntz -i
|
||||||
|
fi
|
||||||
|
eend $?
|
||||||
|
}
|
||||||
|
|
||||||
|
stop() {
|
||||||
|
ebegin "Stopping the System Clock Adjuster"
|
||||||
|
if start-stop-daemon --test --quiet --stop --exec /sbin/adjkerntz ; then
|
||||||
|
start-stop-daemon --stop --exec /sbin/adjkerntz
|
||||||
|
eend $?
|
||||||
|
else
|
||||||
|
eend 0
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# vim: set ts=4 :
|
5
init.d.Linux/Makefile
Normal file
5
init.d.Linux/Makefile
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
DIR = /etc/init.d
|
||||||
|
EXES = clock consolefont keymaps modules numlock volumes
|
||||||
|
|
||||||
|
TOPDIR = ..
|
||||||
|
include $(TOPDIR)/default.mk
|
131
init.d.Linux/clock
Executable file
131
init.d.Linux/clock
Executable file
@ -0,0 +1,131 @@
|
|||||||
|
#!/sbin/runscript
|
||||||
|
# Copyright 1999-2007 Gentoo Foundation
|
||||||
|
# Distributed under the terms of the GNU General Public License v2
|
||||||
|
|
||||||
|
opts="save"
|
||||||
|
|
||||||
|
depend() {
|
||||||
|
case "${CLOCK_ADJTIME}" in
|
||||||
|
"") before *;;
|
||||||
|
/etc/*) need checkroot;;
|
||||||
|
*) need localmount;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
setupopts() {
|
||||||
|
case "${RC_SYS}" in
|
||||||
|
UML|VPS|XEN)
|
||||||
|
TBLURB="${RC_SYS}"
|
||||||
|
fakeit=1
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
case "$(uname -m)" in
|
||||||
|
s390*)
|
||||||
|
TBLURB="s390"
|
||||||
|
fakeit=1
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
if [ -e /proc/devices ] && grep -q " cobd$" /proc/devices ; then
|
||||||
|
TBLURB="coLinux"
|
||||||
|
fakeit=1
|
||||||
|
elif [ "${CLOCK}" = "UTC" ] ; then
|
||||||
|
myopts="--utc"
|
||||||
|
TBLURB="UTC"
|
||||||
|
else
|
||||||
|
myopts="--localtime"
|
||||||
|
TBLURB="Local Time"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
[ ${fakeit} -eq 1 ] && return 0
|
||||||
|
|
||||||
|
if [ -z "${CLOCK_ADJTIME}" -o ! -w /etc ] ; then
|
||||||
|
myadj="--noadjfile"
|
||||||
|
else
|
||||||
|
myadj="--adjust"
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ "${SRM}" = "yes" ] && myopts="${myopts} --srm"
|
||||||
|
[ "${ARC}" = "arc" ] && myopts="${myopts} --arc"
|
||||||
|
myopts="${myopts} ${CLOCK_OPTS}"
|
||||||
|
|
||||||
|
# Make sure user isn't using rc.conf anymore.
|
||||||
|
if grep -q "^CLOCK=" /etc/rc.conf ; then
|
||||||
|
ewarn $"CLOCK should not be set in /etc/rc.conf but in /etc/conf.d/clock"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Make sure people set their timezone ... we do it here
|
||||||
|
# even though we don't actually use the variable so that
|
||||||
|
# people see the warning on boot.
|
||||||
|
if [ "${TIMEZONE-Factory}" = "Factory" ] ; then
|
||||||
|
ewarn "Your TIMEZONE in /etc/conf.d/clock is still set to Factory!"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
start() {
|
||||||
|
local myopts= myadj= TBLURB= fakeit=0 errstr="" retval=0
|
||||||
|
|
||||||
|
if [ -x /sbin/hwclock ] ; then
|
||||||
|
[ -w "${CLOCK_ADJTIME}" ] && echo "0.0 0 0.0" > "${CLOCK_ADJTIME}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
setupopts
|
||||||
|
|
||||||
|
if [ ${fakeit} -ne 1 -a -e /proc/modules -a ! -e /dev/rtc ] ; then
|
||||||
|
modprobe rtc 2>/dev/null || modprobe genrtc 2>/dev/null
|
||||||
|
fi
|
||||||
|
|
||||||
|
ebegin "Setting system clock using the hardware clock" "[${TBLURB}]"
|
||||||
|
if [ ${fakeit} -eq 1 ] ; then
|
||||||
|
ret=0
|
||||||
|
elif [ -x /sbin/hwclock ] ; then
|
||||||
|
# Since hwclock always exit's with a 0, need to check its output.
|
||||||
|
errstr="$(/sbin/hwclock ${myadj} ${myopts} 2>&1 >/dev/null)"
|
||||||
|
errstr="${errstr}$(/sbin/hwclock --hctosys ${myopts} 2>&1 >/dev/null)"
|
||||||
|
|
||||||
|
if [ -n "${errstr}" ] ; then
|
||||||
|
ewarn "${errstr}"
|
||||||
|
ret=1
|
||||||
|
else
|
||||||
|
ret=0
|
||||||
|
fi
|
||||||
|
errstr="Failed to set clock"
|
||||||
|
else
|
||||||
|
ret=1
|
||||||
|
errstr="/sbin/hwclock not found"
|
||||||
|
fi
|
||||||
|
eend ${ret} "${errstr}" "You will need to set the clock yourself"
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
stop() {
|
||||||
|
# Don't tweak the hardware clock on LiveCD halt.
|
||||||
|
[ -n "${CDBOOT}" -o "${CLOCK_SYSTOHC}" != "yes" ] && return 0
|
||||||
|
|
||||||
|
local myopts= myadj= TBLURB= fakeit=0 errstr="" retval=0
|
||||||
|
|
||||||
|
setupopts
|
||||||
|
|
||||||
|
ebegin "Setting hardware clock using the system clock" "[${TBLURB}]"
|
||||||
|
if [ ${fakeit} -eq 1 ] ; then
|
||||||
|
ret=0
|
||||||
|
elif [ -x /sbin/hwclock ] ; then
|
||||||
|
[ -z "$(/sbin/hwclock --systohc ${myopts} 2>&1 >/dev/null)" ]
|
||||||
|
ret=$?
|
||||||
|
errstr="Failed to sync clocks"
|
||||||
|
else
|
||||||
|
ret=1
|
||||||
|
errstr="/sbin/hwclock not found"
|
||||||
|
fi
|
||||||
|
eend ${ret} "${errstr}"
|
||||||
|
}
|
||||||
|
|
||||||
|
save() {
|
||||||
|
CLOCK_SYSTOHC="yes"
|
||||||
|
stop
|
||||||
|
}
|
||||||
|
|
||||||
|
# vim: set ts=4 :
|
87
init.d.Linux/consolefont
Executable file
87
init.d.Linux/consolefont
Executable file
@ -0,0 +1,87 @@
|
|||||||
|
#!/sbin/runscript
|
||||||
|
# Copyright 1999-2007 Gentoo Foundation
|
||||||
|
# Distributed under the terms of the GNU General Public License v2
|
||||||
|
|
||||||
|
depend() {
|
||||||
|
need localmount
|
||||||
|
need keymaps # sets up terminal encoding scheme
|
||||||
|
after hotplug
|
||||||
|
}
|
||||||
|
|
||||||
|
start() {
|
||||||
|
# Forget about any font until we are successful
|
||||||
|
rm -rf "${RC_LIBDIR}"/console
|
||||||
|
|
||||||
|
case "${RC_SYS}" in
|
||||||
|
UML|VPS|XEN) return 0 ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ -z "${CONSOLEFONT}" ] ; then
|
||||||
|
ebegin $"Using the default console font"
|
||||||
|
eend 0
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
local x= param= sf_param= retval=1
|
||||||
|
|
||||||
|
# Get additional parameters
|
||||||
|
if [ -n "${CONSOLETRANSLATION}" ] ; then
|
||||||
|
param="${param} -m ${CONSOLETRANSLATION}"
|
||||||
|
fi
|
||||||
|
if [ -n "${UNICODEMAP}" ] ; then
|
||||||
|
param="${param} -u ${UNICODEMAP}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Set the console font
|
||||||
|
local errmsg=
|
||||||
|
ebegin "Setting user font"
|
||||||
|
if [ -x /bin/setfont ] ; then
|
||||||
|
# We patched setfont to have --tty support ...
|
||||||
|
if [ -n "$(setfont --help 2>&1 | grep -e '--tty')" ] || \
|
||||||
|
[ -n "$(setfont --help 2>&1 | grep -e '-C')" ]
|
||||||
|
then
|
||||||
|
if [ -n "$(setfont --help 2>&1 | grep -e '--tty')" ] ; then
|
||||||
|
sf_param="--tty="
|
||||||
|
else
|
||||||
|
sf_param="-C "
|
||||||
|
fi
|
||||||
|
local ttydev=
|
||||||
|
[ -d /dev/vc ] \
|
||||||
|
&& ttydev=/dev/vc/ \
|
||||||
|
|| ttydev=/dev/tty
|
||||||
|
|
||||||
|
x=1
|
||||||
|
while [ ${x} -le "${RC_TTY_NUMBER}" ] ; do
|
||||||
|
/bin/setfont ${CONSOLEFONT} ${param} \
|
||||||
|
${sf_param}/${ttydev}${x} > /dev/null
|
||||||
|
retval=$?
|
||||||
|
x=$((${x} + 1))
|
||||||
|
done
|
||||||
|
else
|
||||||
|
/bin/setfont ${CONSOLEFONT} ${param} > /dev/null
|
||||||
|
retval=$?
|
||||||
|
fi
|
||||||
|
errmsg="Failed to set user font"
|
||||||
|
else
|
||||||
|
retval=1
|
||||||
|
errmsg="/bin/setfont not found"
|
||||||
|
fi
|
||||||
|
eend ${retval} "${errmsg}"
|
||||||
|
|
||||||
|
# Store the last font so we can use it ASAP on boot
|
||||||
|
if [ ${retval} -eq 0 -a -w "${RC_LIBDIR}" ] ; then
|
||||||
|
mkdir -p "${RC_LIBDIR}"/console
|
||||||
|
|
||||||
|
# Pipe errors to null as maps may not be in use
|
||||||
|
/bin/setfont -o "${RC_LIBDIR}"/console/font 2>/dev/null \
|
||||||
|
|| rm -f "${RC_LIBDIR}"/console/font
|
||||||
|
/bin/setfont -om "${RC_LIBDIR}"/console/map 2>/dev/null \
|
||||||
|
|| rm -f "${RC_LIBDIR}"/console/map
|
||||||
|
/bin/setfont -ou "${RC_LIBDIR}"/console/unimap 2>/dev/null \
|
||||||
|
|| rm -f "${RC_LIBDIR}"/console/unimap
|
||||||
|
fi
|
||||||
|
|
||||||
|
return ${retval}
|
||||||
|
}
|
||||||
|
|
||||||
|
# vim: set ts=4 :
|
80
init.d.Linux/keymaps
Executable file
80
init.d.Linux/keymaps
Executable file
@ -0,0 +1,80 @@
|
|||||||
|
#!/sbin/runscript
|
||||||
|
# Copyright 1999-2007 Gentoo Foundation
|
||||||
|
# Distributed under the terms of the GNU General Public License v2
|
||||||
|
|
||||||
|
depend() {
|
||||||
|
need localmount
|
||||||
|
}
|
||||||
|
|
||||||
|
checkconfig() {
|
||||||
|
if [ -z "${KEYMAP}" ] ; then
|
||||||
|
eerror "You need to setup KEYMAP in /etc/conf.d/keymaps first"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Make sure user isn't using rc.conf anymore
|
||||||
|
if grep -q "^KEYMAP=" /etc/rc.conf ; then
|
||||||
|
ewarn "KEYMAP should not be set in /etc/rc.conf but in /etc/conf.d/keymaps"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
start() {
|
||||||
|
case "${RC_SYS}" in
|
||||||
|
UML|VPS|XEN)
|
||||||
|
ebegin "Loading key mappings"
|
||||||
|
eend 0
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
local WINDOWKEYS_KEYMAP=
|
||||||
|
|
||||||
|
checkconfig || return 1
|
||||||
|
|
||||||
|
# Force linux keycodes for PPC.
|
||||||
|
if [ -f /proc/sys/dev/mac_hid/keyboard_sends_linux_keycodes ] ; then
|
||||||
|
echo 1 > /proc/sys/dev/mac_hid/keyboard_sends_linux_keycodes
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Turn on unicode if user wants it
|
||||||
|
[ "${UNICODE}" = "yes" ] && kbd_mode -u
|
||||||
|
|
||||||
|
ebegin "Loading key mappings"
|
||||||
|
if [ -x /bin/loadkeys ] ; then
|
||||||
|
[ "${SET_WINDOWKEYS}" = "yes" ] && WINDOWKEYS_KEYMAP="windowkeys"
|
||||||
|
loadkeys -q ${WINDOWKEYS_KEYMAP} ${KEYMAP} \
|
||||||
|
${EXTENDED_KEYMAPS} > /dev/null
|
||||||
|
eend $? "Error loading key mappings"
|
||||||
|
else
|
||||||
|
eend 1 "/bin/loadkeys not found"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Set terminal encoding to either ASCII or UNICODE.
|
||||||
|
# See utf-8(7) for more information.
|
||||||
|
local termencoding= termmsg=
|
||||||
|
if [ "${UNICODE}" = "yes" ] ; then
|
||||||
|
local dumpkey_opts=
|
||||||
|
[ -n "${DUMPKEYS_CHARSET}" ] && dumpkey_opts="-c ${DUMPKEYS_CHARSET}"
|
||||||
|
|
||||||
|
dumpkeys ${dumpkey_opts} | loadkeys --unicode
|
||||||
|
termencoding="\033%%G"
|
||||||
|
termmsg="UTF-8"
|
||||||
|
else
|
||||||
|
termencoding="\033(K"
|
||||||
|
termmsg="ASCII"
|
||||||
|
fi
|
||||||
|
local n=1 ttydev=
|
||||||
|
[ -d /dev/vc ] \
|
||||||
|
&& ttydev=/dev/vc/ \
|
||||||
|
|| ttydev=/dev/tty
|
||||||
|
ebegin "Setting terminal encoding to" ${termmsg}
|
||||||
|
while [ ${n} -le "${RC_TTY_NUMBER}" ] ; do
|
||||||
|
printf "${termencoding}" >"${ttydev}${n}"
|
||||||
|
n=$((${n} + 1))
|
||||||
|
done
|
||||||
|
eend 0
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# vim:ts=4
|
104
init.d.Linux/modules
Executable file
104
init.d.Linux/modules
Executable file
@ -0,0 +1,104 @@
|
|||||||
|
#!/sbin/runscript
|
||||||
|
# Copyright 1999-2007 Gentoo Foundation
|
||||||
|
# Distributed under the terms of the GNU General Public License v2
|
||||||
|
|
||||||
|
depend() {
|
||||||
|
need checkroot
|
||||||
|
use isapnp
|
||||||
|
}
|
||||||
|
|
||||||
|
load_modules() {
|
||||||
|
local modules=""
|
||||||
|
local config="$1"
|
||||||
|
|
||||||
|
[ -z "${config}" -o ! -r "${config}" ] && return 0
|
||||||
|
|
||||||
|
modules=$(sed -e 's:#.*::' -e '/^[[:space:]]*$/d' "${config}")
|
||||||
|
[ -z "${modules}" ] && return 0
|
||||||
|
|
||||||
|
einfo "Using ${config} as config:"
|
||||||
|
eindent
|
||||||
|
|
||||||
|
local x= cnt=0 OIFS=${IFS} SIFS=${IFS-y}
|
||||||
|
IFS=\n
|
||||||
|
for x in ${modules} ; do
|
||||||
|
set -- ${x}
|
||||||
|
ebegin "Loading module $1"
|
||||||
|
modprobe -q "$@" >& /dev/null
|
||||||
|
eend $? "Failed to load $1" && cnt=$((${cnt} + 1))
|
||||||
|
done
|
||||||
|
if [ "${SIFS}" = "y" ] ; then
|
||||||
|
IFS=${save_IFS}
|
||||||
|
else
|
||||||
|
unset IFS
|
||||||
|
fi
|
||||||
|
|
||||||
|
einfo "Autoloaded ${cnt} module(s)"
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
start() {
|
||||||
|
# Should not fail if kernel do not have module
|
||||||
|
# support compiled in ...
|
||||||
|
[ ! -f /proc/modules -o "${RC_SYS}" = "VPS" ] && return 0
|
||||||
|
|
||||||
|
local KV=$(uname -r)
|
||||||
|
local KV_MAJOR=${KV%%.*}
|
||||||
|
local x=${KV#*.}
|
||||||
|
local KV_MINOR=${x%%.*}
|
||||||
|
x=${KV#*.*.}
|
||||||
|
local KV_MICRO=${x%%-*}
|
||||||
|
|
||||||
|
# Make sure depmod from modutils do not whine, but do not bother if
|
||||||
|
# we are on a 2.6 kernel without modprobe.old
|
||||||
|
if [ -z "${CDBOOT}" -a ! -e /etc/modules.conf ] && \
|
||||||
|
[ $(KV_to_int "${KV}") -lt $(KV_to_int '2.5.48') -o -x /sbin/modprobe.old ]
|
||||||
|
then
|
||||||
|
echo '### This file is automatically generated by modules-update' \
|
||||||
|
> /etc/modules.conf 2>/dev/null
|
||||||
|
[ ! -f /etc/modules.conf ] && \
|
||||||
|
ewarn "Cannot update /etc/modules.conf!"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Only do this if we have modules.conf or a 2.6 kernel
|
||||||
|
if [ -z "${CDBOOT}" ] && \
|
||||||
|
[ -f /etc/modules.conf -o $(KV_to_int "${KV}") -ge $(KV_to_int '2.5.48') ]
|
||||||
|
then
|
||||||
|
/sbin/modules-update
|
||||||
|
fi
|
||||||
|
|
||||||
|
local auto=""
|
||||||
|
if [ -f /etc/modules.autoload -a ! -L /etc/modules.autoload ]; then
|
||||||
|
auto=/etc/modules.autoload
|
||||||
|
else
|
||||||
|
local x= f="/etc/modules.autoload.d/kernel"
|
||||||
|
for x in "${KV}" ${KV_MAJOR}.${KV_MINOR}.${KV_MICRO} ${KV_MAJOR}.${KV_MINOR} ; do
|
||||||
|
if [ -f "${f}-${x}.${RC_SOFTLEVEL}" ] ; then
|
||||||
|
auto="${f}-${x}.${RC_SOFTLEVEL}"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
if [ "${RC_SOFTLEVEL}" = "${RC_BOOTLEVEL}" -a -f "${f}-${x}.${RC_DEFAULTLEVEL}" ] ; then
|
||||||
|
auto="${f}-${x}.${RC_DEFAULTLEVEL}"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
if [ -f "${f}-${x}" ] ; then
|
||||||
|
auto="${f}-${x}"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
[ -n "${auto}" ] && load_modules "${auto}"
|
||||||
|
|
||||||
|
#
|
||||||
|
# Just in case a sysadmin prefers generic symbolic links in
|
||||||
|
# /lib/modules/boot for boot time modules we will load these modules
|
||||||
|
#
|
||||||
|
[ -n "$(modprobe -l -t boot)" ] && modprobe -a -t boot \* 2>/dev/null
|
||||||
|
|
||||||
|
# Above test clobbers the return
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# vim:ts=4
|
35
init.d.Linux/numlock
Executable file
35
init.d.Linux/numlock
Executable file
@ -0,0 +1,35 @@
|
|||||||
|
#!/sbin/runscript
|
||||||
|
# Copyright 1999-2007 Gentoo Foundation
|
||||||
|
# Distributed under the terms of the GNU General Public License v2
|
||||||
|
|
||||||
|
depend() {
|
||||||
|
need localmount
|
||||||
|
}
|
||||||
|
|
||||||
|
_setleds() {
|
||||||
|
[ -z "$1" ] && return 1
|
||||||
|
|
||||||
|
local dev=/dev/tty t= i=1 retval=0
|
||||||
|
[ -d /dev/vc ] && dev=/dev/vc/
|
||||||
|
|
||||||
|
while [ ${i} -le ${RC_TTY_NUMBER:-11} ] ; do
|
||||||
|
setleds -D "$1"num < ${dev}${i} || retval=1
|
||||||
|
i=$((${i} + 1))
|
||||||
|
done
|
||||||
|
|
||||||
|
return ${retval}
|
||||||
|
}
|
||||||
|
|
||||||
|
start() {
|
||||||
|
ebegin "Enabling numlock on ttys"
|
||||||
|
_setleds +
|
||||||
|
eend $? "Failed to enable numlock"
|
||||||
|
}
|
||||||
|
|
||||||
|
stop() {
|
||||||
|
ebegin "Disabling numlock on ttys"
|
||||||
|
_setleds -
|
||||||
|
eend $? "Failed to disable numlock"
|
||||||
|
}
|
||||||
|
|
||||||
|
# vim: set ts=4 :
|
42
init.d.Linux/volumes
Executable file
42
init.d.Linux/volumes
Executable file
@ -0,0 +1,42 @@
|
|||||||
|
#!/sbin/runscript
|
||||||
|
# Copyright 1999-2007 Gentoo Foundation
|
||||||
|
# Distributed under the terms of the GNU General Public License v2
|
||||||
|
|
||||||
|
VOLUME_ORDER=${VOLUME_ORDER:-${RC_VOLUME_ORDER:-raid evms lvm dm}}
|
||||||
|
|
||||||
|
# Dependancy information is in /etc/conf.d/volumes
|
||||||
|
|
||||||
|
start() {
|
||||||
|
local x=
|
||||||
|
|
||||||
|
# Start our volumes, RAID, LVM, etc
|
||||||
|
for x in ${VOLUME_ORDER} ; do
|
||||||
|
start_addon "${x}"
|
||||||
|
done
|
||||||
|
|
||||||
|
# Setup dm-crypt mappings if any
|
||||||
|
start_addon dm-crypt
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
stop() {
|
||||||
|
local x= rev=
|
||||||
|
|
||||||
|
# Stop dm-crypt mappings if any
|
||||||
|
stop_addon dm-crypt
|
||||||
|
stop_addon truecrypt
|
||||||
|
|
||||||
|
# Stop our volumes, RAID, LVM, etc
|
||||||
|
for x in ${VOLUME_ORDER} ; do
|
||||||
|
rev="${x} ${rev}"
|
||||||
|
done
|
||||||
|
|
||||||
|
for x in ${rev} ; do
|
||||||
|
stop_addon "${x}"
|
||||||
|
done
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# vim: set ts=4 :
|
6
init.d/Makefile
Normal file
6
init.d/Makefile
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
DIR = /etc/init.d
|
||||||
|
EXES = bootmisc checkfs checkroot hostname local localmount \
|
||||||
|
netmount rmnologin urandom halt.sh
|
||||||
|
|
||||||
|
TOPDIR = ..
|
||||||
|
include $(TOPDIR)/default.mk
|
138
init.d/bootmisc
Executable file
138
init.d/bootmisc
Executable file
@ -0,0 +1,138 @@
|
|||||||
|
#!/sbin/runscript
|
||||||
|
# Copyright 1999-2007 Gentoo Foundation
|
||||||
|
# Distributed under the terms of the GNU General Public License v2
|
||||||
|
|
||||||
|
depend() {
|
||||||
|
use hostname
|
||||||
|
need localmount
|
||||||
|
before logger
|
||||||
|
after clock sysctl
|
||||||
|
}
|
||||||
|
|
||||||
|
start() {
|
||||||
|
# Put a nologin file in /etc to prevent people from logging
|
||||||
|
# in before system startup is complete.
|
||||||
|
if [ "${DELAYLOGIN}" = "yes" ] ; then
|
||||||
|
echo "System bootup in progress - please wait" \
|
||||||
|
> /etc/nologin
|
||||||
|
cp /etc/nologin /etc/nologin.boot
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! touch -c /var/run 2> /dev/null ; then
|
||||||
|
ewarn "Skipping /var and /tmp initialization (ro root?)"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${RC_UNAME}" = "Linux" ] ; then
|
||||||
|
# Setup login records
|
||||||
|
> /var/run/utmp
|
||||||
|
touch /var/log/wtmp
|
||||||
|
chgrp utmp /var/run/utmp /var/log/wtmp
|
||||||
|
chmod 0664 /var/run/utmp /var/log/wtmp
|
||||||
|
fi
|
||||||
|
|
||||||
|
ebegin "Updating environment"
|
||||||
|
/sbin/env-update
|
||||||
|
eend $?
|
||||||
|
|
||||||
|
# Take care of random stuff [ /var/lock | /var/run | pam ]
|
||||||
|
ebegin "Cleaning" /var/lock, /var/run
|
||||||
|
rm -rf /var/run/console.lock /var/run/console/*
|
||||||
|
|
||||||
|
# Clean up any stale locks.
|
||||||
|
find /var/lock -type f -print0 | xargs -0 rm -f --
|
||||||
|
|
||||||
|
# Clean up /var/run and create /var/run/utmp so we can login.
|
||||||
|
for x in $(find /var/run ! -type d ! -name utmp ! -name innd.pid ! -name random-seed ! -name ld-elf.so.hints); do
|
||||||
|
[ ! -f "${x}" ] && continue
|
||||||
|
# Do not remove pidfiles of already running daemons
|
||||||
|
case "${x}" in
|
||||||
|
*.pid)
|
||||||
|
start-stop-daemon --test --quiet --stop --pidfile "${x}"
|
||||||
|
[ $? -eq 0 ] && continue
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
rm -f "${x}"
|
||||||
|
done
|
||||||
|
|
||||||
|
# Reset pam_console permissions if we are actually using it
|
||||||
|
if [ -x /sbin/pam_console_apply -a ! -c /dev/.devfsd ] ; then
|
||||||
|
if [ -n $(grep -v -e '^[[:space:]]*#' /etc/pam.d/* | grep 'pam_console') ] ; then
|
||||||
|
/sbin/pam_console_apply -r
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Create the .keep to stop portage from removing /var/lock
|
||||||
|
> /var/lock/.keep
|
||||||
|
eend 0
|
||||||
|
|
||||||
|
# Clean up /tmp directory
|
||||||
|
if [ -d /tmp ] ; then
|
||||||
|
cd /tmp
|
||||||
|
if [ "${WIPE_TMP}" = "yes" ] ; then
|
||||||
|
ebegin "Wiping /tmp directory"
|
||||||
|
local startopts="-x . -depth"
|
||||||
|
[ "${RC_UNAME}" = "Linux" ] && startopts=". -xdev -depth"
|
||||||
|
|
||||||
|
# Faster than find
|
||||||
|
rm -rf [b-ikm-pr-zA-Z]*
|
||||||
|
|
||||||
|
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/*" \
|
||||||
|
-delete
|
||||||
|
eend 0
|
||||||
|
else
|
||||||
|
ebegin "Cleaning /tmp directory"
|
||||||
|
rm -rf /tmp/.X*-lock /tmp/esrv* /tmp/kio* /tmp/jpsock.* \
|
||||||
|
/tmp/.fam* /tmp/.esd* /tmp/orbit-* /tmp/ssh-* \
|
||||||
|
/tmp/ksocket-* /tmp/.*-unix
|
||||||
|
eend 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Make sure our X11 stuff have the correct permissions
|
||||||
|
# Omit the chown as bootmisc is run before network is up
|
||||||
|
# and users may be using lame LDAP auth #139411
|
||||||
|
rm -rf /tmp/.ICE-unix /tmp/.X11-unix
|
||||||
|
mkdir -p /tmp/.ICE-unix /tmp/.X11-unix
|
||||||
|
chmod 1777 /tmp/.ICE-unix /tmp/.X11-unix
|
||||||
|
[ -x /sbin/restorecon ] && restorecon /tmp/.ICE-unix /tmp/.X11-unix
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Create an 'after-boot' dmesg log
|
||||||
|
touch /var/log/dmesg
|
||||||
|
chmod 640 /var/log/dmesg
|
||||||
|
dmesg > /var/log/dmesg
|
||||||
|
|
||||||
|
# Check for /etc/resolv.conf, and create if missing
|
||||||
|
[ -f /etc/resolv.conf ] || touch /etc/resolv.conf 2>/dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
stop() {
|
||||||
|
# Reset pam_console permissions if we are actually using it
|
||||||
|
if [ -x /sbin/pam_console_apply -a ! -c /dev/.devfsd ] && \
|
||||||
|
[ -n $(grep -v -e '^[[:space:]]*#' /etc/pam.d/* | grep 'pam_console') ] ; then
|
||||||
|
/sbin/pam_console_apply -r
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Write a halt record if we're shutting down
|
||||||
|
case "${SOFTLEVEL}" in
|
||||||
|
reboot|shutdown)
|
||||||
|
[ "${RC_UNAME}" = "Linux" ] && halt -w
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# vim: set ts=4 :
|
77
init.d/checkfs
Executable file
77
init.d/checkfs
Executable file
@ -0,0 +1,77 @@
|
|||||||
|
#!/sbin/runscript
|
||||||
|
# Copyright 1999-2007 Gentoo Foundation
|
||||||
|
# Distributed under the terms of the GNU General Public License v2
|
||||||
|
|
||||||
|
depend() {
|
||||||
|
need checkroot
|
||||||
|
use volumes
|
||||||
|
after modules
|
||||||
|
}
|
||||||
|
|
||||||
|
do_checkfs() {
|
||||||
|
local retval=0
|
||||||
|
|
||||||
|
ebegin "Checking all filesystems"
|
||||||
|
if [ "${RC_UNAME}" = "Linux" ] ; then
|
||||||
|
if get_bootparam "forcefsck" ; then
|
||||||
|
ewarn "A full fsck has been forced"
|
||||||
|
fsck -C0 -T -R -A -a -f
|
||||||
|
else
|
||||||
|
fsck -C0 -T -R -A -a
|
||||||
|
fi
|
||||||
|
retval=$?
|
||||||
|
else
|
||||||
|
local parts="$(fstabinfo --passno ">1")"
|
||||||
|
if [ -n "${parts}" ] ; then
|
||||||
|
fsck -p ${parts}
|
||||||
|
retval=$?
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if [ ${retval} -eq 0 ] ; then
|
||||||
|
eend 0
|
||||||
|
elif [ ${retval} -eq 1 ] ; then
|
||||||
|
ewend 1 "Filesystem errors corrected."
|
||||||
|
retval=0
|
||||||
|
elif [ ${retval} -eq 2 ] ; then
|
||||||
|
ewend 1 "System should be rebooted"
|
||||||
|
elif [ ${retval} -eq 8 ] ; then
|
||||||
|
ewend 1 "Operational error, continuing"
|
||||||
|
retval=0
|
||||||
|
else
|
||||||
|
if [ "${RC_FORCE_AUTO}" = "yes" ] ; then
|
||||||
|
eend 2 "Fsck could not correct all errors, rerunning"
|
||||||
|
if [ "${RC_UNAME}" = "Linux" ] ; then
|
||||||
|
fsck -C0 -T -R -A -y
|
||||||
|
else
|
||||||
|
fsck -y
|
||||||
|
fi
|
||||||
|
retval=$?
|
||||||
|
eend $?
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ${retval} -gt 3 ] ; then
|
||||||
|
eend 2 "Fsck could not correct all errors, manual repair needed"
|
||||||
|
if [ "${RC_SYS}" = "VPS" ] ; then
|
||||||
|
halt -f
|
||||||
|
elif [ -x /sbin/sulogin ] ; then
|
||||||
|
sulogin "${CONSOLE}"
|
||||||
|
else
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
return ${retval}
|
||||||
|
}
|
||||||
|
|
||||||
|
start() {
|
||||||
|
do_checkfs
|
||||||
|
}
|
||||||
|
|
||||||
|
stop() {
|
||||||
|
# fsck on shutdown if we need to
|
||||||
|
[ "${FSCK_SHUTDOWN}" = "yes" -a ! -f /forcefsck ] && do_checkfs
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# vim: set ts=4 :
|
149
init.d/checkroot
Executable file
149
init.d/checkroot
Executable file
@ -0,0 +1,149 @@
|
|||||||
|
#!/sbin/runscript
|
||||||
|
# Copyright 1999-2007 Gentoo Foundation
|
||||||
|
# Distributed under the terms of the GNU General Public License v2
|
||||||
|
|
||||||
|
do_mtab() {
|
||||||
|
# Don't create mtab if /etc is readonly
|
||||||
|
if ! touch /etc/mtab 2> /dev/null ; then
|
||||||
|
ewarn "Skipping /etc/mtab initialization" "(ro root?)"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Clear the existing mtab
|
||||||
|
> /etc/mtab
|
||||||
|
|
||||||
|
# Add the entry for / to mtab
|
||||||
|
mount -f /
|
||||||
|
|
||||||
|
# Don't list root more than once
|
||||||
|
grep -v "^[^ ]* / " /proc/mounts >> /etc/mtab
|
||||||
|
|
||||||
|
# Now make sure /etc/mtab have additional info (gid, etc) in there
|
||||||
|
local mnt= mnts="$(mountinfo | sed -e "s/^/'/g" -e "s/$/'/g")"
|
||||||
|
eval set -- ${mnts}
|
||||||
|
for mnt in "$@" ; do
|
||||||
|
if fstabinfo --mount-cmd "${mnt}" >/dev/null ; then
|
||||||
|
mount -f -o remount "${mnt}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# Remove stale backups
|
||||||
|
rm -f /etc/mtab~ /etc/mtab~~
|
||||||
|
}
|
||||||
|
|
||||||
|
start() {
|
||||||
|
local retval=0
|
||||||
|
|
||||||
|
# Don't bother doing a fsck on these
|
||||||
|
if [ -n "${CDBOOT}" ] || is_net_fs / || is_union_fs / ; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if touch /.test.$$ 2> /dev/null ; then
|
||||||
|
einfo "root filesystem is mounted read-write - skipping"
|
||||||
|
rm -f /.test.$$
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if get_bootparam "forcefsck" ; then
|
||||||
|
ebegin "Checking root filesystem (full fsck forced)"
|
||||||
|
if [ "${RC_UNAME}" = "Linux" ] ; then
|
||||||
|
fsck -C -a -f /
|
||||||
|
else
|
||||||
|
fsck -F /
|
||||||
|
fi
|
||||||
|
# /forcefsck isn't deleted because checkfs needs it.
|
||||||
|
# it'll be deleted in that script.
|
||||||
|
retval=$?
|
||||||
|
else
|
||||||
|
# Obey the fs_passno setting for / (see fstab(5))
|
||||||
|
# - find the / entry
|
||||||
|
# - make sure we have 6 fields
|
||||||
|
# - see if fs_passno is something other than 0
|
||||||
|
local pass=$(fstabinfo --passno /)
|
||||||
|
if [ ${pass:-0} != "0" ] ; then
|
||||||
|
ebegin "Checking root filesystem"
|
||||||
|
if [ "${RC_UNAME}" = "Linux" ] ; then
|
||||||
|
fsck -C -T -a /
|
||||||
|
else
|
||||||
|
fsck -p -F /
|
||||||
|
fi
|
||||||
|
retval=$?
|
||||||
|
else
|
||||||
|
ebegin "Skipping root filesystem check" "(fstab's passno == 0)"
|
||||||
|
retval=0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ${retval} -eq 0 ] ; then
|
||||||
|
eend 0
|
||||||
|
elif [ ${retval} -eq 1 ] ; then
|
||||||
|
ewend 1 "Filesystem repaired"
|
||||||
|
retval=0
|
||||||
|
elif [ ${retval} -eq 8 ] ; then
|
||||||
|
ewend 1 $"Operational error, continuing"
|
||||||
|
retval=0
|
||||||
|
elif [ ${retval} -eq 2 -o ${retval} -eq 3 ] ; then
|
||||||
|
ewend 1 "Filesystem repaired, but reboot needed!"
|
||||||
|
if [ "${RC_FORCE_AUTO}" != "yes" ] ; then
|
||||||
|
printf "\a"; sleep 1; printf "\a"; sleep 1
|
||||||
|
printf "\a"; sleep 1; printf "\a"; sleep 1
|
||||||
|
ewarn "Rebooting in 10 seconds ..."
|
||||||
|
sleep 10
|
||||||
|
fi
|
||||||
|
einfo "Rebooting"
|
||||||
|
/sbin/reboot -f
|
||||||
|
else
|
||||||
|
if [ "${RC_FORCE_AUTO}" = "yes" ] ; then
|
||||||
|
eend 2 "Rerunning fsck in force mode"
|
||||||
|
if [ "${RC_UNAME}" = "Linux" ] ; then
|
||||||
|
fsck -y -C -T /
|
||||||
|
else
|
||||||
|
fsck -y /
|
||||||
|
fi
|
||||||
|
retval=$?
|
||||||
|
else
|
||||||
|
eend 2 "Filesystem couldn't be fixed :("
|
||||||
|
[ "${RC_UNAME}" = "Linux" ] || return 1
|
||||||
|
sulogin "${CONSOLE}"
|
||||||
|
fi
|
||||||
|
if [ ${retval} != "0" ] ; then
|
||||||
|
einfo "Unmounting filesystems"
|
||||||
|
if [ "${RC_UNAME}" = "Linux" ] ; then
|
||||||
|
mount -a -o remount,ro /
|
||||||
|
else
|
||||||
|
mount -u -o ro /
|
||||||
|
fi
|
||||||
|
einfo "Rebooting"
|
||||||
|
reboot -f
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
ebegin "Remounting root filesystem read/write"
|
||||||
|
if [ "${RC_UNAME}" = "Linux" ] ; then
|
||||||
|
mount -n -o remount,rw /
|
||||||
|
else
|
||||||
|
mount -u -o rw /
|
||||||
|
fi
|
||||||
|
eend $? "Root filesystem could not be mounted read/write :(" || return 1
|
||||||
|
|
||||||
|
# Only Linux has mtab
|
||||||
|
[ "${RC_UNAME}" = "Linux" ] && do_mtab
|
||||||
|
|
||||||
|
# If the user's /dev/null or /dev/console are missing, we
|
||||||
|
# should help them out and explain how to rectify the situation
|
||||||
|
if [ ! -c /dev/null -o ! -c /dev/console ] ; then
|
||||||
|
if [ -e /usr/share/baselayout/issue.devfix ] ; then
|
||||||
|
# Backup current /etc/issue
|
||||||
|
if [ -e /etc/issue -a ! -e /etc/issue.devfix ] ; then
|
||||||
|
mv -f /etc/issue /etc/issue.devfix
|
||||||
|
fi
|
||||||
|
cp -f /usr/share/baselayout/issue.devfix /etc/issue
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# We got here, so return 0
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# vim: set ts=4 :
|
94
init.d/halt.sh
Executable file
94
init.d/halt.sh
Executable file
@ -0,0 +1,94 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# Copyright 1999-2007 Gentoo Foundation
|
||||||
|
# Distributed under the terms of the GNU General Public License v2
|
||||||
|
|
||||||
|
. /etc/init.d/functions.sh
|
||||||
|
. "${RC_LIBDIR}"/sh/rc-functions.sh
|
||||||
|
|
||||||
|
# Support LiveCD foo
|
||||||
|
if [ -r /sbin/livecd-functions.sh ] ; then
|
||||||
|
. /sbin/livecd-functions.sh
|
||||||
|
livecd_read_commandline
|
||||||
|
fi
|
||||||
|
|
||||||
|
stop_addon devfs
|
||||||
|
stop_addon udev
|
||||||
|
|
||||||
|
# Flush all pending disk writes now
|
||||||
|
sync ; sync
|
||||||
|
|
||||||
|
# If we are in a VPS, we don't need anything below here, because
|
||||||
|
# 1) we don't need (and by default can't) umount anything (VServer) or
|
||||||
|
# 2) the host utils take care of all umounting stuff (OpenVZ)
|
||||||
|
if [ "${RC_SYS}" = "VPS" ] ; then
|
||||||
|
if [ -e /etc/init.d/"$1".sh ] ; then
|
||||||
|
. /etc/init.d/"$1".sh
|
||||||
|
else
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# If $svcdir is still mounted, preserve it if we can
|
||||||
|
if mountinfo "${RC_SVCDIR}" >/dev/null && [ -w "${RC_LIBDIR}" ] ; then
|
||||||
|
f_opts="-m -c"
|
||||||
|
[ "${RC_UNAME}" = "Linux" ] && f_opts="-c"
|
||||||
|
if [ -n "$(fuser ${f_opts} "${svcdir}" 2>/dev/null)" ] ; then
|
||||||
|
fuser -k ${f_opts} "${svcdir}" 1>/dev/null 2>/dev/null
|
||||||
|
sleep 2
|
||||||
|
fi
|
||||||
|
cp -p "${RC_SVCDIR}"/deptree "${RC_SVCDIR}"/softlevel \
|
||||||
|
"${RC_SVCDIR}"/nettree "${RC_LIBDIR}" 2>/dev/null
|
||||||
|
umount "${RC_SVCDIR}"
|
||||||
|
rm -rf "${RC_SVCDIR}"/*
|
||||||
|
# Pipe errors to /dev/null as we may have future timestamps
|
||||||
|
cp -p "${RC_LIBDIR}"/deptree "${RC_LIBDIR}"/softlevel \
|
||||||
|
"${RC_LIBDIR}"/nettree "${RC_SVCDIR}" 2>/dev/null
|
||||||
|
rm -f "${RC_LIBDIR}"/deptree "${RC_LIBDIR}"/softlevel \
|
||||||
|
"${RC_LIBDIR}"/nettree
|
||||||
|
# Release the memory disk if we used it
|
||||||
|
case "${mnt}" in
|
||||||
|
"/dev/md"[0-9]*) mdconfig -d -u "${mnt#/dev/md*}" ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
unmounted=0
|
||||||
|
# Remount the remaining filesystems read-only
|
||||||
|
if [ "${RC_UNAME}" != "FreeBSD" ] ; then
|
||||||
|
ebegin "Remounting remaining filesystems read-only"
|
||||||
|
# We need the do_unmount function
|
||||||
|
. "${RC_LIBDIR}"/sh/rc-mount.sh
|
||||||
|
eindent
|
||||||
|
do_unmount "mount -n -o remount,ro" "^(/dev|/dev/pts|/dev/shm|/proc|/proc/.*|/sys)$"
|
||||||
|
eoutdent
|
||||||
|
eend $?
|
||||||
|
unmounted=$?
|
||||||
|
fi
|
||||||
|
|
||||||
|
# This UPS code should be moved to out of here and to an addon
|
||||||
|
if [ -f /etc/killpower ] ; then
|
||||||
|
UPS_CTL=/sbin/upsdrvctl
|
||||||
|
UPS_POWERDOWN="${UPS_CTL} shutdown"
|
||||||
|
elif [ -f /etc/apcupsd/powerfail ] ; then
|
||||||
|
UPS_CTL=/etc/apcupsd/apccontrol
|
||||||
|
UPS_POWERDOWN="${UPS_CTL} killpower"
|
||||||
|
fi
|
||||||
|
if [ -x "${UPS_CTL}" ] ; then
|
||||||
|
ewarn "Signalling ups driver(s) to kill the load!"
|
||||||
|
${UPS_POWERDOWN}
|
||||||
|
ewarn "Halt system and wait for the UPS to kill our power"
|
||||||
|
halt -id
|
||||||
|
sleep 60
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ${unmounted} -ne 0 ] ; then
|
||||||
|
[ -x /sbin/sulogin ] && sulogin -t 10 /dev/console
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Load the final script - not needed on BSD so they should not exist
|
||||||
|
[ -e /etc/init.d/"$1".sh ] && . /etc/init.d/"$1".sh
|
||||||
|
|
||||||
|
# Always exit 0 here
|
||||||
|
exit 0
|
||||||
|
|
||||||
|
# vim: set ts=4 :
|
20
init.d/hostname
Executable file
20
init.d/hostname
Executable file
@ -0,0 +1,20 @@
|
|||||||
|
#!/sbin/runscript
|
||||||
|
# Copyright 1999-2007 Gentoo Foundation
|
||||||
|
# Distributed under the terms of the GNU General Public License v2
|
||||||
|
|
||||||
|
depend() {
|
||||||
|
need checkroot
|
||||||
|
}
|
||||||
|
|
||||||
|
start() {
|
||||||
|
if [ -f /etc/hostname ] ; then
|
||||||
|
ewarn "You should stop using /etc/hostname and use /etc/conf.d/hostname"
|
||||||
|
HOSTNAME=$(cat /etc/hostname)
|
||||||
|
fi
|
||||||
|
|
||||||
|
ebegin "Setting hostname to ${HOSTNAME}"
|
||||||
|
hostname "${HOSTNAME}"
|
||||||
|
eend $? "Failed to set the hostname"
|
||||||
|
}
|
||||||
|
|
||||||
|
# vim: ts=4 :
|
34
init.d/local
Executable file
34
init.d/local
Executable file
@ -0,0 +1,34 @@
|
|||||||
|
#!/sbin/runscript
|
||||||
|
# Copyright 1999-2007 Gentoo Foundation
|
||||||
|
# Distributed under the terms of the GNU General Public License v2
|
||||||
|
|
||||||
|
depend() {
|
||||||
|
after *
|
||||||
|
}
|
||||||
|
|
||||||
|
start() {
|
||||||
|
ebegin "Starting local"
|
||||||
|
|
||||||
|
# Add any misc programs that should be started
|
||||||
|
# to /etc/conf.d/local.start
|
||||||
|
if [ -e /etc/conf.d/local.start ] ; then
|
||||||
|
. /etc/conf.d/local.start
|
||||||
|
fi
|
||||||
|
|
||||||
|
eend $? "Failed to start local"
|
||||||
|
}
|
||||||
|
|
||||||
|
stop() {
|
||||||
|
ebegin "Stopping local"
|
||||||
|
|
||||||
|
# Add any misc programs that should be stopped
|
||||||
|
# to /etc/conf.d/local.stop
|
||||||
|
if [ -e /etc/conf.d/local.stop ] ; then
|
||||||
|
. /etc/conf.d/local.stop
|
||||||
|
fi
|
||||||
|
|
||||||
|
eend $? $"Failed to stop local"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# vim:ts=4
|
183
init.d/localmount
Executable file
183
init.d/localmount
Executable file
@ -0,0 +1,183 @@
|
|||||||
|
#!/sbin/runscript
|
||||||
|
# Copyright 1999-2007 Gentoo Foundation
|
||||||
|
# Distributed under the terms of the GNU General Public License v2
|
||||||
|
|
||||||
|
depend() {
|
||||||
|
need checkfs
|
||||||
|
}
|
||||||
|
|
||||||
|
start() {
|
||||||
|
# Mount local filesystems in /etc/fstab.
|
||||||
|
local types="noproc" x=
|
||||||
|
for x in ${RC_NET_FS_LIST} ; do
|
||||||
|
types="${types},${x}"
|
||||||
|
done
|
||||||
|
|
||||||
|
ebegin "Mounting local filesystems"
|
||||||
|
mount -at "${types}"
|
||||||
|
eend $? "Some local filesystem failed to mount"
|
||||||
|
|
||||||
|
# Change the mount options of already mounted paritions
|
||||||
|
# This is needed when /usr is separate and coming back from single user
|
||||||
|
if [ "${RC_UNAME}" != "Linux" ] ; then
|
||||||
|
mount -uao fstab -t "${types},linprocfs"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -x /sbin/savecore ] ; then
|
||||||
|
local dumpdir=${KERNEL_DUMP_DIR:-/var/crash}
|
||||||
|
if ! [ -d "${dumpdir}" ]; then
|
||||||
|
mkdir -p "${dumpdir}"
|
||||||
|
chmod 700 "${dumpdir}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Don't quote ${KERNEL_DUMP_DEVICE}, so that if it's unset, savecore
|
||||||
|
# will check on the partitions listed in fstab without errors in the
|
||||||
|
# output
|
||||||
|
if savecore -C "${dumpdir}" ${KERNEL_DUMP_DEVICE} >/dev/null ; then
|
||||||
|
local savecoreopts="${dumpdir} ${KERNEL_DUMP_DEVICE}"
|
||||||
|
[ "${KERNEL_DUMP_COMPRESS}" = "yes" ] \
|
||||||
|
&& savecoreopts="-z ${savecoreopts}"
|
||||||
|
ebegin "Saving kernel core dump in" "${dumpdir}"
|
||||||
|
savecore ${savecoreopts} >/dev/null
|
||||||
|
eend $?
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Sync bootlog now as /var should be mounted
|
||||||
|
if type bootlog >/dev/null 2>/dev/null ; then
|
||||||
|
bootlog sync 2>/dev/null
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Make sure we insert usbcore if its a module
|
||||||
|
if [ -f /proc/modules -a ! -d /proc/bus/usb ] ; then
|
||||||
|
# >/dev/null to hide errors from non-USB users
|
||||||
|
modprobe usbcore &> /dev/null
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -e /proc/filessystems ] ; then
|
||||||
|
# Check what USB fs the kernel support. Currently
|
||||||
|
# 2.5+ kernels, and later 2.4 kernels have 'usbfs',
|
||||||
|
# while older kernels have 'usbdevfs'.
|
||||||
|
if [ -d /proc/bus/usb -a ! -e /proc/bus/usb/devices ] ; then
|
||||||
|
local usbfs=$(grep -Fow usbfs /proc/filesystems ||
|
||||||
|
grep -Fow usbdevfs /proc/filesystems)
|
||||||
|
|
||||||
|
if [ -n "${usbfs}" ] ; then
|
||||||
|
ebegin $"Mounting USB device filesystem" "(${usbfs})"
|
||||||
|
local usbgid="$(getent group usb | \
|
||||||
|
sed -e 's/.*:.*:\(.*\):.*/\1/')"
|
||||||
|
mount -t ${usbfs} \
|
||||||
|
-o ${usbgid:+devmode=0664,devgid=${usbgid},}noexec,nosuid \
|
||||||
|
usbfs /proc/bus/usb
|
||||||
|
eend $?
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Setup Kernel Support for miscellaneous Binary Formats
|
||||||
|
if [ -d /proc/sys/fs/binfmt_misc ] ; then
|
||||||
|
if [ -n "$(grep -Fow binfmt_misc /proc/filesystems)" ] ; then
|
||||||
|
ebegin "Mounting misc binary format filesystem"
|
||||||
|
mount -t binfmt_misc -o nodev,noexec,nosuid \
|
||||||
|
binfmt_misc /proc/sys/fs/binfmt_misc
|
||||||
|
eend $?
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if [ -d /sys/kernel/security ] ; then
|
||||||
|
if [ -n "$(grep -Fow securityfs /proc/filesystems)" ] ; then
|
||||||
|
ebegin "Mounting security filesystem"
|
||||||
|
mount -t securityfs securityfs /sys/kernel/security \
|
||||||
|
-o nodev,noexec,nosuid
|
||||||
|
eend $?
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# We do our swapping here instead of rc so we can get urandom started
|
||||||
|
# before us for people that like an encrypted swap.
|
||||||
|
ebegin "Activating (possible) swap"
|
||||||
|
swapon -a >/dev/null
|
||||||
|
eend 0 # If swapon has nothing todo it errors, so always return 0
|
||||||
|
|
||||||
|
# Start dm-crypt mappings, if any
|
||||||
|
start_addon dm-crypt
|
||||||
|
|
||||||
|
# Setup any user requested dump device
|
||||||
|
if [ -x /sbin/dumpon -a -n "${KERNEL_DUMP_DEVICE}" ] ; then
|
||||||
|
ebegin "Activating kernel core dump device" "(${KERNEL_DUMP_DEVICE})"
|
||||||
|
dumpon "${KERNEL_DUMP_DEVICE}"
|
||||||
|
eend $?
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Always return 0 - some local mounts may not be critical for boot
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
stop() {
|
||||||
|
# Don't unmount anything for VPS systems
|
||||||
|
[ "${RC_SYS}" = "VPS" ] && return 0
|
||||||
|
|
||||||
|
# We never unmount / or /dev or $RC_LIBDIR
|
||||||
|
local x= no_umounts="/|/dev|${RC_SVCDIR}"
|
||||||
|
|
||||||
|
# NO_UMOUNTS is taken from /etc/conf.d/localmount
|
||||||
|
# RC_NO_UMOUNTS is taken from /etc/conf.d/rc and can also be
|
||||||
|
# set by plugins
|
||||||
|
local OIFS=$IFS SIFS=${IFS-y}
|
||||||
|
IFS=$IFS:
|
||||||
|
for x in ${NO_UMOUNTS} ${RC_NO_UMOUNTS} ; do
|
||||||
|
no_umounts="${no_umounts}|${x}"
|
||||||
|
done
|
||||||
|
if [ "${SIFS}" = "y" ] ; then
|
||||||
|
IFS=$OIFS
|
||||||
|
else
|
||||||
|
unset IFS
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${RC_UNAME}" = "Linux" ] ; then
|
||||||
|
no_umounts="${no_umounts}|/dev/pts|/dev/shm|/proc|/proc/.*|/sys"
|
||||||
|
fi
|
||||||
|
no_umounts="^(${no_umounts})$"
|
||||||
|
|
||||||
|
# Flush all pending disk writes now
|
||||||
|
sync ; sync
|
||||||
|
|
||||||
|
# Try to unmount all tmpfs filesystems not in use, else a deadlock may
|
||||||
|
# occure, bug #13599.
|
||||||
|
# As $RC_SVCDIR may also be tmpfs we cd to it to lock it
|
||||||
|
cd "${RC_SVCDIR}"
|
||||||
|
umount -a -t tmpfs 2>/dev/null
|
||||||
|
|
||||||
|
# As we're turning off swap below, we need to disable kernel dumps
|
||||||
|
[ -x /sbin/dumpon ] && dumpon off
|
||||||
|
|
||||||
|
local swap_list=
|
||||||
|
# Turn off swap
|
||||||
|
if [ -r /proc/swaps ] ;then
|
||||||
|
swap_list=$(sed -e '1d' /proc/swaps)
|
||||||
|
else
|
||||||
|
swap_list=$(swapctl -l 2>/dev/null | sed -e '1d')
|
||||||
|
fi
|
||||||
|
if [ -n "${swap_list}" ] ; then
|
||||||
|
ebegin "Deactivating swap"
|
||||||
|
swapoff -a >/dev/null
|
||||||
|
eend $?
|
||||||
|
fi
|
||||||
|
|
||||||
|
. "${RC_LIBDIR}"/sh/rc-mount.sh
|
||||||
|
|
||||||
|
# Umount loopback devices
|
||||||
|
einfo "Unmounting loopback devices"
|
||||||
|
eindent
|
||||||
|
do_unmount "umount -d" "${no_umounts}" "^/dev/loop"
|
||||||
|
eoutdent
|
||||||
|
|
||||||
|
# Now everything else
|
||||||
|
einfo "Unmounting filesystems"
|
||||||
|
eindent
|
||||||
|
do_unmount "umount" "${no_umounts}"
|
||||||
|
eoutdent
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# vim: set ts=4 :
|
85
init.d/netmount
Executable file
85
init.d/netmount
Executable file
@ -0,0 +1,85 @@
|
|||||||
|
#!/sbin/runscript
|
||||||
|
# Copyright 1999-2007 Gentoo Foundation
|
||||||
|
# Distributed under the terms of the GNU General Public License v2
|
||||||
|
|
||||||
|
have_nfs() {
|
||||||
|
local IFS=\n x=
|
||||||
|
set -- $(fstabinfo --fstype nfs,nfs4)
|
||||||
|
for x in "$@" ; do
|
||||||
|
! fstabinfo --opts "${x}" | grep -q noauto && return 0
|
||||||
|
done
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
depend() {
|
||||||
|
local myneed= myuse= pmap="portmap" nfsmounts= x
|
||||||
|
[ -x /etc/init.d/rpcbind ] && pmap="rpcbind"
|
||||||
|
|
||||||
|
# Only have Portmap as a dependency if there is a nfs mount in fstab that
|
||||||
|
# is set to mount at boot
|
||||||
|
if have_nfs ; then
|
||||||
|
myneed="${myneed} ${pmap}"
|
||||||
|
else
|
||||||
|
myuse="${myuse} ${pmap}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
need net ${myneed}
|
||||||
|
use afc-client amd autofs dns nfs nfsmount ${myuse}
|
||||||
|
}
|
||||||
|
|
||||||
|
start() {
|
||||||
|
local myneed= myuse= pmap="portmap" nfsmounts=
|
||||||
|
[ -x /etc/init.d/rpcbind ] && pmap="rpcbind"
|
||||||
|
|
||||||
|
local x= fs=
|
||||||
|
for x in ${RC_NET_FS_LIST} ; do
|
||||||
|
case "${x}" in
|
||||||
|
nfs|nfs4)
|
||||||
|
# If the nfsmount script took care of the nfs filesystems,
|
||||||
|
# then there's no point in trying them twice
|
||||||
|
service_started nfsmount && continue
|
||||||
|
|
||||||
|
# Only try to mount NFS filesystems if portmap was started.
|
||||||
|
# This is to fix "hang" problems for new users who do not
|
||||||
|
# add portmap to the default runlevel.
|
||||||
|
if have_nfs && ! service_started "${pmap}" ; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fs="${fs}${fs:+,}${x}"
|
||||||
|
done
|
||||||
|
|
||||||
|
ebegin "Mounting network filesystems"
|
||||||
|
mount -at ${fs}
|
||||||
|
ewend $? "Could not mount all network filesystems!"
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
stop() {
|
||||||
|
local x= fs=
|
||||||
|
for x in ${RC_NET_FS_LIST} ; do
|
||||||
|
fs="${fs}${fs:+,}${x}"
|
||||||
|
done
|
||||||
|
|
||||||
|
ebegin "Unmounting network filesystems"
|
||||||
|
umount -at ${fs}
|
||||||
|
local retval=$?
|
||||||
|
eend ${retval} "Failed to simply unmount filesystems"
|
||||||
|
|
||||||
|
if [ ${retval} -ne 0 ] ; then
|
||||||
|
. "${RC_SVCLIB}/sh/rc-mount.sh"
|
||||||
|
eindent
|
||||||
|
fs=
|
||||||
|
for x in ${RC_NET_FS_LIST} ; do
|
||||||
|
fs="${fs:+|}${x}"
|
||||||
|
done
|
||||||
|
do_unmount "umount" "" "" "^(${fs})$"
|
||||||
|
retval=$?
|
||||||
|
eoutent
|
||||||
|
fi
|
||||||
|
|
||||||
|
return ${retval}
|
||||||
|
}
|
||||||
|
|
||||||
|
# vim: set ts=4 :
|
16
init.d/rmnologin
Executable file
16
init.d/rmnologin
Executable file
@ -0,0 +1,16 @@
|
|||||||
|
#!/sbin/runscript
|
||||||
|
# Copyright 1999-2007 Gentoo Foundation
|
||||||
|
# Distributed under the terms of the GNU General Public License v2
|
||||||
|
|
||||||
|
depend() {
|
||||||
|
need localmount
|
||||||
|
}
|
||||||
|
|
||||||
|
start() {
|
||||||
|
if [ -f /etc/nologin.boot ] ; then
|
||||||
|
rm -f /etc/nologin /etc/nologin.boot
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# vim:ts=4
|
34
init.d/urandom
Executable file
34
init.d/urandom
Executable file
@ -0,0 +1,34 @@
|
|||||||
|
#!/sbin/runscript
|
||||||
|
# Copyright 1999-2007 Gentoo Foundation
|
||||||
|
# Distributed under the terms of the GNU General Public License v2
|
||||||
|
|
||||||
|
depend() {
|
||||||
|
need localmount
|
||||||
|
}
|
||||||
|
|
||||||
|
start() {
|
||||||
|
[ -c /dev/urandom ] || return
|
||||||
|
if [ -f /var/run/random-seed ] ; then
|
||||||
|
cat /var/run/random-seed > /dev/urandom
|
||||||
|
fi
|
||||||
|
if ! rm -f /var/run/random-seed ; then
|
||||||
|
ewarn "Skipping /var/run/random-seed initialization (ro root?)"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
ebegin "Initializing random number generator"
|
||||||
|
umask 077
|
||||||
|
dd if=/dev/urandom of=/var/run/random-seed count=1 2>/dev/null
|
||||||
|
eend $? "Error initializing random number generator"
|
||||||
|
umask 022
|
||||||
|
}
|
||||||
|
|
||||||
|
stop() {
|
||||||
|
ebegin "Saving random seed"
|
||||||
|
# Carry a random seed from shut-down to start-up;
|
||||||
|
# see documentation in linux/drivers/char/random.c
|
||||||
|
umask 077
|
||||||
|
dd if=/dev/urandom of=/var/run/random-seed count=1 2>/dev/null
|
||||||
|
eend $? "Failed to save random seed"
|
||||||
|
}
|
||||||
|
|
||||||
|
# vim:ts=4
|
5
man.Linux/Makefile
Normal file
5
man.Linux/Makefile
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
DIR = /usr/share/man
|
||||||
|
MANS = modules.autoload.5
|
||||||
|
|
||||||
|
TOPDIR = ..
|
||||||
|
include $(TOPDIR)/default.mk
|
19
man.Linux/modules.autoload.5
Normal file
19
man.Linux/modules.autoload.5
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
.TH MODULES.AUTOLOAD 5 "Gentoo Linux" "Nov 2001"
|
||||||
|
.SH NAME
|
||||||
|
\fI/etc/modules.autoload\fR - kernel modules to load at boot time
|
||||||
|
.SH DESCRIPTION
|
||||||
|
.PP
|
||||||
|
The \fI/etc/modules.autoload\fR
|
||||||
|
file contains the names of kernel modules that are to be loaded at boot
|
||||||
|
time, one per line. Arguments can be given on the same line as the module
|
||||||
|
name. Comments begin with a `#', and everything on the line after it is
|
||||||
|
ignored. This file is read by the \fI/etc/init.d/modules\fR initscript,
|
||||||
|
which is usually linked in the \fI/etc/runlevels/boot\fR directory.
|
||||||
|
.SH "SEE ALSO"
|
||||||
|
.BR modules-update (8),
|
||||||
|
.BR modprobe (8),
|
||||||
|
.BR modules.conf (5)
|
||||||
|
.TP
|
||||||
|
The \fI/sbin/modules-update\fR script.
|
||||||
|
.TP
|
||||||
|
The files in \fI/etc/modules.d\fR.
|
5
man/Makefile
Normal file
5
man/Makefile
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
DIR = /usr/share/man
|
||||||
|
MANS = rc-depend.8 rc-status.8 rc-update.8 start-stop-daemon.8
|
||||||
|
|
||||||
|
TOPDIR = ..
|
||||||
|
include $(TOPDIR)/default.mk
|
73
man/rc-depend.8
Normal file
73
man/rc-depend.8
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
.TH "BASELAYOUT" "8" "March 2007" "baselayout" "baselayout"
|
||||||
|
.SH NAME
|
||||||
|
rc-depend \ - resolve init script dependencies
|
||||||
|
.SH SYNOPSIS
|
||||||
|
\fBrc-depend\fR \fI-ineed\fR \fI-iuse\fR \fIservice\fR ...
|
||||||
|
.br
|
||||||
|
\fBrc-depend\fR \fI--notrace\fR \fI-iprovide\fR \fIservice\fR ...
|
||||||
|
.br
|
||||||
|
\fBrc-depend\fR \fI-needsme\fR \fIservice\fR ...
|
||||||
|
.br
|
||||||
|
\fBrc-depend\fR \fI--update\fR
|
||||||
|
.SH DESCRIPTION
|
||||||
|
Gentoos init system uses service dependencies to depend on other services.
|
||||||
|
Rather than just starting in a set order, we start and stop in the order
|
||||||
|
defined by the services themselves.
|
||||||
|
For example, most services require local disks to be mounted and as such can
|
||||||
|
depend on the localmount service. Others depend on and net and dns and will
|
||||||
|
only start when those dependencies have been satisfied.
|
||||||
|
|
||||||
|
One issue of note is that a service can provide another service, which is more
|
||||||
|
generic. A good example of this is that net.lo and any service linked to it
|
||||||
|
provide "net", which a few services depend on. You can of course have a few
|
||||||
|
network interfaces: modern laptops have 3 being loopback, wired and wireless.
|
||||||
|
What makes this more interesting is that it could be setup so that both wired
|
||||||
|
and wireless are optional. So we work out provided services like so :-
|
||||||
|
|
||||||
|
1) Always use any services in the runlevel.
|
||||||
|
.br
|
||||||
|
2) If no services are defined in the runlevel then use any running services
|
||||||
|
that satisfy the provide.
|
||||||
|
.br
|
||||||
|
3) Append any services in the boot runlevel.
|
||||||
|
|
||||||
|
\fBrc-order\fR is primarily used internally by Gentoo and is not meant as an
|
||||||
|
end-user or admin tool. This man page is purely to describe its function.
|
||||||
|
.SH OPTIONS
|
||||||
|
.TP
|
||||||
|
\fB--deptree \fIdeptree\fR
|
||||||
|
Use this \fIdeptree\fR instead of the default one,
|
||||||
|
\fI/lib/rcscripts/init.d/deptree\fR.
|
||||||
|
.TP
|
||||||
|
\fB--notrace\fR
|
||||||
|
Just show the dependencies for the specified services without working out
|
||||||
|
anything extra.
|
||||||
|
.TP
|
||||||
|
\fB--strict\fR
|
||||||
|
For provided services, depend on all of them in the runlevel instead of just
|
||||||
|
ones that are started.
|
||||||
|
.TP
|
||||||
|
\fB--update\fR
|
||||||
|
Force an update of the dependency tree. Normally this is not needed as we
|
||||||
|
automatically update the dependency tree if any files in /etc/init.d or
|
||||||
|
/etc/conf.d are newer than the tree.
|
||||||
|
.TP
|
||||||
|
\fB-dependency_type\fR
|
||||||
|
Work with the specified dependency type, such as \fIineed\fR, \fIiafter\fR,
|
||||||
|
\fIneedsme\fR.
|
||||||
|
If none are supplied we default to \fIineed\fR and \fIiuse\fR.
|
||||||
|
.SH NOTES
|
||||||
|
When needsme depends on a provided service, like net, we don't do any
|
||||||
|
mapping to an actual service unless it's the last one up. So if net.lo and
|
||||||
|
net.eth0 are started then neither are returned. If net.eth0 then stops then
|
||||||
|
every service that needs net then has net.lo in its needsme list so that
|
||||||
|
we net.lo stops it brings down all services that depend on net.
|
||||||
|
.SH BUGS
|
||||||
|
Provided services are calculated at runtime. The current downside of this
|
||||||
|
approach means that if you do "after net; before net.lo" and net.lo provides
|
||||||
|
net then you can get into an sticky loop where services hang.
|
||||||
|
.SH "REPORTING BUGS"
|
||||||
|
Please report bugs via http://bugs.gentoo.org/
|
||||||
|
.SH "SEE ALSO"
|
||||||
|
.BR rc-update (8),
|
||||||
|
.BR rc-status (8)
|
37
man/rc-status.8
Normal file
37
man/rc-status.8
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
.TH "BASELAYOUT" "8" "May 2004" "baselayout" "baselayout"
|
||||||
|
.SH NAME
|
||||||
|
rc-status \- show status info about runlevels
|
||||||
|
.SH SYNOPSIS
|
||||||
|
\fBrc-status\fR \fI[command [runlevel]]\fR
|
||||||
|
.SH DESCRIPTION
|
||||||
|
\fBrc-status\fR gathers and displays information about the status of init
|
||||||
|
scripts in different runlevels. The default behavior is to show information
|
||||||
|
about the current runlevel, but any runlevel can be quickly examined.
|
||||||
|
directory. They must also conform to the Gentoo runscript standard.
|
||||||
|
.SH OPTIONS
|
||||||
|
.TP
|
||||||
|
\fB\-\-all (\-a)\fR
|
||||||
|
Show all runlevels and their services
|
||||||
|
.TP
|
||||||
|
\fB\-\-list (\-l)\fR
|
||||||
|
List all defined runlevels
|
||||||
|
.TP
|
||||||
|
\fB\-\-nocolor (\-nc)\fR
|
||||||
|
Disable color output
|
||||||
|
.TP
|
||||||
|
\fB\-\-servicelist (\-s)\fR
|
||||||
|
Show all services
|
||||||
|
.TP
|
||||||
|
\fB\-\-unused (\-u)\fR
|
||||||
|
Show services not assigned to any runlevel
|
||||||
|
.TP
|
||||||
|
\fB[runlevel]\fR
|
||||||
|
Show information only for the named \fBrunlevel\fR
|
||||||
|
.SH "REPORTING BUGS"
|
||||||
|
Please report bugs via http://bugs.gentoo.org/
|
||||||
|
.SH "SEE ALSO"
|
||||||
|
.BR rc-update (8)
|
||||||
|
|
||||||
|
http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=2&chap=4
|
||||||
|
.SH AUTHORS
|
||||||
|
Mike Frysinger <vapier@gentoo.org>
|
43
man/rc-update.8
Normal file
43
man/rc-update.8
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
.TH "BASELAYOUT" "8" "May 2004" "baselayout" "baselayout"
|
||||||
|
.SH NAME
|
||||||
|
rc-update \- add and remove init scripts to a runlevel
|
||||||
|
.SH SYNOPSIS
|
||||||
|
\fBrc-update\fR \fIadd\fR \fIscript\fR \fI<runlevels>\fR
|
||||||
|
.br
|
||||||
|
\fBrc-update\fR \fIdel\fR \fIscript\fR \fI[runlevels]\fR
|
||||||
|
.br
|
||||||
|
\fBrc-update\fR \fIshow\fR \fI[\-\-verbose]\fR \fI[runlevels]\fR
|
||||||
|
.SH DESCRIPTION
|
||||||
|
Gentoo's init system uses named runlevels. Rather than editing some obscure
|
||||||
|
file or managing a directory of symlinks, \fBrc-update\fR exists to quickly
|
||||||
|
add or delete init scripts from different runlevels.
|
||||||
|
|
||||||
|
All scripts specified with this utility must reside in the \fI/etc/init.d\fR
|
||||||
|
directory. They must also conform to the Gentoo runscript standard.
|
||||||
|
.SH OPTIONS
|
||||||
|
.TP
|
||||||
|
\fBadd (\-a)\fR \fIscript\fR \fI<runlevels>\fR
|
||||||
|
Add the specified \fIinit script\fR to the specified \fIrunlevels\fR. You
|
||||||
|
must specify at least one runlevel.
|
||||||
|
|
||||||
|
Example: rc-update add net.eth0 default
|
||||||
|
.TP
|
||||||
|
\fBdel (\-d)\fR \fIscript\fR \fI[runlevels]\fR
|
||||||
|
Delete the specified \fIinit script\fR from the specified \fIrunlevels\fR.
|
||||||
|
If you do not specify the \fIrunlevels\fR from which to delete, the script
|
||||||
|
will be removed from all exists runlevels.
|
||||||
|
|
||||||
|
Example: rc-update del sysklogd
|
||||||
|
.TP
|
||||||
|
\fBshow (\-s)\fR \fI[\-v|\-\-verbose]\fR \fI[runlevels]\fR
|
||||||
|
Show all enabled scripts and the runlevels they belong to. If you specify
|
||||||
|
\fIrunlevels\fR to show, then only those will be included in the output. To
|
||||||
|
view all init scripts, run with the \fI\-\-verbose\fR option.
|
||||||
|
|
||||||
|
Example: rc-update show
|
||||||
|
.SH "REPORTING BUGS"
|
||||||
|
Please report bugs via http://bugs.gentoo.org/
|
||||||
|
.SH "SEE ALSO"
|
||||||
|
.BR rc-status (8)
|
||||||
|
|
||||||
|
http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=2&chap=4
|
212
man/start-stop-daemon.8
Normal file
212
man/start-stop-daemon.8
Normal file
@ -0,0 +1,212 @@
|
|||||||
|
.TH "BASELAYOUT" "8" "March 2007" "baselayout" "baselayout"
|
||||||
|
.SH NAME
|
||||||
|
start\-stop\-daemon \- start and stop system daemon programs
|
||||||
|
.SH SYNOPSIS
|
||||||
|
.B start-stop-daemon
|
||||||
|
.BR -S | --start
|
||||||
|
.IR options
|
||||||
|
.RB [ \-\- ]
|
||||||
|
.IR arguments
|
||||||
|
.HP
|
||||||
|
.B start-stop-daemon
|
||||||
|
.BR -K | --stop
|
||||||
|
.IR options
|
||||||
|
.HP
|
||||||
|
.B start-stop-daemon
|
||||||
|
.BR -H | --help
|
||||||
|
.HP
|
||||||
|
.B start-stop-daemon
|
||||||
|
.BR -V | --version
|
||||||
|
.SH DESCRIPTION
|
||||||
|
.B start\-stop\-daemon
|
||||||
|
is used to control the creation and termination of system-level processes.
|
||||||
|
Using the
|
||||||
|
.BR --exec ", " --pidfile ", " --user ", and " --name " options,"
|
||||||
|
.B start\-stop\-daemon
|
||||||
|
can be configured to find existing instances of a running process.
|
||||||
|
|
||||||
|
With
|
||||||
|
.BR --start ,
|
||||||
|
.B start\-stop\-daemon
|
||||||
|
checks for the existence of a specified process.
|
||||||
|
If such a process exists,
|
||||||
|
.B start\-stop\-daemon
|
||||||
|
does nothing, and exits with error status 1.
|
||||||
|
If such a process does not exist, it starts an
|
||||||
|
instance, using the executable specified by
|
||||||
|
.BR --exec .
|
||||||
|
Any arguments given after
|
||||||
|
.BR --
|
||||||
|
on the command line are passed unmodified to the program being
|
||||||
|
started.
|
||||||
|
.B start\-stop\-daemon
|
||||||
|
pauses for a little bit then checks the daemon is still running as badly
|
||||||
|
written ones like to fork early and then bail on a error in their config.
|
||||||
|
As such it may be necessary to use the --name parameter if the daemon in
|
||||||
|
question is not a C program, ie a script. Once started, we store how we
|
||||||
|
are called in \fBrc\fR if called from an init script.
|
||||||
|
|
||||||
|
With
|
||||||
|
.BR --stop ,
|
||||||
|
.B start\-stop\-daemon
|
||||||
|
also checks for the existence of a specified process.
|
||||||
|
If such a process exists,
|
||||||
|
.B start\-stop\-daemon
|
||||||
|
sends it the signal specified by
|
||||||
|
.BR --signal ,
|
||||||
|
and exits with error status 0.
|
||||||
|
If such a process does not exist, or there was an error stopping it
|
||||||
|
.B start\-stop\-daemon
|
||||||
|
exits with error status 1. If
|
||||||
|
.BR --test
|
||||||
|
is specified then we just send the signal and not the schedule. If
|
||||||
|
.BR --oknodo
|
||||||
|
is specified then we don't remove the daemon information from
|
||||||
|
.BR rc.
|
||||||
|
|
||||||
|
.SH OPTIONS
|
||||||
|
|
||||||
|
.TP
|
||||||
|
\fB-x\fP|\fB--exec\fP \fIexecutable\fP
|
||||||
|
Check for processes that are instances of this executable.
|
||||||
|
.TP
|
||||||
|
\fB-p\fP|\fB--pidfile\fP \fIpid-file\fP
|
||||||
|
Check for processes whose process-id is specified in
|
||||||
|
.I pid-file.
|
||||||
|
.TP
|
||||||
|
\fB-u\fP|\fB--user\fP \fIusername\fP|\fIuid\fP
|
||||||
|
Check for processes owned by the user specified by
|
||||||
|
.I username
|
||||||
|
or
|
||||||
|
.I uid.
|
||||||
|
.TP
|
||||||
|
\fB-n\fP|\fB--name\fP \fIprocess-name\fP
|
||||||
|
Check for processes with the name
|
||||||
|
.I process-name
|
||||||
|
.TP
|
||||||
|
\fB-s\fP|\fB--signal\fP \fIsignal\fP
|
||||||
|
With
|
||||||
|
.BR --stop
|
||||||
|
, specifies the signal to send to processes being stopped (default SIGTERM).
|
||||||
|
.TP
|
||||||
|
\fB-R\fP|\fB--retry\fP \fItimeout\fP|\fIschedule\fP
|
||||||
|
With
|
||||||
|
.BR --stop ,
|
||||||
|
specifies that
|
||||||
|
.B start-stop-daemon
|
||||||
|
is to check whether the process(es)
|
||||||
|
do finish. It will check repeatedly whether any matching processes
|
||||||
|
are running, until none are. If the processes do not exit it will
|
||||||
|
then take further action as determined by the schedule.
|
||||||
|
|
||||||
|
If
|
||||||
|
.I timeout
|
||||||
|
is specified instead of
|
||||||
|
.I schedule
|
||||||
|
then the schedule
|
||||||
|
.IB signal / timeout
|
||||||
|
is used, where
|
||||||
|
.I signal
|
||||||
|
is the signal specified with
|
||||||
|
.BR --signal .
|
||||||
|
|
||||||
|
.I schedule
|
||||||
|
is a list of at least two items separated by slashes
|
||||||
|
.RB ( / );
|
||||||
|
each item may be
|
||||||
|
.BI - signal-number
|
||||||
|
or [\fB\-\fP]\fIsignal-name\fP,
|
||||||
|
which means to send that signal,
|
||||||
|
or
|
||||||
|
.IR timeout ,
|
||||||
|
which means to wait that many seconds for processes to
|
||||||
|
exit,
|
||||||
|
or
|
||||||
|
.BR forever ,
|
||||||
|
which means to repeat the rest of the schedule forever if
|
||||||
|
necessary.
|
||||||
|
|
||||||
|
If the end of the schedule is reached and
|
||||||
|
.BR forever
|
||||||
|
is not specified, then
|
||||||
|
.B start-stop-daemon
|
||||||
|
exits with error status 2.
|
||||||
|
If a schedule is specified, then any signal specified
|
||||||
|
with
|
||||||
|
.B --signal
|
||||||
|
is ignored.
|
||||||
|
.TP
|
||||||
|
.BR -t | --test
|
||||||
|
Print actions that would be taken and set appropriate return value,
|
||||||
|
but take no action.
|
||||||
|
.TP
|
||||||
|
.BR -o | --oknodo
|
||||||
|
Used for sending signals to a running daemon but not expecting it to stop.
|
||||||
|
.TP
|
||||||
|
.BR -q | --quiet
|
||||||
|
Do not print informational messages; only display error messages.
|
||||||
|
.TP
|
||||||
|
\fB-c\fP|\fB--chuid\fP \fIusername\fR|\fIuid\fP
|
||||||
|
Change to this username/uid before starting the process. You can also
|
||||||
|
specify a group by appending a
|
||||||
|
.BR : ,
|
||||||
|
then the group or gid in the same way
|
||||||
|
as you would for the `chown' command (\fIuser\fP\fB:\fP\fIgroup\fP).
|
||||||
|
When using this option
|
||||||
|
you must realize that the primary and supplemental groups are set as well,
|
||||||
|
even if the
|
||||||
|
.B --group
|
||||||
|
option is not specified. The
|
||||||
|
.B --group
|
||||||
|
option is only for
|
||||||
|
groups that the user isn't normally a member of (like adding per/process
|
||||||
|
group membership for generic users like
|
||||||
|
.BR nobody ).
|
||||||
|
.TP
|
||||||
|
\fB-r\fP|\fB--chroot\fP \fIroot\fP
|
||||||
|
Chdir and chroot to
|
||||||
|
.I root
|
||||||
|
before starting the process. Please note that the pidfile is also written
|
||||||
|
after the chroot.
|
||||||
|
.TP
|
||||||
|
.BR -b | --background
|
||||||
|
Typically used with programs that don't detach on their own. This option
|
||||||
|
will force
|
||||||
|
.B start-stop-daemon
|
||||||
|
to fork before starting the process, and force it into the background.
|
||||||
|
.TP
|
||||||
|
\fB-1\fP|\fB--stdout\fP \fIlogfile\fP
|
||||||
|
Redirect the standard output of the process to \fIlogfile\fP when started with \fB--background\fP.
|
||||||
|
Must be an absolute pathname, but relative to the \fIpath\fP optionally given with
|
||||||
|
\fB--chroot\fP.
|
||||||
|
Hint: The \fIlogfile\fP can also be a named pipe.
|
||||||
|
.TP
|
||||||
|
\fB-2\fP|\fB--stderr\fP \fIlogfile\fP
|
||||||
|
The same thing as \fB--stdout\fP but with the standard error output.
|
||||||
|
.TP
|
||||||
|
.BR -N | --nicelevel
|
||||||
|
This alters the prority of the process before starting it.
|
||||||
|
.TP
|
||||||
|
.BR -m | --make-pidfile
|
||||||
|
Used when starting a program that does not create its own pid file. This
|
||||||
|
option will make
|
||||||
|
.B start-stop-daemon
|
||||||
|
create the file referenced with
|
||||||
|
.B --pidfile
|
||||||
|
and place the pid into it just before executing the process. Note, it will
|
||||||
|
not be removed when stopping the program.
|
||||||
|
.B NOTE:
|
||||||
|
This feature may not work in all cases. Most notably when the program
|
||||||
|
being executed forks from its main process. Because of this it is usually
|
||||||
|
only useful when combined with the
|
||||||
|
.B --background
|
||||||
|
option.
|
||||||
|
.TP
|
||||||
|
.BR -v | --verbose
|
||||||
|
Print verbose informational messages.
|
||||||
|
.TP
|
||||||
|
.BR -H | --help
|
||||||
|
Print help information; then exit.
|
||||||
|
.TP
|
||||||
|
.BR -V | --version
|
||||||
|
Print version information; then exit.
|
5
net.BSD/Makefile
Normal file
5
net.BSD/Makefile
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
DIR = /$(LIB)/rcscripts/net
|
||||||
|
FILES = ifconfig.sh iwconfig.sh
|
||||||
|
|
||||||
|
TOPDIR = ..
|
||||||
|
include $(TOPDIR)/default.mk
|
125
net.BSD/ifconfig.sh
Normal file
125
net.BSD/ifconfig.sh
Normal file
@ -0,0 +1,125 @@
|
|||||||
|
# Copyright 2004-2007 Gentoo Foundation
|
||||||
|
# Distributed under the terms of the GNU General Public License v2
|
||||||
|
|
||||||
|
ifconfig_depend() {
|
||||||
|
program /sbin/ifconfig
|
||||||
|
provide interface
|
||||||
|
}
|
||||||
|
|
||||||
|
_exists() {
|
||||||
|
[ -e /dev/net/"${IFACE}" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
_get_mac_address() {
|
||||||
|
local mac=$(LC_ALL=C ifconfig "${IFACE}" | \
|
||||||
|
sed -n -e 's/^[[:space:]]*ether \(..:..:..:..:..:..\).*/\1/p')
|
||||||
|
|
||||||
|
case "${mac}" in
|
||||||
|
00:00:00:00:00:00) ;;
|
||||||
|
44:44:44:44:44:44) ;;
|
||||||
|
FF:FF:FF:FF:FF:FF) ;;
|
||||||
|
*) echo "${mac}"; return 0 ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
_up () {
|
||||||
|
ifconfig "${IFACE}" up
|
||||||
|
}
|
||||||
|
|
||||||
|
_down () {
|
||||||
|
ifconfig "${IFACE}" down
|
||||||
|
}
|
||||||
|
|
||||||
|
_ifindex() {
|
||||||
|
local x=
|
||||||
|
for x in /dev/net[0-9]* ; do
|
||||||
|
if [ "${x}" -ef /dev/net/"${IFACE}" ] ; then
|
||||||
|
echo "${x#/dev/net}"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
_is_wireless() {
|
||||||
|
LC_ALL=C ifconfig "${IFACE}" 2>/dev/null | \
|
||||||
|
grep -q "^[[:space:]]*media: IEEE 802.11 Wireless"
|
||||||
|
}
|
||||||
|
|
||||||
|
_get_inet_address() {
|
||||||
|
set -- $(LC_ALL=C ifconfig "${IFACE}" |
|
||||||
|
sed -n -e 's/^[[:space:]]*inet \([^ ]*\) netmask 0x\(..\)\(..\)\(..\)\(..\).*/\1 0x\2.0x\3.0x\4/p')
|
||||||
|
echo -n "$1"
|
||||||
|
shift
|
||||||
|
|
||||||
|
echo "/$(_netmask2cidr "$1")"
|
||||||
|
}
|
||||||
|
|
||||||
|
_add_address() {
|
||||||
|
if [ "${metric:-0}" != "0" ] ; then
|
||||||
|
set -- "$@" metric ${metric}
|
||||||
|
fi
|
||||||
|
|
||||||
|
ifconfig "${IFACE}" add "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
_add_route() {
|
||||||
|
if [ $# -gt 3 ] ; then
|
||||||
|
if [ "$3" = "gw" -o "$3" = "via" ] ; then
|
||||||
|
local one=$1 two=$2
|
||||||
|
shift ; shift; shift
|
||||||
|
set -- "${one}" "${two}" "$@"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
route add "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
_delete_addresses() {
|
||||||
|
# We don't remove addresses from aliases
|
||||||
|
case "${IFACE}" in
|
||||||
|
*:*) return 0 ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
einfo "Removing addresses"
|
||||||
|
eindent
|
||||||
|
local addr=
|
||||||
|
for addr in $(LC_ALL=C ifconfig "${IFACE}" |
|
||||||
|
sed -n -e 's/^[[:space:]]*inet \([^ ]*\).*/\1/p') ; do
|
||||||
|
if [ "${addr}" = "127.0.0.1" ] ; then
|
||||||
|
# Don't delete the loopback address
|
||||||
|
[ "$1" = "lo" -o "$1" = "lo0" ] && continue
|
||||||
|
fi
|
||||||
|
einfo "${addr}"
|
||||||
|
/sbin/ifconfig "$1" delete "${addr}"
|
||||||
|
eend $?
|
||||||
|
done
|
||||||
|
|
||||||
|
# Remove IPv6 addresses
|
||||||
|
for addr in $(LC_ALL=C ifconfig "${IFACE}" | \
|
||||||
|
sed -n -e 's/^[[:space:]]*inet6 \([^ ]*\).*/\1/p') ; do
|
||||||
|
case "${addr}" in
|
||||||
|
*"%${IFACE}") continue ;;
|
||||||
|
::1) continue ;;
|
||||||
|
esac
|
||||||
|
einfo "${addr}"
|
||||||
|
/sbin/ifconfig "${IFACE}" inet6 delete "${addr}"
|
||||||
|
eend $?
|
||||||
|
done
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
_show_address() {
|
||||||
|
einfo "received address $(_get_inet_address "${IFACE}")"
|
||||||
|
}
|
||||||
|
|
||||||
|
_has_carrier() {
|
||||||
|
local s=$(LC_ALL=C ifconfig "${IFACE}" | \
|
||||||
|
sed -n -e 's/^[[:space:]]status: \(.*\)$/\1/p')
|
||||||
|
[ -z "${s}" -o "${s}" = "active" -o "${s}" = "associated" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
# vim: set ts=4 :
|
562
net.BSD/iwconfig.sh
Normal file
562
net.BSD/iwconfig.sh
Normal file
@ -0,0 +1,562 @@
|
|||||||
|
# Copyright 2004-2007 Gentoo Foundation
|
||||||
|
# Distributed under the terms of the GNU General Public License v2
|
||||||
|
|
||||||
|
_config_vars="$_config_vars essid mode associate_timeout preferred_aps blacklist_aps"
|
||||||
|
|
||||||
|
iwconfig_depend() {
|
||||||
|
program /sbin/ifconfig
|
||||||
|
after plug
|
||||||
|
before interface
|
||||||
|
provide wireless
|
||||||
|
}
|
||||||
|
|
||||||
|
iwconfig_get_wep_status() {
|
||||||
|
local status="disabled"
|
||||||
|
local mode=$(LC_ALL=C ifconfig "${IFACE}" \
|
||||||
|
| sed -n -e 's/^[[:space:]]*authmode \([^ ]*\) privacy ON .*/\1/p')
|
||||||
|
if [ -n "${mode}" ] ; then
|
||||||
|
status="enabled - ${mode}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "(WEP ${status})"
|
||||||
|
}
|
||||||
|
|
||||||
|
_iwconfig_get() {
|
||||||
|
LC_ALL=C ifconfig "${IFACE}" | \
|
||||||
|
sed -n -e 's/^[[:space:]]*ssid \(.*\) channel \([0-9]*\) bssid \(..:..:..:..:..:..\)$/\'"$1"'/p'
|
||||||
|
}
|
||||||
|
|
||||||
|
_get_ssid() {
|
||||||
|
_iwconfig_get 1
|
||||||
|
}
|
||||||
|
|
||||||
|
_get_ap_mac_address() {
|
||||||
|
_iwconfig_get 3
|
||||||
|
}
|
||||||
|
|
||||||
|
_get_channel() {
|
||||||
|
_iwconfig_get 2
|
||||||
|
}
|
||||||
|
|
||||||
|
iwconfig_report() {
|
||||||
|
local m="connected to"
|
||||||
|
local ssid=$(_get_ssid)
|
||||||
|
local mac=$(_get_ap_mac_address "${iface}")
|
||||||
|
[ -n "${mac}" ] && mac=" at ${mac}"
|
||||||
|
local wep_status="$(iwconfig_get_wep_status "${iface}")"
|
||||||
|
local channel=$(_get_channel)
|
||||||
|
[ -n "${channel}" ] && channel="on channel ${channel} "
|
||||||
|
|
||||||
|
eindent
|
||||||
|
einfo "${IFACE} ${m} \"${ssid}\"${mac}"
|
||||||
|
einfo "${channel}${wep_status}"
|
||||||
|
eoutdent
|
||||||
|
}
|
||||||
|
|
||||||
|
iwconfig_get_wep_key() {
|
||||||
|
local mac="$1" key=
|
||||||
|
[ -n "${mac}" ] && mac="$(echo "${mac}" | sed -e 's/://g')"
|
||||||
|
eval key=\$mac_key_${mac}
|
||||||
|
[ -z "${key}" ] && eval key=\$key_${SSIDVAR}
|
||||||
|
echo "${key:--}"
|
||||||
|
}
|
||||||
|
|
||||||
|
iwconfig_user_config() {
|
||||||
|
local conf=
|
||||||
|
eval set -- \$ifconfig_${SSIDVAR}
|
||||||
|
for conf in "$@" ; do
|
||||||
|
ifconfig "${IFACE}" ${conf}
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
iwconfig_set_mode() {
|
||||||
|
local x= opt= unopt="hostap adhoc"
|
||||||
|
case "${mode}" in
|
||||||
|
master|hostap) unopt="adhoc" opt="hostap" ;;
|
||||||
|
ad-hoc|adhoc) unopt="hostap" opt="adhoc" ;;
|
||||||
|
esac
|
||||||
|
for x in ${unopt} ; do
|
||||||
|
ifconfig "${IFACE}" -mediaopt ${x}
|
||||||
|
done
|
||||||
|
for x in ${opt} ; do
|
||||||
|
ifconfig "${IFACE}" mediaopt ${x}
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
iwconfig_setup_specific() {
|
||||||
|
local mode="${1:-master}" channel=
|
||||||
|
if [ -z "${SSID}" ]; then
|
||||||
|
eerror "${IFACE} requires an SSID to be set to operate in ${mode} mode"
|
||||||
|
eerror "adjust the ssid_${IFVAR} setting in /etc/conf.d/net"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
iwconfig_set_mode "${mode}" || return 1
|
||||||
|
|
||||||
|
SSIDVAR=$(_shell_var "${SSID}")
|
||||||
|
local key=$(iwconfig_get_wep_key)
|
||||||
|
|
||||||
|
# Now set the key
|
||||||
|
ifconfig "${IFACE}" wepkey ${key}
|
||||||
|
|
||||||
|
ifconfig "${IFACE}" ssid "${ESSID}" || return 1
|
||||||
|
|
||||||
|
eval channel=\$channel_${IFVAR}
|
||||||
|
# We default the channel to 3
|
||||||
|
ifconfig "${IFACE}" channel "${channel:-3}" || return 1
|
||||||
|
|
||||||
|
iwconfig_user_config
|
||||||
|
iwconfig_report "${iface}"
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
iwconfig_associate() {
|
||||||
|
local mac="$1" channel="$2" caps="$3"
|
||||||
|
local mode= w="(WEP Disabled)" key=
|
||||||
|
|
||||||
|
SSIDVAR=$(_shell_var "${SSID}")
|
||||||
|
key=$(iwconfig_get_wep_key "${mac}")
|
||||||
|
case "${caps}" in
|
||||||
|
[EI]P*)
|
||||||
|
if [ "${key}" = "-" ] ; then
|
||||||
|
ewarn "WEP key is not set for \"${SSID}\"; not connecting"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
"") ;;
|
||||||
|
*)
|
||||||
|
if [ "${key}" != "-" ] ; then
|
||||||
|
key="-"
|
||||||
|
ewarn "\"${ESSID}\" is not WEP enabled; ignoring setting"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# Set mode accordingly
|
||||||
|
case "${caps}" in
|
||||||
|
*E*) mode="managed"; ifconfig "${IFACE}" -mediaopt adhoc ;;
|
||||||
|
*I*) mode="adhoc"; ifconfig "${IFACE}" mediaopt adhoc ;;
|
||||||
|
*)
|
||||||
|
if LC_ALL=C ifconfig "${IFACE}" | grep -q "^[[:space:]]*media: .*adhoc" ; then
|
||||||
|
mode="adhoc"
|
||||||
|
else
|
||||||
|
mode="managed"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ "${key}" = "-" ] ; then
|
||||||
|
ifconfig "${IFACE}" wepmode off
|
||||||
|
else
|
||||||
|
ifconfig "${IFACE}" wepmode on
|
||||||
|
ifconfig "${IFACE}" deftxkey 1
|
||||||
|
w=$(iwconfig_get_wep_status)
|
||||||
|
fi
|
||||||
|
|
||||||
|
ebegin "Connecting to \"${SSID}\" in ${mode} mode ${w}"
|
||||||
|
|
||||||
|
if ! ifconfig "${IFACE}" wepkey ${key} ; then
|
||||||
|
eerror "Invalid WEP key ${key}"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
ifconfig "${IFACE}" ssid "${SSID}" || return 1
|
||||||
|
iwconfig_user_config
|
||||||
|
|
||||||
|
if [ "${SSID}" != "any" ] && type preassociate >/dev/null 2>/dev/null ; then
|
||||||
|
veinfo "Running preassociate function"
|
||||||
|
veindent
|
||||||
|
( preassociate )
|
||||||
|
local e=$?
|
||||||
|
veoutdent
|
||||||
|
if [ ${e} -eq 0 ] ; then
|
||||||
|
veend 1 "preassociate \"${SSID}\" on ${IFACE} failed"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
local timeout= i=0
|
||||||
|
eval timeout=\$associate_timeout_${IFVAR}
|
||||||
|
timeout=${timeout:-10}
|
||||||
|
|
||||||
|
[ ${timeout} -eq 0 ] \
|
||||||
|
&& vewarn "WARNING: infinite timeout set for association on ${IFACE}"
|
||||||
|
|
||||||
|
while true; do
|
||||||
|
_has_carrier && break
|
||||||
|
sleep 1
|
||||||
|
[ ${timeout} -eq 0 ] && continue
|
||||||
|
i=$((${i} + 1))
|
||||||
|
[ ${i} -ge ${timeout} ] && return 1
|
||||||
|
done
|
||||||
|
|
||||||
|
if ! _has_carrier ; then
|
||||||
|
eend 1
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
eend 0
|
||||||
|
|
||||||
|
if [ "${SSID}" = "any" ]; then
|
||||||
|
SSID="$(_get_ssid)"
|
||||||
|
iwconfig_associate
|
||||||
|
return $?
|
||||||
|
fi
|
||||||
|
|
||||||
|
iwconfig_report
|
||||||
|
|
||||||
|
if type postassociate >/dev/null 2>/dev/null ; then
|
||||||
|
veinfo "Running postassociate function"
|
||||||
|
veindent
|
||||||
|
( postassociate )
|
||||||
|
veoutdent
|
||||||
|
fi
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
iwconfig_scan() {
|
||||||
|
local x= i=0 scan= quality=
|
||||||
|
einfo "Scanning for access points"
|
||||||
|
eindent
|
||||||
|
|
||||||
|
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 -o -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")"
|
||||||
|
i=$((${i} + 1))
|
||||||
|
done
|
||||||
|
|
||||||
|
local OIFS=$IFS
|
||||||
|
APS=-1
|
||||||
|
eval set -- ${scan}
|
||||||
|
for line in "$@" ; do
|
||||||
|
APS=$((${APS} + 1))
|
||||||
|
set -- ${line}
|
||||||
|
while true ; do
|
||||||
|
case "$1" in
|
||||||
|
*:*:*:*:*:*) break ;;
|
||||||
|
esac
|
||||||
|
eval SSID_${APS}="\"\${SSID_${APS}}\${SSID_${APS}:+ }$1\""
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
eval MAC_${APS}="$(echo "$1" | tr '[:lower:]' '[:upper:]')"
|
||||||
|
eval CHAN_${APS}=$2
|
||||||
|
quality=${4%:*}
|
||||||
|
shift ; shift ; shift ; shift ; shift
|
||||||
|
eval CAPS_${APS}=$*
|
||||||
|
|
||||||
|
# Add 1000 for managed nodes as we prefer them to adhoc
|
||||||
|
set -- $*
|
||||||
|
case "$1" in
|
||||||
|
*E*) eval QUAL_${APS}=$((${quality} + 1000)) ;;
|
||||||
|
*) eval QUAL_${APS}=\$quality ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ -z "${MAC_0}" ]; then
|
||||||
|
ewarn "no access points found"
|
||||||
|
eoutdent
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Sort based on quality
|
||||||
|
local i=0 k=1 a= b= x= t=
|
||||||
|
while [ ${i} -lt ${APS} ] ; do
|
||||||
|
k=$((${i} + 1))
|
||||||
|
while [ ${k} -le ${APS} ] ; do
|
||||||
|
eval a=\$QUALITY_${i}
|
||||||
|
[ -z "${a}" ] && break
|
||||||
|
eval b=\$QUALITY_${k}
|
||||||
|
if [ -n "${b}" -a "${a}" -lt "${b}" ] ; then
|
||||||
|
for x in MAC SSID CHAN QUALITY CAPS ; do
|
||||||
|
eval t=\$${x}_${i}
|
||||||
|
eval ${x}_${i}=\$${x}_${k}
|
||||||
|
eval ${x}_${k}=\$t
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
k=$((${k} + 1))
|
||||||
|
done
|
||||||
|
i=$((${i} + 1))
|
||||||
|
done
|
||||||
|
|
||||||
|
# Strip any duplicates
|
||||||
|
local i=0 k=1 a= b=
|
||||||
|
while [ ${i} -lt ${APS} ] ; do
|
||||||
|
k=$((${i} + 1))
|
||||||
|
while [ ${k} -le ${APS} ] ; do
|
||||||
|
eval a=\$MAC_${i}
|
||||||
|
eval b=\$MAC_${k}
|
||||||
|
if [ "${a}" = "${b}" ] ; then
|
||||||
|
eval a=\$QUALITY_${i}
|
||||||
|
eval b=\$QUALITY_${k}
|
||||||
|
if [ -n "${a}" -a -n "${b}" ] ; then
|
||||||
|
if [ ${a} -ge ${b} ] ; then
|
||||||
|
unset MAC_${k} SSID_${k} CHAN_${k} QUALITY_${k} CAPS_${k}
|
||||||
|
else
|
||||||
|
unset MAC_${i} SSID_${i} CHAN_${i} QUALITY_${i} CAPS_${i}
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
unset MAC_${k} SSID_${k} CHAN_${k} QUALITY_${k} CAPS_${k}
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
k=$((${k} + 1))
|
||||||
|
done
|
||||||
|
i=$((${i} + 1))
|
||||||
|
done
|
||||||
|
|
||||||
|
local i=0 e= m= black= s=
|
||||||
|
eval "$(_get_array "blacklist_aps")"
|
||||||
|
black="$@"
|
||||||
|
|
||||||
|
while [ ${i} -le ${APS} ] ; do
|
||||||
|
eval x=\$MAC_${i}
|
||||||
|
if [ -z "${x}" ] ; then
|
||||||
|
i=$((${i} + 1))
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
eval m=\$MODE_${i}
|
||||||
|
[ -n "${m}" ] && m=", ${m}"
|
||||||
|
eval s=\$SSID_${i}
|
||||||
|
eval q=\$QUALITY_${i}
|
||||||
|
eval e=\$CAPS_${i}
|
||||||
|
case "${e}" in
|
||||||
|
[EI]P*) e=", encrypted" ;;
|
||||||
|
*) e="" ;;
|
||||||
|
esac
|
||||||
|
if [ -z "${s}" ] ; then
|
||||||
|
einfo "Found ${x}${m}${e}"
|
||||||
|
else
|
||||||
|
einfo "Found \"${s}\" at ${x}${m}${e}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
x="$(echo "${x}" | sed -e 's/://g')"
|
||||||
|
eval x=\$mac_ssid_${x}
|
||||||
|
if [ -n "${x}" ] ; then
|
||||||
|
eval SSID_${i}=\$x
|
||||||
|
s=${x}
|
||||||
|
eindent
|
||||||
|
einfo "mapping to \"${x}\""
|
||||||
|
eoutdent
|
||||||
|
fi
|
||||||
|
|
||||||
|
eval "$(_get_array "blacklist_aps")"
|
||||||
|
for x in "$@" ; do
|
||||||
|
if [ "${x}" = "${s}" ] ; then
|
||||||
|
ewarn "${s} has been blacklisted - not connecting"
|
||||||
|
unset SSID_${i} MAC_${i} CHAN_${i} QUALITY_${i} CAPS_${i}
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
i=$((${i} + 1))
|
||||||
|
done
|
||||||
|
eoutdent
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
iwconfig_force_preferred() {
|
||||||
|
[ -z "${preferred_aps}" ] && return 1
|
||||||
|
|
||||||
|
ewarn "Trying to force preferred in case they are hidden"
|
||||||
|
eval "(_get_array "preferred_aps")"
|
||||||
|
local ssid=
|
||||||
|
for ssid in "$@"; do
|
||||||
|
local found_AP=false i=0 e=
|
||||||
|
while [ ${i} -le ${APS} ] ; do
|
||||||
|
eval e=\$SSID_${i}
|
||||||
|
if [ "${e}" = "${ssid}" ] ; then
|
||||||
|
found_AP=true
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
i=$((${i} + 1))
|
||||||
|
done
|
||||||
|
if ! ${found_AP} ; then
|
||||||
|
SSID=${e}
|
||||||
|
iwconfig_associate && return 0
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
ewarn "Failed to associate with any preferred access points on ${IFACE}"
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
iwconfig_connect_preferred() {
|
||||||
|
local essid= i=0 mode= mac= caps= freq= chan=
|
||||||
|
|
||||||
|
eval "$(_get_array preferred_aps)"
|
||||||
|
for essid in "$@"; do
|
||||||
|
while [ ${i} -le ${APS} ] ; do
|
||||||
|
eval e=\$SSID_${i}
|
||||||
|
if [ "${e}" = "${essid}" ] ; then
|
||||||
|
SSID=${e}
|
||||||
|
eval mac=\$MAC_${i}
|
||||||
|
eval caps=\$CAPS_${i}
|
||||||
|
eval freq=\$FREQ_${i}
|
||||||
|
eval chan=\$CHAN_${i}
|
||||||
|
iwconfig_associate "${mac}" \
|
||||||
|
"${chan}" "${caps}" && return 0
|
||||||
|
fi
|
||||||
|
i=$((${i} + 1))
|
||||||
|
done
|
||||||
|
done
|
||||||
|
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
iwconfig_connect_not_preferred() {
|
||||||
|
local essid= i=0 mode= mac= caps= freq= chan= pref=
|
||||||
|
|
||||||
|
while [ ${i} -le ${APS} ] ; do
|
||||||
|
eval e=\$SSID_${i}
|
||||||
|
if [ -z "${e}" ] ; then
|
||||||
|
i=$((${i} + 1))
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
eval "$(_get_array preferred_aps)"
|
||||||
|
pref=false
|
||||||
|
for essid in "$@" ; do
|
||||||
|
if [ "${e}" = "${essid}" ] ; then
|
||||||
|
pref=true
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if ! ${pref} ; then
|
||||||
|
SSID=${e}
|
||||||
|
eval mac=\$MAC_${i}
|
||||||
|
eval caps=\$CAPS_${i}
|
||||||
|
eval freq=\$FREQ_${i}
|
||||||
|
eval chan=\$CHAN_${i}
|
||||||
|
iwconfig_associate "${mac}" \
|
||||||
|
"${chan}" "${caps}" && return 0
|
||||||
|
fi
|
||||||
|
i=$((${i} + 1))
|
||||||
|
done
|
||||||
|
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
iwconfig_defaults() {
|
||||||
|
# Set some defaults
|
||||||
|
#ifconfig "${iface}" txpower 100 2>/dev/null
|
||||||
|
ifconfig "${IFACE}" bssid -
|
||||||
|
ifconfig "${IFACE}" ssid -
|
||||||
|
ifconfig "${IFACE}" authmode open
|
||||||
|
ifconfig "${IFACE}" -mediaopt adhoc
|
||||||
|
ifconfig "${IFACE}" -mediaopt hostap
|
||||||
|
}
|
||||||
|
|
||||||
|
iwconfig_configure() {
|
||||||
|
local x APS
|
||||||
|
eval SSID=\$ssid_${IFVAR}
|
||||||
|
|
||||||
|
# Setup ad-hoc mode?
|
||||||
|
eval x=\$mode_${IFVAR}
|
||||||
|
x=${x:-managed}
|
||||||
|
case "${x}" in
|
||||||
|
ad-hoc|adhoc|hostap|master) iwconfig_setup_specific "${x}" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ "${x}" != "managed" -a "${x}" != "auto" ] ; then
|
||||||
|
eerror "Only managed, ad-hoc, master and auto modes are supported"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Has an ESSID been forced?
|
||||||
|
if [ -n "${SSID}" ]; then
|
||||||
|
iwconfig_set_mode "${x}"
|
||||||
|
iwconfig_associate && return 0
|
||||||
|
[ "${SSID}" = "any" ] && iwconfig_force_preferred && return 0
|
||||||
|
|
||||||
|
eval SSID=\$adhoc_ssid_${IFVAR}
|
||||||
|
if [ -n "${SSID}" ]; then
|
||||||
|
iwconfig_setup_specific adhoc
|
||||||
|
return $?
|
||||||
|
fi
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Do we have a preferred Access Point list specific to the interface?
|
||||||
|
# x="preferred_aps_${ifvar}[@]"
|
||||||
|
# [[ -n ${!x} ]] && preferred_aps=( "${!x}" )
|
||||||
|
|
||||||
|
# # Do we have a blacklist Access Point list specific to the interface?
|
||||||
|
# x="blacklist_aps_${ifvar}[@]"
|
||||||
|
# [[ -n ${!x} ]] && blacklist_aps=( "${!x}" )
|
||||||
|
|
||||||
|
# Are we forcing preferred only?
|
||||||
|
eval x=\$associate_order_${IFVAR}
|
||||||
|
[ -n "${x}" ] && associate_order=${x}
|
||||||
|
associate_order=${associate_order:-any}
|
||||||
|
if [ "${associate_order}" = "forcepreferredonly" ]; then
|
||||||
|
iwconfig_force_preferred && return 0
|
||||||
|
else
|
||||||
|
iwconfig_scan || return 1
|
||||||
|
iwconfig_connect_preferred && return 0
|
||||||
|
[ "${associate_order}" = "forcepreferred" ] || \
|
||||||
|
[ "${associate_order}" = "forceany" ] && \
|
||||||
|
iwconfig_force_preferred && return 0
|
||||||
|
[ "${associate_order}" = "any" ] || \
|
||||||
|
[ "${associate_order}" = "forceany" ] && \
|
||||||
|
iwconfig_connect_not_preferred && return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
e="associate with"
|
||||||
|
[ -z "${MAC_0}" ] && e="find"
|
||||||
|
[ "${preferred_aps}" = "force" ] || \
|
||||||
|
[ "${preferred_aps}" = "forceonly" ] && \
|
||||||
|
e="force"
|
||||||
|
e="Couldn't ${e} any access points on ${IFACE}"
|
||||||
|
|
||||||
|
eval SSID=\$adhoc_ssid_${IFVAR}
|
||||||
|
if [ -n "${SSID}" ]; then
|
||||||
|
ewarn "${e}"
|
||||||
|
iwconfig_setup_specific adhoc
|
||||||
|
return $?
|
||||||
|
fi
|
||||||
|
|
||||||
|
eerror "${e}"
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
iwconfig_pre_start() {
|
||||||
|
# We don't configure wireless if we're being called from
|
||||||
|
# the background
|
||||||
|
${IN_BACKGROUND} && return 0
|
||||||
|
|
||||||
|
save_options "SSID" ""
|
||||||
|
_exists || return 0
|
||||||
|
|
||||||
|
if ! _is_wireless ; then
|
||||||
|
veinfo "${IFACE} is not wireless"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
iwconfig_defaults
|
||||||
|
iwconfig_user_config
|
||||||
|
|
||||||
|
# Set the base metric to be 2000
|
||||||
|
metric=2000
|
||||||
|
|
||||||
|
einfo "Configuring wireless network for ${IFACE}"
|
||||||
|
|
||||||
|
if iwconfig_configure ; then
|
||||||
|
save_options "ESSID" "${ESSID}"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
eerror "Failed to configure wireless for ${IFACE}"
|
||||||
|
iwconfig_defaults
|
||||||
|
#iwconfig "${IFACE}" txpower 0 2>/dev/null
|
||||||
|
unset SSID SSIDVAR
|
||||||
|
_down
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
iwconfig_post_stop() {
|
||||||
|
${IN_BACKGROUND} && return 0
|
||||||
|
_is_wireless || return 0
|
||||||
|
iwconfig_defaults
|
||||||
|
#iwconfig "${IFACE}" txpower 0 2>/dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
# vim: set ts=4
|
8
net.Linux/Makefile
Normal file
8
net.Linux/Makefile
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
DIR = /$(LIB)/rcscripts/net
|
||||||
|
FILES = adsl.sh apipa.sh arping.sh bonding.sh br2684ctl.sh bridge.sh \
|
||||||
|
ccwgroup.sh clip.sh ifconfig.sh ifplugd.sh ip6to4.sh ipppd.sh \
|
||||||
|
iproute2.sh iwconfig.sh netplugd.sh pppd.sh pump.sh tuntap.sh \
|
||||||
|
udhcpc.sh vlan.sh
|
||||||
|
|
||||||
|
TOPDIR = ..
|
||||||
|
include $(TOPDIR)/default.mk
|
71
net.Linux/adsl.sh
Normal file
71
net.Linux/adsl.sh
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
# Copyright 2004-2007 Gentoo Foundation
|
||||||
|
# Distributed under the terms of the GNU General Public License v2
|
||||||
|
|
||||||
|
adsl_depend() {
|
||||||
|
program /usr/sbin/adsl-start /usr/sbin/pppoe-start
|
||||||
|
before dhcp
|
||||||
|
}
|
||||||
|
|
||||||
|
adsl_setup_vars() {
|
||||||
|
local startstop="$2" cfgexe=
|
||||||
|
|
||||||
|
if [ -x /usr/sbin/pppoe-start ]; then
|
||||||
|
exe="/usr/sbin/pppoe-${startstop}"
|
||||||
|
cfgexe=pppoe-setup
|
||||||
|
else
|
||||||
|
exe="/usr/sbin/adsl-${startstop}"
|
||||||
|
cfgexe=adsl-setup
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Decide which configuration to use. Hopefully there is an
|
||||||
|
# interface-specific one
|
||||||
|
cfgfile="/etc/ppp/pppoe-${IFACE}.conf"
|
||||||
|
[ -f "${cfgfile}" ] || cfgfile="/etc/ppp/pppoe.conf"
|
||||||
|
|
||||||
|
if [ ! -f "${cfgfile}" ]; then
|
||||||
|
eerror "no pppoe.conf file found!"
|
||||||
|
eerror "Please run ${cfgexe} to create one"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
adsl_start() {
|
||||||
|
local exe= cfgfile= user=
|
||||||
|
|
||||||
|
adsl_setup_vars start || return 1
|
||||||
|
|
||||||
|
# Might or might not be set in conf.d/net
|
||||||
|
eval user=\$adsl_user_${IFVAR}
|
||||||
|
|
||||||
|
# Start ADSL with the cfgfile, but override ETH and PIDFILE
|
||||||
|
einfo "Starting ADSL for ${IFACE}"
|
||||||
|
(
|
||||||
|
cat "${cfgfile}";
|
||||||
|
echo "ETH=${IFACE}";
|
||||||
|
echo "PIDFILE=/var/run/rp-pppoe-${IFACE}.pid";
|
||||||
|
[ -n "${user}" ] && echo "USER=${user}";
|
||||||
|
) | ${exe} >/dev/null
|
||||||
|
eend $?
|
||||||
|
}
|
||||||
|
|
||||||
|
adsl_stop() {
|
||||||
|
local exe= cfgfile=
|
||||||
|
|
||||||
|
[ ! -f /var/run/rp-pppoe-"${IFACE}".pid ] && return 0
|
||||||
|
|
||||||
|
adsl_setup_vars stop || return 1
|
||||||
|
|
||||||
|
einfo "Stopping ADSL for ${IFACE}"
|
||||||
|
(
|
||||||
|
cat "${cfgfile}";
|
||||||
|
echo "ETH=${IFACE}";
|
||||||
|
echo "PIDFILE=/var/run/rp-pppoe-${IFACE}.pid";
|
||||||
|
) | ${exe} >/dev/null
|
||||||
|
eend $?
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# vim: set ts=4 :
|
46
net.Linux/apipa.sh
Normal file
46
net.Linux/apipa.sh
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
# Copyright 2004-2007 Gentoo Foundation
|
||||||
|
# Distributed under the terms of the GNU General Public License v2
|
||||||
|
|
||||||
|
apipa_depend() {
|
||||||
|
program /sbin/arping
|
||||||
|
}
|
||||||
|
|
||||||
|
_random() {
|
||||||
|
if [ -n "${BASH}" ] ; then
|
||||||
|
echo "${RANDOM}"
|
||||||
|
else
|
||||||
|
uuidgen | sed -n -e 's/[^[:digit:]]//g' -e 's/\(^.\{1,7\}\).*/\1/p'
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
apipa_start() {
|
||||||
|
local iface="$1" i1= i2= addr= i=0
|
||||||
|
|
||||||
|
_exists true || return 1
|
||||||
|
|
||||||
|
einfo "Searching for free addresses in 169.254.0.0/16"
|
||||||
|
eindent
|
||||||
|
|
||||||
|
while [ ${i} -lt 64516 ]; do
|
||||||
|
i1=$((($(_random) % 255) + 1))
|
||||||
|
i2=$((($(_random) % 255) + 1))
|
||||||
|
|
||||||
|
addr="169.254.${i1}.${i2}"
|
||||||
|
vebegin "${addr}/16"
|
||||||
|
if ! arping_address "${addr}" ; then
|
||||||
|
eval config_${config_index}="\"${addr}/16 broadcast 169.254.255.255\""
|
||||||
|
config_index=$((${config_index} - 1))
|
||||||
|
veend 0
|
||||||
|
eoutdent
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
i=$((${i} + 1))
|
||||||
|
done
|
||||||
|
|
||||||
|
eerror "No free address found!"
|
||||||
|
eoutdent
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# vim: set ts=4 :
|
111
net.Linux/arping.sh
Normal file
111
net.Linux/arping.sh
Normal file
@ -0,0 +1,111 @@
|
|||||||
|
# Copyright 2004-2007 Gentoo Foundation
|
||||||
|
# Distributed under the terms of the GNU General Public License v2
|
||||||
|
|
||||||
|
arping_depend() {
|
||||||
|
program /sbin/arping
|
||||||
|
before interface
|
||||||
|
}
|
||||||
|
|
||||||
|
arping_address() {
|
||||||
|
local ip=${1%%/*} mac="$2" foundmac= i= w= opts=
|
||||||
|
|
||||||
|
# We only handle IPv4 addresses
|
||||||
|
case "${ip}" in
|
||||||
|
0.0.0.0|0) return 1 ;;
|
||||||
|
*.*.*.*) ;;
|
||||||
|
*) return 1 ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# We need to bring the interface up to test
|
||||||
|
_exists "${iface}" || return 1
|
||||||
|
_up "${iface}"
|
||||||
|
|
||||||
|
eval w=\$arping_wait_${IFVAR}
|
||||||
|
[ -z "${w}" ] && w=${arping_wait:-5}
|
||||||
|
|
||||||
|
[ -z "$(_get_inet_address)" ] && opts="${opts} -D"
|
||||||
|
|
||||||
|
foundmac="$(arping -w "${w}" ${opts} -f -I "${IFACE}" "${ip}" 2>/dev/null | \
|
||||||
|
sed -n -e 'y/abcdef/ABCDEF/' -e 's/.*\[\([^]]*\)\].*/\1/p')"
|
||||||
|
[ -z "${foundmac}" ] && return 1
|
||||||
|
|
||||||
|
if [ -n "${mac}" ] ; then
|
||||||
|
if [ "${mac}" != "${foundmac}" ] ; then
|
||||||
|
vewarn "Found ${ip} but MAC ${foundmac} does not match"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
arping_start() {
|
||||||
|
local gateways= x= conf= i=
|
||||||
|
einfo "Pinging gateways on ${IFACE} for configuration"
|
||||||
|
|
||||||
|
eval $(_get_array "gateways_${IFVAR}")
|
||||||
|
if [ -z "$@" ] ; then
|
||||||
|
eerror "No gateways have been defined (gateways_${IFVAR}=\"...\")"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
eindent
|
||||||
|
|
||||||
|
for x in "$@"; do
|
||||||
|
eval set -- "${x}"
|
||||||
|
local ip=$1 mac=$2 extra=
|
||||||
|
|
||||||
|
if [ -n "${mac}" ] ; then
|
||||||
|
mac="$(echo "${mac}" | tr '[:lower:]' '[:upper:]')"
|
||||||
|
extra="(MAC ${mac})"
|
||||||
|
fi
|
||||||
|
|
||||||
|
vebegin "${ip} ${extra}"
|
||||||
|
if arping_address "${ip}" "${mac}" ; then
|
||||||
|
local OIFS=$IFS SIFS=${IFS-y}
|
||||||
|
IFS=.
|
||||||
|
for i in ${ip} ; do
|
||||||
|
if [ "${#i}" = "2" ] ; then
|
||||||
|
conf="${conf}0${i}"
|
||||||
|
elif [ "${#i}" = "1" ] ; then
|
||||||
|
conf="${conf}00${i}"
|
||||||
|
else
|
||||||
|
conf="${conf}${i}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if [ "${SIFS}" = "y" ] ; then
|
||||||
|
IFS=$OFIS
|
||||||
|
else
|
||||||
|
unset IFS
|
||||||
|
fi
|
||||||
|
[ -n "${mac}" ] && conf="${conf}_$(echo "${mac}" | sed -e 's/://g')"
|
||||||
|
|
||||||
|
veend 0
|
||||||
|
eoutdent
|
||||||
|
veinfo "Configuring ${IFACE} for ${ip} ${extra}"
|
||||||
|
_configure_variables "${conf}"
|
||||||
|
|
||||||
|
# Call the system module as we've aleady passed it by ....
|
||||||
|
# And it *has* to be pre_start for other things to work correctly
|
||||||
|
system_pre_start
|
||||||
|
|
||||||
|
# Ensure that we have a valid config - ie arping is no longer there
|
||||||
|
eval $(_get_array "config_${IFVAR}")
|
||||||
|
for i in "$@" ; do
|
||||||
|
if [ "${i}" = "arping" ] ; then
|
||||||
|
veend 1 "No config found for ${ip} (config_${conf}=\"...\")"
|
||||||
|
continue 2
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
_load_config
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
veend 1
|
||||||
|
done
|
||||||
|
|
||||||
|
eoutdent
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# vim: set ts=4 :
|
100
net.Linux/bonding.sh
Normal file
100
net.Linux/bonding.sh
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
# Copyright 2004-2007 Gentoo Foundation
|
||||||
|
# Distributed under the terms of the GNU General Public License v2
|
||||||
|
|
||||||
|
bonding_depend() {
|
||||||
|
before interface macchanger
|
||||||
|
program /sbin/ifenslave
|
||||||
|
}
|
||||||
|
|
||||||
|
_config_vars="$_config_vars slaves"
|
||||||
|
|
||||||
|
_is_bond() {
|
||||||
|
[ -f "/proc/net/bonding/${IFACE}" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
bonding_pre_start() {
|
||||||
|
local s= slaves=
|
||||||
|
|
||||||
|
eval $(_get_array "slaves_${IFACE}")
|
||||||
|
[ $# = "0" ] && return 0
|
||||||
|
|
||||||
|
# Load the kernel module if required
|
||||||
|
if [ ! -d /proc/net/bonding ] ; then
|
||||||
|
if ! modprobe bonding ; then
|
||||||
|
eerror "Cannot load the bonding module"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# We can create the interface name we like now, but this
|
||||||
|
# requires sysfs
|
||||||
|
if ! _exists && [ -d /sys/class/net ] ; then
|
||||||
|
echo "+${IFACE}" > /sys/class/net/bonding_masters
|
||||||
|
fi
|
||||||
|
_exists true || return 1
|
||||||
|
|
||||||
|
if ! _is_bond ; then
|
||||||
|
eerror "${IFACE} is not capable of bonding"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
ebegin "Adding slaves to ${IFACE}"
|
||||||
|
eindent
|
||||||
|
einfo "$@"
|
||||||
|
|
||||||
|
# Check that our slaves exist
|
||||||
|
(
|
||||||
|
for IFACE in "$@" ; do
|
||||||
|
_exists true || return 1
|
||||||
|
done
|
||||||
|
|
||||||
|
# Must force the slaves to a particular state before adding them
|
||||||
|
for IFACE in "$@" ; do
|
||||||
|
_delete_addresses
|
||||||
|
_up
|
||||||
|
done
|
||||||
|
)
|
||||||
|
|
||||||
|
# now force the master to up
|
||||||
|
_up
|
||||||
|
|
||||||
|
# finally add in slaves
|
||||||
|
eoutdent
|
||||||
|
/sbin/ifenslave "${IFACE}" $@ >/dev/null
|
||||||
|
eend $?
|
||||||
|
|
||||||
|
return 0 #important
|
||||||
|
}
|
||||||
|
|
||||||
|
bonding_stop() {
|
||||||
|
_is_bond || return 0
|
||||||
|
|
||||||
|
local slaves= s=
|
||||||
|
slaves=$( \
|
||||||
|
sed -n -e 's/^Slave Interface: //p' "/proc/net/bonding/${IFACE}" \
|
||||||
|
| tr '\n' ' ' \
|
||||||
|
)
|
||||||
|
[ -z "${slaves}" ] && return 0
|
||||||
|
|
||||||
|
# remove all slaves
|
||||||
|
ebegin "Removing slaves from ${IFACE}"
|
||||||
|
eindent
|
||||||
|
einfo "${slaves}"
|
||||||
|
eoutdent
|
||||||
|
/sbin/ifenslave -d "${IFACE}" ${slaves}
|
||||||
|
|
||||||
|
# reset all slaves
|
||||||
|
(
|
||||||
|
for IFACE in ${slaves}; do
|
||||||
|
if _exists ; then
|
||||||
|
_delete_addresses
|
||||||
|
_down
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
)
|
||||||
|
|
||||||
|
eend 0
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# vim: set ts=4 :
|
50
net.Linux/br2684ctl.sh
Normal file
50
net.Linux/br2684ctl.sh
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
# Copyright 2004-2007 Gentoo Foundation
|
||||||
|
# Distributed under the terms of the GNU General Public License v2
|
||||||
|
|
||||||
|
br2684ctl_depend() {
|
||||||
|
before ppp
|
||||||
|
program start /sbin/br2684ctl
|
||||||
|
}
|
||||||
|
|
||||||
|
_config_vars="$_config_vars bridge bridge_add brctl"
|
||||||
|
|
||||||
|
br2684ctl_pre_start() {
|
||||||
|
local opts=
|
||||||
|
eval opts=\$br2684ctl_${IFVAR}
|
||||||
|
[ -z "${opts}" ] && return 0
|
||||||
|
|
||||||
|
if [ "${IFACE#nas[0-9]*}" = "${IFACE}" ] ; then
|
||||||
|
eerror "Interface must be called nas[0-9] for RFC 2684 Bridging"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
case " ${opts} " in
|
||||||
|
*" -b "*|*" -c "*)
|
||||||
|
eerror "The -b and -c options are not allowed for br2684ctl_${IVAR}"
|
||||||
|
return 1
|
||||||
|
;;
|
||||||
|
*" -a "*) ;;
|
||||||
|
*)
|
||||||
|
eerror "-a option (VPI and VCI) is required in br2684ctl_${IFVAR}"
|
||||||
|
return 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
einfo "Starting RFC 2684 Bridge control on ${IFACE}"
|
||||||
|
start-stop-daemon --start --exec /sbin/br2684ctl --background \
|
||||||
|
--make-pidfile --pidfile "/var/run/br2684ctl-${IFACE}.pid" \
|
||||||
|
-- -c "${IFACE#nas*}" ${opts}
|
||||||
|
eend $?
|
||||||
|
}
|
||||||
|
|
||||||
|
br2684ctl_post_stop() {
|
||||||
|
local pidfile="/var/run/br2684ctl-${IFACE}.pid"
|
||||||
|
[ -e "${pidfile}" ] || return 0
|
||||||
|
|
||||||
|
einfo "Stopping RFC 2684 Bridge control on ${IFACE}"
|
||||||
|
start-stop-daemon --stop --quiet \
|
||||||
|
--exec /sbin/br2684ctl --pidfile "${pidfile}"
|
||||||
|
eend $?
|
||||||
|
}
|
||||||
|
|
||||||
|
# vim: set ts=4 :
|
113
net.Linux/bridge.sh
Normal file
113
net.Linux/bridge.sh
Normal file
@ -0,0 +1,113 @@
|
|||||||
|
# Copyright 2004-2007 Gentoo Foundation
|
||||||
|
# Distributed under the terms of the GNU General Public License v2
|
||||||
|
|
||||||
|
bridge_depend() {
|
||||||
|
before interface macnet
|
||||||
|
program /sbin/brctl
|
||||||
|
}
|
||||||
|
|
||||||
|
_config_vars="$_config_vars bridge bridge_add brctl"
|
||||||
|
|
||||||
|
_is_bridge() {
|
||||||
|
brctl show 2>/dev/null | grep -q "^${IFACE}[[:space:]]"
|
||||||
|
}
|
||||||
|
|
||||||
|
bridge_pre_start() {
|
||||||
|
local ports= brif= opts= iface="${IFACE}" e= x=
|
||||||
|
eval $(_get_array "bridge_${IFVAR}")
|
||||||
|
ports="$@"
|
||||||
|
eval brif=\$bridge_add_${IFVAR}
|
||||||
|
eval $(_get_array "brctl_${IFVAR}")
|
||||||
|
opts="$@"
|
||||||
|
[ -z "${ports}" -a -z "${brif}" -a -z "${opts}" ] && return 0
|
||||||
|
|
||||||
|
[ -n "${ports}" ] && bridge_post_stop
|
||||||
|
|
||||||
|
(
|
||||||
|
if [ -z "${ports}" -a -n "${brif}" ] ; then
|
||||||
|
ports="${IFACE}"
|
||||||
|
IFACE="${brif}"
|
||||||
|
else
|
||||||
|
ports="${ports}"
|
||||||
|
metric=1000
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! _is_bridge ; then
|
||||||
|
ebegin "Creating bridge ${IFACE}"
|
||||||
|
if ! brctl addbr "${IFACE}" ; then
|
||||||
|
eend 1
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
eval set -- ${opts}
|
||||||
|
for x in "$@" ; do
|
||||||
|
case " ${x} " in
|
||||||
|
*" ${IFACE} "*) ;;
|
||||||
|
*) x="${x} ${IFACE}" ;;
|
||||||
|
esac
|
||||||
|
brctl ${x}
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "${ports}" ] ; then
|
||||||
|
einfo "Adding ports to ${IFACE}"
|
||||||
|
eindent
|
||||||
|
|
||||||
|
eval set -- ${ports}
|
||||||
|
for x in "$@" ; do
|
||||||
|
ebegin "${x}"
|
||||||
|
if ! ifconfig "${x}" promisc up && brctl addif "${IFACE}" "${x}" ; then
|
||||||
|
ifconfig "${x}" -promisc 2>/dev/null
|
||||||
|
eend 1
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
eend 0
|
||||||
|
done
|
||||||
|
eoutdent
|
||||||
|
fi
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
bridge_post_stop() {
|
||||||
|
local port= ports= delete=false extra=
|
||||||
|
|
||||||
|
if _is_bridge ; then
|
||||||
|
ebegin "Destroying bridge ${IFACE}"
|
||||||
|
_down
|
||||||
|
ports="$( brctl show 2>/dev/null | \
|
||||||
|
sed -n -e '/^'"${IFACE}"'[[:space:]]/,/^\S/ { /^\('"${IFACE}"'[[:space:]]\|\t\)/s/^.*\t//p }')"
|
||||||
|
delete=true
|
||||||
|
iface=${IFACE}
|
||||||
|
eindent
|
||||||
|
else
|
||||||
|
# Work out if we're added to a bridge for removal or not
|
||||||
|
eval set -- $(brctl show 2>/dev/null | sed -e "s/'/'\\\\''/g" -e "s/$/'/g" -e "s/^/'/g")
|
||||||
|
local line=
|
||||||
|
for line in "$@" ; do
|
||||||
|
set -- ${line}
|
||||||
|
if [ "$3" = "${IFACE}" ] ; then
|
||||||
|
iface=$1
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
[ -z "${iface}" ] && return 0
|
||||||
|
extra=" from ${iface}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
for port in ${ports} ; do
|
||||||
|
ebegin "Removing port ${port}${extra}"
|
||||||
|
ifconfig "${port}" -promisc
|
||||||
|
brctl delif "${iface}" "${port}"
|
||||||
|
eend $?
|
||||||
|
done
|
||||||
|
|
||||||
|
if ${delete} ; then
|
||||||
|
eoutdent
|
||||||
|
brctl delbr "${iface}"
|
||||||
|
eend $?
|
||||||
|
fi
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# vim: set ts=4 :
|
66
net.Linux/ccwgroup.sh
Normal file
66
net.Linux/ccwgroup.sh
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
# Copyright 2006-2007 Gentoo Foundation
|
||||||
|
# Distributed under the terms of the GNU General Public License v2
|
||||||
|
# Contributed by Roy Marples (uberlord@gentoo.org)
|
||||||
|
|
||||||
|
_config_vars="$_config_vars ccwgroup"
|
||||||
|
|
||||||
|
ccwgroup_depend() {
|
||||||
|
before interface
|
||||||
|
}
|
||||||
|
|
||||||
|
ccwgroup_pre_start() {
|
||||||
|
eval $(_get_array "ccwgroup_${IFVAR}")
|
||||||
|
[ $# = "0" ] && return 0
|
||||||
|
|
||||||
|
if [ ! -d /sys/bus/ccwgroup ] ; then
|
||||||
|
modprobe qeth
|
||||||
|
if [ ! -d /sys/bus/ccwgroup ] ; then
|
||||||
|
eerror "ccwgroup support missing in kernel"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
einfo "Enabling ccwgroup on ${IFACE}"
|
||||||
|
local x= ccw= first= layer2=
|
||||||
|
for x in "$@" ; do
|
||||||
|
[ -z "${first}" ] && first=${x}
|
||||||
|
ccw="${ccw}${ccw:+,}${x}"
|
||||||
|
done
|
||||||
|
if [ -e /sys/devices/qeth/"${first}" ] ; then
|
||||||
|
echo "0" > /sys/devices/qeth/"${first}"/online
|
||||||
|
else
|
||||||
|
echo "${ccw}" > /sys/bus/ccwgroup/drivers/qeth/group
|
||||||
|
fi
|
||||||
|
eval layer2=\$qeth_layer2_${IFVAR}
|
||||||
|
echo "${layer2:-0}" > /sys/devices/qeth/"${first}"/layer2
|
||||||
|
echo "1" > /sys/devices/qeth/"${first}"/online
|
||||||
|
eend $?
|
||||||
|
}
|
||||||
|
|
||||||
|
ccwgroup_pre_stop() {
|
||||||
|
# Erase any existing ccwgroup to be safe
|
||||||
|
save_options ccwgroup_device ""
|
||||||
|
|
||||||
|
[ ! -L /sys/class/net/"${FACE}"/driver ] && return 0
|
||||||
|
local driver="$(readlink /sys/class/net/"${IFACE}"/driver)"
|
||||||
|
case "${diver}" in
|
||||||
|
*/bus/ccwgroup/*) ;;
|
||||||
|
*) return 0 ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
local device="$(readlink /sys/class/net/"${IFACE}"/device)"
|
||||||
|
device=${device##*/}
|
||||||
|
save_options ccwgroup_device "${device}"
|
||||||
|
}
|
||||||
|
|
||||||
|
ccwgroup_post_stop() {
|
||||||
|
local device="$(get_options ccwgroup_device)"
|
||||||
|
[ -z "${device}" ] && return 0
|
||||||
|
|
||||||
|
einfo "Disabling ccwgroup on ${iface}"
|
||||||
|
echo "0" > /sys/devices/qeth/"${device}"/online
|
||||||
|
echo "1" > /sys/devices/qeth/"${device}"/ungroup
|
||||||
|
eend $?
|
||||||
|
}
|
||||||
|
|
||||||
|
# vim: set ts=4 :
|
212
net.Linux/clip.sh
Normal file
212
net.Linux/clip.sh
Normal file
@ -0,0 +1,212 @@
|
|||||||
|
# Copyright 2005-2007 Gentoo Foundation
|
||||||
|
# Distributed under the terms of the GNU General Public License v2
|
||||||
|
|
||||||
|
clip_depend() {
|
||||||
|
program /usr/sbin/atmsigd
|
||||||
|
before interface
|
||||||
|
}
|
||||||
|
|
||||||
|
_config_vars="$_config_vars clip"
|
||||||
|
|
||||||
|
# This starts a service. Albeit atmsigd, ilmid and atmarpd do allow for back-
|
||||||
|
# grounding through the -b option, its usage causes them to be sensible to
|
||||||
|
# SIGHUP, which is sent to all daemons when console detaches right after
|
||||||
|
# startup. This is probably due to the fact that these programs don't detach
|
||||||
|
# themself from the controlling terminal when backgrounding... The only way I
|
||||||
|
# see to overcame this is to use the --background option in start-stop-daemon,
|
||||||
|
# which is reported as a "last resort" method, but it acts correctly about this.
|
||||||
|
atmclip_svc_start() {
|
||||||
|
ebegin "Starting $2 Daemon ($1)"
|
||||||
|
start-stop-daemon --start \
|
||||||
|
--background \
|
||||||
|
--make-pidfile --pidfile "/var/run/$1.pid" \
|
||||||
|
--exec "/usr/sbin/$1" -- -l syslog
|
||||||
|
eend $?
|
||||||
|
}
|
||||||
|
|
||||||
|
atmclip_svcs_start() {
|
||||||
|
einfo "First CLIP instance: starting ATM CLIP daemons"
|
||||||
|
eindent
|
||||||
|
|
||||||
|
if [ "${clip_full:-yes}" = "yes" ]; then
|
||||||
|
atmclip_svc_start atmsigd "Signaling" && \
|
||||||
|
atmclip_svc_start ilmid "Integrated Local Management Interface" && \
|
||||||
|
atmclip_svc_start atmarpd "Address Resolution Protocol"
|
||||||
|
else
|
||||||
|
atmclip_svc_start atmarpd "Address Resolution Protocol"
|
||||||
|
fi
|
||||||
|
|
||||||
|
local r=$?
|
||||||
|
|
||||||
|
eoutdent
|
||||||
|
return ${r}
|
||||||
|
}
|
||||||
|
|
||||||
|
atmclip_svc_stop() {
|
||||||
|
ebegin "Stopping $2 Daemon ($1)"
|
||||||
|
start-stop-daemon --stop --quiet \
|
||||||
|
--pidfile "/var/run/$1.pid" \
|
||||||
|
--exec "/usr/sbin/$1"
|
||||||
|
eend $?
|
||||||
|
}
|
||||||
|
|
||||||
|
atmclip_svcs_stop() {
|
||||||
|
einfo "Last CLIP instance: stopping ATM CLIP daemons"
|
||||||
|
eindent
|
||||||
|
|
||||||
|
# Heartake operation!
|
||||||
|
sync
|
||||||
|
|
||||||
|
atmclip_svc_stop atmarpd "Address Resolution Protocol"
|
||||||
|
if [ "${clip_full:-yes}" = "yes" ]; then
|
||||||
|
atmclip_svc_stop ilmid "Integrated Local Management Interface"
|
||||||
|
atmclip_svc_stop atmsigd "Signaling"
|
||||||
|
fi
|
||||||
|
|
||||||
|
eoutdent
|
||||||
|
}
|
||||||
|
|
||||||
|
are_atmclip_svcs_running() {
|
||||||
|
is_daemon_running atmarpd || return 1
|
||||||
|
if [[ ${clip_full:-yes} == "yes" ]]; then
|
||||||
|
is_daemon_running ilmid || return 1
|
||||||
|
is_daemon_running atmsigd || return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
atmarp() {
|
||||||
|
/usr/sbin/atmarp "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
clip_pre_start() {
|
||||||
|
eval $(_get_array "clip_${IFVAR}")
|
||||||
|
[ -z "$@" ] && return 0
|
||||||
|
|
||||||
|
if [ ! -r /proc/net/atm/arp ] ; then
|
||||||
|
modprobe clip && sleep 2
|
||||||
|
if [ ! -r /proc/net/atm/arp ] ; then
|
||||||
|
eerror "You need first to enable kernel support for ATM CLIP"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
local started_here=
|
||||||
|
if ! are_atmclip_svcs_running ; then
|
||||||
|
atmclip_svcs_start || return 1
|
||||||
|
started_here=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! _exists ; then
|
||||||
|
ebegin "Creating CLIP interface ${IFACE}"
|
||||||
|
atmarp -c "${IFACE}"
|
||||||
|
if ! eend $? ; then
|
||||||
|
[ -z "${started_here}" ] && atmclip_svcs_stop
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
clip_post_start() {
|
||||||
|
eval $(_get_array "clip_${IFVAR}")
|
||||||
|
[ -z "$@" ] && return 0
|
||||||
|
|
||||||
|
are_atmclip_svcs_running || return 1
|
||||||
|
|
||||||
|
# The atm tools (atmarpd?) are silly enough that they would not work with
|
||||||
|
# iproute2 interface setup as opposed to the ifconfig one.
|
||||||
|
# The workaround is to temporarily toggle the interface state from up
|
||||||
|
# to down and then up again, without touching its address. This (should)
|
||||||
|
# work with both iproute2 and ifconfig.
|
||||||
|
_down
|
||||||
|
_up
|
||||||
|
|
||||||
|
# Now the real thing: create a PVC with our peer(s).
|
||||||
|
# There are cases in which the ATM interface is not yet
|
||||||
|
# ready to establish new VCCs. In that cases, atmarp would
|
||||||
|
# fail. Here we allow 10 retries to happen every 2 seconds before
|
||||||
|
# reporting problems. Also, when no defined VC can be established,
|
||||||
|
# we stop the ATM daemons.
|
||||||
|
local has_failures= i=
|
||||||
|
for i in "$@" ; do
|
||||||
|
set -- ${i}
|
||||||
|
local peerip="$1"; shift
|
||||||
|
local ifvpivci="$1"; shift
|
||||||
|
ebegin "Creating PVC ${ifvpivci} for peer ${peerip}"
|
||||||
|
|
||||||
|
local nleftretries=10 emsg= ecode=
|
||||||
|
while [ ${nleftretries} -gt 0 ] ; do
|
||||||
|
nleftretries=$((${nleftretries} - 1))
|
||||||
|
emsg="$(atmarp -s "${peerip}" "${ifvpivci}" "$@" 2>&1)"
|
||||||
|
ecode=$? && break
|
||||||
|
sleep 2
|
||||||
|
done
|
||||||
|
|
||||||
|
if ! eend ${ecode} ; then
|
||||||
|
eerror "Creation failed for PVC ${ifvpivci}: ${emsg}"
|
||||||
|
has_failures=1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ -n "${has_failures}" ]; then
|
||||||
|
clip_pre_stop "${iface}"
|
||||||
|
clip_post_stop "${iface}"
|
||||||
|
return 1
|
||||||
|
else
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
clip_pre_stop() {
|
||||||
|
are_atmclip_svcs_running || return 0
|
||||||
|
|
||||||
|
# We remove all the PVCs which may have been created by
|
||||||
|
# clip_post_start for this interface. This shouldn't be
|
||||||
|
# needed by the ATM stack, but sometimes I got a panic
|
||||||
|
# killing CLIP daemons without previously vacuuming
|
||||||
|
# every active CLIP PVCs.
|
||||||
|
# The linux 2.6's ATM stack is really a mess...
|
||||||
|
local itf= t= encp= idle= ipaddr= left=
|
||||||
|
einfo "Removing PVCs on this interface"
|
||||||
|
eindent
|
||||||
|
{
|
||||||
|
read left && \
|
||||||
|
while read itf t encp idle ipaddr left ; do
|
||||||
|
if [ "${itf}" = "${IFACE}" ]]; then
|
||||||
|
ebegin "Removing PVC to ${ipaddr}"
|
||||||
|
atmarp -d "${ipaddr}"
|
||||||
|
eend $?
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
} < /proc/net/atm/arp
|
||||||
|
eoutdent
|
||||||
|
}
|
||||||
|
|
||||||
|
# Here we should teorically delete the interface previously created in the
|
||||||
|
# clip_pre_start function, but there is no way to "undo" an interface creation.
|
||||||
|
# We can just leave the interface down. "ifconfig -a" will still list it...
|
||||||
|
# Also, here we can stop the ATM CLIP daemons if there is no other CLIP PVC
|
||||||
|
# outstanding. We check this condition by inspecting the /proc/net/atm/arp file.
|
||||||
|
clip_post_stop() {
|
||||||
|
are_atmclip_svcs_running || return 0
|
||||||
|
|
||||||
|
local itf= left= hasothers=
|
||||||
|
{
|
||||||
|
read left && \
|
||||||
|
while read itf left ; do
|
||||||
|
if [ "${itf}" != "${IFACE}" ] ; then
|
||||||
|
hasothers=1
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
} < /proc/net/atm/arp
|
||||||
|
|
||||||
|
if [ -z "${hasothers}" ] ; then
|
||||||
|
atmclip_svcs_stop || return 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# vim: set ts=4 :
|
239
net.Linux/ifconfig.sh
Normal file
239
net.Linux/ifconfig.sh
Normal file
@ -0,0 +1,239 @@
|
|||||||
|
# Copyright 2004-2007 Gentoo Foundation
|
||||||
|
# Distributed under the terms of the GNU General Public License v2
|
||||||
|
|
||||||
|
ifconfig_depend() {
|
||||||
|
program /sbin/ifconfig
|
||||||
|
provide interface
|
||||||
|
}
|
||||||
|
|
||||||
|
_get_mac_address() {
|
||||||
|
local mac=$(LC_ALL=C ifconfig "${IFACE}" | \
|
||||||
|
sed -n -e 's/.* HWaddr \(..:..:..:..:..:..\).*/\1/p')
|
||||||
|
|
||||||
|
|
||||||
|
case "${mac}" in
|
||||||
|
00:00:00:00:00:00) ;;
|
||||||
|
44:44:44:44:44:44) ;;
|
||||||
|
FF:FF:FF:FF:FF:FF) ;;
|
||||||
|
"") ;;
|
||||||
|
*) echo "${mac}"; return 0 ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
_up() {
|
||||||
|
ifconfig "${IFACE}" up
|
||||||
|
}
|
||||||
|
|
||||||
|
_down() {
|
||||||
|
ifconfig "${IFACE}" down
|
||||||
|
}
|
||||||
|
|
||||||
|
_exists() {
|
||||||
|
grep -Eq "^[[:space:]]*${IFACE}:[[:space:]]*" /proc/net/dev
|
||||||
|
}
|
||||||
|
|
||||||
|
_ifindex() {
|
||||||
|
local line= i=-2
|
||||||
|
while read line ; do
|
||||||
|
i=$((${i} + 1))
|
||||||
|
[ ${i} -lt 1 ] && continue
|
||||||
|
case "${line}" in
|
||||||
|
"${IFACE}: "*) echo "${i}"; return 0;;
|
||||||
|
esac
|
||||||
|
done < /proc/net/dev
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
_is_wireless() {
|
||||||
|
# Support new sysfs layout
|
||||||
|
[ -d /sys/class/net/"${IFACE}"/wireless ] && return 0
|
||||||
|
|
||||||
|
[ ! -e /proc/net/wireless ] && return 1
|
||||||
|
grep -Eq "^[[:space:]]*${IFACE}:[[:space:]]+" /proc/net/wireless
|
||||||
|
}
|
||||||
|
|
||||||
|
_get_inet_address() {
|
||||||
|
set -- $(LC_ALL=C ifconfig "${IFACE}" |
|
||||||
|
sed -n -e 's/.*inet addr:\([^ ]*\).*Mask:\([^ ]*\).*/\1 \2/p')
|
||||||
|
echo -n "$1"
|
||||||
|
shift
|
||||||
|
echo "/$(_netmask2cidr "$1")"
|
||||||
|
}
|
||||||
|
|
||||||
|
_get_inet_addresses() {
|
||||||
|
local iface=${IFACE} i=0
|
||||||
|
local addrs="$(_get_inet_address)"
|
||||||
|
|
||||||
|
while true ; do
|
||||||
|
local IFACE="${iface}:${i}"
|
||||||
|
_exists || break
|
||||||
|
local addr="$(_get_inet_address)"
|
||||||
|
[ -n "${addr}" ] && addrs="${addrs}${addrs:+ }${addr}"
|
||||||
|
i=$((${i} + 1))
|
||||||
|
done
|
||||||
|
echo "${addrs}"
|
||||||
|
}
|
||||||
|
|
||||||
|
_cidr2netmask() {
|
||||||
|
local cidr="$1" netmask="" done=0 i=0 sum=0 cur=128
|
||||||
|
local octets= frac=
|
||||||
|
|
||||||
|
local octets=$((${cidr} / 8))
|
||||||
|
local frac=$((${cidr} % 8))
|
||||||
|
while [ ${octets} -gt 0 ] ; do
|
||||||
|
netmask="${netmask}.255"
|
||||||
|
octets=$((${octets} - 1))
|
||||||
|
done=$((${done} + 1))
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ ${done} -lt 4 ] ; then
|
||||||
|
while [ ${i} -lt ${frac} ] ; do
|
||||||
|
sum=$((${sum} + ${cur}))
|
||||||
|
cur=$((${cur} / 2))
|
||||||
|
i=$((i + 1))
|
||||||
|
done
|
||||||
|
netmask="${netmask}.${sum}"
|
||||||
|
done=$((${done} + 1))
|
||||||
|
|
||||||
|
while [ ${done} -lt 4 ] ; do
|
||||||
|
netmask="${netmask}.0"
|
||||||
|
done=$((${done} + 1))
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "${netmask#.*}"
|
||||||
|
}
|
||||||
|
|
||||||
|
_add_address() {
|
||||||
|
if [ "$1" = "127.0.0.1/8" -a "${IFACE}" = "lo" ] ; then
|
||||||
|
ifconfig "${IFACE}" "$@" 2>/dev/null
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
*:*) ifconfig "${IFACE}" inet6 add "$@"; return $?;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# IPv4 is tricky - ifconfig requires an aliased device
|
||||||
|
# for multiple addresses
|
||||||
|
local iface="${IFACE}"
|
||||||
|
if LC_ALL=C ifconfig "${iface}" | grep -Eq "\<inet addr:.*" ; then
|
||||||
|
# Get the last alias made for the interface and add 1 to it
|
||||||
|
i=$(ifconfig | sed '1!G;h;$!d' | grep -m 1 -o "^${iface}:[0-9]*" \
|
||||||
|
| sed -n -e 's/'"${iface}"'://p')
|
||||||
|
i=$((${i:-0} + 1))
|
||||||
|
iface="${iface}:${i}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# ifconfig doesn't like CIDR addresses
|
||||||
|
local ip="${1%%/*}" cidr="${1##*/}" netmask=
|
||||||
|
if [ -n "${cidr}" -a "${cidr}" != "${ip}" ]; then
|
||||||
|
netmask="$(_cidr2netmask "${cidr}")"
|
||||||
|
shift
|
||||||
|
set -- "${ip}" netmask "${netmask}" "$@"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# # Support iproute2 style config where possible
|
||||||
|
# r="${config[@]}"
|
||||||
|
# config=( ${r//brd +/} )
|
||||||
|
# config=( "${config[@]//brd/broadcast}" )
|
||||||
|
# config=( "${config[@]//peer/pointopoint}" )
|
||||||
|
# fi
|
||||||
|
|
||||||
|
ifconfig "${iface}" "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
_add_route() {
|
||||||
|
if [ $# -eq 3 ] ; then
|
||||||
|
set -- "$1" "$2" gw "$3"
|
||||||
|
elif [ "$3" = "via" ] ; then
|
||||||
|
local one=$1 two=$2
|
||||||
|
shift ; shift; shift
|
||||||
|
set -- "${one}" "${two}" gw "$@"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "${metric}" ] ; then
|
||||||
|
set -- "$@" metric ${metric}
|
||||||
|
fi
|
||||||
|
|
||||||
|
route add "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
_delete_addresses() {
|
||||||
|
# We don't remove addresses from aliases
|
||||||
|
case "${IFACE}" in
|
||||||
|
*:*) return 0 ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
einfo "Removing addresses"
|
||||||
|
eindent
|
||||||
|
# iproute2 can add many addresses to an iface unlike ifconfig ...
|
||||||
|
# iproute2 added addresses cause problems for ifconfig
|
||||||
|
# as we delete an address, a new one appears, so we have to
|
||||||
|
# keep polling
|
||||||
|
while true ; do
|
||||||
|
local addr=$(LC_ALL=C ifconfig "${IFACE}" |
|
||||||
|
sed -n -e 's/.*inet addr:\([^ ]*\).*/\1/p')
|
||||||
|
|
||||||
|
[ -z "${addr}" ] && break
|
||||||
|
|
||||||
|
if [ "${addr}" = "127.0.0.1/8" ] ; then
|
||||||
|
# Don't delete the loopback address
|
||||||
|
[ "${IFACE}" = "lo" -o "${IFACE}" = "lo0" ] && break
|
||||||
|
fi
|
||||||
|
ifconfig "${IFACE}" 0.0.0.0 || break
|
||||||
|
done
|
||||||
|
|
||||||
|
# Remove IPv6 addresses
|
||||||
|
local addr=
|
||||||
|
for addr in $(LC_ALL=C ifconfig "${IFACE}" | \
|
||||||
|
sed -n -e 's/^.*inet6 addr: \([^ ]*\) Scope:[^L].*/\1/p') ; do
|
||||||
|
[ "${addr}" = "::1/128" -a "${IFACE}" = "lo" ] && continue
|
||||||
|
einfo "${addr}"
|
||||||
|
ifconfig "${IFACE}" inet6 del "${addr}"
|
||||||
|
done
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
_has_carrier() {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
_tunnel() {
|
||||||
|
iptunnel "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
ifconfig_pre_start() {
|
||||||
|
# MTU support
|
||||||
|
local mtu=
|
||||||
|
eval mtu=\$mtu_${IFVAR}
|
||||||
|
[ -n "${mtu}" ] && ifconfig "${IFACE}" mtu "${mtu}"
|
||||||
|
|
||||||
|
local tunnel=
|
||||||
|
|
||||||
|
eval tunnel=\$iptunnel_${IFVAR}
|
||||||
|
[ -z "${tunnel}" ] && return 0
|
||||||
|
|
||||||
|
# Set our base metric to 1000
|
||||||
|
metric=1000
|
||||||
|
|
||||||
|
ebegin "Creating tunnel ${IFVAR}"
|
||||||
|
iptunnel add "${tunnel}"
|
||||||
|
eend $?
|
||||||
|
}
|
||||||
|
|
||||||
|
ifconfig_post_stop() {
|
||||||
|
# Don't delete sit0 as it's a special tunnel
|
||||||
|
[ "${IFACE}" = "sit0" ] && return 0
|
||||||
|
|
||||||
|
[ -z "$(iptunnel show "${IFACE}" 2>/dev/null)" ] && return 0
|
||||||
|
|
||||||
|
ebegin "Destroying tunnel ${IFACE}"
|
||||||
|
iptunnel del "${IFACE}"
|
||||||
|
eend $?
|
||||||
|
}
|
||||||
|
|
||||||
|
# vim: set ts=4 :
|
91
net.Linux/ifplugd.sh
Normal file
91
net.Linux/ifplugd.sh
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
# Copyright 2005-2007 Gentoo Foundation
|
||||||
|
# Distributed under the terms of the GNU General Public License v2
|
||||||
|
|
||||||
|
_config_vars="$_config_vars plug_timeout"
|
||||||
|
|
||||||
|
ifplugd_depend() {
|
||||||
|
program start /usr/sbin/ifplugd
|
||||||
|
after macnet rename
|
||||||
|
before interface
|
||||||
|
provide plug
|
||||||
|
}
|
||||||
|
|
||||||
|
ifplugd_pre_start() {
|
||||||
|
local pidfile="/var/run/ifplugd.${IFACE}.pid" timeout= args=
|
||||||
|
|
||||||
|
# We don't start netplug if we're being called from the background
|
||||||
|
${IN_BACKGROUND} && return 0
|
||||||
|
|
||||||
|
_exists || return 0
|
||||||
|
|
||||||
|
# We need a valid MAC address
|
||||||
|
# It's a basic test to ensure it's not a virtual interface
|
||||||
|
if ! _get_mac_address >/dev/null 2>/dev/null ; then
|
||||||
|
vewarn "netplug only works on interfaces with a valid MAC address"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# We don't work on bonded, bridges, tun/tap, vlan or wireless
|
||||||
|
for f in bond bridge tuntap vlan wireless ; do
|
||||||
|
if type "_is_${f}" >/dev/null 2>/dev/null ; then
|
||||||
|
if _is_${f} ; then
|
||||||
|
veinfo "netplug does not work with" "${f}"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
ebegin "Starting ifplugd on" "${IFACE}"
|
||||||
|
|
||||||
|
eval args=\$ifplugd_${IFVAR}
|
||||||
|
|
||||||
|
# Mark the us as inactive so netplug can restart us
|
||||||
|
mark_service_inactive "${SVCNAME}"
|
||||||
|
|
||||||
|
# Start ifplugd
|
||||||
|
eval start-stop-daemon --start --exec /usr/sbin/ifplugd \
|
||||||
|
--pidfile "${pidfile}" -- "${args}" --iface="${IFACE}"
|
||||||
|
eend "$?" || return 1
|
||||||
|
|
||||||
|
eindent
|
||||||
|
|
||||||
|
eval timeout=\$plug_timeout_${IFVAR}
|
||||||
|
[ -z "${timeout}" ] && timeout=-1
|
||||||
|
if [ ${timeout} -eq 0 ] ; then
|
||||||
|
ewarn "WARNING: infinite timeout set for" "${IFACE}" "to come up"
|
||||||
|
elif [ ${timeout} -lt 0 ] ; then
|
||||||
|
einfo "Backgrounding ..."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
veinfo "Waiting for" "${IFACE}" "to be marked as started"
|
||||||
|
|
||||||
|
local i=0
|
||||||
|
while true ; do
|
||||||
|
if service_started "${SVCNAME}" ; then
|
||||||
|
_show_address
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
sleep 1
|
||||||
|
[ ${timeout} -eq 0 ]] && continue
|
||||||
|
i=$((${i} + 1))
|
||||||
|
[ ${i} -ge ${timeout} ] && break
|
||||||
|
done
|
||||||
|
|
||||||
|
eend 1 "Failed to configure" "${IFACE}" "in the background"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
ifplugd_stop() {
|
||||||
|
${IN_BACKGROUND} && return 0
|
||||||
|
|
||||||
|
local pidfile="/var/run/ifplugd.${IFACE}.pid"
|
||||||
|
[ ! -e "${pidfile}" ] && return 0
|
||||||
|
|
||||||
|
ebegin "Stopping ifplugd on" "${IFACE}"
|
||||||
|
start-stop-daemon --stop --quiet --exec /usr/sbin/ifplugd \
|
||||||
|
--pidfile "${pidfile}" --signal QUIT
|
||||||
|
eend $?
|
||||||
|
}
|
||||||
|
|
||||||
|
# vim: set ts=4 :
|
97
net.Linux/ip6to4.sh
Normal file
97
net.Linux/ip6to4.sh
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
# Copyright 2004-2007 Gentoo Foundation
|
||||||
|
# Distributed under the terms of the GNU General Public License v2
|
||||||
|
|
||||||
|
_config_vars="$_config_vars link suffix relay"
|
||||||
|
|
||||||
|
ip6to4_depend() {
|
||||||
|
after interface
|
||||||
|
}
|
||||||
|
|
||||||
|
ip6to4_start() {
|
||||||
|
case " ${MODULES} " in
|
||||||
|
*" ifconfig "*)
|
||||||
|
if [ "${IFACE}" != "sit0" ] ; then
|
||||||
|
eerror "ip6to4 can only work on the sit0 interface using ifconfig"
|
||||||
|
eerror "emerge sys-apps/iproute2 to use other interfaces"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
esac
|
||||||
|
|
||||||
|
local host= suffix= relay= addr= iface=${IFACE} new=
|
||||||
|
eval host=\$link_${IFVAR}
|
||||||
|
if [ -z "${host}" ] ; then
|
||||||
|
eerror "link_${IFVAR} not set"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
eval suffix=\${suffix_${IFVAR}:-1}
|
||||||
|
eval relay=\${relay_${IFVAR}:-192.88.99.1}
|
||||||
|
|
||||||
|
IFACE=${host}
|
||||||
|
addrs=$(_get_inet_addresses)
|
||||||
|
IFACE=${iface}
|
||||||
|
if [ -z "${addrs}" ] ; then
|
||||||
|
eerror "${host} is not configured with an IPv4 address"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
for addr in ${addrs} ; do
|
||||||
|
# Strip the subnet
|
||||||
|
local ip="${addr%/*}" subnet="${addr#*/}"
|
||||||
|
# We don't work on private IPv4 addresses
|
||||||
|
case "${ip}" in
|
||||||
|
127.*) continue ;;
|
||||||
|
10.*) continue ;;
|
||||||
|
192.168.*) continue ;;
|
||||||
|
172.*)
|
||||||
|
local i=16
|
||||||
|
while [ ${i} -lt 32 ] ; do
|
||||||
|
case "${ip}" in
|
||||||
|
172.${i}.*) break ;;
|
||||||
|
esac
|
||||||
|
i=$((${i} + 1))
|
||||||
|
done
|
||||||
|
[ ${i} -lt 32 ] && continue
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
veinfo "IPv4 address on ${host}: ${ip}/${subnet}"
|
||||||
|
local OIFS=$IFS SIFS=${IFS-y} ipa= ip6=
|
||||||
|
IFS="${IFS}."
|
||||||
|
for i in ${ip} ; do
|
||||||
|
ipa="${ipa} ${i}"
|
||||||
|
done
|
||||||
|
if [ "${SIFS}" = "y" ] ; then
|
||||||
|
IFS=$OIFS
|
||||||
|
else
|
||||||
|
unset IFS
|
||||||
|
fi
|
||||||
|
eval ip6="$(printf "2002:%02x%02x:%02x%02x::%s" ${ipa} ${suffix})"
|
||||||
|
veinfo "Derived IPv6 address: ${ip6}"
|
||||||
|
|
||||||
|
# Now apply our IPv6 address to our config
|
||||||
|
new="${new}${new:+ }${ip6}/16"
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ -z "${new}" ] ; then
|
||||||
|
eerror "No global IPv4 addresses found on interface ${host}"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${IFACE}" != "sit0" ] ; then
|
||||||
|
ebegin "Creating 6to4 tunnel on ${IFACE}"
|
||||||
|
_tunnel add "${IFACE}" mode sit ttl 255 remote any local "${ip}"
|
||||||
|
eend $? || return 1
|
||||||
|
_up
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Now apply our config
|
||||||
|
eval config_${config_index}=\'"${new}"\'
|
||||||
|
config_index=$((${config_index} - 1))
|
||||||
|
|
||||||
|
# Add a route for us, ensuring we don't delete anything else
|
||||||
|
eval $(_get_array "routes_${IFVAR}")
|
||||||
|
eval routes_${IFVAR}="\"$@ '2003::/3 via ::${relay} metric 2147483647'\""
|
||||||
|
}
|
||||||
|
|
||||||
|
# vim: set ts=4 :
|
47
net.Linux/ipppd.sh
Normal file
47
net.Linux/ipppd.sh
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
# Copyright 2004-2007 Gentoo Foundation
|
||||||
|
# Distributed under the terms of the GNU General Public License v2
|
||||||
|
|
||||||
|
ipppd_depend() {
|
||||||
|
program start /usr/sbin/ipppd
|
||||||
|
after macnet
|
||||||
|
before interface
|
||||||
|
provide isdn
|
||||||
|
}
|
||||||
|
|
||||||
|
_config_vars="$_config_vars ipppd"
|
||||||
|
|
||||||
|
ipppd_pre_start() {
|
||||||
|
local opts= pidfile="/var/run/ipppd-${IFACE}.pid"
|
||||||
|
|
||||||
|
# Check that we are a valid ippp interface
|
||||||
|
case "${IFACE}" in
|
||||||
|
ippp[0-9]*) ;;
|
||||||
|
*) return 0 ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# Check that the interface exists
|
||||||
|
_exists || return 1
|
||||||
|
|
||||||
|
# Might or might not be set in conf.d/net
|
||||||
|
eval opts=\$ipppd_${IFVAR}
|
||||||
|
|
||||||
|
einfo "Starting ipppd for ${IFACE}"
|
||||||
|
start-stop-daemon --start --exec /usr/sbin/ipppd \
|
||||||
|
--pidfile "${pidfile}" \
|
||||||
|
-- ${opts} pidfile "${pidfile}" \
|
||||||
|
file "/etc/ppp/options.${IFACE}" >/dev/null
|
||||||
|
eend $?
|
||||||
|
}
|
||||||
|
|
||||||
|
ipppd_post_stop() {
|
||||||
|
local pidfile="/var/run/ipppd-${IFACE}.pid"
|
||||||
|
|
||||||
|
[ ! -f "${pidfile}" ] && return 0
|
||||||
|
|
||||||
|
einfo "Stopping ipppd for ${IFACE}"
|
||||||
|
start-stop-daemon --stop --quiet --exec /usr/sbin/ipppd \
|
||||||
|
--pidfile "${pidfile}"
|
||||||
|
eend $?
|
||||||
|
}
|
||||||
|
|
||||||
|
# vim: set ts=4 :
|
185
net.Linux/iproute2.sh
Normal file
185
net.Linux/iproute2.sh
Normal file
@ -0,0 +1,185 @@
|
|||||||
|
# Copyright 2004-2007 Gentoo Foundation
|
||||||
|
# Distributed under the terms of the GNU General Public License v2
|
||||||
|
|
||||||
|
iproute2_depend() {
|
||||||
|
program /sbin/ip
|
||||||
|
provide interface
|
||||||
|
after ifconfig
|
||||||
|
}
|
||||||
|
|
||||||
|
_get_mac_address() {
|
||||||
|
local mac=$(LC_ALL=C ip link show "${IFACE}" | sed -n \
|
||||||
|
-e 'y/abcdef/ABCDEF/' \
|
||||||
|
-e '/link\// s/^.*\<\(..:..:..:..:..:..\)\>.*/\1/p')
|
||||||
|
|
||||||
|
case "${mac}" in
|
||||||
|
00:00:00:00:00:00) ;;
|
||||||
|
44:44:44:44:44:44) ;;
|
||||||
|
FF:FF:FF:FF:FF:FF) ;;
|
||||||
|
"") ;;
|
||||||
|
*) echo "${mac}"; return 0 ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
_up() {
|
||||||
|
ip link set up dev "${IFACE}"
|
||||||
|
}
|
||||||
|
|
||||||
|
_down() {
|
||||||
|
ip link set down dev "${IFACE}"
|
||||||
|
}
|
||||||
|
|
||||||
|
_exists() {
|
||||||
|
grep -Eq "^[[:space:]]*${IFACE}:[[:space:]]*" /proc/net/dev
|
||||||
|
}
|
||||||
|
|
||||||
|
_ifindex() {
|
||||||
|
local line= i=-2
|
||||||
|
while read line ; do
|
||||||
|
i=$((${i} + 1))
|
||||||
|
[ ${i} -lt 1 ] && continue
|
||||||
|
case "${line}" in
|
||||||
|
"${IFACE}: "*) echo "${i}"; return 0;;
|
||||||
|
esac
|
||||||
|
done < /proc/net/dev
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
_is_wireless() {
|
||||||
|
# Support new sysfs layout
|
||||||
|
[ -d /sys/class/net/"${IFACE}"/wireless ] && return 0
|
||||||
|
|
||||||
|
[ ! -e /proc/net/wireless ] && return 1
|
||||||
|
grep -Eq "^[[:space:]]*${IFACE}:[[:space:]]+" /proc/net/wireless
|
||||||
|
}
|
||||||
|
|
||||||
|
_get_inet_addresses() {
|
||||||
|
LC_ALL=C ip -family inet addr show "${IFACE}" | \
|
||||||
|
sed -n -e 's/.*inet \([^ ]*\).*/\1/p'
|
||||||
|
}
|
||||||
|
|
||||||
|
_get_inet_address() {
|
||||||
|
set -- $(_get_inet_addresses)
|
||||||
|
[ $# = "0" ] && return 1
|
||||||
|
echo "$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
_add_address() {
|
||||||
|
if [ "$1" = "127.0.0.1/8" -a "${IFACE}" = "lo" ] ; then
|
||||||
|
ip addr add "$@" dev "${IFACE}" 2>/dev/null
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Convert an ifconfig line to iproute2
|
||||||
|
if [ "$2" = "netmask" ] ; then
|
||||||
|
local one="$1" three="$3"
|
||||||
|
shift ; shift ; shift
|
||||||
|
set -- "${one}/$(_netmask2cidr "${three}")" "$@"
|
||||||
|
fi
|
||||||
|
|
||||||
|
#config=( "${config[@]//pointopoint/peer}" )
|
||||||
|
|
||||||
|
# Always scope lo addresses as host unless specified otherwise
|
||||||
|
if [ "${IFACE}" = "lo" ] ; then
|
||||||
|
set -- "$@" "scope" "host"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# IPv4 specifics
|
||||||
|
case "$1" in
|
||||||
|
*.*.*.*)
|
||||||
|
case "$@" in
|
||||||
|
*" brd "*) ;;
|
||||||
|
*" broadcast "*) ;;
|
||||||
|
*) set -- "$@" brd + ;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
ip addr add dev "${IFACE}" "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
_add_route() {
|
||||||
|
if [ $# -eq 3 ] ; then
|
||||||
|
set -- "$1" "$2" via "$3"
|
||||||
|
elif [ "$3" = "gw" ] ; then
|
||||||
|
local one=$1 two=$2
|
||||||
|
shift ; shift; shift
|
||||||
|
set -- "${one}" "${two}" gw "$@"
|
||||||
|
fi
|
||||||
|
|
||||||
|
local cmd= have_metric=false
|
||||||
|
while [ -n "$1" ] ; do
|
||||||
|
case "$1" in
|
||||||
|
metric) cmd="${cmd} $1"; have_metric=true ;;
|
||||||
|
netmask) cmd="${cmd}/$(_netmask2cidr "$2")"; shift ;;
|
||||||
|
-net) ;;
|
||||||
|
-A) [ "$2" = "inet6" ] && shift ;;
|
||||||
|
-host) cmd="${cmd} scope host" ;;
|
||||||
|
*) cmd="${cmd} $1" ;;
|
||||||
|
esac
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
|
||||||
|
if ! ${have_metric} && [ -n "${metric}" ] ; then
|
||||||
|
cmd="${cmd} metric ${metric}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
ip route append ${cmd} dev "${IFACE}"
|
||||||
|
eend $?
|
||||||
|
}
|
||||||
|
|
||||||
|
_delete_addresses() {
|
||||||
|
ip addr flush dev "${IFACE}" scope global 2>/dev/null
|
||||||
|
ip addr flush dev "${IFACE}" scope site 2>/dev/null
|
||||||
|
if [ "${IFACE}" != "lo" ] ; then
|
||||||
|
ip addr flush dev "${IFACE}" scope host 2>/dev/null
|
||||||
|
fi
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
_has_carrier() {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
_tunnel() {
|
||||||
|
ip tunnel "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
iproute2_pre_start() {
|
||||||
|
# MTU support
|
||||||
|
local mtu=
|
||||||
|
eval mtu=\$mtu_${IFVAR}
|
||||||
|
[ -n "${mtu}" ] && ip link set mtu "${mtu}" dev "${IFACE}"
|
||||||
|
|
||||||
|
local tunnel=
|
||||||
|
eval tunnel=\$iptunnel_${IFVAR}
|
||||||
|
if [ -n "${tunnel}" ] ; then
|
||||||
|
# Set our base metric to 1000
|
||||||
|
metric=1000
|
||||||
|
|
||||||
|
ebegin "Creating tunnel ${IFVAR}"
|
||||||
|
ip tunnel add "${tunnel}"
|
||||||
|
eend $? || return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
iproute2_post_start() {
|
||||||
|
ip route flush cache dev "${IFACE}"
|
||||||
|
}
|
||||||
|
|
||||||
|
iproute2_post_stop() {
|
||||||
|
# Don't delete sit0 as it's a special tunnel
|
||||||
|
if [ "${IFACE}" != "sit0" ] ; then
|
||||||
|
if [ -n "$(ip tunnel show "${IFACE}" 2>/dev/null)" ] ; then
|
||||||
|
ebegin "Destroying tunnel ${IFACE}"
|
||||||
|
ip tunnel del "${IFACE}"
|
||||||
|
eend $?
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# vim: set ts=4 :
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user