Commit f4003d1a authored by Vitaly Lipatov's avatar Vitaly Lipatov

realize assure_exists (install needed package for needed command), use it in the project,

remove mandatory requires to apt-repo
parent e4fccbad
......@@ -21,6 +21,7 @@ epm_addrepo()
{
case $PMTYPE in
apt-rpm)
assure_exists apt-repo
sudocmd apt-repo add $pkg_filenames
;;
apt-dpkg)
......
......@@ -21,6 +21,7 @@ epm_autoremove()
{
case $PMTYPE in
apt-rpm)
assure_exists remove-old-kernels
# ALT Linux only
sudocmd remove-old-kernels
;;
......
......@@ -70,6 +70,10 @@ __epm_filelist_name()
docmd pacman -Ql $pkg_names | sed -e "s|.* ||g"
return
;;
emerge)
assure_exists equery
CMD="equery files"
;;
slackpkg)
is_installed $pkg_names || fatal "Query filelist for non installed packages does not realized"
docmd awk 'BEGIN{desk=1}{if(/^FILE LIST:$/){desk=0} else if (desk==0) {print}}' /var/log/packages/${pkg_filenames}*
......
......@@ -23,6 +23,7 @@ epm_kernel_update()
case $DISTRNAME in
ALTLinux)
assure_exists update-kernel
sudocmd update-kernel
return ;;
esac
......
......@@ -58,6 +58,7 @@ case $PMTYPE in
fi
;;
emerge)
assure_exists equery
CMD="equery files"
;;
# yum-rpm)
......
......@@ -79,6 +79,7 @@ __do_query()
CMD="rpm -qf"
;;
emerge)
assure_exists equery
CMD="equery belongs"
;;
pacman)
......@@ -116,6 +117,7 @@ __do_short_query()
dpkg_print_name_version $(dpkg -S $1 | sed -e "s|:.*||" | grep -v "^diversion by")
return ;;
NOemerge)
assure_exists equery
CMD="equery belongs"
;;
NOpacman)
......
......@@ -21,6 +21,7 @@ epm_removerepo()
{
case $PMTYPE in
apt-rpm)
assure_exists apt-repo
sudocmd apt-repo rm $pkg_filenames
;;
apt-dpkg)
......
......@@ -32,6 +32,7 @@ epm_repolist()
{
case $PMTYPE in
apt-rpm)
assure_exists apt-repo
docmd apt-repo list
;;
deepsolver-rpm)
......
......@@ -50,6 +50,7 @@ case $PMTYPE in
local_content_search $pkg_filenames
return ;;
apt-dpkg)
assure_exists apt-file
sudocmd apt-file update
docmd apt-file search $pkg_filenames
return ;;
......
......@@ -219,6 +219,29 @@ set_sudo()
SUDO="fatal 'Can't find sudo. Please install sudo or run epm under root.'"
}
assure_exists()
{
PATH=$PATH:/sbin:/usr/sbin which $1 2>/dev/null >/dev/null && return
echo "Install appropriate package for $1 command..."
case $1 in
equery)
epm install gentoolkit
;;
apt-repo)
epm install apt-repo
;;
apt-file)
epm install apt-file
;;
update-kernel|remove-old-kernels)
epm install update-kernel
;;
*)
fatal "Internal error: Unknown binary $1 to check if exists"
;;
esac
}
# print options description from HELPCMD/HELPOPT lines in the code
get_help()
{
......
......@@ -34,6 +34,7 @@ case $PMTYPE in
CMD="repoquery --whatrequires"
;;
emerge)
assure_exists equery
CMD="equery depends -a"
;;
*)
......
......@@ -20,9 +20,7 @@ Conflicts: epm
Provides: upm
%if %_vendor == "alt"
Requires: apt rpm apt-repo
%endif
Requires: apt rpm
%description
Etersoft EPM is the package manager for any platform
......
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