summaryrefslogtreecommitdiff
path: root/actions/image_partition_action.go
diff options
context:
space:
mode:
authorEmanuele Aina <emanuele.aina@collabora.com>2019-09-09 06:58:33 +0000
committerEmanuele Aina <emanuele.aina@collabora.com>2019-09-09 06:58:33 +0000
commit8c16f187783f193a7e5a87d9ef1281cd8ca92c1e (patch)
treeefd3b745eec6410d08dc53dd7ecb43a7be5cdd32 /actions/image_partition_action.go
parent3f13e87bb45d0d791c86338f9aa0853a9f41a992 (diff)
parentafdeba754f8766de3b12211953eced5304991cde (diff)
Update upstream source from tag 'upstream/1.0.0+git20190906.f5be960'
Update to upstream version '1.0.0+git20190906.f5be960' with Debian dir ff8d0024ed4cb787f364d24c9d56bc359f4d73e9
Diffstat (limited to 'actions/image_partition_action.go')
-rw-r--r--actions/image_partition_action.go32
1 files changed, 29 insertions, 3 deletions
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")