MAINTAINERS
-Maintainer of development version
-is Marcin Krol <hawk@tld-linux.org>
-
AUTHORS/CREDITS
-Arkadiusz Miśkiewicz <misiek@pld-linux.org>
+Marcin Krol <hawk@tld-linux.org>
+ fixes, scripts for controlling bonding,
+ preparation for TLD Linux
+
+Arkadiusz Miśkiewicz <arekm@pld-linux.org>
networking functions, iproute2 support,
national language support, scripts for
controling tunnels and bridges
Bartosz Waszak <waszi@pld-linux.org>
fixes, devfsd support
+Elan Ruusamäe <glen@pld-linux.org>
+ fixes and features
+
Grzegorz Stanislawski <stangrze@open.net.pl>
ppp scripts, prefix/netmask converting
functions, bug fixes
Arkadiusz Miskiewicz <misiek@pld-linux.org>
1)
- consult all major changes with people on pld-rc-scripts@pld-linux.org
+ consult all major changes with people on pld-devel-en@lists.pld-linux.org
mailing list. This is very important.
2)
+++ /dev/null
- !! First read README file !!
-
-Basic Installation
-==================
-
- These are generic installation instructions.
-
- The `configure' shell script attempts to guess correct values for
-various system-dependent variables used during compilation. It uses
-those values to create a `Makefile' in each directory of the package.
-It may also create one or more `.h' files containing system-dependent
-definitions. Finally, it creates a shell script `config.status' that
-you can run in the future to recreate the current configuration, a file
-`config.cache' that saves the results of its tests to speed up
-reconfiguring, and a file `config.log' containing compiler output
-(useful mainly for debugging `configure').
-
- If you need to do unusual things to compile the package, please try
-to figure out how `configure' could check whether to do them, and mail
-diffs or instructions to the address given in the `README' so they can
-be considered for the next release. If at some point `config.cache'
-contains results you don't want to keep, you may remove or edit it.
-
- The file `configure.in' is used to create `configure' by a program
-called `autoconf'. You only need `configure.in' if you want to change
-it or regenerate `configure' using a newer version of `autoconf'.
-
-The simplest way to compile this package is:
-
- 1. `cd' to the directory containing the package's source code and type
- `./configure' to configure the package for your system. If you're
- using `csh' on an old version of System V, you might need to type
- `sh ./configure' instead to prevent `csh' from trying to execute
- `configure' itself.
-
- Running `configure' takes awhile. While running, it prints some
- messages telling which features it is checking for.
-
- 2. Type `make' to compile the package.
-
- 3. Optionally, type `make check' to run any self-tests that come with
- the package.
-
- 4. Type `make install' to install the programs and any data files and
- documentation.
-
- 5. You can remove the program binaries and object files from the
- source code directory by typing `make clean'. To also remove the
- files that `configure' created (so you can compile the package for
- a different kind of computer), type `make distclean'. There is
- also a `make maintainer-clean' target, but that is intended mainly
- for the package's developers. If you use it, you may have to get
- all sorts of other programs in order to regenerate files that came
- with the distribution.
-
-Compilers and Options
-=====================
-
- Some systems require unusual options for compilation or linking that
-the `configure' script does not know about. You can give `configure'
-initial values for variables by setting them in the environment. Using
-a Bourne-compatible shell, you can do that on the command line like
-this:
- CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
-
-Or on systems that have the `env' program, you can do it like this:
- env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
-
-Compiling For Multiple Architectures
-====================================
-
- You can compile the package for more than one kind of computer at the
-same time, by placing the object files for each architecture in their
-own directory. To do this, you must use a version of `make' that
-supports the `VPATH' variable, such as GNU `make'. `cd' to the
-directory where you want the object files and executables to go and run
-the `configure' script. `configure' automatically checks for the
-source code in the directory that `configure' is in and in `..'.
-
- If you have to use a `make' that does not supports the `VPATH'
-variable, you have to compile the package for one architecture at a time
-in the source code directory. After you have installed the package for
-one architecture, use `make distclean' before reconfiguring for another
-architecture.
-
-Installation Names
-==================
-
- By default, `make install' will install the package's files in
-`/usr/local/bin', `/usr/local/man', etc. You can specify an
-installation prefix other than `/usr/local' by giving `configure' the
-option `--prefix=PATH'.
-
- You can specify separate installation prefixes for
-architecture-specific files and architecture-independent files. If you
-give `configure' the option `--exec-prefix=PATH', the package will use
-PATH as the prefix for installing programs and libraries.
-Documentation and other data files will still use the regular prefix.
-
- In addition, if you use an unusual directory layout you can give
-options like `--bindir=PATH' to specify different values for particular
-kinds of files. Run `configure --help' for a list of the directories
-you can set and what kinds of files go in them.
-
- If the package supports it, you can cause programs to be installed
-with an extra prefix or suffix on their names by giving `configure' the
-option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
-
-Optional Features
-=================
-
- Some packages pay attention to `--enable-FEATURE' options to
-`configure', where FEATURE indicates an optional part of the package.
-They may also pay attention to `--with-PACKAGE' options, where PACKAGE
-is something like `gnu-as' or `x' (for the X Window System). The
-`README' should mention any `--enable-' and `--with-' options that the
-package recognizes.
-
- For packages that use the X Window System, `configure' can usually
-find the X include and library files automatically, but if it doesn't,
-you can use the `configure' options `--x-includes=DIR' and
-`--x-libraries=DIR' to specify their locations.
-
-Specifying the System Type
-==========================
-
- There may be some features `configure' can not figure out
-automatically, but needs to determine by the type of host the package
-will run on. Usually `configure' can figure that out, but if it prints
-a message saying it can not guess the host type, give it the
-`--host=TYPE' option. TYPE can either be a short name for the system
-type, such as `sun4', or a canonical name with three fields:
- CPU-COMPANY-SYSTEM
-
-See the file `config.sub' for the possible values of each field. If
-`config.sub' isn't included in this package, then this package doesn't
-need to know the host type.
-
- If you are building compiler tools for cross-compiling, you can also
-use the `--target=TYPE' option to select the type of system they will
-produce code for and the `--build=TYPE' option to select the type of
-system on which you are compiling the package.
-
-Sharing Defaults
-================
-
- If you want to set default values for `configure' scripts to share,
-you can create a site shell script called `config.site' that gives
-default values for variables like `CC', `cache_file', and `prefix'.
-`configure' looks for `PREFIX/share/config.site' if it exists, then
-`PREFIX/etc/config.site' if it exists. Or, you can set the
-`CONFIG_SITE' environment variable to the location of the site script.
-A warning: not all `configure' scripts look for a site script.
-
-Operation Controls
-==================
-
- `configure' recognizes the following options to control how it
-operates.
-
-`--cache-file=FILE'
- Use and save the results of the tests in FILE instead of
- `./config.cache'. Set FILE to `/dev/null' to disable caching, for
- debugging `configure'.
-
-`--help'
- Print a summary of the options to `configure', and exit.
-
-`--quiet'
-`--silent'
-`-q'
- Do not print messages saying which checks are being made. To
- suppress all normal output, redirect it to `/dev/null' (any error
- messages will still be shown).
-
-`--srcdir=DIR'
- Look for the package's source code in directory DIR. Usually
- `configure' can determine that directory automatically.
-
-`--version'
- Print the version of Autoconf used to generate the `configure'
- script, and exit.
-
-`configure' also accepts some other, not widely useful, options.
$(sbin_SCRIPTS) \
$(bin_SCRIPTS)
+DISTCLEANFILES = \
+ ChangeLog
+
+ChangeLog:
+ $(top_srcdir)/changelog.sh $(top_builddir)
+
+dist-hook:
+ rm -f $(top_builddir)/ChangeLog
+ $(MAKE) -C $(top_builddir) ChangeLog
+ cp -pf $(top_builddir)/ChangeLog $(top_distdir)/ChangeLog
+
install-data-hook:
install -d $(DESTDIR)$(localstatedir)/cache/$(PACKAGE)
[ -f $(DESTDIR)$(localstatedir)/cache/$(PACKAGE)/msg.cache ] || touch $(DESTDIR)$(localstatedir)/cache/$(PACKAGE)/msg.cache
#!/bin/sh
# Run this to generate all the initial makefiles, etc.
-srcdir=`dirname $0`
+srcdir=$(dirname "$0")
test -z "$srcdir" && srcdir=.
PKG_NAME="TLD Linux rc-scripts"
-if [ -x ./changelog.sh ]; then
- ./changelog.sh
-else
- echo "Error: missing script changelog.sh to generate ChangeLog" >&2
- exit 1
-fi
-
-cd "$srcdir"
-
-
-(test -f $srcdir/configure.ac \
- && test -d $srcdir/src) || {
- echo -n "**Error**: Directory "\`$srcdir\'" does not look like the"
- echo " top-level rc-scripts directory"
-
- exit 1
-}
-
-DIE=0
-
-(autoconf --version) < /dev/null > /dev/null 2>&1 || {
- echo
- echo "**Error**: You must have \`autoconf' installed to compile $PKG_NAME."
- echo "Download the appropriate package for your distribution,"
- echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
- DIE=1
-}
-
-(grep "^AM_PROG_LIBTOOL" $srcdir/configure.ac >/dev/null) && {
- (libtoolize --version) < /dev/null > /dev/null 2>&1 || {
- echo
- echo "**Error**: You must have \`libtool' installed to compile $PKG_NAME."
- echo "Get ftp://alpha.gnu.org/gnu/libtool/libtool-1.4b.tar.gz"
- echo "(or a newer version if it is available)"
- DIE=1
- }
-}
-
-grep "^AM_GNU_GETTEXT" $srcdir/configure.ac >/dev/null && {
- grep "sed.*POTFILES" $srcdir/configure.ac >/dev/null || \
- (gettextize --version) < /dev/null > /dev/null 2>&1 || {
- echo
- echo "**Error**: You must have \`gettext' installed to compile $PKG_NAME."
- echo "Get ftp://alpha.gnu.org/gnu/gettext-0.10.38.tar.gz"
- echo "(or a newer version if it is available)"
- DIE=1
- }
-}
-
-(automake --version) < /dev/null > /dev/null 2>&1 || {
- echo
- echo "**Error**: You must have \`automake' installed to compile $PKG_NAME."
- echo "Get ftp://sourceware.cygnus.com/pub/automake/automake-1.4-p4.tar.gz"
- echo "(or a newer version if it is available)"
- DIE=1
- NO_AUTOMAKE=yes
-}
-
-
-# if no automake, don't bother testing for aclocal
-test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || {
- echo
- echo "**Error**: Missing \`aclocal'. The version of \`automake'"
- echo "installed doesn't appear recent enough."
- echo "Get ftp://sourceware.cygnus.com/pub/automake/automake-1.4-p4.tar.gz"
- echo "(or a newer version if it is available)"
- DIE=1
-}
-
-if test "$DIE" -eq 1; then
- exit 1
-fi
-
-if test -z "$*"; then
- echo "**Warning**: I am going to run \`configure' with no arguments."
- echo "If you wish to pass any to it, please specify them on the"
- echo \`$0\'" command line."
- echo
-fi
-
-case $CC in
-xlc )
- am_opt=--include-deps;;
-esac
-
-for coin in `find $srcdir -name configure.ac -print`
-do
- dr=`dirname $coin`
- if test -f $dr/NO-AUTO-GEN; then
- echo skipping $dr -- flagged as no auto-gen
- else
- echo processing $dr
- macrodirs=`sed -n -e 's,AM_ACLOCAL_INCLUDE(\(.*\)),\1,gp' < $coin`
- ( cd $dr
- aclocalinclude="$ACLOCAL_FLAGS"
- for k in $macrodirs; do
- if test -d $k; then
- aclocalinclude="$aclocalinclude -I $k"
- ##else
- ## echo "**Warning**: No such directory \`$k'. Ignored."
- fi
- done
- if grep "^AM_GNU_GETTEXT" configure.ac >/dev/null; then
- if grep "sed.*POTFILES" configure.ac >/dev/null; then
- : do nothing -- we still have an old unmodified configure.ac
- else
- echo "Creating $dr/aclocal.m4 ..."
- test -r $dr/aclocal.m4 || touch $dr/aclocal.m4
- echo "Running gettextize... Ignore non-fatal messages."
- echo "no" | gettextize --force --copy
- echo "Making $dr/aclocal.m4 writable ..."
- test -r $dr/aclocal.m4 && chmod u+w $dr/aclocal.m4
- fi
- fi
- if grep "^AM_PROG_LIBTOOL" configure.ac >/dev/null; then
- echo "Running libtoolize..."
- libtoolize --force --copy
- fi
- echo "Running aclocal $aclocalinclude ..."
- aclocal $aclocalinclude
- if grep "^A[CM]_CONFIG_HEADER" configure.ac >/dev/null; then
- echo "Running autoheader..."
- autoheader
- fi
- echo "Running autoconf ..."
- autoconf
- echo "Running automake --gnu $am_opt ..."
- automake --add-missing --gnu $am_opt
- )
- fi
-done
+autoreconf -vif "$srcdir"
conf_flags="" #--enable-maintainer-mode --enable-compile-warnings --enable-iso-c
#!/bin/sh
# Run this to generate ChangeLog.
+top_builddir=${1:-$(pwd)}
+
+set -e
+
+cd "$top_builddir"
+
[ -e .git/shallow ] && git fetch --unshallow
git log --format='%+ai [%h] %aN <%ae>%n%n%x09* %s' --stat | sed '1d' > ChangeLog
-AC_INIT([rc-scripts], [0.5.0], [tld-devel@lists.tld-linux.org], [rc-scripts])
-AM_INIT_AUTOMAKE
+AC_INIT([rc-scripts], [0.5.1], [tld-devel@lists.tld-linux.org], [rc-scripts])
+
+dnl Do not require AUTHORS, ChangeLog, NEWS, and README to exist
+AM_INIT_AUTOMAKE([foreign])
ALL_LINGUAS="pl de"
#!/bin/sh
-#
-#
-if [ -f /etc/sysconfig/i18n ]; then
+[ ! -f /etc/sysconfig/i18n -a ! -f /etc/locale.conf ] && exit
+
ORG_LANG=$LANG
ORG_LC_ADDRESS=$LC_ADDRESS
ORG_LC_COLLATE=$LC_COLLATE
ORG_LC_TELEPHONE=$LC_TELEPHONE
ORG_LC_TIME=$LC_TIME
ORG_LC_ALL=$LC_ALL
+ ORG_LANGUAGE=$LANGUAGE
- . /etc/sysconfig/i18n
+[ -f /etc/sysconfig/i18n ] && . /etc/sysconfig/i18n
+[ -f /etc/locale.conf ] && . /etc/locale.conf
# we prefer session settings (that came from ssh for example)
# instead of system one
LC_TELEPHONE=${ORG_LC_TELEPHONE:-$LC_TELEPHONE}
LC_TIME=${ORG_LC_TIME:-$LC_TIME}
LC_ALL=${ORG_LC_ALL:-$LC_ALL}
+ LANGUAGE=${ORG_LANGUAGE:-$LANGUAGE}
- unset ORG_LANG ORG_LC_ADDRESS ORG_LC_COLLATE ORG_LC_CTYPE ORG_LC_IDENTIFICATION ORG_LC_MEASUREMENT
- unset ORG_LC_MESSAGES ORG_LC_MONETARY ORG_LC_NAME ORG_LC_NUMERIC ORG_LC_PAPER ORG_LC_TELEPHONE
- unset ORG_LC_TIME ORG_LC_ALL
+unset ORG_LANG ORG_LC_ADDRESS ORG_LC_COLLATE ORG_LC_CTYPE ORG_LC_IDENTIFICATION ORG_LC_MEASUREMENT \
+ ORG_LC_MESSAGES ORG_LC_MONETARY ORG_LC_NAME ORG_LC_NUMERIC ORG_LC_PAPER ORG_LC_TELEPHONE \
+ ORG_LC_TIME ORG_LC_ALL ORG_LANGUAGE
[ "$LANG" ] && export LANG || unset LANG
[ "$LC_ADDRESS" ] && export LC_ADDRESS || unset LC_ADDRESS
[ "$LC_TIME" ] && export LC_TIME || unset LC_TIME
[ "$LC_ALL" ] && export LC_ALL || unset LC_ALL
[ "$LANGUAGE" ] && export LANGUAGE || unset LANGUAGE
- [ "$LINGUAS" ] && export LINGUAS || unset LINGUAS
-
- [ "$_XKB_CHARSET" ] && export _XKB_CHARSET || unset _XKB_CHARSET
- if [ "$INPUTRC" ]; then
- export INPUTRC
- fi
+[ "$LINGUAS" ] && export LINGUAS
+[ "$_XKB_CHARSET" ] && export _XKB_CHARSET
+[ "$INPUTRC" ] && export INPUTRC
if [ "$LESSCHARSET" ]; then
export LESSCHARSET
LESSCHARSET=latin1
export LESSCHARSET
fi
-fi
tnldown \
tnlup
-#scriptsdir = @networkscriptsdir@
scriptsdir = @exec_prefix@/lib/$(PACKAGE)
scripts_SCRIPTS = \
ifup-ppp \
ifup-routes \
ifup-sl \
- ifup-vlan
+ ifup-vlan \
+ makepid
scripts_DATA = \
functions \
done
}
+# inner function used by daemon().
+# do not call this directly, as it expects variables being inherited.
+# also it expects to be called from subshell as it exports env.
+# it expects options parsed by daemon() and command to be executed in "$@".
+_daemon_exec() {
+ local prog=""
+ umask ${SERVICE_UMASK:-$DEFAULT_SERVICE_UMASK};
+ export USER=root HOME=/tmp TMPDIR=/tmp
+
+ nice=${nice:-$DEFAULT_SERVICE_RUN_NICE_LEVEL}
+ nice=${nice:-0}
+
+ # make nice level absolute, not to be dependant of nice level of shell where service started
+ nice=$(($nice - $(nice)))
+
+ if [ "$closefds" = 1 ]; then
+ exec 1>&-
+ exec 2>&-
+ exec 0<&-
+ elif [ "$redirfds" = 1 ]; then
+ exec 1>/dev/null
+ exec 2>/dev/null
+ exec 0</dev/null
+ else
+ exec 2>&1
+ exec 0</dev/null
+ fi
+
+ if is_no "$RC_LOGGING"; then
+ prog=$1; shift
+ if [ ! -x $prog ]; then
+ logger -t rc-scripts -p daemon.debug "daemon: Searching PATH for $prog, consider using full path in initscript"
+ local a o=$IFS
+ IFS=:
+ for a in $PATH; do
+ if [ -x $a/$prog ]; then
+ prog=$a/$prog
+ break
+ fi
+ done
+ IFS=$o
+ fi
+ set -- "$prog" "$@"
+
+ # use setsid to detach from terminal,
+ # NOTE: setsid needs to be "outer" program
+ # otherwise start-stop-daemon would capture the setsid pid not the actual program
+
+ prog=$1; shift
+ /usr/bin/setsid \
+ /sbin/start-stop-daemon -q --start \
+ --nicelevel $nice \
+ ${pidfile:+--pidfile $pidfile} \
+ ${makepid:+--make-pidfile} \
+ ${user:+--chuid $user} \
+ ${chdir:+--chdir "$chdir"} \
+ ${fork:+--background} \
+ ${SERVICE_DROPCAPS:+--dropcap $SERVICE_DROPCAPS} \
+ --exec "$prog" \
+ -- "$@"
+ else
+ if [ "$fork" = "1" ]; then
+ export PIDFILE="/dev/null"
+ if [ "$makepid" ] && [ "$pidfile" ]; then
+ export PIDFILE="$pidfile"
+ fi
+ set -- /lib/rc-scripts/makepid "$@"
+ set -- /usr/bin/setsid "$@"
+ fi
+ if [ -n "$user" -a "$user" != "root" ]; then
+ set -- /bin/runuser -u "$user" -- "$@"
+ fi
+
+ nice -n $nice initlog -c "$*" 2>&1 </dev/null
+ fi
+}
+
# A function to start a program (now it's useful on read-only filesystem too)
daemon() {
- local errors="" prog="" end="" waitname="" waittime=0
+ local errors="" waitname="" waittime=0
local exit_code=0
local nice=$SERVICE_RUN_NICE_LEVEL
local fork user closefds redirfds pidfile makepid chdir=/
- # NOTE: if you wonder how the shellish (by syntax) $prog works in ssd mode,
- # then the answer is: it totally ignores $prog and uses "$@" itself.
-
while [ $# -gt 0 ]; do
case $1 in
'')
;;
--fork)
fork=1
- end='&'
;;
--chdir)
shift
;;
--makepid)
makepid=1
+ # makepid implies fork
+ fork=1
;;
-*|+*)
nice=$1
esac
shift
done
- if [ -n "$user" -a "$user" != "root" ]; then
- prog="/bin/su $user -s /bin/sh -c \""
- fi
- if [ "$fork" = "1" ]; then
- prog="/usr/bin/setsid ${prog:-sh -c \"}"
- fi
- # If command to execute ends with quotation mark, add remaining
- # arguments and close quotation.
- if [ "$prog" != "${prog%\"}" ]; then
- prog="$prog $*$end\""
- else
- prog="$prog $*$end"
- fi
_daemon_set_ulimits
busy
cd $chdir
[ -n "$SERVICE_CPUSET" ] && is_yes "$CPUSETS" && echo $$ > "/dev/cpuset/${SERVICE_CPUSET}/tasks"
- if errors=$(
- umask ${SERVICE_UMASK:-$DEFAULT_SERVICE_UMASK};
- export USER=root HOME=/tmp TMPDIR=/tmp
-
- nice=${nice:-$DEFAULT_SERVICE_RUN_NICE_LEVEL}
- nice=${nice:-0}
-
- # make nice level absolute, not to be dependant of nice level of shell where service started
- nice=$(($nice - $(nice)))
-
- if [ "$closefds" = 1 ]; then
- exec 1>&-
- exec 2>&-
- exec 0<&-
- elif [ "$redirfds" = 1 ]; then
- exec 1>/dev/null
- exec 2>/dev/null
- exec 0</dev/null
- else
- exec 2>&1
- exec 0</dev/null
- fi
-
- if is_no "$RC_LOGGING"; then
- prog=$1; shift
- if [ ! -x $prog ]; then
- logger -t rc-scripts -p daemon.debug "daemon: Searching PATH for $prog, consider using full path in initscript"
- local a o=$IFS
- IFS=:
- for a in $PATH; do
- if [ -x $a/$prog ]; then
- prog=$a/$prog
- break
- fi
- done
- IFS=$o
- fi
- set -- "$prog" "$@"
-
- # use setsid to detach from terminal,
- # needs pidfile or ssd would check setsid program instead of real program
- if [ "$pidfile" ]; then
- set -- /usr/bin/setsid "$@"
- fi
-
- prog=$1; shift
- /sbin/start-stop-daemon -q --start \
- --nicelevel $nice \
- ${pidfile:+--pidfile $pidfile} \
- ${makepid:+--make-pidfile} \
- ${user:+--chuid $user} \
- ${chdir:+--chdir "$chdir"} \
- ${fork:+--background} \
- ${SERVICE_DROPCAPS:+--dropcap $SERVICE_DROPCAPS} \
- --exec "$prog" \
- -- "$@"
- else
- nice -n $nice initlog -c "$prog" 2>&1 </dev/null
- fi
- ); then
-
+ if errors=$(_daemon_exec "$@"); then
# wait for process (or pidfile) to be created
if [ "$waittime" -gt 0 ]; then
# waitname can be empty, as if pidfile is in use, it is not relevant
fi
# Next try "pidof" if pidfile is not specified
- if [ -z "$pid" ] && [ -z "$pidfile" ]; then
+ if [ -z "$pid" ] && [ -z "$2" ]; then
pid=$(pidof -o $$ -o $PPID -o %PPID -x "$1")
fi
esac
# Multicast ready devices
- if is_yes "$MULTICAST"; then
- MULTICAST="on"
+ if [ -n "$MULTICAST" ]; then
+ MULTICAST="$MULTICAST"
else
case "$DEVICETYPE" in
- eth|br)
+ eth|br|vlan)
MULTICAST="on"
;;
*)
if [ -z "${IPV6_GLOBALROUTEDEV}" -o "${IPV6_GLOBALROUTEDEV}" = "${DEVICE}" ]; then
# set up default route
if [ "${IPV6_GLOBALROUTEGW}" ]; then
+ ip -6 route add ${IPV6_GLOBALROUTEGW} dev ${DEVICE} ${IP6SRCADDR} onlink
ip -6 route add 2000::/3 via ${IPV6_GLOBALROUTEGW} dev ${DEVICE} ${IP6SRCADDR} onlink
elif [ "${IPV6_GLOBALROUTEDEV}" = "${DEVICE}" ]; then
ip -6 route add 2000::/3 dev ${DEVICE} ${IP6SRCADDR}
#
PATH=/sbin:/usr/sbin:/bin:/usr/bin
+run_pre_down() { :; }
+
. /etc/sysconfig/network
. /etc/rc.d/init.d/functions
. /lib/rc-scripts/functions.network
# set all major variables
setup_ip_param
+# anything you need done first
+run_pre_down
+
OTHERSCRIPT="/lib/rc-scripts/ifdown-${DEVICETYPE}"
# shutdown tleds software
#
PATH=/sbin:/usr/sbin:/bin:/usr/bin
+run_pre_up() { :; }
+
. /etc/sysconfig/network
. /etc/rc.d/init.d/functions
. /lib/rc-scripts/functions.network
SYSCTLDEVICE=$(echo ${DEVICE} | sed 's/\./\//g')
+# anything you need done first
+run_pre_up
+
OTHERSCRIPT="/lib/rc-scripts/ifup-${DEVICETYPE}"
if [ -x "$OTHERSCRIPT" ]; then
if [ -n "$MACVLAN_DEV" -a -n "$MACVLAN_MACADDR" ]; then
ip link del link ${MACVLAN_DEV} ${DEVICE} type macvlan > /dev/null 2>&1
- ip link add link ${MACVLAN_DEV} address ${MACVLAN_MACADDR} name ${DEVICE} type macvlan
+ ip link add link ${MACVLAN_DEV} address ${MACVLAN_MACADDR} name ${DEVICE} type macvlan ${MACVLAN_MODE:+mode $MACVLAN_MODE}
fi
# is this device available? (this catches PCMCIA devices for us)
fi
DHCP_ARGS="$DHCP_OPTIONS $DHCP_ARGS"
- if check_link_down ${DEVICE}; then
+ [ -z "$CHECK_LINK_WAIT_TIMEOUT" ] && CHECK_LINK_WAIT_TIMEOUT=5
+ if check_link_down ${DEVICE} $(( $CHECK_LINK_WAIT_TIMEOUT * 2 )); then
run_cmd "$(nls 'Determining IP information for %s (%s)' "$DEVICE" "${DHCP_CLIENT##*/}")" /bin/false
nls '%s: Check cable/radio on-off switch?' "$DEVICE"
exit 1
--- /dev/null
+#!/bin/sh
+test -n "$PIDFILE" || { echo >&2 'Missing $PIDFILE env'; exit 1; }
+
+# run the program, and capture pid
+prog="$1"; shift
+"$prog" "$@" &
+pid=$!
+rc=$?
+
+# write pid to file
+echo "$pid" > "$PIDFILE"
+exit $rc
DEVICE=""; ONBOOT=""; USERS=""; . "$i" 2>/dev/null
[ "${DEVICE:+set}" != "set" ] && continue
[ ${USERS:-no} != no ] && continue
- [ ${ONBOOT:-no} = yes ] && echo "${i##*/ifcfg-}"
+ is_yes ${ONBOOT:-no} && echo "${i##*/ifcfg-}"
done
`
else
DEVICE=""; ONBOOT=""; USERS=""; . "$i" 2>/dev/null
[ "${DEVICE:+set}" != "set" ] && continue
[ ${USERS:-no} != no ] && continue
- [ ${ONBOOT:-no} = yes ] && echo "${i##*/ifcfg-}"
+ is_yes ${ONBOOT:-no} && echo "${i##*/ifcfg-}"
done
`
DEVICE=""; ONBOOT=""; USERS=""; . "$i" 2>/dev/null
[ "${DEVICE:+set}" != "set" ] && continue
[ ${USERS:-no} != no ] && continue
- [ ${ONBOOT:-no} = yes ] && echo "${i##*/ifcfg-}"
+ is_yes [ ${ONBOOT:-no} && echo "${i##*/ifcfg-}"
done
`
DEVICE=""; ONBOOT=""; USERS=""; . "$i" 2>/dev/null
[ "${DEVICE:+set}" != "set" ] && continue
[ ${USERS:-no} != no ] && continue
- [ ${ONBOOT:-no} = yes ] && echo "${i##*/ifcfg-}"
+ is_yes ${ONBOOT:-no} && echo "${i##*/ifcfg-}"
done
`
DEVICE=""; ONBOOT=""; USERS=""; . "$i" 2>/dev/null
[ "${DEVICE:+set}" != "set" ] && continue
[ ${USERS:-no} != no ] && continue
- [ ${ONBOOT:-no} = yes ] && echo "${i##*/ifcfg-}"
+ is_yes ${ONBOOT:-no} && echo "${i##*/ifcfg-}"
done
`
DEVICE=""; ONBOOT=""; USERS=""; . "$i" 2>/dev/null
[ "${DEVICE:+set}" != "set" ] && continue
[ ${USERS:-no} != no ] && continue
- [ ${ONBOOT:-no} = yes ] && echo "${i##*/ifcfg-}"
+ is_yes ${ONBOOT:-no} && echo "${i##*/ifcfg-}"
done
`
fi
DEVICE=""; ONBOOT=""; USERS=""; . "$i" 2>/dev/null
[ "${DEVICE:+set}" != "set" ] && continue
[ ${USERS:-no} != no ] && continue
- [ ${ONBOOT:-no} = yes ] && echo "${i##*/tnlcfg-}"
+ is_yes ${ONBOOT:-no} && echo "${i##*/tnlcfg-}"
done
)
}
parse_cmdline
if [ -d /run ]; then
- is_fsmounted tmpfs /run || mount -n -t tmpfs run /run
+ is_fsmounted tmpfs /run || mount -n -t tmpfs run /run -o mode=0755,noexec,nosuid,nodev
fi
# Early sysctls
mount -f -t devtmpfs devtmpfs /dev 2> /dev/null
fi
if is_fsmounted tmpfs /run; then
- mount -f -t tmpfs run /run 2> /dev/null
+ mount -f -t tmpfs run /run -o mode=0755,noexec,nosuid,nodev 2> /dev/null
fi
if is_fsmounted usbfs /proc/bus/usb; then
[ HANDLING=0|1|2|3 ] (0 is default; used ie. in ATM configuration, for
details see ifup script)
+[ CHECK_LINK_WAIT_TIMEOUT=<wait max x sec for interface link up> ]
+
if DEVICE=eth*; then
[ MEDIA={auto|10baseT|10base2|AUI} ]
if macvlan
MACVLAN_DEV=<exitsting base interface eg. eth0>
MACVLAN_MACADDR=<desired hw address of new interface>
+ MACVLAN_MODE=<desired mode of new interface (private, vepa, bridge, passthru, source)>
fi
DISCOVERY=yes|no (starts discovery of remote IrDA devices)
fi
-# You can also run some other programs *after* device has been brought up or down.
-# Just create functions run_up() and run_down().
+# You can also run commands before/after a device has been brought up or down.
+# Just create functions run_up/run_pre_up/run_down/run_pre_down.
+run_pre_up()
+{
+ echo "This will be executed before device is brought up!"
+}
+
run_up()
{
echo "This will be executed after device is brought up!"
}
+run_pre_down()
+{
+ echo "This will be executed before device is brought down!"
+}
+
run_down()
{
echo "This will be executed after device is brought down!"
-
# Do you want colorized starting scripts ?
COLOR_INIT=yes
CONSOLE_LOGLEVEL=1
# On errors (when system is starting) run sulogin instead of shell ?
+# This option disables debuginitrd=sh in geninitrd as well.
RUN_SULOGIN_ON_ERR=yes
# Default run nice level for all services if $SERVICE_RUN_NICE_LEVEL is not
# Useful for debugging multi-threaded applications.
#kernel.core_uses_pid = 1
-# Enable the magic-sysrq key
+# System Request functionality of the kernel (SYNC)
+# Use kernel.sysrq = 1 to allow all keys.
+# See http://fedoraproject.org/wiki/QA/Sysrq for a list of values and keys.
kernel.sysrq = 1
# After how many seconds reboot system after kernel panic?
--- /dev/null
+#!/bin/sh
+# test that variables local to function are inherited when another function is called out
+#
+# the whole program should output:
+#---
+#sub: var='var'
+#sub: subvar='subvar'
+#main: var='var'
+#main: subvar='subvar'
+#subshelled: sub: var='var' sub: subvar='subvar'
+#outer: var=''
+#outer: subvar=''
+#---
+
+sub() {
+ subvar=subvar
+ echo "sub: var='$var'"
+ echo "sub: subvar='$subvar'"
+}
+
+main() {
+ local var=var
+ local subvar
+
+ sub
+ echo "main: var='$var'"
+ echo "main: subvar='$subvar'"
+
+ echo "subshelled:" $(sub)
+}
+
+main
+echo "outer: var='$var'"
+echo "outer: subvar='$subvar'"
--- /dev/null
+#!/bin/sh
+#
+# testcase experimenting whether daemon --pidfile --fork --makepid works with RC_LOGGING=on and off
+#
+
+dir=$(readlink -f $(dirname "$0"))
+testname=$(basename "$0")
+# save flags, as want to load functions with set +x
+set=$-
+
+set +x
+. $dir/../lib/functions
+set -$set
+
+pidfile=$dir/$testname.pid
+makepid="$dir/../lib/makepid"
+# use /bin/sleep to avoid using sleep builtin
+testprog="/bin/sleep 300"
+
+# fail on errors
+set -e
+
+assert_pidfile() {
+ pid=$(cat $pidfile)
+ # pid must exist
+ test -n "$pid"
+
+ # command must match what was started
+ cmd=$(ps -o cmd= -p $pid)
+ test "$cmd" = "$testprog"
+}
+
+test_makepid() {
+ rm -f $pidfile
+ PIDFILE=$pidfile $makepid $testprog
+ assert_pidfile
+}
+
+test_daemon() {
+ rm -f $pidfile
+ daemon --pidfile $pidfile --fork --makepid $testprog
+ assert_pidfile
+}
+
+test_makepid
+
+RC_LOGGING=yes
+test_daemon
+
+RC_LOGGING=no
+test_daemon