summaryrefslogtreecommitdiff
path: root/actions
diff options
context:
space:
mode:
Diffstat (limited to 'actions')
-rw-r--r--actions/debootstrap_action.go5
-rw-r--r--actions/filesystem_deploy_action.go23
-rw-r--r--actions/image_partition_action.go18
3 files changed, 34 insertions, 12 deletions
diff --git a/actions/debootstrap_action.go b/actions/debootstrap_action.go
index b4d6730..02cbb15 100644
--- a/actions/debootstrap_action.go
+++ b/actions/debootstrap_action.go
@@ -81,11 +81,6 @@ func (d *DebootstrapAction) RunSecondStage(context debos.DebosContext) error {
"--no-check-gpg",
"--second-stage"}
- if d.Components != nil {
- s := strings.Join(d.Components, ",")
- cmdline = append(cmdline, fmt.Sprintf("--components=%s", s))
- }
-
c := debos.NewChrootCommandForContext(context)
// Can't use nspawn for debootstrap as it wants to create device nodes
c.ChrootMethod = debos.CHROOT_METHOD_CHROOT
diff --git a/actions/filesystem_deploy_action.go b/actions/filesystem_deploy_action.go
index bb89a83..af087f1 100644
--- a/actions/filesystem_deploy_action.go
+++ b/actions/filesystem_deploy_action.go
@@ -8,6 +8,7 @@ Yaml syntax:
- action: filesystem-deploy
setup-fstab: bool
setup-kernel-cmdline: bool
+ append-kernel-cmdline: arguments
Optional properties:
@@ -16,6 +17,8 @@ by 'image-partition' action. By default is 'true'.
- setup-kernel-cmdline -- add location of root partition to '/etc/kernel/cmdline'
file on target image. By default is 'true'.
+
+- append-kernel-cmdline -- additional kernel command line arguments passed to kernel.
*/
package actions
@@ -33,9 +36,10 @@ import (
)
type FilesystemDeployAction struct {
- debos.BaseAction `yaml:",inline"`
- SetupFSTab bool `yaml:"setup-fstab"`
- SetupKernelCmdline bool `yaml:"setup-kernel-cmdline"`
+ debos.BaseAction `yaml:",inline"`
+ SetupFSTab bool `yaml:"setup-fstab"`
+ SetupKernelCmdline bool `yaml:"setup-kernel-cmdline"`
+ AppendKernelCmdline string `yaml:"append-kernel-cmdline"`
}
func NewFilesystemDeployAction() *FilesystemDeployAction {
@@ -75,6 +79,8 @@ func (fd *FilesystemDeployAction) setupFSTab(context *debos.DebosContext) error
}
func (fd *FilesystemDeployAction) setupKernelCmdline(context *debos.DebosContext) error {
+ var cmdline []string
+
log.Print("Setting up /etc/kernel/cmdline")
err := os.MkdirAll(path.Join(context.Rootdir, "etc", "kernel"), 0755)
@@ -89,11 +95,14 @@ func (fd *FilesystemDeployAction) setupKernelCmdline(context *debos.DebosContext
log.Fatalf("Couldn't open kernel cmdline: %v", err)
}
- cmdline := fmt.Sprintf("%s %s\n",
- strings.TrimSpace(string(current)),
- context.ImageKernelRoot)
+ cmdline = append(cmdline, strings.TrimSpace(string(current)))
+ cmdline = append(cmdline, context.ImageKernelRoot)
+
+ if fd.AppendKernelCmdline != "" {
+ cmdline = append(cmdline, fd.AppendKernelCmdline)
+ }
- _, err = f.WriteString(cmdline)
+ _, err = f.WriteString(strings.Join(cmdline, " ") + "\n")
if err != nil {
return fmt.Errorf("Couldn't write kernel/cmdline: %v", err)
}
diff --git a/actions/image_partition_action.go b/actions/image_partition_action.go
index ce63464..fcfd93e 100644
--- a/actions/image_partition_action.go
+++ b/actions/image_partition_action.go
@@ -70,6 +70,7 @@ Yaml syntax for mount points:
- mountpoint: path
partition: partition label
options: list of options
+ buildtime: bool
Mandatory properties:
@@ -81,6 +82,12 @@ should be mounted.
Optional properties:
- options -- list of options to be added to appropriate entry in fstab file.
+- buildtime -- if set to true then the mountpoint only used during the debos run.
+No entry in `/etc/fstab' will be created.
+The mountpoints directory will be removed from the image, so it is recommended
+to define a `mountpoint` path which is temporary and unique for the image,
+for example: `/mnt/temporary_mount`.
+Defaults to false.
Layout example for Raspberry PI 3:
@@ -139,6 +146,7 @@ type Mountpoint struct {
Mountpoint string
Partition string
Options []string
+ Buildtime bool
part *Partition
}
@@ -161,6 +169,10 @@ func (i *ImagePartitionAction) generateFSTab(context *debos.DebosContext) error
for _, m := range i.Mountpoints {
options := []string{"defaults"}
options = append(options, m.Options...)
+ if m.Buildtime == true {
+ /* Do not need to add mount point into fstab */
+ continue
+ }
if m.part.FSUUID == "" {
return fmt.Errorf("Missing fs UUID for partition %s!?!", m.part.Name)
}
@@ -397,6 +409,12 @@ func (i ImagePartitionAction) Cleanup(context *debos.DebosContext) error {
log.Printf("Unmount failure can cause images being incomplete!")
return err
}
+ if m.Buildtime == true {
+ if err = os.Remove(mntpath); err != nil {
+ log.Printf("Failed to remove temporary mount point %s: %s", m.Mountpoint, err)
+ return err
+ }
+ }
}
if i.usingLoop {