updated build system
All checks were successful
Blockstorage/repertory_msys2/pipeline/head This commit looks good
BlockStorage/repertory/pipeline/head This commit looks good

This commit is contained in:
2025-12-14 19:52:46 -06:00
parent 97d557a1a9
commit f0396fccd5
13 changed files with 74 additions and 42 deletions

View File

@@ -311,11 +311,24 @@ auto use_getpwuid(uid_t uid, passwd_callback_t callback) -> result {
#if defined(PROJECT_ENABLE_PUGIXML)
auto generate_launchd_plist(const plist_cfg &cfg, bool overwrite_existing)
-> bool {
REPERTORY_USES_FUNCTION_NAME();
auto file = utils::path::combine(cfg.plist_path, {cfg.label + ".plist"});
if (utils::file::file{file}.exists() && not overwrite_existing) {
return true;
}
auto parent_directory = utils::path::get_parent_path(file);
if (not utils::file::directory{parent_directory}.create_directory()) {
utils::error::handle_error(function_name,
utils::error::create_error_message({
"failed to create plist parent directory",
parent_directory,
std::to_string(errno),
}));
return false;
}
pugi::xml_document doc;
auto decl = doc.append_child(pugi::node_declaration);
decl.append_attribute("version") = "1.0";
@@ -370,26 +383,24 @@ auto generate_launchd_plist(const plist_cfg &cfg, bool overwrite_existing)
#if defined(PROJECT_ENABLE_SPDLOG) || defined(PROJECT_ENABLE_FMT)
auto launchctl_command(std::string_view label, launchctl_type type) -> int {
auto launch_agents_dir = utils::path::combine("~", {
"Library",
"LaunchAgents",
});
switch (type) {
case launchctl_type::bootout:
return system(
fmt::format("launchctl bootout gui/{} '{}' 1>/dev/null 2>&1", getuid(),
utils::path::combine("~",
{
"/Library/LaunchAgents",
fmt::format("{}.plist", label),
}))
utils::path::combine(launch_agents_dir,
{fmt::format("{}.plist", label)}))
.c_str());
case launchctl_type::bootstrap:
return system(
fmt::format("launchctl bootstrap gui/{} '{}' 1>/dev/null 2>&1",
getuid(),
utils::path::combine("~",
{
"/Library/LaunchAgents",
fmt::format("{}.plist", label),
}))
utils::path::combine(launch_agents_dir,
{fmt::format("{}.plist", label)}))
.c_str());
case launchctl_type::kickstart: