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.