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.
This commit is contained in:
Matthew Hooker 2013-09-30 21:53:01 +00:00
parent 43e76cc7d0
commit 2af19060ce
1 changed files with 2 additions and 2 deletions

View File

@ -21,7 +21,7 @@ type Communicator struct {
func (c *Communicator) Start(cmd *packer.RemoteCmd) error { func (c *Communicator) Start(cmd *packer.RemoteCmd) error {
command, err := c.CmdWrapper( 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 { if err != nil {
return err return err
} }
@ -50,7 +50,7 @@ func (c *Communicator) Start(cmd *packer.RemoteCmd) error {
} }
log.Printf( log.Printf(
"Chroot executation exited with '%d': '%s'", "Chroot execution exited with '%d': '%s'",
exitStatus, cmd.Command) exitStatus, cmd.Command)
cmd.SetExited(exitStatus) cmd.SetExited(exitStatus)
}() }()