The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/distrobuilder/pull/282
This e-mail was sent by the LXC bot, direct replies will not reach the author unless they happen to be subscribed to this list. === Description (from pull-request) === Signed-off-by: Thomas Hipp <thomas.h...@canonical.com>
From 50bddef754d396d1138d09f356c9fd0212b8eec0 Mon Sep 17 00:00:00 2001 From: Thomas Hipp <thomas.h...@canonical.com> Date: Thu, 20 Feb 2020 09:58:37 +0100 Subject: [PATCH] main: Check VM dependencies Signed-off-by: Thomas Hipp <thomas.h...@canonical.com> --- distrobuilder/main_lxd.go | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/distrobuilder/main_lxd.go b/distrobuilder/main_lxd.go index 1915ec27..9517cd8a 100644 --- a/distrobuilder/main_lxd.go +++ b/distrobuilder/main_lxd.go @@ -38,9 +38,9 @@ func (c *cmdLXD) commandBuild() *cobra.Command { // Check dependencies if c.flagVM { - _, err := exec.LookPath("qemu-img") + err := c.checkVMDependencies() if err != nil { - return fmt.Errorf("Required tool 'qemu-img' is missing") + return err } } @@ -80,9 +80,9 @@ func (c *cmdLXD) commandPack() *cobra.Command { // Check dependencies if c.flagVM { - _, err := exec.LookPath("qemu-img") + err := c.checkVMDependencies() if err != nil { - return fmt.Errorf("Required tool 'qemu-img' is missing") + return err } } @@ -321,3 +321,16 @@ func (c *cmdLXD) run(cmd *cobra.Command, args []string, overlayDir string) error return nil } + +func (c *cmdLXD) checkVMDependencies() error { + dependencies := []string{"btrfs", "qemu-img", "rsync", "sgdisk"} + + for _, dep := range dependencies { + _, err := exec.LookPath(dep) + if err != nil { + return fmt.Errorf("Required tool %q is missing", dep) + } + } + + return nil +}
_______________________________________________ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel