| 148 | } |
| 149 | |
| 150 | static void createGroup(const String & group_name) |
| 151 | { |
| 152 | if (!group_name.empty()) |
| 153 | { |
| 154 | #if defined(OS_DARWIN) |
| 155 | // TODO: implement. |
| 156 | throw Exception(ErrorCodes::NOT_IMPLEMENTED, "Unable to create a group in macOS"); |
| 157 | #elif defined(OS_FREEBSD) |
| 158 | std::string command = fmt::format("pw groupadd {}", shellQuote(group_name)); |
| 159 | fmt::print(" {}\n", command); |
| 160 | executeScript(command); |
| 161 | #else |
| 162 | std::string command = fmt::format("groupadd -r {}", shellQuote(group_name)); |
| 163 | fmt::print(" {}\n", command); |
| 164 | executeScript(command); |
| 165 | #endif |
| 166 | } |
| 167 | } |
| 168 | |
| 169 | static void createUser(const String & user_name, [[maybe_unused]] const String & group_name) |
| 170 | { |
no test coverage detected