summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorChristian Heim <phreak@gentoo.org>2005-10-20 17:03:41 +0000
committerChristian Heim <phreak@gentoo.org>2005-10-20 17:03:41 +0000
commitf87f368a867febcde2f1f6dc182f5f8652ed92b4 (patch)
treeca8a1a6d334c942bbd88fe0c94b44be6503d0e69 /sbin
parentMerging changes from baselayout revision 1572 (diff)
downloadbaselayout-vserver-f87f368a867febcde2f1f6dc182f5f8652ed92b4.tar.gz
baselayout-vserver-f87f368a867febcde2f1f6dc182f5f8652ed92b4.tar.bz2
baselayout-vserver-f87f368a867febcde2f1f6dc182f5f8652ed92b4.zip
Merging changes from baselayout 1583
svn path=/baselayout-vserver/trunk/; revision=63
Diffstat (limited to 'sbin')
-rwxr-xr-xsbin/MAKEDEV1
-rwxr-xr-xsbin/functions.sh8
-rwxr-xr-xsbin/rc-daemon.sh17
-rwxr-xr-xsbin/rc-services.sh13
4 files changed, 35 insertions, 4 deletions
diff --git a/sbin/MAKEDEV b/sbin/MAKEDEV
index dfcae19..4a28ad3 100755
--- a/sbin/MAKEDEV
+++ b/sbin/MAKEDEV
@@ -309,7 +309,6 @@ cvt () {
}
get_arch() {
- local a=`uname -m`
case `uname -m` in
arm*) echo arm;;
i?86) echo i386;;
diff --git a/sbin/functions.sh b/sbin/functions.sh
index d5cbf22..e301d67 100755
--- a/sbin/functions.sh
+++ b/sbin/functions.sh
@@ -401,10 +401,12 @@ KV_to_int() {
# portion of Z is a number.
# e.g. 2.4.25, 2.6.10, 2.6.4-rc3, 2.2.40-poop, 2.0.15+foo
#
+_RC_GET_KV_CACHE=""
get_KV() {
- local KV=$(uname -r)
+ [[ -z ${_RC_GET_KV_CACHE} ]] \
+ && _RC_GET_KV_CACHE=$(uname -r)
- echo "$(KV_to_int "${KV}")"
+ echo $(KV_to_int "${_RC_GET_KV_CACHE}")
return $?
}
@@ -733,9 +735,9 @@ else
GOOD=$'\e[32;01m'
WARN=$'\e[33;01m'
BAD=$'\e[31;01m'
- NORMAL=$'\e[0m'
HILITE=$'\e[36;01m'
BRACKET=$'\e[34;01m'
+ NORMAL=$'\e[0m'
fi
##############################################################################
diff --git a/sbin/rc-daemon.sh b/sbin/rc-daemon.sh
index b59eb66..8ef6bc6 100755
--- a/sbin/rc-daemon.sh
+++ b/sbin/rc-daemon.sh
@@ -281,6 +281,23 @@ rc_stop_daemon() {
pids=${pid}
fi
+ # If there's nothing to kill then return without error
+ [[ -z ${pids} ]] && return 0
+
+ # We may not have pgrep to find our children, so we provide
+ # two methods
+ if [[ ${RC_KILL_CHILDREN} == "yes" ]]; then
+ if [[ -x /usr/bin/pgrep ]]; then
+ pids="${pids} $(pgrep -P ${pids// /,})"
+ else
+ local npids
+ for pid in ${pids} ; do
+ npids="${npids} $(ps -eo pid,ppid | sed -n 's/'${pid}'$//p')"
+ done
+ pids="${pids} ${npids}"
+ fi
+ fi
+
for pid in ${pids}; do
if [[ ${RC_FAIL_ON_ZOMBIE} == "yes" ]]; then
ps -p "${pid}" &>/dev/null || return 1
diff --git a/sbin/rc-services.sh b/sbin/rc-services.sh
index e828863..d629dd4 100755
--- a/sbin/rc-services.sh
+++ b/sbin/rc-services.sh
@@ -597,6 +597,19 @@ service_failed() {
[[ -n $1 && -L ${svcdir}/failed/$1 ]]
}
+# bool service_started_daemon(char *interface, char *daemon, int index)
+# Returns 0 if the service started the given daemon
+# via start-stop-daemon, otherwise 1.
+# If index is emtpy, then we don't care what the first daemon launched
+# was, otherwise the daemon must also be at that index
+service_started_daemon() {
+ local service="$1" daemon="$2" index="${3:-[0-9]*}"
+ local daemonfile="${svcdir}/daemons/${service}"
+
+ [[ ! -e ${daemonfile} ]] && return 1
+ grep -q '^RC_DAEMONS\['"${index}"'\]="'${daemon}'"$' "${daemonfile}"
+}
+
# bool net_service(service)
#
# Returns true if 'service' is a service controlling a network interface