diff options
author | Andrej Shadura <andrew.shadura@collabora.co.uk> | 2020-01-16 15:25:17 +0100 |
---|---|---|
committer | Andrej Shadura <andrew.shadura@collabora.co.uk> | 2020-01-16 15:25:17 +0100 |
commit | fef5746ee329eb560d740132895ed29a44e44d10 (patch) | |
tree | acbe7190a025de95c107fce342e2d2175aa88e2f /actions | |
parent | afdeba754f8766de3b12211953eced5304991cde (diff) |
New upstream version 1.0.0+git20191223.292995b
Diffstat (limited to 'actions')
-rw-r--r-- | actions/debootstrap_action.go | 12 | ||||
-rw-r--r-- | actions/image_partition_action.go | 27 |
2 files changed, 31 insertions, 8 deletions
diff --git a/actions/debootstrap_action.go b/actions/debootstrap_action.go index b4d6730..77ee63d 100644 --- a/actions/debootstrap_action.go +++ b/actions/debootstrap_action.go @@ -3,6 +3,10 @@ Debootstrap Action Construct the target rootfs with debootstrap tool. +Please keep in mind -- file `/etc/resolv.conf` will be removed after execution. +Most of the OS scripts used by `debootstrap` copy `resolv.conf` from the host, +and this may lead to incorrect configuration when becoming part of the created rootfs. + Yaml syntax: - action: debootstrap mirror: URL @@ -174,6 +178,14 @@ func (d *DebootstrapAction) Run(context *debos.DebosContext) error { } srclist.Close() + /* Cleanup resolv.conf after debootstrap */ + resolvconf := path.Join(context.Rootdir, "/etc/resolv.conf") + if _, err = os.Stat(resolvconf); !os.IsNotExist(err) { + if err = os.Remove(resolvconf); err != nil { + return err + } + } + c := debos.NewChrootCommandForContext(*context) return c.Run("apt clean", "/usr/bin/apt-get", "clean") diff --git a/actions/image_partition_action.go b/actions/image_partition_action.go index b4f0cd2..0850990 100644 --- a/actions/image_partition_action.go +++ b/actions/image_partition_action.go @@ -41,6 +41,7 @@ Yaml syntax for partitions: fs: filesystem start: offset end: offset + features: list of filesystem features flags: list of flags fsck: bool @@ -62,6 +63,9 @@ form -- '32MB', '1GB' or as disk percentage -- '100%'. Optional properties: +- features -- list of additional filesystem features which need to be enabled +for partition. + - flags -- list of additional flags for partition compatible with parted(8) 'set' command. @@ -138,14 +142,15 @@ import ( ) type Partition struct { - number int - Name string - Start string - End string - FS string - Flags []string - Fsck bool "fsck" - FSUUID string + number int + Name string + Start string + End string + FS string + Flags []string + Features []string + Fsck bool "fsck" + FSUUID string } type Mountpoint struct { @@ -268,6 +273,9 @@ func (i ImagePartitionAction) formatPartition(p *Partition, context debos.DebosC case "btrfs": // Force formatting to prevent failure in case if partition was formatted already cmdline = append(cmdline, "mkfs.btrfs", "-L", p.Name, "-f") + if len(p.Features) > 0 { + cmdline = append(cmdline, "-O", strings.Join(p.Features, ",")) + } case "hfs": cmdline = append(cmdline, "mkfs.hfs", "-h", "-v", p.Name) case "hfsplus": @@ -279,6 +287,9 @@ func (i ImagePartitionAction) formatPartition(p *Partition, context debos.DebosC case "none": default: cmdline = append(cmdline, fmt.Sprintf("mkfs.%s", p.FS), "-L", p.Name) + if len(p.Features) > 0 { + cmdline = append(cmdline, "-O", strings.Join(p.Features, ",")) + } } if len(cmdline) != 0 { |