Commit 33b0063a authored by Ivan Mazhukin's avatar Ivan Mazhukin Committed by Vitaly Lipatov

epm, epm-install: added --force-overwrite option (eterbug #17603)

parent d7df8bdd
...@@ -153,6 +153,7 @@ pkg_options= ...@@ -153,6 +153,7 @@ pkg_options=
quoted_args= quoted_args=
direct_args= direct_args=
ipfs= ipfs=
force_overwrite=
eget_backend=$EGET_BACKEND eget_backend=$EGET_BACKEND
epm_vardir=/var/lib/eepm epm_vardir=/var/lib/eepm
...@@ -584,6 +585,9 @@ check_option() ...@@ -584,6 +585,9 @@ check_option()
--no-check-certificate) --no-check-certificate)
fatal "--no-check-certificate is a wget option. It is recommended never use it at all. Check the date or upgrade your system." fatal "--no-check-certificate is a wget option. It is recommended never use it at all. Check the date or upgrade your system."
;; ;;
--force-overwrite)
force_overwrite="--force-overwrite"
;;
-*) -*)
[ -n "$direct_args" ] && return 1 [ -n "$direct_args" ] && return 1
[ -n "$pkg_options" ] && pkg_options="$pkg_options $1" || pkg_options="$1" [ -n "$pkg_options" ] && pkg_options="$pkg_options $1" || pkg_options="$1"
...@@ -652,7 +656,7 @@ if [ -n "$quiet" ] ; then ...@@ -652,7 +656,7 @@ if [ -n "$quiet" ] ; then
fi fi
# fill # fill
export EPM_OPTIONS="$nodeps $force $verbose $debug $quiet $interactive $non_interactive $save_only $download_only" export EPM_OPTIONS="$nodeps $force $verbose $debug $quiet $interactive $non_interactive $save_only $download_only $force_overwrite"
# if input is not console and run script from file, get pkgs from stdin too # if input is not console and run script from file, get pkgs from stdin too
if [ ! -n "$inscript" ] && [ -p /dev/stdin ] && [ "$EPMMODE" != "pipe" ] ; then if [ ! -n "$inscript" ] && [ -p /dev/stdin ] && [ "$EPMMODE" != "pipe" ] ; then
......
...@@ -87,6 +87,10 @@ epm_install_names() ...@@ -87,6 +87,10 @@ epm_install_names()
return return
fi fi
if [ -n "$force_overwrite" ] ; then
APTOPTIONS="$APTOPTIONS -o Dpkg::Options::=\"--force-overwrite\""
fi
case $PMTYPE in case $PMTYPE in
apt-rpm|apt-dpkg) apt-rpm|apt-dpkg)
APTOPTIONS="$APTOPTIONS $(subst_option verbose "-o Debug::pkgMarkInstall=1 -o Debug::pkgProblemResolver=1")" APTOPTIONS="$APTOPTIONS $(subst_option verbose "-o Debug::pkgMarkInstall=1 -o Debug::pkgProblemResolver=1")"
......
...@@ -32,6 +32,10 @@ epm_install_files_apt_dpkg() ...@@ -32,6 +32,10 @@ epm_install_files_apt_dpkg()
files="$repacked_pkgs" files="$repacked_pkgs"
fi fi
if [ -n "$force_overwrite" ] ; then
DPKGOPTIONS="$DPKGOPTIONS --force-overwrite"
fi
if [ -n "$save_only" ] ; then if [ -n "$save_only" ] ; then
echo echo
cp -v $files "$EPMCURDIR" cp -v $files "$EPMCURDIR"
......
...@@ -39,12 +39,16 @@ epm_install_files_rpm() ...@@ -39,12 +39,16 @@ epm_install_files_rpm()
return return
fi fi
if [ -n "$force_overwrite" ] ; then
force_overwrite="--replacefiles"
fi
__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="$(__epm_get_replacepkgs $files)" local replacepkgs="$(__epm_get_replacepkgs $files)"
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 $force_overwrite && return
local RES=$? local RES=$?
__epm_check_if_rpm_already_installed $force $replacepkgs $noscripts $nodeps $files && return __epm_check_if_rpm_already_installed $force $replacepkgs $noscripts $nodeps $files && return
......
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