From 49ade4f4b5b1978db4561d62063008a339a1526f Mon Sep 17 00:00:00 2001 From: Marcin Krol Date: Wed, 11 Jul 2018 21:23:51 +0000 Subject: [PATCH] - merged changes from PLD, all TLD changes and fixes are kept --- AUTHORS | 12 +- DEVELOPMENT | 2 +- INSTALL | 184 ------------------------- Makefile.am | 11 ++ autogen.sh | 134 +----------------- changelog.sh | 6 + configure.ac | 6 +- lang.sh | 26 ++-- lib/Makefile.am | 4 +- lib/functions | 162 +++++++++++----------- lib/functions.network | 7 +- lib/ifdown | 5 + lib/ifup | 10 +- lib/makepid | 12 ++ rc.d/init.d/network | 14 +- rc.d/rc.sysinit | 4 +- sysconfig/interfaces/ifcfg-description | 17 ++- sysconfig/system | 2 +- sysctl.conf | 4 +- t/inherit.sh | 34 +++++ t/service-fork-makepid.sh | 51 +++++++ 21 files changed, 270 insertions(+), 437 deletions(-) delete mode 100644 INSTALL create mode 100755 lib/makepid create mode 100755 t/inherit.sh create mode 100755 t/service-fork-makepid.sh diff --git a/AUTHORS b/AUTHORS index af351ad..252e6a0 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,11 +1,12 @@ MAINTAINERS -Maintainer of development version -is Marcin Krol - AUTHORS/CREDITS -Arkadiusz Miśkiewicz +Marcin Krol + fixes, scripts for controlling bonding, + preparation for TLD Linux + +Arkadiusz Miśkiewicz networking functions, iproute2 support, national language support, scripts for controling tunnels and bridges @@ -16,6 +17,9 @@ Artur Frysiak Bartosz Waszak fixes, devfsd support +Elan Ruusamäe + fixes and features + Grzegorz Stanislawski ppp scripts, prefix/netmask converting functions, bug fixes diff --git a/DEVELOPMENT b/DEVELOPMENT index b347b76..8a6ca0b 100644 --- a/DEVELOPMENT +++ b/DEVELOPMENT @@ -2,7 +2,7 @@ Arkadiusz Miskiewicz 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) diff --git a/INSTALL b/INSTALL deleted file mode 100644 index 0068d75..0000000 --- a/INSTALL +++ /dev/null @@ -1,184 +0,0 @@ - !! 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. diff --git a/Makefile.am b/Makefile.am index aabcb6f..1e7761f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -36,6 +36,17 @@ EXTRA_DIST = \ $(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 diff --git a/autogen.sh b/autogen.sh index 1c09dcd..6698d91 100755 --- a/autogen.sh +++ b/autogen.sh @@ -1,142 +1,12 @@ #!/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 diff --git a/changelog.sh b/changelog.sh index 54baf7d..a7f24dc 100755 --- a/changelog.sh +++ b/changelog.sh @@ -1,6 +1,12 @@ #!/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 diff --git a/configure.ac b/configure.ac index c81669c..f743551 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,8 @@ -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" diff --git a/lang.sh b/lang.sh index dfb0ddf..2e88efb 100755 --- a/lang.sh +++ b/lang.sh @@ -1,8 +1,7 @@ #!/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 @@ -17,8 +16,10 @@ if [ -f /etc/sysconfig/i18n ]; then 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 @@ -37,10 +38,11 @@ if [ -f /etc/sysconfig/i18n ]; then 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 @@ -57,13 +59,10 @@ if [ -f /etc/sysconfig/i18n ]; then [ "$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 @@ -71,4 +70,3 @@ if [ -f /etc/sysconfig/i18n ]; then LESSCHARSET=latin1 export LESSCHARSET fi -fi diff --git a/lib/Makefile.am b/lib/Makefile.am index 85e5d92..c198154 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -6,7 +6,6 @@ sbin_SCRIPTS = \ tnldown \ tnlup -#scriptsdir = @networkscriptsdir@ scriptsdir = @exec_prefix@/lib/$(PACKAGE) scripts_SCRIPTS = \ @@ -30,7 +29,8 @@ scripts_SCRIPTS = \ ifup-ppp \ ifup-routes \ ifup-sl \ - ifup-vlan + ifup-vlan \ + makepid scripts_DATA = \ functions \ diff --git a/lib/functions b/lib/functions index fac4c46..fb41ffa 100644 --- a/lib/functions +++ b/lib/functions @@ -605,16 +605,90 @@ _daemon_set_ulimits() { 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&1 + exec 0&1 "/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&1 - exec 0&1 /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) @@ -172,7 +177,8 @@ if [ -n "$BOOTPROTO" -a "$BOOTPROTO" != "none" -a "$BOOTPROTO" != "static" ]; th 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 diff --git a/lib/makepid b/lib/makepid new file mode 100755 index 0000000..224b431 --- /dev/null +++ b/lib/makepid @@ -0,0 +1,12 @@ +#!/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 diff --git a/rc.d/init.d/network b/rc.d/init.d/network index cfbaa72..5e8cd20 100755 --- a/rc.d/init.d/network +++ b/rc.d/init.d/network @@ -143,7 +143,7 @@ find_boot_interfaces() { 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 @@ -155,7 +155,7 @@ find_boot_interfaces() { 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 ` @@ -168,7 +168,7 @@ find_boot_interfaces() { 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 ` @@ -181,7 +181,7 @@ find_boot_interfaces() { 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 ` @@ -194,7 +194,7 @@ find_boot_interfaces() { 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 ` @@ -207,7 +207,7 @@ find_boot_interfaces() { 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 @@ -217,7 +217,7 @@ find_boot_interfaces() { 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 ) } diff --git a/rc.d/rc.sysinit b/rc.d/rc.sysinit index c7375fe..826b435 100755 --- a/rc.d/rc.sysinit +++ b/rc.d/rc.sysinit @@ -372,7 +372,7 @@ if ! is_yes "$VSERVER" && [[ "$container" != lxc* ]]; then 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 @@ -643,7 +643,7 @@ if ! is_yes "$VSERVER" && [[ "$container" != lxc* ]]; then 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 diff --git a/sysconfig/interfaces/ifcfg-description b/sysconfig/interfaces/ifcfg-description index 3986ef9..45d5a70 100644 --- a/sysconfig/interfaces/ifcfg-description +++ b/sysconfig/interfaces/ifcfg-description @@ -81,6 +81,8 @@ VLAN_REORDER_HDR=[0|1] When this is set, the VLAN device will move the [ HANDLING=0|1|2|3 ] (0 is default; used ie. in ATM configuration, for details see ifup script) +[ CHECK_LINK_WAIT_TIMEOUT= ] + if DEVICE=eth*; then [ MEDIA={auto|10baseT|10base2|AUI} ] @@ -89,6 +91,7 @@ if DEVICE=eth*; then if macvlan MACVLAN_DEV= MACVLAN_MACADDR= + MACVLAN_MODE= fi @@ -227,13 +230,23 @@ elif DEVICE=irda* ; then /* IrDA */ 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!" diff --git a/sysconfig/system b/sysconfig/system index 0734c41..a196f21 100644 --- a/sysconfig/system +++ b/sysconfig/system @@ -1,4 +1,3 @@ - # Do you want colorized starting scripts ? COLOR_INIT=yes @@ -14,6 +13,7 @@ FASTRC=no 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 diff --git a/sysctl.conf b/sysctl.conf index d918cd5..a34935b 100644 --- a/sysctl.conf +++ b/sysctl.conf @@ -131,7 +131,9 @@ net.ipv4.conf.default.rp_filter = 1 # 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? diff --git a/t/inherit.sh b/t/inherit.sh new file mode 100755 index 0000000..c362635 --- /dev/null +++ b/t/inherit.sh @@ -0,0 +1,34 @@ +#!/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'" diff --git a/t/service-fork-makepid.sh b/t/service-fork-makepid.sh new file mode 100755 index 0000000..2426149 --- /dev/null +++ b/t/service-fork-makepid.sh @@ -0,0 +1,51 @@ +#!/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 -- 2.46.0