albatross/packaging/rc.d/albatross_x

73 lines
1.5 KiB
Plaintext
Raw Normal View History

2018-10-05 22:46:53 +00:00
#!/bin/sh
# $FreeBSD$
#
# PROVIDE: albatross_x
# REQUIRE: LOGIN albatross_daemon
# KEYWORDS: shutdown nojail
#
# Define these albatross_x_* variables in one of these files
# /etc/rc.conf
# /etc/rc.conf.local
# /etc/rc.conf.d/albatross_x
# /usr/local/etc/rc.conf.d/albatross_x
#
# albatross_x_enable: Set YES to enable the albatross vm start service
# Default: NO
# albatross_x_vms: list of vms to manage
# Default: ""
# albatross_x_args_$VM: vm create arguments
#
#
. /etc/rc.subr
name=albatross_x
rcvar=${name}_enable
desc="Manage Albatross VMs"
load_rc_config $name
start_cmd="albatross_x_start"
stop_cmd="albatross_x_stop"
status_cmd="albatross_x_status"
extra_commands="status"
: ${albatross_x_enable:="NO"}
: ${albatross_x_vms:=""}
albatross_x_start () {
case $1 in
_ALL)
for _vm in $albatross_x_vms; do
eval _create_args=\"\$albatross_x_args_${_vm}\"
2018-10-28 22:18:07 +00:00
/usr/local/sbin/vmmc_local create $_vm $_create_args
2018-10-05 22:46:53 +00:00
done
return
;;
esac
for _vm in $@; do
eval _create_args=\"\$albatross_x_args_${_vm}\"
2018-10-28 22:18:07 +00:00
/usr/local/sbin/vmmc_local create $_vm $_create_args
2018-10-05 22:46:53 +00:00
done
}
albatross_x_stop () {
case $1 in
_ALL)
2018-10-05 22:46:53 +00:00
for _vm in $albatross_x_vms
2018-10-28 22:18:07 +00:00
do /usr/local/sbin/vmmc_local destroy $_vm; done
2018-10-05 22:46:53 +00:00
return
esac
for _vm in $@
2018-10-28 22:18:07 +00:00
do /usr/local/sbin/vmmc_local destroy $_vm; done
2018-10-05 22:46:53 +00:00
}
albatross_x_status () {
/usr/local/sbin/vmmc_local info
2018-10-05 22:46:53 +00:00
}
case $# in
1) run_rc_command $@ ${albatross_x_list:-_ALL} ;;
*) run_rc_command $@ ;;
esac