summaryrefslogtreecommitdiff
path: root/actions/debootstrap_action.go
diff options
context:
space:
mode:
Diffstat (limited to 'actions/debootstrap_action.go')
-rw-r--r--actions/debootstrap_action.go12
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")