Commit b98f3835 authored by Ivan Mazhukin's avatar Ivan Mazhukin Committed by Vitaly Lipatov

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

parent 61b7dc24
......@@ -153,6 +153,7 @@ pkg_options=
quoted_args=
direct_args=
ipfs=
force_overwrite=
eget_backend=$EGET_BACKEND
epm_vardir=/var/lib/eepm
......@@ -584,6 +585,9 @@ check_option()
--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."
;;
--force-overwrite)
force_overwrite="--force-overwrite"
;;
-*)
[ -n "$direct_args" ] && return 1
[ -n "$pkg_options" ] && pkg_options="$pkg_options $1" || pkg_options="$1"
......@@ -652,7 +656,7 @@ if [ -n "$quiet" ] ; then
fi
# 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 [ ! -n "$inscript" ] && [ -p /dev/stdin ] && [ "$EPMMODE" != "pipe" ] ; then
......
......@@ -87,6 +87,10 @@ epm_install_names()
return
fi
if [ -n "$force_overwrite" ] ; then
APTOPTIONS="$APTOPTIONS -o Dpkg::Options::=\"--force-overwrite\""
fi
case $PMTYPE in
apt-rpm|apt-dpkg)
APTOPTIONS="$APTOPTIONS $(subst_option verbose "-o Debug::pkgMarkInstall=1 -o Debug::pkgProblemResolver=1")"
......
......@@ -32,6 +32,10 @@ epm_install_files_apt_dpkg()
files="$repacked_pkgs"
fi
if [ -n "$force_overwrite" ] ; then
DPKGOPTIONS="$DPKGOPTIONS --force-overwrite"
fi
if [ -n "$save_only" ] ; then
echo
cp -v $files "$EPMCURDIR"
......
......@@ -39,12 +39,16 @@ epm_install_files_rpm()
return
fi
if [ -n "$force_overwrite" ] ; then
force_overwrite="--replacefiles"
fi
__epm_check_if_src_rpm $files
# --replacepkgs: Install the Package Even If Already Installed
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=$?
__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