8000
Skip to content

Copying /etc/resolv.conf to chroot while restoring the original file unless it has been changed during provisioning - #160

Open
chrsoo wants to merge 2 commits into
mkaczanowski:masterfrom
chrsoo:master
Open

Copying /etc/resolv.conf to chroot while restoring the original file unless it has been changed during provisioning#160
chrsoo wants to merge 2 commits into
mkaczanowski:masterfrom
chrsoo:master

Conversation

@chrsoo
@chrsoo chrsoo commented Jan 4, 2022
Copy link
Copy Markdown

This PR relates to #144.

There are very likely room for improvements both in algorithm and code, please review carefully before merging!

Change tested on Macbook Pro M1 with ubuntu-20.04.2-preinstalled-server-arm64+raspi.img.xz and confirmed working.

@chrsoo chrsoo changed the title First stab for fixing resolv.conf in issue #144 Copying /etc/resolv.cong to chroot while restoring the original file unless it has been changed during provisioning Jan 4, 2022
@chrsoo chrsoo changed the title Copying /etc/resolv.cong to chroot while restoring the original file unless it has been changed during provisioning Copying /etc/resolv.conf to chroot while restoring the original file unless it has been changed during provisioning Jan 4, 2022
@dbast
dbast commented Oct 17, 2022
Copy link
Copy Markdown
Collaborator

This are 123 lines of added code... how is it fundamentally different from, e.g.?

  provisioner "shell" {
    inline = [
      "mv /etc/resolv.conf /etc/resolv.conf.bak",
    ]
  }
  provisioner "file" {
    source      = "/etc/resolv.conf"
    destination = "/etc/resolv.conf"
  }
  provisioner "shell" {
    inline = [
      "rm -rf /etc/resolv.conf",
      "mv /etc/resolv.conf.bak /etc/resolv.conf",
    ]
  }

Why implement this on the go-side inside the builder? Above solution can also be customised, by e.g. skipping the restore etc with not unexpected automatic behaviour.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0