mirror of
https://github.com/CachyOS/New-Cli-Installer.git
synced 2025-01-23 14:32:22 +08:00
👷 gucc: add option to create system group
This commit is contained in:
parent
bb43ad5def
commit
cfd260855c
@ -15,7 +15,7 @@ struct UserInfo final {
|
||||
};
|
||||
|
||||
// Create group on the system
|
||||
auto create_group(std::string_view group, std::string_view mountpoint) noexcept -> bool;
|
||||
auto create_group(std::string_view group, std::string_view mountpoint, bool is_system = false) noexcept -> bool;
|
||||
|
||||
// Set user password on the system
|
||||
auto set_user_password(std::string_view username, std::string_view password, std::string_view mountpoint) noexcept -> bool;
|
||||
|
@ -34,11 +34,11 @@ using namespace std::string_view_literals;
|
||||
|
||||
namespace gucc::user {
|
||||
|
||||
auto create_group(std::string_view group, std::string_view mountpoint) noexcept -> bool {
|
||||
auto create_group(std::string_view group, std::string_view mountpoint, bool is_system) noexcept -> bool {
|
||||
// TODO(vnepogodin):
|
||||
// 1. add parameter to check if the group was already created
|
||||
// 2. add parameter if the group should be --system group
|
||||
const auto& cmd = fmt::format(FMT_COMPILE("groupadd {}"), group);
|
||||
const auto& cmd = fmt::format(FMT_COMPILE("groupadd {}{}"), is_system ? "--system"sv : ""sv, group);
|
||||
return utils::arch_chroot_checked(cmd, mountpoint);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user