Gentoo Logo
Gentoo Spaceship

Installation:
Gentoo Handbook
Installation Docs

Documentation:
Home
Listing
About Gentoo
Philosophy
Social Contract

Resources:
Bug Tracker
Developer List
Discussion Forums
Gentoo BitTorrents
Gentoo Linux Enhancement Proposals
IRC Channels
Mailing Lists
Mirrors
Name and Logo Guidelines
Online Package Database
Security Announcements
Staffing Needs
Supporting Vendors
View our CVS

Graphics:
Logos and themes
Icons
ScreenShots

Miscellaneous Resources:
Gentoo Linux Store
Gentoo-hosted projects
IBM dW/Intel article archive




List Archive: gentoo-commits
Navigation:
Lists: gentoo-commits: < Prev By Thread Next > < Prev By Date Next >
Headers:
To: gentoo-commits@g.o
From: "Robin H. Johnson (robbat2)" <robbat2@g.o>
Subject: gentoo-x86 commit in sys-block/vblade/files: init.d-vblade.vblade0-14-r1
Date: Sat, 05 Jul 2008 09:53:39 +0000

 1.1

robbat2     08/07/05 09:53:39

  Added:                init.d-vblade.vblade0-14-r1
  Log:
  Bug #209792, use "vbladed?" and a shorter chunk of arguments to match more processes.
  (Portage version: 2.2_rc1/cvs/Linux 2.6.26-rc4-00103-g1beee8d x86_64)

Revision  Changes    Path
1.1                  sys-block/vblade/files/init.d-vblade.vblade0-14-r1

file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-block/vblade/files/init.d-vblade.vblade0-14-r1?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-block/vblade/files/init.d-vblade.vblade0-14-r1?rev=1.1&content-type=text/plain

Index: init.d-vblade.vblade0-14-r1
===================================================================
#!/sbin/runscript
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License, v2 or later
# $Header: /var/cvsroot/gentoo-x86/sys-block/vblade/files/init.d-vblade.vblade0-14-r1,v 1.1 2008/07/05 09:53:39 robbat2 Exp $

opts="${opts} checkconfig"

depend() {
	need net
}

conf="$(add_suffix /etc/conf.d/vblade)"
[[ -e "${conf}" ]] && source "${conf}"
vblade_name="${myservice#*.}"
vblade_conf_variable="config_${vblade_name}"
vblade_conf="${!vblade_conf_variable}"
pidfile="/var/run/vblade-${vblade_name}.pid"
srvname="vblade.${vblade_name}"

getconfig() {
	tmp="${vblade_conf}"
	shelf="${tmp/ *}"
	tmp="${tmp#* }"
	slot="${tmp/ *}"
	tmp="${tmp#* }"
	netif="${tmp/ *}"
	tmp="${tmp#* }"
	src="${tmp}"
	export shelf slot netif src
}


checkconfig() {
	if [ -z "${vblade_conf}" ]; then
		eerror "vblade configuration not specified for ${vblade_name}"
		return 1
	fi
	getconfig
	
	is_valid_numeric "${shelf}" 0
	if [[ $? -ne 0 ]]; then
		eerror "Shelf '${shelf}' is non-numeric or less than zero."
		return 1
	fi
	is_valid_numeric "${slot}" 0 15
	if [[ $? -ne 0 ]]; then
		eerror "Slot '${slot}' is outside the valid range [0..15]."
		return 1
	fi

	sysfs_base="/sys/class/net/"
	procfs_base="/proc/sys/net/ipv4/conf/"
	if test ! \( -e "${sysfs_base}${netif}" -o -e "${procfs_base}${netif}" \); then
		eerror "Network interface '${netif}' does not exist"
		return 1
	fi
	
	if test ! \( -f "${src}" -o -b "${src}" \) ; then
		eerror "Source '${src}' must be a file or block device"
		return 1
	fi
	
	if test ! \( -e "${src}" -a -r "${src}" \) ; then
		eerror "Source '${src}' is not readable."
		return 1
	fi

	return 0
}

is_valid_numeric() {
	num="${1}"
	min="${2}"
	max="${3}"
	# non-numeric
	test "$num" -ge "0" 2>/dev/null
	rc=$?
	test "$rc" -eq 2 && return 2
	# check for min
	test -z "$min" && return 0
	test "$num" -lt "$min" && return 1
	# check for max
	test -z "$max" && return 0
	test "$num" -gt "$max" && return 1
	# done
	return 0
}

start() {
	checkconfig || return 1
	getconfig
	ebegin "Starting ${srvname}: e${shelf}.${slot} on ${netif} using '${src}'"
	export LOGTAG="${srvname}"
	start-stop-daemon --start --quiet \
	--pidfile ${pidfile} --background \
	--make-pidfile --exec /usr/sbin/vbladed -- \
	${shelf} ${slot} ${netif} "${src}" 
	eend $?
	
	#${shelf} ${slot} ${netif} "${src}" 2>&1 | logger -t ${srvname} &
}

stop() {
	ebegin "Stopping ${srvname}"
	#start-stop-daemon --stop --quiet --pidfile ${pidfile}
	getconfig
	ps -Ao pid,args | egrep "^[[:space:]]*[[:digit:]]+ /usr/sbin/vbladed? ${shelf} ${slot}" | awk '{print $1}' | xargs kill
	eend $?
	
	#start-stop-daemon --stop --quiet --exec /usr/sbin/vblade
}

# vim: ft=gentoo-init-d syntax=gentoo-init-d :
# vim: ai sw=4 sts=4 ts=4 :



-- 
gentoo-commits@g.o mailing list


Navigation:
Lists: gentoo-commits: < Prev By Thread Next > < Prev By Date Next >
Previous by thread:
gentoo-x86 commit in sys-block/vblade: ChangeLog vblade-14-r1.ebuild
Next by thread:
gentoo-x86 commit in sys-boot/grub: grub-0.97-r6.ebuild ChangeLog
Previous by date:
gentoo-x86 commit in sys-block/vblade: ChangeLog vblade-14-r1.ebuild
Next by date:
gentoo-x86 commit in sys-boot/grub: grub-0.97-r6.ebuild ChangeLog


Aug 21, 2008

Donate to support our development efforts.

Gentoo Centric Hosting: vr.org

VR Hosted

Tek Alchemy

Tek Alchemy

SevenL.net

SevenL.net

php|architect

php|architect

Copyright 2001-2007 Gentoo Foundation, Inc. Questions, Comments? Email www@gentoo.org.