From 2af19060ce8465199df5f6a004a642bb01d1f018 Mon Sep 17 00:00:00 2001 From: Matthew Hooker Date: Mon, 30 Sep 2013 21:53:01 +0000 Subject: [PATCH] Fix the way we run commands in chroot. * Single quotes around chroot command cause it to fail. * The chroot command also gets passed through the CommandWrapper template, so having sudo would clash with however the user wants to run it. * Fix spelling mistake. --- builder/amazon/chroot/communicator.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/builder/amazon/chroot/communicator.go b/builder/amazon/chroot/communicator.go index 0cd636bf7..0da11996e 100644 --- a/builder/amazon/chroot/communicator.go +++ b/builder/amazon/chroot/communicator.go @@ -21,7 +21,7 @@ type Communicator struct { func (c *Communicator) Start(cmd *packer.RemoteCmd) error { command, err := c.CmdWrapper( - fmt.Sprintf("sudo chroot %s '%s'", c.Chroot, cmd.Command)) + fmt.Sprintf("chroot %s %s", c.Chroot, cmd.Command)) if err != nil { return err } @@ -50,7 +50,7 @@ func (c *Communicator) Start(cmd *packer.RemoteCmd) error { } log.Printf( - "Chroot executation exited with '%d': '%s'", + "Chroot execution exited with '%d': '%s'", exitStatus, cmd.Command) cmd.SetExited(exitStatus) }()