Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

chrsoo
Copy link

@chrsoo chrsoo commented Jan 4, 2022

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
Copy link
Collaborator

dbast commented Oct 17, 2022

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.

None yet

2 participants