[Fix] Do not try to install package if already upgraded just before

This commit is contained in:
samuel 2023-05-11 01:59:20 +02:00
parent e797b705ab
commit f9a5808607
1 changed files with 10 additions and 10 deletions

View File

@ -198,9 +198,9 @@ process_request() (
fi fi
log_debug "RPM path found at '${rpm_path}'." log_debug "RPM path found at '${rpm_path}'."
# Upgrade package if already installed.
log_debug "Check if pkg '${pkg_name}' is already installed." log_debug "Check if pkg '${pkg_name}' is already installed."
if rpm --query "${pkg_name}" 1>/dev/null 2>/dev/null; then 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 log_debug "Package '${pkg_name}' already installed, so upgrade to v
${pkg_version}" ${pkg_version}"
if ! output="$(sudo rpm --upgrade \ if ! output="$(sudo rpm --upgrade \
@ -210,8 +210,7 @@ process_request() (
return return
fi fi
log_debug "RPM package '${pkg_name}' upgraded to v${pkg_version}." log_debug "RPM package '${pkg_name}' upgraded to v${pkg_version}."
fi else
# Install package if not already installed. # Install package if not already installed.
log_debug "Package '${pkg_name}' is not already installed, so install log_debug "Package '${pkg_name}' is not already installed, so install
v${pkg_version}." v${pkg_version}."
@ -220,6 +219,7 @@ process_request() (
"Cannot install package '${pkg_name}' v${pkg_version}: ${output}." "Cannot install package '${pkg_name}' v${pkg_version}: ${output}."
return return
fi fi
fi
# Package deployed. # Package deployed.
reply 0 "RPM package '${pkg_name}' v${pkg_version} has been deployed." reply 0 "RPM package '${pkg_name}' v${pkg_version} has been deployed."