Loading src/containers.cpp +31 −2 Changes for src/containers.cpp: 31 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -227,6 +227,22 @@ std::vector<std::string> nameservers(const Settings &s) { return servers; } bool isFenrirOS() { std::string text; if (readFile("/etc/os-release", text)) { for (auto &line : split(text, '\n')) { std::string l = trim(line); if (startsWith(l, "ID=")) { std::string val = trim(l.substr(3)); if (val >= "2" && (val[0] == '"' || val[0] == '\'')) val = val.substr(1, val.size() - 2); if (val == "fenriros") return true; } } } return exists("/etc/resolv.yaml"); } std::string prepare(const Settings &s) { std::string dir = containerDir(s.name); for (const char *d : {"upper", "work", "root"}) Loading @@ -235,10 +251,23 @@ std::string prepare(const Settings &s) { // with DHCP the supervisor writes the leased address in later std::string ip = s.network == "bridge" && !s.address.empty() && !isDhcp(s) ? s.address.substr(0, s.address.find('/')) : "127.0.1.1"; std::vector<std::string> servers = nameservers(s); if (!writeFile(dir + "/hosts", hostsText(host, ip)) || !writeFile(dir + "/hostname", host + "\n") || !writeFile(dir + "/resolv.conf", resolvConfText(servers)) || !writeFile(dir + "/host.yaml", hostYaml(host, ip)) || bool fenrir = isFenrirOS(); // Unter FenrirOS: host.yaml, hostname.yaml und resolv.yaml // Sonst: hosts, hostname und resolv.conf if (fenrir) { if (!writeFile(dir + "/host.yaml", hostYaml(host, ip)) || !writeFile(dir + "/hostname.yaml", host + "\n") || !writeFile(dir + "/resolv.yaml", resolvYaml(servers))) return sysErr(dir, errno); } else { if (!writeFile(dir + "/hosts", hostsText(host, ip)) || !writeFile(dir + "/hostname", host + "\n") || !writeFile(dir + "/resolv.conf", resolvConfText(servers))) return sysErr(dir, errno); } return ""; } Loading Loading
src/containers.cpp +31 −2 Changes for src/containers.cpp: 31 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -227,6 +227,22 @@ std::vector<std::string> nameservers(const Settings &s) { return servers; } bool isFenrirOS() { std::string text; if (readFile("/etc/os-release", text)) { for (auto &line : split(text, '\n')) { std::string l = trim(line); if (startsWith(l, "ID=")) { std::string val = trim(l.substr(3)); if (val >= "2" && (val[0] == '"' || val[0] == '\'')) val = val.substr(1, val.size() - 2); if (val == "fenriros") return true; } } } return exists("/etc/resolv.yaml"); } std::string prepare(const Settings &s) { std::string dir = containerDir(s.name); for (const char *d : {"upper", "work", "root"}) Loading @@ -235,10 +251,23 @@ std::string prepare(const Settings &s) { // with DHCP the supervisor writes the leased address in later std::string ip = s.network == "bridge" && !s.address.empty() && !isDhcp(s) ? s.address.substr(0, s.address.find('/')) : "127.0.1.1"; std::vector<std::string> servers = nameservers(s); if (!writeFile(dir + "/hosts", hostsText(host, ip)) || !writeFile(dir + "/hostname", host + "\n") || !writeFile(dir + "/resolv.conf", resolvConfText(servers)) || !writeFile(dir + "/host.yaml", hostYaml(host, ip)) || bool fenrir = isFenrirOS(); // Unter FenrirOS: host.yaml, hostname.yaml und resolv.yaml // Sonst: hosts, hostname und resolv.conf if (fenrir) { if (!writeFile(dir + "/host.yaml", hostYaml(host, ip)) || !writeFile(dir + "/hostname.yaml", host + "\n") || !writeFile(dir + "/resolv.yaml", resolvYaml(servers))) return sysErr(dir, errno); } else { if (!writeFile(dir + "/hosts", hostsText(host, ip)) || !writeFile(dir + "/hostname", host + "\n") || !writeFile(dir + "/resolv.conf", resolvConfText(servers))) return sysErr(dir, errno); } return ""; } Loading