packer-cn/builder/amazon/chroot/copy_files.go

20 lines
408 B
Go
Raw Normal View History

2013-09-26 03:58:25 -04:00
package chroot
import (
2013-09-26 04:32:53 -04:00
"fmt"
2013-09-26 21:28:06 -04:00
"log"
"os/exec"
2013-09-26 03:58:25 -04:00
)
func ChrootCommand(chroot string, command string) *exec.Cmd {
2013-09-27 21:10:33 -04:00
cmd := fmt.Sprintf("sudo chroot %s", chroot)
return ShellCommand(cmd, command)
}
2013-09-27 21:10:33 -04:00
func ShellCommand(commands ...string) *exec.Cmd {
cmds := append([]string{"-c"}, commands...)
cmd := exec.Command("/bin/sh", cmds...)
log.Printf("ShellCommand: %s %v", cmd.Path, cmd.Args[1:])
return cmd
2013-09-26 03:58:25 -04:00
}