From c04a7e8ecd3a29b3ca2671b202b39be487d7c594 Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Sun, 15 Mar 2020 01:22:07 -0500 Subject: script: Handle pre-existing network condition better Previously, if /etc/resolv.conf existed, execution would fail with: internal: error: cannot use DNS configuration during installation: File exists If /etc/conf.d/net.$IFACE existed, execution would log: internal: error: could not use networking on eth0: File exists Fix both of these issues. --- hscript/script_e.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'hscript') diff --git a/hscript/script_e.cc b/hscript/script_e.cc index ea430dc..8bb9196 100644 --- a/hscript/script_e.cc +++ b/hscript/script_e.cc @@ -402,7 +402,7 @@ bool Script::execute() const { for(auto &iface : ifaces) { fs::create_symlink("/etc/init.d/net.lo", "/etc/init.d/net." + iface, ec); - if(ec) { + if(ec && ec.value() != EEXIST) { output_error("internal", "could not use networking on " + iface, ec.message()); EXECUTE_FAILURE("network"); @@ -413,10 +413,10 @@ bool Script::execute() const { if(!internal->nses.empty()) { if(dhcp) { fs::copy_file(targ_etc + "/resolv.conf.head", - "/etc/resolv.conf.head", ec); + "/etc/resolv.conf.head", fs_overwrite, ec); } else { fs::copy_file(targ_etc + "/resolv.conf", - "/etc/resolv.conf", ec); + "/etc/resolv.conf", fs_overwrite, ec); } if(ec) { -- cgit v1.2.3-70-g09d2