remove launchd entry on unmount
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
This commit is contained in:
@@ -936,11 +936,14 @@ auto fuse_base::unlink_(const char *path) -> int {
|
||||
}
|
||||
|
||||
auto fuse_base::unmount(const std::string &mount_location) -> int {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
#if defined(__APPLE__)
|
||||
if (utils::file::file{
|
||||
utils::path::combine("~", {"/Library/LaunchAgents", label_})}
|
||||
.exists()) {
|
||||
return utils::launchctl_command(label_, utils::launchctl_type::bootout);
|
||||
if (not utils::remove_launchd_plist(
|
||||
utils::path::combine("~", {"/Library/LaunchAgents"}), label_, true)) {
|
||||
utils::error::raise_error(
|
||||
function_name,
|
||||
fmt::format("failed to remove launchd entry|label|{}", label_));
|
||||
}
|
||||
|
||||
auto cmd = "umount \"" + mount_location + "\" >/dev/null 2>&1";
|
||||
|
@@ -304,9 +304,6 @@ void mgmt_app_config::set_auto_start(bool auto_start) {
|
||||
#if defined(__APPLE__)
|
||||
const auto *label = "com.fifthgrid.blockstorage.repertory.ui";
|
||||
auto plist_path = utils::path::combine("~", {"/Library/LaunchAgents"});
|
||||
auto file = utils::file::file{
|
||||
utils::path::combine(plist_path, {label}),
|
||||
};
|
||||
if (auto_start) {
|
||||
utils::plist_cfg cfg{};
|
||||
cfg.args = {
|
||||
@@ -330,13 +327,12 @@ void mgmt_app_config::set_auto_start(bool auto_start) {
|
||||
function_name, utils::get_last_error_code(),
|
||||
"failed to create auto-start entry|name|repertory");
|
||||
}
|
||||
} else if (file.remove()) {
|
||||
} else if (utils::remove_launchd_plist(plist_path, label, false)) {
|
||||
utils::error::handle_info(function_name,
|
||||
"removed auto-start entry|name|repertory");
|
||||
} else {
|
||||
utils::error::raise_error(
|
||||
function_name, utils::get_last_error_code(),
|
||||
"failed to remove auto-start entry|name|repertory");
|
||||
function_name, "failed to remove auto-start entry|name|repertory");
|
||||
}
|
||||
#endif // defined(__APPLE__)
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user