Commit 480dcf00 authored by Vitaly Lipatov's avatar Vitaly Lipatov

epm install: fix --replacepkgs again

parent 706aaf9a
...@@ -308,6 +308,12 @@ __epm_if_command_path() ...@@ -308,6 +308,12 @@ __epm_if_command_path()
is_dirpath "$1" && rhas "$1" "bin/" is_dirpath "$1" && rhas "$1" "bin/"
} }
__epm_get_replacepkgs()
{
[ -n "$2" ] && echo '--replacepkgs' && return
# don't use --replacepkgs when install only one file
}
epm_install_files() epm_install_files()
{ {
local files="$*" local files="$*"
...@@ -345,9 +351,7 @@ epm_install_files() ...@@ -345,9 +351,7 @@ epm_install_files()
fi fi
# --replacepkgs: Install the Package Even If Already Installed # --replacepkgs: Install the Package Even If Already Installed
local replacepkgs='--replacepkgs' local replacepkgs="$(__epm_get_replacepkgs $files)"
# don't use --replacepkgs when install only one file
[ -f "$files" ] && replacepkgs=''
sudocmd rpm -Uvh $replacepkgs $(subst_option dryrun --test) $force $noscripts $nodeps $files && save_installed_packages $files && return sudocmd rpm -Uvh $replacepkgs $(subst_option dryrun --test) $force $noscripts $nodeps $files && save_installed_packages $files && return
local RES=$? local RES=$?
# TODO: check rpm result code and convert it to compatible format if possible # TODO: check rpm result code and convert it to compatible format if possible
...@@ -369,9 +373,7 @@ epm_install_files() ...@@ -369,9 +373,7 @@ epm_install_files()
epm install $(epm req --short $files) || return epm install $(epm req --short $files) || return
# retry with rpm # retry with rpm
# --replacepkgs: Install the Package Even If Already Installed # --replacepkgs: Install the Package Even If Already Installed
local replacepkgs='--replacepkgs' local replacepkgs="$(__epm_get_replacepkgs $files)"
# don't use --replacepkgs when install only one file
[ -f "$files" ] && replacepkgs=''
sudocmd rpm -Uvh $replacepkgs $(subst_option dryrun --test) $force $noscripts $nodeps $files && save_installed_packages $files sudocmd rpm -Uvh $replacepkgs $(subst_option dryrun --test) $force $noscripts $nodeps $files && save_installed_packages $files
return return
fi fi
...@@ -459,9 +461,7 @@ epm_install_files() ...@@ -459,9 +461,7 @@ epm_install_files()
__epm_check_if_src_rpm $files __epm_check_if_src_rpm $files
# --replacepkgs: Install the Package Even If Already Installed # --replacepkgs: Install the Package Even If Already Installed
local replacepkgs='--replacepkgs' local replacepkgs="$(__epm_get_replacepkgs $files)"
# don't use --replacepkgs when install only one file
[ -f "$files" ] && replacepkgs=''
sudocmd rpm -Uvh $replacepkgs $(subst_option dryrun --test) $force $noscripts $nodeps $files && return sudocmd rpm -Uvh $replacepkgs $(subst_option dryrun --test) $force $noscripts $nodeps $files && return
local RES=$? local RES=$?
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment