From afdeba754f8766de3b12211953eced5304991cde Mon Sep 17 00:00:00 2001 From: Emanuele Aina Date: Mon, 9 Sep 2019 06:58:33 +0000 Subject: New upstream version 1.0.0+git20190906.f5be960 --- actions/image_partition_action.go | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) (limited to 'actions/image_partition_action.go') 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") -- cgit v1.2.3