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