This commit is contained in:
Your Name
2025-05-23 21:41:33 +12:00
parent 94f77994f0
commit 048345c636
21 changed files with 377 additions and 203 deletions

View File

@ -53,23 +53,25 @@ namespace dropshell
return false; // should never hit this.
}
std::string user = server_env.get_user_for_service(server, service);
// 2. Check if service directory exists on server
if (!server_env.check_remote_dir_exists(remotepath::service(server, service)))
if (!server_env.check_remote_dir_exists(remotepath(server, user).service(service), user))
{
error << "Service is not installed: " << service << std::endl;
return true; // Nothing to uninstall
}
// 3. Run uninstall script if it exists
std::string uninstall_script = remotepath::service_template(server, service) + "/uninstall.sh";
std::string uninstall_script = remotepath(server, user).service_template(service) + "/uninstall.sh";
if (!server_env.run_remote_template_command(service, "uninstall", {}, false, {}))
warning << "Uninstall script failed, but continuing with directory removal" << std::endl;
// 4. Remove the service directory from the server, running in a docker container as root.
if (server_env.remove_remote_dir(remotepath::service(server, service), false))
if (server_env.remove_remote_dir(remotepath(server, user).service(service), false, user))
{
ASSERT(!server_env.check_remote_dir_exists(remotepath::service(server, service)), "Service directory still found on server after uninstall");
info << "Removed remote service directory " << remotepath::service(server, service) << std::endl;
ASSERT(!server_env.check_remote_dir_exists(remotepath(server, user).service(service), user), "Service directory still found on server after uninstall");
info << "Removed remote service directory " << remotepath(server, user).service(service) << std::endl;
}
else
warning << "Failed to remove remote service directory" << std::endl;