summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Heim <phreak@gentoo.org>2006-05-23 10:14:37 +0000
committerChristian Heim <phreak@gentoo.org>2006-05-23 10:14:37 +0000
commit01cfc67f0ac727187a6faf0161f000bb44816b2e (patch)
treebc2218db3ea8713cfab444697d08004527bbe493
parentWe're only at _pre17, so this is _pre18 (diff)
downloadbaselayout-vserver-01cfc67f0ac727187a6faf0161f000bb44816b2e.tar.gz
baselayout-vserver-01cfc67f0ac727187a6faf0161f000bb44816b2e.tar.bz2
baselayout-vserver-01cfc67f0ac727187a6faf0161f000bb44816b2e.zip
Merging r2042, preparing stabilization of baselayout-1.12.0
svn path=/baselayout-vserver/branches/baselayout-1_12/; revision=361
-rw-r--r--ChangeLog33
-rw-r--r--ChangeLog.vserver4
-rw-r--r--etc/conf.d/rc26
-rw-r--r--net-scripts/conf.d/net.example5
-rw-r--r--net-scripts/net/br2684ctl.sh15
-rw-r--r--net-scripts/net/bridge.sh26
-rwxr-xr-xsbin/depscan.sh2
-rw-r--r--sbin/functions.sh5
-rwxr-xr-xsbin/rc36
-rwxr-xr-xsbin/rc-services.sh29
-rwxr-xr-xsbin/runscript.sh54
-rwxr-xr-xtarball.sh2
12 files changed, 164 insertions, 73 deletions
diff --git a/ChangeLog b/ChangeLog
index 71083d0..65fd2b9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,9 +1,38 @@
# ChangeLog for Gentoo System Intialization ("rc") scripts
# Copyright 1999-2006 Gentoo Foundation; Distributed under the GPLv2
- 02 May 2006; Roy Marples <uberlord@gentoo.org>:
+ 16 May 2006; Roy Marples <uberlord@gentoo.org>:
- RC_COLDPLUG is now a pure pattern list which defaults to "*"
+ Always report Xen domU domains correctly, #107976.
+
+ 15 May 2006; Roy Marples <uberlord@gentoo.org>:
+
+ Always test for space at the end of the bridge name.
+
+ 14 May 2006; Roy Marples <uberlord@gentoo.org>:
+
+ Don't stop coldplugged services when changing runlevels, #113264.
+
+ Only report inactive start once.
+
+ 07 May 2006; Roy Marples <uberlord@gentoo.org>:
+
+ Fix logic in br2684ctl.sh as reported by Alin Nastac, #132549.
+
+ 05 May 2006; Mike Frysinger <vapier@gentoo.org>:
+
+ Fix typo s/veend/vewend/ in functions.sh as reported by Yoshino #132262.
+
+ 05 May 2006; Roy Marples <uberlord@gentoo.org>:
+
+ If a device initiated service is in the default runlevel then we no
+ longer start it in the boot runlevel.
+
+ 04 May 2006; Roy Marples <uberlord@gentoo.org>:
+
+ RC_COLDPLUG is now just a yes|no setting and the service list allowed
+ is now in RC_PLUG_SERVICES.
+ Added RC_HOTPLUG setting similar to RC_COLDPLUG.
* baselayout-1.12.0_pre19 (02 May 2006)
diff --git a/ChangeLog.vserver b/ChangeLog.vserver
index dd19d8d..347d01a 100644
--- a/ChangeLog.vserver
+++ b/ChangeLog.vserver
@@ -1,6 +1,10 @@
# ChangeLog for Gentoo System Intialization ("rc") scripts
# Copyright 1999-2006 Gentoo Foundation; Distributed under the GPLv2
+ 23 May 2006; Christian Heim <phreak@gentoo.org>:
+ Merging latest changes to the baselayout-1_12 branch. This merge is based
+ upon revision 2042.
+
02 May 2006; Christian Heim <phreak@gentoo.org>:
Merging latest changes to the baselayout-1_12 branch. This merge is based
upon revision 2022.
diff --git a/etc/conf.d/rc b/etc/conf.d/rc
index 7c52f0e..dc18886 100644
--- a/etc/conf.d/rc
+++ b/etc/conf.d/rc
@@ -10,15 +10,29 @@ RC_TTY_NUMBER=0
RC_PARALLEL_STARTUP="no"
+# Do we allow services to be hotplugged? If not, set to RC_HOTPLUG="no"
+# NOTE: This does not affect anything hotplug/udev related, just the
+# starting/stopping of the init.d service triggered by hotplug.
+
+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. RC_COLDPLUG is a list of services we
-# allow to be coldplugged in this way. Globbing is allowed as is prefixing
-# with ! which means don't coldplug.
-# Example - RC_COLDPLUG="net.wlan !net.* *"
-# This allows net.wlan and any service not matching net.* to coldplug.
+# services to start in the boot runlevel. Set RC_COLDPLUG="no" if you don't
+# want this.
+# NOTE: This does not affect anything coldplug/udev related, just the
+# starting/stopping of the init.d service triggered by coldplug.
+
+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_COLDPLUG="*"
+RC_PLUG_SERVICES=""
# RC_NET_STRICT_CHECKING allows some flexibility with the 'net' service.
# The following values are allowed:
diff --git a/net-scripts/conf.d/net.example b/net-scripts/conf.d/net.example
index 2d62a18..10c10c9 100644
--- a/net-scripts/conf.d/net.example
+++ b/net-scripts/conf.d/net.example
@@ -557,6 +557,11 @@
# 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 encapulation 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" )
diff --git a/net-scripts/net/br2684ctl.sh b/net-scripts/net/br2684ctl.sh
index 445d2f1..e325817 100644
--- a/net-scripts/net/br2684ctl.sh
+++ b/net-scripts/net/br2684ctl.sh
@@ -35,16 +35,15 @@ br2684ctl_pre_start() {
return 1
fi
- if [[ " ${!opts} " != *" -b "* ]] ; then
- eerror "The -b option is not allowed for br2684ctl_${ifvar}"
+ if [[ " ${!opts} " == *" -b "* || " {!opts} " == *" -c "* ]] ; then
+ eerror "The -b and -c options are not allowed for br2684ctl_${ifvar}"
return 1
fi
einfo "Starting RFC 2684 Bridge control on ${iface}"
-
start-stop-daemon --start --exec /sbin/br2684ctl --background \
--make-pidfile --pidfile "/var/run/br2684ctl-${iface}.pid" \
- -- ${!opts} -c "${number}"
+ -- -c "${number}" ${!opts}
eend $?
}
@@ -52,14 +51,14 @@ br2684ctl_pre_start() {
br2684ctl_post_stop() {
local iface="$1"
local number="${iface#${iface%%[0-9]}}"
+ local pidfile="/var/run/br2684ctl-${iface}.pid"
- [[ $(itype "${iface}") != "nas" ]] && return 0
+ [[ $(interface_type "${iface}") != "nas" ]] && return 0
- [[ -e /var/run/br2864ctl-${iface}.pid ]] || return 0
+ [[ -e ${pidfile} ]] || return 0
einfo "Stopping RFC 2684 Bridge control on ${iface}"
- start-stop-daemon --stop --exec /sbin/br2864ctl \
- --pidfile "/var/run/br2684ctl-${iface}.pid"
+ start-stop-daemon --stop --exec /sbin/br2684ctl --pidfile "${pidfile}"
eend $?
}
diff --git a/net-scripts/net/bridge.sh b/net-scripts/net/bridge.sh
index 67af002..2d4e6f5 100644
--- a/net-scripts/net/bridge.sh
+++ b/net-scripts/net/bridge.sh
@@ -36,29 +36,33 @@ bridge_check_installed() {
# Returns the interfaces added to the given bridge
bridge_get_ports() {
brctl show 2>/dev/null \
- | sed -n -e '/^'"$1"'/,/^\S/ { /^\('"$1"'\|\t\)/s/^.*\t//p }'
+ | sed -n -e '/^'"$1"'[[:space:]]/,/^\S/ { /^\('"$1"'[[:space:]]\|\t\)/s/^.*\t//p }'
}
# char* bridge_get_bridge(char *interface)
#
# Returns the bridge interface of the given interface
bridge_get_bridge() {
- local x="$( brctl show 2>/dev/null \
- | sed -e '1 {d}; /^[^ ]/ { N }; /.*'"$1"'.*/ {s/^\([^ \t]\+\).*/\1/p}; d')"
-
- local -a a=( ${x} )
- if [[ ${#a[@]} == "1" ]] ; then
- echo "${x}"
- elif [[ $1 == "${a[3]}" ]] ; then
- echo "${a[0]}"
- fi
+ local myiface="$1"
+ local bridge= idx= stp= iface= x=
+ while read bridge idx stp iface x ; do
+ if [[ -z ${iface} ]] ; then
+ iface="${stp}"
+ stp="${idx}"
+ idx="${bridge}"
+ fi
+ if [[ ${iface} == "${myiface}" ]] ; then
+ echo "${bridge}"
+ return 0
+ fi
+ done < <(brctl show 2>/dev/null)
}
# bool bridge_exists(char *interface)
#
# Returns 0 if the bridge exists, otherwise 1
bridge_exists() {
- brctl show 2>/dev/null | grep -q "^$1"
+ brctl show 2>/dev/null | grep -q "^$1[[:space:]]"
}
# bool bridge_create(char *interface)
diff --git a/sbin/depscan.sh b/sbin/depscan.sh
index e9454a1..d0cff4a 100755
--- a/sbin/depscan.sh
+++ b/sbin/depscan.sh
@@ -68,7 +68,7 @@ fi
for x in softscripts snapshot options daemons \
started starting inactive wasinactive stopping failed \
- exclusive exitcodes scheduled ; do
+ exclusive exitcodes scheduled coldplugged ; do
if [[ ! -d "${mysvcdir}/${x}" ]] ; then
if ! mkdir -p -m 0755 "${mysvcdir}/${x}" 2>/dev/null ; then
eerror "Could not create needed directory '${mysvcdir}/${x}'!"
diff --git a/sbin/functions.sh b/sbin/functions.sh
index da3b5c7..34e00ad 100644
--- a/sbin/functions.sh
+++ b/sbin/functions.sh
@@ -6,9 +6,6 @@ RC_GOT_FUNCTIONS="yes"
# Override defaults with user settings ...
[[ -f /etc/conf.d/rc ]] && source /etc/conf.d/rc
-# daemontools dir
-SVCDIR="/var/lib/supervise"
-
# Check /etc/conf.d/rc for a description of these ...
declare -r svclib="/lib/rcscripts"
declare -r svcdir="${svcdir:-/var/lib/init.d}"
@@ -336,7 +333,7 @@ veend() {
[[ ${RC_VERBOSE} == "yes" ]] && { eend "$@"; return $?; }
return ${1:-0}
}
-veend() {
+vewend() {
[[ ${RC_VERBOSE} == "yes" ]] && { ewend "$@"; return $?; }
return ${1:-0}
}
diff --git a/sbin/rc b/sbin/rc
index e4a828d..85d2ff5 100755
--- a/sbin/rc
+++ b/sbin/rc
@@ -269,8 +269,16 @@ else
# As we're in the bootlevel, add any services that failed due
# to /dev/.rcsysinit existing to the list
if [[ -d /dev/.rcboot ]] ; then
+ COLDPLUG_SERVICES=
for x in $(dolisting /dev/.rcboot/) ; do
- [[ -L ${x} ]] && myscripts="${myscripts} ${x##*/}"
+ [[ -L ${x} ]] && COLDPLUG_SERVICES="${COLDPLUG_SERVICES} ${x##*/}"
+ done
+ for x in ${COLDPLUG_SERVICES} ; do
+ if [[ ! -e /etc/runlevels/"${BOOTLEVEL}"/"${x}" \
+ && ! -e /etc/runlevels/"${DEFAULTLEVEL}"/"${x}" ]] ; then
+ myscripts="${myscripts} ${x}"
+ mark_service_coldplugged "${x}"
+ fi
done
einfo "Device initiated services:${HILITE}${myscripts}${NORMAL}"
rm -rf /dev/.rcboot
@@ -319,23 +327,15 @@ dep_stop() {
service_stopped "${service}" && return 0
# Candidate for zapping ?
- [[ ! -L ${svcdir}/softscripts.new/${service} ]] || \
- return 0
-
- # If this is a 'net' service, we do not want to stop it if it was
- # not in the previous runlevel, and we are not shutting down,
- # rebooting or going to single runlevel. This is because the user
- # (or hotplut) might have started it (net.ppp?) ...
- if net_service "${service}" && \
- [[ ${SOFTLEVEL} != "reboot" && \
- ${SOFTLEVEL} != "shutdown" ]] ; then
- if [[ -z ${OLDSOFTLEVEL} ]] || \
- ! in_runlevel "${service}" "${OLDSOFTLEVEL}"
- then
- # This service is not in the previous runlevel, so
- # do not stop it ...
- return 0
- fi
+ [[ -L ${svcdir}/softscripts.new/${service} ]] \
+ && return 0
+
+ if [[ ${SOFTLEVEL} != "reboot" \
+ && ${SOFTLEVEL} != "shutdown" ]] ; then
+ service_coldplugged "${service}" && return 0
+ [[ -z ${OLDSOFTLEVEL} ]] \
+ || ! in_runlevel "${service}" "${OLDSOFTLEVEL}" \
+ && return 0
fi
# Should not work for 'use'
diff --git a/sbin/rc-services.sh b/sbin/rc-services.sh
index 45076e3..26cd7dc 100755
--- a/sbin/rc-services.sh
+++ b/sbin/rc-services.sh
@@ -405,12 +405,14 @@ start_service() {
# if we can not start the services in parallel
# then just start it and return the exit status
( "/etc/init.d/${service}" start )
+ service_started "${service}" || service_inactive "${service}"
retval=$?
return "${retval}"
else
# if parallel startup is allowed, start it in background
(
- "/etc/init.d/${service}" start
+ "/etc/init.d/${service}" start
+ service_started "${service}" || service_inactive "${service}"
retval=$?
) &
return 0
@@ -448,18 +450,31 @@ stop_service() {
# if we can not start the services in parallel
# then just start it and return the exit status
( "/etc/init.d/${service}" stop )
+ service_stopped "${service}"
retval=$?
return "${retval}"
else
# if parallel startup is allowed, start it in background
(
( "/etc/init.d/${service}" stop )
+ service_stopped "${service}"
retval=$?
) &
return 0
fi
}
+# bool mark_service_coldplugged(service)
+#
+# Mark 'service' as coldplugged.
+#
+mark_service_coldplugged() {
+ [[ -z $1 ]] && return 1
+
+ ln -snf "/etc/init.d/$1" "${svcdir}/coldplugged/$1"
+ return 0
+}
+
# bool mark_service_starting(service)
#
# Mark 'service' as starting.
@@ -532,7 +547,8 @@ mark_service_stopped() {
rm -Rf "${svcdir}/daemons/$1" "${svcdir}/starting/$1" \
"${svcdir}/started/$1" "${svcdir}/inactive/$1" \
"${svcdir}/wasinactive/$1" "${svcdir}/stopping/$1" \
- "${svcdir}/scheduled/$1" "${svcdir}/options/$1"
+ "${svcdir}/scheduled/$1" "${svcdir}/options/$1" \
+ "${svcdir}/coldplugged/$1"
return 0
}
@@ -553,6 +569,14 @@ test_service_state() {
return 1
}
+# bool service_coldplugged(service)
+#
+# Returns true if 'service' is coldplugged
+#
+service_coldplugged() {
+ test_service_state "$1" "coldplugged"
+}
+
# bool service_starting(service)
#
# Returns true if 'service' is starting
@@ -712,7 +736,6 @@ valid_i() {
${x} == "net" ]] \
&& echo "${x}"
done
-
return 0
}
diff --git a/sbin/runscript.sh b/sbin/runscript.sh
index 417e563..d6ca8a7 100755
--- a/sbin/runscript.sh
+++ b/sbin/runscript.sh
@@ -23,19 +23,24 @@ export SVCNAME
# Support deprecated myservice variable
myservice="${SVCNAME}"
+svc_trap() {
+ trap 'eerror "ERROR: ${SVCNAME} caught an interrupt"; exit 1' \
+ INT QUIT TSTP
+}
+
+# Setup a default trap
+svc_trap
+
# coldplug events can trigger init scripts, but we don't want to run them
# until after rc sysinit has completed so we punt them to the boot runlevel
if [[ -e /dev/.rcsysinit ]] ; then
eerror "ERROR: cannot run ${SVCNAME} until sysinit completes"
- [[ "${RC_COLDPLUG} " == "!* "* ]] && exit 1
- if [[ "${RC_COLDPLUG} " != "* "* ]] ; then
- for x in ${RC_COLDPLUG} ; do
- # We don't quote ${x} so we can do globbing
- [[ ${SVCNAME} == ${x} ]] && break
- [[ "!${SVCNAME}" == ${x} ]] && exit 1
- done
- [[ ${SVCNAME} == ${x} ]] || exit 1
- fi
+ [[ ${RC_COLDPLUG:-yes} != "yes" ]] && exit 1
+ set -f
+ for x in ${RC_PLUG_SERVICES} ; do
+ [[ ${SVCNAME} == ${x} ]] && break
+ [[ "!${SVCNAME}" == ${x} ]] && exit 1
+ done
eerror "${SVCNAME} will be started in the ${BOOTLEVEL} runlevel"
if [[ ! -L /dev/.rcboot/"${SVCNAME}" ]] ; then
[[ ! -d /dev/.rcboot ]] && mkdir /dev/.rcboot
@@ -44,13 +49,23 @@ if [[ -e /dev/.rcsysinit ]] ; then
exit 1
fi
-svc_trap() {
- trap 'eerror "ERROR: ${SVCNAME} caught an interrupt"; exit 1' \
- INT QUIT TSTP
-}
-
-# Setup a default trap
-svc_trap
+# Only hotplug if we're allowed to
+if [[ ${IN_HOTPLUG} == "1" ]] ; then
+ if [[ ${RC_HOTPLUG:-yes} != "yes" ]] ; then
+ eerror "${SVCNAME} is not allowed to be hotplugged"
+ exit 1
+ fi
+
+ set -f
+ for x in ${RC_PLUG_SERVICES} ; do
+ [[ ${SVCNAME} == ${x} ]] && break
+ if [[ "!${SVCNAME}" == ${x} ]] ; then
+ eerror "${SVCNAME} is not allowed to be hotplugged"
+ exit 1
+ fi
+ done
+ set +f
+fi
# State variables
svcpause="no"
@@ -376,9 +391,10 @@ svc_start() {
&& ! is_net_up ; then
if service_inactive "${x}" || service_wasinactive "${x}" || \
[[ -n $(ls "${svcdir}"/scheduled/*/"${x}" 2>/dev/null) ]] ; then
- svc_schedule_start "${x}" "${SVCNAME}"
- [[ -n ${startinactive} ]] && startinactive="${startinactive}, "
- startinactive="${startinactive}${x}"
+ if svc_schedule_start "${x}" "${SVCNAME}" ; then
+ [[ -n ${startinactive} ]] && startinactive="${startinactive}, "
+ startinactive="${startinactive}${x}"
+ fi
else
startfail="${x}"
break
diff --git a/tarball.sh b/tarball.sh
index 6fe38db..8adedd6 100755
--- a/tarball.sh
+++ b/tarball.sh
@@ -1,6 +1,6 @@
#!/bin/bash
export TMP="${TMP:-/tmp}"
-export V="1.12.0_pre18"
+export V="1.12.0_pre19"
export NAME="baselayout-vserver"
export DEST="${TMP}/${NAME}-${V}"