diff options
author | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2020-03-15 01:22:07 -0500 |
---|---|---|
committer | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2020-03-15 01:22:07 -0500 |
commit | c04a7e8ecd3a29b3ca2671b202b39be487d7c594 (patch) | |
tree | ab623d63a3b26728e095a8a82be4f1ef3d8d8eaf | |
parent | 6d0267d1b1fc9597e0c49299114016341ff4646e (diff) | |
download | horizon-c04a7e8ecd3a29b3ca2671b202b39be487d7c594.tar.gz horizon-c04a7e8ecd3a29b3ca2671b202b39be487d7c594.tar.bz2 horizon-c04a7e8ecd3a29b3ca2671b202b39be487d7c594.tar.xz horizon-c04a7e8ecd3a29b3ca2671b202b39be487d7c594.zip |
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.
-rw-r--r-- | hscript/script_e.cc | 6 |
1 files changed, 3 insertions, 3 deletions
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) { |