summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrej Shadura <andrew.shadura@collabora.co.uk>2019-02-08 16:31:53 +0100
committerAndrej Shadura <andrew.shadura@collabora.co.uk>2019-02-08 16:31:53 +0100
commit4a31eda27ed921e8d8b8c705facd554c8fff490c (patch)
treeab0320e04e5fce394d8c8397c74db59c3634d501
parent1d3663fc3a861188bbf4343d1ffe5767e9815c57 (diff)
New upstream version 1.0.0+git20190123.d6e16be
-rw-r--r--actions/debootstrap_action.go5
-rw-r--r--actions/filesystem_deploy_action.go23
-rw-r--r--actions/image_partition_action.go18
-rw-r--r--doc/man/debos.16
4 files changed, 37 insertions, 15 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 {
diff --git a/doc/man/debos.1 b/doc/man/debos.1
index 9af586c..44148a0 100644
--- a/doc/man/debos.1
+++ b/doc/man/debos.1
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pandoc 2.0.6
+.\" Automatically generated by Pandoc 2.2.1
.\"
.TH "debos" "1" "" "" ""
.hy
@@ -77,8 +77,8 @@ https://godoc.org/github.com/go\-debos/debos/actions
.IP
.nf
\f[C]
-sudo\ apt\ install\ golang
-sudo\ apt\ install\ libglib2.0\-dev\ libostree\-dev
+sudo\ apt\ install\ golang\ git\ libglib2.0\-dev\ libostree\-dev\ qemu\-system\-x86\ \\
+\ \ \ \ \ qemu\-user\-static\ debootstrap\ systemd\-container
export\ GOPATH=/opt/src/gocode\ #\ or\ whatever\ suites\ your\ needs
go\ get\ \-u\ github.com/go\-debos/debos/cmd/debos
/opt/src/gocode/bin/debos\ \-\-help