Bug #697 » rc.d.vkernel2.patch
etc/defaults/rc.conf | ||
---|---|---|
watchdogd_enable="NO" # Start the software watchdog daemon
|
||
##############################################################
|
||
### VKernel options #########################################
|
||
##############################################################
|
||
vkernel_enable="NO" # Set to YES to enable starting of vkernels
|
||
vkernel_list="" # Space separated list of names of vkernels
|
||
#
|
||
# Create an entry for each vkernel specified in vkernel_list
|
||
# replacing 'example' by the name of the vkernel.
|
||
#
|
||
#vkernel_example_bin="/usr/obj/usr/src/sys/VKERNEL/kernel.debug"
|
||
# Path to the vkernel binary
|
||
#vkernel_example_memsize="64m"
|
||
# Amount of memory for the vkernel
|
||
#vkernel_example_rootimg_list="/var/vkernel/rootimg.01"
|
||
# Space separated list of disk images
|
||
#vkernel_example_iface_list="auto:bridge0"
|
||
# Optional: space separated list network interfaces for the vkernel
|
||
#vkernel_example_logfile="/dev/null"
|
||
# Optional: path to the console log file
|
||
#vkernel_example_flags="-U"
|
||
# Optional: aditional flags to start the vkernel with
|
||
##############################################################
|
||
### Define source_rc_confs, the mechanism used by /etc/rc.* ##
|
||
### scripts to source rc_conf_files overrides safely. ##
|
||
##############################################################
|
etc/rc.d/Makefile | ||
---|---|---|
quota random rarpd rcconf.sh resident rndcontrol root route6d routed \
|
||
routing rpcbind rtadvd rtsold rwho sysdb savecore securelevel sendmail \
|
||
serial sppp sshd swap1 syscons sysctl syslogd timed ttys usbd \
|
||
vinum virecover watchdogd ypbind yppasswdd ypserv ypset ypupdated \
|
||
vinum virecover vkernel watchdogd \
|
||
ypbind yppasswdd ypserv ypset ypupdated \
|
||
ypxfrd varsym
|
||
FILESDIR= /etc/rc.d
|
||
FILESMODE= ${BINMODE}
|
etc/rc.d/vkernel | ||
---|---|---|
#!/bin/sh
|
||
#
|
||
# $DragonFly$
|
||
#
|
||
# PROVIDE: vkernel
|
||
# REQUIRE: LOGIN NETWORKING
|
||
. /etc/rc.subr
|
||
name="vkernel"
|
||
rcvar=`set_rcvar`
|
||
start_cmd="vkernel_start"
|
||
stop_cmd="vkernel_stop"
|
||
vkernel_start()
|
||
{
|
||
echo -n 'Starting virtual kernels:'
|
||
for _vkernel in ${vkernel_list}
|
||
do
|
||
# Check if already running
|
||
eval pidfile="/var/run/vkernel.${_vkernel}.pid"
|
||
if [ -f "${_pidfile}" ]; then
|
||
echo
|
||
warn "Vkernel ${_vkernel} already running? (check ${pidfile})"
|
||
continue
|
||
fi
|
||
# Configure vkernel binary
|
||
eval _bin=\"\${vkernel_${_vkernel}_bin}\"
|
||
if [ -z "${_bin}" -o ! -x "${_bin}" ]; then
|
||
echo
|
||
warn "Missing or undefined binary for vkernel '${_vkernel}'. Skipping."
|
||
continue
|
||
else
|
||
bin=${_bin}
|
||
fi
|
||
# Configure vkernel memory
|
||
eval _memsize=\"\$vkernel_${_vkernel}_memsize\"
|
||
if [ -z "${_memsize}" ]; then
|
||
echo
|
||
warn "No memsize has been defined for vkernel '${_vkernel}'. Skipping."
|
||
continue
|
||
else
|
||
memsize="-m ${_memsize}"
|
||
fi
|
||
# Configure vkernel root image(s)
|
||
eval _rootimgs=\"\${vkernel_${_vkernel}_rootimg_list}\"
|
||
if [ -z "${_rootimgs}" ]; then
|
||
echo
|
||
warn "No root image has been defined for vkernel '${_vkernel}'. Skipping."
|
||
continue
|
||
else
|
||
for _rootimg in ${_rootimgs}
|
||
do
|
||
eval rootimgs=\"${rootimgs} -r ${_rootimg}\"
|
||
done
|
||
fi
|
||
# Configure optional vkernel network interface(s)
|
||
eval _ifaces=\"\${vkernel_${_vkernel}_iface_list}\"
|
||
if [ -n "${_ifaces}" ]; then
|
||
for _iface in ${_ifaces}
|
||
do
|
||
eval ifaces=\"${ifaces} -I ${_iface}\"
|
||
done
|
||
fi
|
||
# Configure optional console logfile
|
||
eval logfile=\"\${vkernel_${_vkernel}_logfile}\"
|
||
[ -z "${logfile}" ] && logfile="/dev/null"
|
||
# Configure optional flags
|
||
eval flags=\"\${vkernel_${_vkernel}_flags}\"
|
||
eval "daemon ${bin} ${memsize} ${rootimgs} ${ifaces} ${flags} -p ${pidfile} >>${logfile} 2>&1"
|
||
echo -n " ${_vkernel}"
|
||
done
|
||
echo '.'
|
||
}
|
||
vkernel_stop()
|
||
{
|
||
for _vkernel in ${vkernel_list}
|
||
do
|
||
eval pidfile="/var/run/vkernel.${_vkernel}.pid"
|
||
if [ -f "${pidfile}" ]; then
|
||
eval pid=`cat ${pidfile}`
|
||
else
|
||
eval _bin=\"\${vkernel_${_vkernel}_bin}\"
|
||
if [ -n "$_bin" ]; then
|
||
eval pid=`ps auxwww | grep ${_bin} | grep -v grep | awk '{print $2}'`
|
||
fi
|
||
fi
|
||
if [ -z "${pid}" ]; then
|
||
warn "vkernel '${_vkernel}' not running?"
|
||
else
|
||
eval kill -TERM ${pid}
|
||
fi
|
||
done
|
||
}
|
||
load_rc_config $name
|
||
run_rc_command "$1"
|
share/man/man5/rc.conf.5 | ||
---|---|---|
if
|
||
.Xr shutdown 8
|
||
has not completed within the specified time (in seconds).
|
||
.It Va vkernel_enable
|
||
.Pq Vt bool
|
||
If set to
|
||
.Dq Li NO ,
|
||
any configured vkernels will not be started.
|
||
.It Va vkernel_list
|
||
.Pq Vt str
|
||
A space separated list of names for vkernels.
|
||
This is purely a configuration aid to help identify and
|
||
configure multiple vkernels.
|
||
The names specified in this list will be used to
|
||
identify settings common to a vkernel instance.
|
||
Assuming that the vkernel in question was named
|
||
.Li example ,
|
||
you would have the following dependent variables
|
||
(filled with reference values in this text):
|
||
.Bd -literal
|
||
vkernel_example_bin="/usr/obj/usr/src/sys/VKERNEL/kernel.debug"
|
||
vkernel_example_memsize="64m"
|
||
vkernel_example_rootimg_list="/var/vkernel/rootimg.01"
|
||
vkernel_example_iface_list="auto:bridge0"
|
||
vkernel_example_logfile="/dev/null"
|
||
vkernel_example_flags="-U"
|
||
.Ed
|
||
.Pp
|
||
The last three are optional.
|
||
They default to an empty string if not set, except for logfile which defaults to
|
||
.Pa /dev/null
|
||
if it is not set.
|
||
.El
|
||
.Sh FILES
|
||
.Bl -tag -width ".Pa /etc/defaults/rc.conf" -compact
|