Add Makefile command to setup VM directory and copy templates

This commit is contained in:
Matt Churchyard
2015-07-29 09:17:58 +01:00
parent 4420305ea5
commit 9e331fb3a2
4 changed files with 16 additions and 7 deletions

View File

@@ -2,8 +2,6 @@
# vm-bhyve Makefile
#
.include <bsd.own.mk>
PREFIX?=/usr/local
MAN=
BINOWN=root
@@ -29,7 +27,16 @@ install:
$(INSTALL) $(MAN).gz $(MANDIR)/
rm -f $(MAN).gz
vmdir:
@if [ -z "${PATH}" ]; then \
echo "Usage: make vmdir PATH=/path"; \
else \
${MKDIR} -p "${PATH}"; \
${MKDIR} "${PATH}/.templates"; \
${MKDIR} "${PATH}/.iso"; \
${MKDIR} "${PATH}/.config"; \
cp sample-templates/* "${PATH}/.templates/"; \
fi;
.MAIN: clean
clean: ;
.include <bsd.prog.mk>

View File

@@ -25,7 +25,7 @@ Install the vm script using the Makefile
Create a directory for the virtual machines
# mkdir /path/to/my/vms
# make vmdir PATH=/path/to/my/vms
Update `/etc/rc.conf`
@@ -40,8 +40,6 @@ This command needs to be run once after each host reboot (this is normally handl
# vm init
Copy the sample templates to the folder `/path/to/my/vms/.templates/`
This completes the basic setup
##Virtual Switch Management

View File

@@ -37,6 +37,9 @@ __parse_cmd(){
switch)
__parse_switch_cmd "$@"
;;
image)
__parse_image_cmd "$@"
;;
list)
__vm_list
;;

1
vm
View File

@@ -43,6 +43,7 @@ fi
[ ! -d "${vm_dir}/.config" ] && mkdir "${vm_dir}/.config"
[ ! -d "${vm_dir}/.templates" ] && mkdir "${vm_dir}/.templates"
[ ! -d "${vm_dir}/.iso" ] && mkdir "${vm_dir}/.iso"
[ ! -d "${vm_dir}/.img" ] && mkdir "${vm_dir}/.img"
# get libs
if [ -e "/usr/local/lib/vm-bhyve" ]; then