{"modulePath":"github.com/stackpointcloud/packer","version":"v0.10.1","isLatest":true,"isStandardLibrary":false,"goos":"linux","goarch":"amd64","docs":"# package chroot\n\nThe chroot package is able to create an Amazon AMI without requiring the launch of a new instance for every build. It does this by attaching and mounting the root volume of another AMI and chrooting into that directory. It then creates an AMI from that attached drive.\n\n## Constants\n\n```go\nconst BuilderId = \"mitchellh.amazon.chroot\"\n```\nThe unique ID for this builder\n\n```go\nconst LOCK_EX = 2\n```\nSee: [http://linux.die.net/include/sys/file.h](http://linux.die.net/include/sys/file.h)\n\n```go\nconst LOCK_NB = 4\n```\n\n```go\nconst LOCK_UN = 8\n```\n\n## Functions\n\n```go\nfunc AvailableDevice() (string, error)\n```\nAvailableDevice finds an available device and returns it. Note that you should externally hold a flock or something in order to guarantee that this device is available across processes.\n\n```go\nfunc ShellCommand(command string) *exec.Cmd\n```\nShellCommand takes a command string and returns an \\*exec.Cmd to execute it within the context of a shell (/bin/sh).\n\n## Types\n\n```go\ntype Builder struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc (b *Builder) Cancel()\n```\n\n```go\nfunc (b *Builder) Prepare(raws ...interface{}) ([]string, error)\n```\n\n```go\nfunc (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packer.Artifact, error)\n```\n\n```go\ntype Cleanup interface {\n\tCleanupFunc(multistep.StateBag) error\n}\n```\nCleanup is an interface that some steps implement for early cleanup.\n\n```go\ntype CommandWrapper func(string) (string, error)\n```\nCommandWrapper is a type that given a command, will possibly modify that command in-flight. This might return an error.\n\n```go\ntype Communicator struct {\n\tChroot     string\n\tCmdWrapper CommandWrapper\n}\n```\nCommunicator is a special communicator that works by executing commands locally but within a chroot.\n\n```go\nfunc (c *Communicator) Download(src string, w io.Writer) error\n```\n\n```go\nfunc (c *Communicator) DownloadDir(src string, dst string, exclude []string) error\n```\n\n```go\nfunc (c *Communicator) Start(cmd *packer.RemoteCmd) error\n```\n\n```go\nfunc (c *Communicator) Upload(dst string, r io.Reader, fi *os.FileInfo) error\n```\n\n```go\nfunc (c *Communicator) UploadDir(dst string, src string, exclude []string) error\n```\n\n```go\ntype Config struct {\n\tcommon.PackerConfig    `mapstructure:\",squash\"`\n\tawscommon.AccessConfig `mapstructure:\",squash\"`\n\tawscommon.AMIConfig    `mapstructure:\",squash\"`\n\n\tChrootMounts   [][]string `mapstructure:\"chroot_mounts\"`\n\tCommandWrapper string     `mapstructure:\"command_wrapper\"`\n\tCopyFiles      []string   `mapstructure:\"copy_files\"`\n\tDevicePath     string     `mapstructure:\"device_path\"`\n\tMountPath      string     `mapstructure:\"mount_path\"`\n\tSourceAmi      string     `mapstructure:\"source_ami\"`\n\tRootVolumeSize int64      `mapstructure:\"root_volume_size\"`\n\tMountOptions   []string   `mapstructure:\"mount_options\"`\n\tMountPartition int        `mapstructure:\"mount_partition\"`\n\t// contains filtered or unexported fields\n}\n```\nConfig is the configuration that is chained through the steps and settable from the template.\n\n```go\ntype StepAttachVolume struct {\n\t// contains filtered or unexported fields\n}\n```\nStepAttachVolume attaches the previously created volume to an available device location.\n\nProduces:\n\n\tdevice string - The location where the volume was attached.\n\tattach_cleanup CleanupFunc\n\n```go\nfunc (s *StepAttachVolume) Cleanup(state multistep.StateBag)\n```\n\n```go\nfunc (s *StepAttachVolume) CleanupFunc(state multistep.StateBag) error\n```\n\n```go\nfunc (s *StepAttachVolume) Run(state multistep.StateBag) multistep.StepAction\n```\n\n```go\ntype StepCheckRootDevice struct{}\n```\nStepCheckRootDevice makes sure the root device on the AMI is EBS-backed.\n\n```go\nfunc (s *StepCheckRootDevice) Cleanup(multistep.StateBag)\n```\n\n```go\nfunc (s *StepCheckRootDevice) Run(state multistep.StateBag) multistep.StepAction\n```\n\n```go\ntype StepChrootProvision struct {\n\t// contains filtered or unexported fields\n}\n```\nStepChrootProvision provisions the instance within a chroot.\n\n```go\nfunc (s *StepChrootProvision) Cleanup(state multistep.StateBag)\n```\n\n```go\nfunc (s *StepChrootProvision) Run(state multistep.StateBag) multistep.StepAction\n```\n\n```go\ntype StepCopyFiles struct {\n\t// contains filtered or unexported fields\n}\n```\nStepCopyFiles copies some files from the host into the chroot environment.\n\nProduces:\n\n\tcopy_files_cleanup CleanupFunc - A function to clean up the copied files\n\tearly.\n\n```go\nfunc (s *StepCopyFiles) Cleanup(state multistep.StateBag)\n```\n\n```go\nfunc (s *StepCopyFiles) CleanupFunc(state multistep.StateBag) error\n```\n\n```go\nfunc (s *StepCopyFiles) Run(state multistep.StateBag) multistep.StepAction\n```\n\n```go\ntype StepCreateVolume struct {\n\tRootVolumeSize int64\n\t// contains filtered or unexported fields\n}\n```\nStepCreateVolume creates a new volume from the snapshot of the root device of the AMI.\n\nProduces:\n\n\tvolume_id string - The ID of the created volume\n\n```go\nfunc (s *StepCreateVolume) Cleanup(state multistep.StateBag)\n```\n\n```go\nfunc (s *StepCreateVolume) Run(state multistep.StateBag) multistep.StepAction\n```\n\n```go\ntype StepEarlyCleanup struct{}\n```\nStepEarlyCleanup performs some of the cleanup steps early in order to prepare for snapshotting and creating an AMI.\n\n```go\nfunc (s *StepEarlyCleanup) Cleanup(state multistep.StateBag)\n```\n\n```go\nfunc (s *StepEarlyCleanup) Run(state multistep.StateBag) multistep.StepAction\n```\n\n```go\ntype StepEarlyUnflock struct{}\n```\nStepEarlyUnflock unlocks the flock.\n\n```go\nfunc (s *StepEarlyUnflock) Cleanup(state multistep.StateBag)\n```\n\n```go\nfunc (s *StepEarlyUnflock) Run(state multistep.StateBag) multistep.StepAction\n```\n\n```go\ntype StepFlock struct {\n\t// contains filtered or unexported fields\n}\n```\nStepFlock provisions the instance within a chroot.\n\nProduces:\n\n\tflock_cleanup Cleanup - To perform early cleanup\n\n```go\nfunc (s *StepFlock) Cleanup(state multistep.StateBag)\n```\n\n```go\nfunc (s *StepFlock) CleanupFunc(state multistep.StateBag) error\n```\n\n```go\nfunc (s *StepFlock) Run(state multistep.StateBag) multistep.StepAction\n```\n\n```go\ntype StepInstanceInfo struct{}\n```\nStepInstanceInfo verifies that this builder is running on an EC2 instance.\n\n```go\nfunc (s *StepInstanceInfo) Cleanup(multistep.StateBag)\n```\n\n```go\nfunc (s *StepInstanceInfo) Run(state multistep.StateBag) multistep.StepAction\n```\n\n```go\ntype StepMountDevice struct {\n\tMountOptions   []string\n\tMountPartition int\n\t// contains filtered or unexported fields\n}\n```\nStepMountDevice mounts the attached device.\n\nProduces:\n\n\tmount_path string - The location where the volume was mounted.\n\tmount_device_cleanup CleanupFunc - To perform early cleanup\n\n```go\nfunc (s *StepMountDevice) Cleanup(state multistep.StateBag)\n```\n\n```go\nfunc (s *StepMountDevice) CleanupFunc(state multistep.StateBag) error\n```\n\n```go\nfunc (s *StepMountDevice) Run(state multistep.StateBag) multistep.StepAction\n```\n\n```go\ntype StepMountExtra struct {\n\t// contains filtered or unexported fields\n}\n```\nStepMountExtra mounts the attached device.\n\nProduces:\n\n\tmount_extra_cleanup CleanupFunc - To perform early cleanup\n\n```go\nfunc (s *StepMountExtra) Cleanup(state multistep.StateBag)\n```\n\n```go\nfunc (s *StepMountExtra) CleanupFunc(state multistep.StateBag) error\n```\n\n```go\nfunc (s *StepMountExtra) Run(state multistep.StateBag) multistep.StepAction\n```\n\n```go\ntype StepPrepareDevice struct {\n\t// contains filtered or unexported fields\n}\n```\nStepPrepareDevice finds an available device and sets it.\n\n```go\nfunc (s *StepPrepareDevice) Cleanup(state multistep.StateBag)\n```\n\n```go\nfunc (s *StepPrepareDevice) Run(state multistep.StateBag) multistep.StepAction\n```\n\n```go\ntype StepRegisterAMI struct {\n\tRootVolumeSize int64\n}\n```\nStepRegisterAMI creates the AMI.\n\n```go\nfunc (s *StepRegisterAMI) Cleanup(state multistep.StateBag)\n```\n\n```go\nfunc (s *StepRegisterAMI) Run(state multistep.StateBag) multistep.StepAction\n```\n\n```go\ntype StepSnapshot struct {\n\t// contains filtered or unexported fields\n}\n```\nStepSnapshot creates a snapshot of the created volume.\n\nProduces:\n\n\tsnapshot_id string - ID of the created snapshot\n\n```go\nfunc (s *StepSnapshot) Cleanup(state multistep.StateBag)\n```\n\n```go\nfunc (s *StepSnapshot) Run(state multistep.StateBag) multistep.StepAction\n```\n\n","path":"github.com/stackpointcloud/packer/builder/amazon/chroot","name":"chroot","synopsis":"The chroot package is able to create an Amazon AMI without requiring the launch of a new instance for every build.","isRedistributable":true}
