[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
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.