# HG changeset patch # User Franz Glasner # Date 1718350804 -7200 # Node ID 6ecd16725818c8808615ad7fbb02eaf54196d131 # Parent 4638f2f68b9dd46829fb8082cb6c0090d5bbc7c8 Begin refactoring bhyve into fbhyve. Planned: - more consistent naming (analogous to jails) - using bhyve configuration files instead of RC variables for bhyve devices - more docs diff -r 4638f2f68b9d -r 6ecd16725818 docs/conf.py --- a/docs/conf.py Fri Jun 14 08:48:27 2024 +0200 +++ b/docs/conf.py Fri Jun 14 09:40:04 2024 +0200 @@ -80,6 +80,7 @@ ("man/man8/local-bsdtools", "local-bsdtools", 'FreeBSD administration helper tools v%s' % release, [author], 8), ("man/man8/bsmtp2dma", "bsmtp2dma", "Bacula compatible mail submission program", [author], 8), ("man/man8/check-ports", "check-ports", "Report the version status of installed packages and check for them also in repositories", [author], 8), + ("man/man8/fbhyve", "fbhyve", "Manage bhyve VMs (RC script)", [author], 8), ("man/man8/fjail", "fjail", "Management of jails", [author], 8), ("man/man8/fjail-configure", "fjail-configure", "Basic configuration of jails", [author], 8), #("man/man8/fjail-copy", "fjail-copy", "Recursively copy ZFS datasets including all properties", [author], 8), diff -r 4638f2f68b9d -r 6ecd16725818 docs/man/index.rst --- a/docs/man/index.rst Fri Jun 14 08:48:27 2024 +0200 +++ b/docs/man/index.rst Fri Jun 14 09:40:04 2024 +0200 @@ -11,6 +11,7 @@ man8/local-bsdtools man8/bsmtp2dma man8/check-ports + man8/fbhyve man8/fjail man8/fjail-configure man8/fjail-freebsd-update diff -r 4638f2f68b9d -r 6ecd16725818 docs/man/man8/fbhyve.rst --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man/man8/fbhyve.rst Fri Jun 14 09:40:04 2024 +0200 @@ -0,0 +1,40 @@ +.. -*- coding: utf-8; indent-tabs-mode: nil; -*- + +fbhyve +====== + +Synopsis +-------- + +**service fbhyve** [ **start** | **stop** | **poll** | **status** ] [**name**]... + + +Description +----------- + +An :file:`rc.d` script to start :manpage:`bhyve(8)` virtual machines + + +Configuration Variables +~~~~~~~~~~~~~~~~~~~~~~~ + +`fbhyve_enable` + Default: NO + +`fbhyve_list` + The name of VMs to start to (aka. "profiles" or "sessions") + + +Files +----- + +- :file:`/usr/local/etc/fbhyve` + + Default-directory where all the configuration files with relative + filenames are looked up. + + +See also +-------- + +:manpage:`bhyve(8)`, :manpage:`rc.conf(5)`, :manpage:`tmux(1)` diff -r 4638f2f68b9d -r 6ecd16725818 docs/man/man8/local-bsdtools.rst --- a/docs/man/man8/local-bsdtools.rst Fri Jun 14 08:48:27 2024 +0200 +++ b/docs/man/man8/local-bsdtools.rst Fri Jun 14 09:40:04 2024 +0200 @@ -66,8 +66,10 @@ - :manpage:`fpkg(8)` +- :manpage:`fbhyve(8)` + - :manpage:`fwireguard(8)` - + - :manpage:`fzfs(8)` * :manpage:`fzfs-copy-tree(8)` diff -r 4638f2f68b9d -r 6ecd16725818 files/fbhyve.in --- a/files/fbhyve.in Fri Jun 14 08:48:27 2024 +0200 +++ b/files/fbhyve.in Fri Jun 14 09:40:04 2024 +0200 @@ -1,14 +1,16 @@ #!/bin/sh -# PROVIDE: bhyve +# PROVIDE: fbhyve # REQUIRE: LOGIN -# KEYWORD: nojail +# KEYWORD: shutdown nojail # +# @(#)%%SIMPLEVERSIONTAG%% + # # Add the following lines to /etc/rc.conf to enable bhyve: -# bhyve_enable (bool): Set to "NO" by default. -# Set it to "YES" to enable bhyve +# fbhyve_enable (bool): Set to "NO" by default. +# Set it to "YES" to enable bhyve # bhyve_profiles (str): Set to "" by default. # Define your profiles here. # bhyve_tapdev (str): Set to "tap0" by default. @@ -22,8 +24,8 @@ . /etc/rc.subr -name="bhyve" -rcvar=bhyve_enable +name="fbhyve" +rcvar=fbhyve_enable start_precmd="bhyve_prestart" status_cmd="bhyve_status" @@ -33,7 +35,6 @@ command="/usr/local/bin/tmux" procname="-sh" -[ -z "$bhyve_enable" ] && bhyve_enable="NO" [ -z "$bhyve_tapdev" ] && bhyve_tapdev="tap0" [ -z "$bhyve_diskdev" ] && bhyve_diskdev="none" [ -z "$bhyve_ncpu" ] && bhyve_ncpu="1" @@ -41,11 +42,15 @@ load_rc_config $name +: {fbhyve_enable:="NO"} +: {fbhyve_configdir:="%%PREFIX%%/etc/fbhyve"} + + if [ -n "$2" ]; then profile="$2" _session="${_session}_${profile}" if [ "x${bhyve_profiles}" != "x" ]; then - eval bhyve_enable="\${${_session}_enable:-${bhyve_enable}}" + eval fbhyve_enable="\${${_session}_enable:-${fbhyve_enable}}" eval bhyve_tapdev="\${${_session}_tapdev:-${bhyve_tapdev}}" eval bhyve_diskdev="\${${_session}_diskdev:-${bhyve_diskdev}}" eval bhyve_ncpu="\${${_session}_ncpu:-${bhyve_ncpu}}" @@ -57,7 +62,7 @@ if [ "x${bhyve_profiles}" != "x" -a "x$1" != "x" ]; then for profile in ${bhyve_profiles}; do eval _enable="\${bhyve_${profile}_enable}" - case "x${_enable:-${bhyve_enable}}" in + case "x${_enable:-${fbhyve_enable}}" in x|x[Nn][Oo]|x[Nn][Oo][Nn][Ee]) continue ;; @@ -65,12 +70,12 @@ ;; *) if test -z "$_enable"; then - _var=bhyve_enable + _var=fbhyve_enable else _var=bhyve_"${profile}"_enable fi echo "Bad value" \ - "'${_enable:-${bhyve_enable}}'" \ + "'${_enable:-${fbhyve_enable}}'" \ "for ${_var}. " \ "Profile ${profile} skipped." continue diff -r 4638f2f68b9d -r 6ecd16725818 pkg-plist --- a/pkg-plist Fri Jun 14 08:48:27 2024 +0200 +++ b/pkg-plist Fri Jun 14 09:40:04 2024 +0200 @@ -18,6 +18,7 @@ %%DOCS%%share/man/man8/local-bsdtools.8.gz %%DOCS%%share/man/man8/bsmtp2dma.8.gz %%DOCS%%share/man/man8/check-ports.8.gz +%%DOCS%%share/man/man8/fbhyve.8.gz %%DOCS%%share/man/man8/fjail.8.gz %%DOCS%%share/man/man8/fjail-configure.8.gz %%DOCS%%share/man/man8/fjail-freebsd-update.8.gz