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:
parent
43e76cc7d0
commit
2af19060ce
|
@ -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)
|
||||||
}()
|
}()
|
||||||
|
|
Loading…
Reference in New Issue