Commit 5086ff1a authored by Matthew Hooker's avatar Matthew Hooker

pass chroot command to /bin/sh

this allows us to specify an arbitrary chroot command, i.e. for sudo
parent 4f6fc963
......@@ -13,13 +13,14 @@ import (
// Communicator is a special communicator that works by executing
// commands locally but within a chroot.
type Communicator struct {
Chroot string
ChrootCommand string
Chroot string
ChrootCommand string
}
func (c *Communicator) Start(cmd *packer.RemoteCmd) error {
localCmd := exec.Command(c.ChrootCommand, c.Chroot, "/bin/sh", "-c", cmd.Command)
chrootCommand := fmt.Sprintf("%s %s %s", c.ChrootCommand, c.Chroot, cmd.Command)
localcmd := exec.Command("/bin/sh", "-c", chrootCommand)
localCmd.Stdin = cmd.Stdin
localCmd.Stdout = cmd.Stdout
localCmd.Stderr = cmd.Stderr
......
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