From c165895ab457aea9aba529d84224bf1336337cec Mon Sep 17 00:00:00 2001 From: j Date: Fri, 27 Feb 2026 12:07:18 +1300 Subject: [PATCH] Update source/src/commands/install.cpp --- source/src/commands/install.cpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/source/src/commands/install.cpp b/source/src/commands/install.cpp index aa1bdff..a198c98 100644 --- a/source/src/commands/install.cpp +++ b/source/src/commands/install.cpp @@ -145,22 +145,26 @@ namespace dropshell } // Run install-pre.sh if it exists in the local template cache (reduces downtime by e.g. pulling images before uninstall) + // Only sync the single script, NOT the full template — the old uninstall.sh must stay matching the installed version. bool has_install_pre = std::filesystem::exists(tinfo.local_template_path() / "install-pre.sh"); if (has_install_pre && server_env.check_remote_dir_exists(remote_service_path, user)) { info << "Running pre-install script to prepare for update..." << std::endl; - // Sync template and config so install-pre.sh is available on remote - if (!shared_commands::rsync_service_config(server_env, service, false)) + // Copy only install-pre.sh to the existing remote template directory + std::string local_script = (tinfo.local_template_path() / "install-pre.sh").string(); + std::string remote_script = remotepath(server, user).service_template(service) + "/install-pre.sh"; + if (!shared_commands::rsync_file_to_remote(local_script, remote_script, server_env, false, user)) { - error << "Failed to sync service configuration to remote for pre-install" << std::endl; - return false; + warning << "Failed to copy install-pre.sh to remote, skipping pre-install" << std::endl; } - - shared_commands::cRemoteTempFolder remote_temp_folder(server_env, user); - if (!server_env.run_remote_template_command(service, "install-pre", {}, false, {{"TEMP_DIR", remote_temp_folder.path()}}, NULL)) + else { - warning << "Pre-install script failed, continuing with install..." << std::endl; + shared_commands::cRemoteTempFolder remote_temp_folder(server_env, user); + if (!server_env.run_remote_template_command(service, "install-pre", {}, false, {{"TEMP_DIR", remote_temp_folder.path()}}, NULL)) + { + warning << "Pre-install script failed, continuing with install..." << std::endl; + } } }