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/debootstrap_action.go | |
parent | afdeba754f8766de3b12211953eced5304991cde (diff) |
New upstream version 1.0.0+git20191223.292995b
Diffstat (limited to 'actions/debootstrap_action.go')
-rw-r--r-- | actions/debootstrap_action.go | 12 |
1 files changed, 12 insertions, 0 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") |