From f9a58086072d0c44335fc450a432c7d486e8cddd Mon Sep 17 00:00:00 2001 From: samuel Date: Thu, 11 May 2023 01:59:20 +0200 Subject: [PATCH] [Fix] Do not try to install package if already upgraded just before --- src/deployer.sh | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/deployer.sh b/src/deployer.sh index 0dcc3c8..7fe0e18 100755 --- a/src/deployer.sh +++ b/src/deployer.sh @@ -198,9 +198,9 @@ process_request() ( fi log_debug "RPM path found at '${rpm_path}'." - # Upgrade package if already installed. log_debug "Check if pkg '${pkg_name}' is already installed." if rpm --query "${pkg_name}" 1>/dev/null 2>/dev/null; then + # Upgrade package if already installed. log_debug "Package '${pkg_name}' already installed, so upgrade to v ${pkg_version}" if ! output="$(sudo rpm --upgrade \ @@ -210,15 +210,15 @@ process_request() ( return fi log_debug "RPM package '${pkg_name}' upgraded to v${pkg_version}." - fi - - # Install package if not already installed. - log_debug "Package '${pkg_name}' is not already installed, so install - v${pkg_version}." - if ! output="$(sudo rpm --install --verbose --hash "${rpm_path}")"; then - reply "${err_rpm_install}" \ - "Cannot install package '${pkg_name}' v${pkg_version}: ${output}." - return + else + # Install package if not already installed. + log_debug "Package '${pkg_name}' is not already installed, so install + v${pkg_version}." + if ! output="$(sudo rpm --install --verbose --hash "${rpm_path}")"; then + reply "${err_rpm_install}" \ + "Cannot install package '${pkg_name}' v${pkg_version}: ${output}." + return + fi fi # Package deployed.