Commit 5c41eccf authored by Matthew Hooker's avatar Matthew Hooker

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.
parent 0d1b936f
...@@ -21,7 +21,7 @@ type Communicator struct { ...@@ -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 { ...@@ -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)
}() }()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment