diff options
Diffstat (limited to 'actions')
-rw-r--r-- | actions/apt_action.go | 1 | ||||
-rw-r--r-- | actions/image_partition_action.go | 32 | ||||
-rw-r--r-- | actions/ostree_deploy_action.go | 8 | ||||
-rw-r--r-- | actions/overlay_action.go | 2 | ||||
-rw-r--r-- | actions/pack_action.go | 6 | ||||
-rw-r--r-- | actions/recipe_action.go | 10 | ||||
-rw-r--r-- | actions/recipe_test.go | 22 | ||||
-rw-r--r-- | actions/run_action.go | 4 |
8 files changed, 52 insertions, 33 deletions
diff --git a/actions/apt_action.go b/actions/apt_action.go index 6f3988f..9136687 100644 --- a/actions/apt_action.go +++ b/actions/apt_action.go @@ -18,6 +18,7 @@ Mandatory properties: Optional properties: - recommends -- boolean indicating if suggested packages will be installed + - unauthenticated -- boolean indicating if unauthenticated packages can be installed */ package actions diff --git a/actions/image_partition_action.go b/actions/image_partition_action.go index fcfd93e..b4f0cd2 100644 --- a/actions/image_partition_action.go +++ b/actions/image_partition_action.go @@ -42,6 +42,7 @@ Yaml syntax for partitions: start: offset end: offset flags: list of flags + fsck: bool Mandatory properties: @@ -64,6 +65,9 @@ Optional properties: - flags -- list of additional flags for partition compatible with parted(8) 'set' command. +- fsck -- if set to `false` -- then set fs_passno (man fstab) to 0 meaning no filesystem +checks in boot time. By default is set to `true` allowing checks on boot. + Yaml syntax for mount points: mountpoints: @@ -82,6 +86,7 @@ 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 @@ -139,6 +144,7 @@ type Partition struct { End string FS string Flags []string + Fsck bool "fsck" FSUUID string } @@ -163,6 +169,16 @@ type ImagePartitionAction struct { usingLoop bool } +func (p *Partition) UnmarshalYAML(unmarshal func(interface{}) error) error { + type rawPartition Partition + part := rawPartition{Fsck: true} + if err := unmarshal(&part); err != nil { + return err + } + *p = Partition(part) + return nil +} + func (i *ImagePartitionAction) generateFSTab(context *debos.DebosContext) error { context.ImageFSTab.Reset() @@ -176,9 +192,19 @@ func (i *ImagePartitionAction) generateFSTab(context *debos.DebosContext) error if m.part.FSUUID == "" { return fmt.Errorf("Missing fs UUID for partition %s!?!", m.part.Name) } - context.ImageFSTab.WriteString(fmt.Sprintf("UUID=%s\t%s\t%s\t%s\t0\t0\n", + + fs_passno := 0 + + if m.part.Fsck { + if m.Mountpoint == "/" { + fs_passno = 1 + } else { + fs_passno = 2 + } + } + context.ImageFSTab.WriteString(fmt.Sprintf("UUID=%s\t%s\t%s\t%s\t0\t%d\n", m.part.FSUUID, m.Mountpoint, m.part.FS, - strings.Join(options, ","))) + strings.Join(options, ","), fs_passno)) } return nil @@ -238,7 +264,7 @@ func (i ImagePartitionAction) formatPartition(p *Partition, context debos.DebosC cmdline := []string{} switch p.FS { case "vfat": - cmdline = append(cmdline, "mkfs.vfat", "-n", p.Name) + cmdline = append(cmdline, "mkfs.vfat", "-F32", "-n", p.Name) case "btrfs": // Force formatting to prevent failure in case if partition was formatted already cmdline = append(cmdline, "mkfs.btrfs", "-L", p.Name, "-f") diff --git a/actions/ostree_deploy_action.go b/actions/ostree_deploy_action.go index 7d6e6bd..7353691 100644 --- a/actions/ostree_deploy_action.go +++ b/actions/ostree_deploy_action.go @@ -55,7 +55,6 @@ import ( "io" "os" "path" - "runtime" "strings" "github.com/go-debos/debos" @@ -198,6 +197,11 @@ func (ot *OstreeDeployAction) Run(context *debos.DebosContext) error { return err } - runtime.GC() + /* libostree keeps some information, like repo lock file descriptor, in + * thread specific variables. As GC can be run from another thread, it + * may not been able to access this, preventing to free them correctly. + * To prevent this, explicitly dereference libostree objects. */ + dstRepo.Unref() + sysroot.Unref() return nil } diff --git a/actions/overlay_action.go b/actions/overlay_action.go index f17ecb3..b5e4924 100644 --- a/actions/overlay_action.go +++ b/actions/overlay_action.go @@ -20,7 +20,7 @@ Optional properties: - destination -- absolute path in the target rootfs where 'source' will be copied. All existing files will be overwritten. -If destination isn't set '/' of the rootfs will be usedi. +If destination isn't set '/' of the rootfs will be used. */ package actions diff --git a/actions/pack_action.go b/actions/pack_action.go index 1cb1af0..b8f28a7 100644 --- a/actions/pack_action.go +++ b/actions/pack_action.go @@ -34,6 +34,8 @@ func (pf *PackAction) Run(context *debos.DebosContext) error { pf.LogStart() outfile := path.Join(context.Artifactdir, pf.File) - log.Printf("Compression to %s\n", outfile) - return debos.Command{}.Run("Packing", "tar", "czf", outfile, "-C", context.Rootdir, ".") + log.Printf("Compressing to %s\n", outfile) + return debos.Command{}.Run("Packing", "tar", "czf", outfile, + "--xattrs", "--xattrs-include=*.*", + "-C", context.Rootdir, ".") } diff --git a/actions/recipe_action.go b/actions/recipe_action.go index d9500dd..9fa3b1c 100644 --- a/actions/recipe_action.go +++ b/actions/recipe_action.go @@ -1,7 +1,15 @@ /* Recipe Action -Include a recipe. +This action includes the recipe at the given path, and can optionally +override or set template variables. + +To ensure compatibility, both the parent recipe and all included recipes have +to be for the same architecture. For convenience the parent architecture is +passed in the "architecture" template variable. + +Limitations of combined recipes are equivalent to limitations within a +single recipe (e.g. there can only be one image partition action). Yaml syntax: - action: recipe diff --git a/actions/recipe_test.go b/actions/recipe_test.go index de9d6ea..ef2a755 100644 --- a/actions/recipe_test.go +++ b/actions/recipe_test.go @@ -228,16 +228,6 @@ actions: command: ok.sh `, } - var recipeIncluded = subRecipe { - "included.yaml", - ` -architecture: amd64 - -actions: - - action: run - command: ok.sh -`, - } // test recipes var tests = []testSubRecipe { @@ -289,18 +279,6 @@ actions: recipeArmhf, "Expect architecture 'amd64' but got 'armhf'", }, - { - // Test included_recipe prevents parsing OK - ` -architecture: amd64 - -actions: - - action: recipe - recipe: included.yaml -`, - recipeIncluded, - "", // Do not expect failure - }, } for _, test := range tests { diff --git a/actions/run_action.go b/actions/run_action.go index 7bae989..8d36228 100644 --- a/actions/run_action.go +++ b/actions/run_action.go @@ -98,8 +98,8 @@ func (run *RunAction) doRun(context debos.DebosContext) error { script[0] = debos.CleanPathAt(script[0], context.RecipeDir) if run.Chroot { scriptpath := path.Dir(script[0]) - cmd.AddBindMount(scriptpath, "/script") - script[0] = strings.Replace(script[0], scriptpath, "/script", 1) + cmd.AddBindMount(scriptpath, "/tmp/script") + script[0] = strings.Replace(script[0], scriptpath, "/tmp/script", 1) } cmdline = []string{strings.Join(script, " ")} label = path.Base(run.Script) |