Commit 563f545d authored by Vitaly Lipatov's avatar Vitaly Lipatov

add initial packagekit (pkcon) support

parent ec11eef2
...@@ -197,6 +197,9 @@ case $PMTYPE in ...@@ -197,6 +197,9 @@ case $PMTYPE in
fi fi
sudocmd aura -Oj sudocmd aura -Oj
;; ;;
packagekit-*)
docmd pkcon repair --autoremove
;;
yum-rpm) yum-rpm)
# cleanup orphanes? # cleanup orphanes?
while true ; do while true ; do
......
...@@ -37,6 +37,9 @@ case $PMTYPE in ...@@ -37,6 +37,9 @@ case $PMTYPE in
sudocmd apt-get -f install || return sudocmd apt-get -f install || return
#sudocmd apt-get autoremove #sudocmd apt-get autoremove
;; ;;
packagekit-*)
docmd pkcon repair
;;
aptitude-dpkg) aptitude-dpkg)
sudocmd aptitude -f install || return sudocmd aptitude -f install || return
#sudocmd apt-get autoremove #sudocmd apt-get autoremove
......
...@@ -198,6 +198,10 @@ epm_download() ...@@ -198,6 +198,10 @@ epm_download()
aptcyg) aptcyg)
sudocmd apt-cyg download $pkg_filenames sudocmd apt-cyg download $pkg_filenames
;; ;;
packagekit-*)
# TODO: force
docmd pkcon download $pkg_filenames
;;
yum-rpm) yum-rpm)
# TODO: check yum install --downloadonly --downloaddir=/tmp <package-name> # TODO: check yum install --downloadonly --downloaddir=/tmp <package-name>
assure_exists yumdownloader yum-utils assure_exists yumdownloader yum-utils
......
...@@ -67,6 +67,9 @@ __epm_filelist_remote() ...@@ -67,6 +67,9 @@ __epm_filelist_remote()
fi fi
docmd_foreach __deb_local_content_filelist "$@" docmd_foreach __deb_local_content_filelist "$@"
;; ;;
packagekit-*)
docmd pkcon get-files "$@"
;;
yum-rpm) yum-rpm)
assure_exists yum-utils || return assure_exists yum-utils || return
docmd repoquery -q -l "$@" docmd repoquery -q -l "$@"
...@@ -120,6 +123,9 @@ __epm_filelist_name() ...@@ -120,6 +123,9 @@ __epm_filelist_name()
*-dpkg) *-dpkg)
CMD="dpkg -L" CMD="dpkg -L"
;; ;;
packagekit-*)
CMD="pkcon get-files"
;;
android) android)
CMD="pm list packages -f" CMD="pm list packages -f"
;; ;;
......
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2012, 2014, 2016 Etersoft # Copyright (C) 2012, 2014, 2016, 2019 Etersoft
# Copyright (C) 2012, 2014, 2016 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012, 2014, 2016, 2019 Vitaly Lipatov <lav@etersoft.ru>
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by
...@@ -48,10 +48,6 @@ __epm_info_by_pkgtype() ...@@ -48,10 +48,6 @@ __epm_info_by_pkgtype()
__epm_info_by_pmtype() __epm_info_by_pmtype()
{ {
case $PMTYPE in case $PMTYPE in
apt-rpm)
__epm_info_rpm_low && return
docmd apt-cache show $pkg_names
;;
apt-dpkg) apt-dpkg)
if [ -n "$pkg_files" ] ; then if [ -n "$pkg_files" ] ; then
docmd dpkg -I $pkg_files docmd dpkg -I $pkg_files
...@@ -67,21 +63,35 @@ case $PMTYPE in ...@@ -67,21 +63,35 @@ case $PMTYPE in
[ -z "$pkg_names" ] && return [ -z "$pkg_names" ] && return
docmd aptitude show $pkg_names docmd aptitude show $pkg_names
;; ;;
yum-rpm) *-rpm)
__epm_info_rpm_low && return
docmd yum info $pkg_names
;;
urpmi-rpm)
__epm_info_rpm_low && return
docmd urpmq -i $pkg_names
;;
dnf-rpm)
__epm_info_rpm_low && return
docmd dnf info $pkg_names
;;
zypper-rpm)
__epm_info_rpm_low && return __epm_info_rpm_low && return
docmd zypper info $pkg_names case $PMTYPE in
apt-rpm)
docmd apt-cache show $pkg_names
;;
packagekit-rpm)
docmd pkcon get-details $pkg_names
;;
yum-rpm)
docmd yum info $pkg_names
;;
urpmi-rpm)
docmd urpmq -i $pkg_names
;;
dnf-rpm)
docmd dnf info $pkg_names
;;
zypper-rpm)
docmd zypper info $pkg_names
;;
*)
warning "Unknown command for $PMTYPE"
;;
esac
;;
packagekit-*)
# TODO: get-details-local
docmd pkcon get-details $pkg_names
;; ;;
pacman) pacman)
is_installed $pkg_names && docmd pacman -Qi $pkg_names && return is_installed $pkg_names && docmd pacman -Qi $pkg_names && return
......
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2012-2018 Etersoft # Copyright (C) 2012-2019 Etersoft
# Copyright (C) 2012-2018 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012-2019 Vitaly Lipatov <lav@etersoft.ru>
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by
...@@ -129,6 +129,9 @@ epm_install_names() ...@@ -129,6 +129,9 @@ epm_install_names()
urpm-rpm) urpm-rpm)
sudocmd urpmi $URPMOPTIONS $@ sudocmd urpmi $URPMOPTIONS $@
return ;; return ;;
packagekit-*)
docmd pkcon install $@
return ;;
pkgsrc) pkgsrc)
sudocmd pkg_add -r $@ sudocmd pkg_add -r $@
return ;; return ;;
...@@ -230,6 +233,9 @@ epm_ni_install_names() ...@@ -230,6 +233,9 @@ epm_ni_install_names()
# FIXME: returns true ever no package found, need check for "no found", "Nothing to do." # FIXME: returns true ever no package found, need check for "no found", "Nothing to do."
yes | sudocmd zypper --non-interactive $ZYPPEROPTIONS install $@ yes | sudocmd zypper --non-interactive $ZYPPEROPTIONS install $@
return ;; return ;;
packagekit-*)
docmd pkcon install --noninteractive $@
return ;;
pkgsrc) pkgsrc)
sudocmd pkg_add -r $@ sudocmd pkg_add -r $@
return ;; return ;;
...@@ -315,9 +321,9 @@ epm_install_files() ...@@ -315,9 +321,9 @@ epm_install_files()
# TODO: check read permissions # TODO: check read permissions
# sudo test -r FILE # sudo test -r FILE
# do not fallback to install_names if we have no permissions # do not fallback to install_names if we have no permissions
case "$DISTRNAME" in
"ALTLinux")
case $PMTYPE in
apt-rpm)
# TODO: replace with name changed function # TODO: replace with name changed function
__epm_check_if_try_install_deb $@ && return __epm_check_if_try_install_deb $@ && return
...@@ -334,7 +340,9 @@ epm_install_files() ...@@ -334,7 +340,9 @@ epm_install_files()
# use install_names # use install_names
;; ;;
esac
case $PMTYPE in
apt-dpkg|aptitude-dpkg) apt-dpkg|aptitude-dpkg)
# the new version of the conf. file is installed with a .dpkg-dist suffix # the new version of the conf. file is installed with a .dpkg-dist suffix
if [ -n "$non_interactive" ] ; then if [ -n "$non_interactive" ] ; then
...@@ -358,34 +366,7 @@ epm_install_files() ...@@ -358,34 +366,7 @@ epm_install_files()
return return
;; ;;
yum-rpm|dnf-rpm) *-rpm)
__epm_check_if_try_install_deb $@ && return
sudocmd rpm -Uvh $force $nodeps $@ && return
# if run with --nodeps, do not fallback on hi level
__epm_check_if_rpm_already_installed $@ && return
[ -n "$nodeps" ] && return
YUMOPTIONS=--nogpgcheck
# use install_names
;;
zypper-rpm)
__epm_check_if_try_install_deb $@ && return
sudocmd rpm -Uvh $force $nodeps $@ && return
local RES=$?
__epm_check_if_rpm_already_installed $@ && return
# if run with --nodeps, do not fallback on hi level
[ -n "$nodeps" ] && return $RES
ZYPPEROPTIONS=$(__use_zypper_no_gpg_checks)
# use install_names
;;
urpm-rpm)
__epm_check_if_try_install_deb $@ && return __epm_check_if_try_install_deb $@ && return
sudocmd rpm -Uvh $force $nodeps $@ && return sudocmd rpm -Uvh $force $nodeps $@ && return
local RES=$? local RES=$?
...@@ -395,9 +376,27 @@ epm_install_files() ...@@ -395,9 +376,27 @@ epm_install_files()
# if run with --nodeps, do not fallback on hi level # if run with --nodeps, do not fallback on hi level
[ -n "$nodeps" ] && return $RES [ -n "$nodeps" ] && return $RES
URPMOPTIONS=--no-verify-rpm case $PMTYPE in
# use install_names yum-rpm|dnf-rpm)
YUMOPTIONS=--nogpgcheck
# use install_names
;;
zypper-rpm)
ZYPPEROPTIONS=$(__use_zypper_no_gpg_checks)
# use install_names
;;
urpm-rpm)
URPMOPTIONS=--no-verify-rpm
# use install_names
;;
*)
# use install_names
;;
esac
;; ;;
packagekit-*)
docmd pkcon install-local $@
return ;;
pkgsrc) pkgsrc)
sudocmd pkg_add $@ sudocmd pkg_add $@
return ;; return ;;
...@@ -518,6 +517,9 @@ epm_print_install_names_command() ...@@ -518,6 +517,9 @@ epm_print_install_names_command()
zypper-rpm) zypper-rpm)
echo "zypper --non-interactive $ZYPPEROPTIONS install $*" echo "zypper --non-interactive $ZYPPEROPTIONS install $*"
return ;; return ;;
packagekit-*)
echo "pkcon --noninteractive $*"
return ;;
pacman) pacman)
echo "pacman -S --noconfirm $force $*" echo "pacman -S --noconfirm $force $*"
return ;; return ;;
......
...@@ -84,6 +84,9 @@ case $PMTYPE in ...@@ -84,6 +84,9 @@ case $PMTYPE in
[ -n "$short" ] && CMD="rpm -qa --queryformat %{name}\n $pkg_filenames" [ -n "$short" ] && CMD="rpm -qa --queryformat %{name}\n $pkg_filenames"
docmd $CMD docmd $CMD
return ;; return ;;
packagekit-*)
docmd pkcon get-packages --filter installed
;;
emerge) emerge)
CMD="qlist -I -C" CMD="qlist -I -C"
# print with colors for console output # print with colors for console output
......
...@@ -34,8 +34,8 @@ case $PMTYPE in ...@@ -34,8 +34,8 @@ case $PMTYPE in
apt-rpm) apt-rpm)
docmd apt-cache policy $pkg_names docmd apt-cache policy $pkg_names
;; ;;
apt-dpkg) packagekit-*)
docmd apt-cache policy $pkg_names docmd pkcon resolve $pkg_names
;; ;;
*) *)
fatal "Have no suitable command for $PMTYPE" fatal "Have no suitable command for $PMTYPE"
......
...@@ -33,6 +33,10 @@ epm_reinstall_names() ...@@ -33,6 +33,10 @@ epm_reinstall_names()
aptitude-dpkg) aptitude-dpkg)
sudocmd aptitude reinstall $@ sudocmd aptitude reinstall $@
return ;; return ;;
packagekit-*)
warning "Please send me the correct command form for it"
docmd pkcon install --allow-reinstall $@
return ;;
yum-rpm) yum-rpm)
sudocmd yum reinstall $@ sudocmd yum reinstall $@
return ;; return ;;
......
...@@ -326,6 +326,9 @@ epm_release_upgrade() ...@@ -326,6 +326,9 @@ epm_release_upgrade()
assure_exists do-release-upgrade update-manager-core assure_exists do-release-upgrade update-manager-core
sudocmd do-release-upgrade sudocmd do-release-upgrade
;; ;;
packagekit-*)
docmd pkcon upgrade-system $pkg_filenames
;;
yum-rpm) yum-rpm)
docmd epm install rpm yum docmd epm install rpm yum
sudocmd yum clean all sudocmd yum clean all
......
...@@ -72,6 +72,9 @@ epm_remove_names() ...@@ -72,6 +72,9 @@ epm_remove_names()
apt-rpm) apt-rpm)
sudocmd apt-get remove $APTOPTIONS $@ sudocmd apt-get remove $APTOPTIONS $@
return ;; return ;;
packagekit-*)
docmd pkcon remove $@
return ;;
deepsolver-rpm) deepsolver-rpm)
sudocmd ds-remove $@ sudocmd ds-remove $@
return ;; return ;;
...@@ -164,6 +167,9 @@ epm_remove_nonint() ...@@ -164,6 +167,9 @@ epm_remove_nonint()
apt-rpm) apt-rpm)
sudocmd apt-get -y --force-yes remove $@ sudocmd apt-get -y --force-yes remove $@
return ;; return ;;
packagekit-*)
docmd pkcon remove --noninteractive $@
return ;;
urpm-rpm) urpm-rpm)
sudocmd urpme --auto $@ sudocmd urpme --auto $@
return ;; return ;;
...@@ -204,6 +210,9 @@ epm_print_remove_command() ...@@ -204,6 +210,9 @@ epm_print_remove_command()
apt-dpkg|aptitude-dpkg) apt-dpkg|aptitude-dpkg)
echo "dpkg -P $*" echo "dpkg -P $*"
;; ;;
packagekit-*)
echo "pkcon remove --noninteractive $*"
;;
pkgsrc) pkgsrc)
echo "pkg_delete -r $*" echo "pkg_delete -r $*"
;; ;;
......
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2012, 2016 Etersoft # Copyright (C) 2012, 2016, 2019 Etersoft
# Copyright (C) 2012, 2016 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012, 2016, 2019 Vitaly Lipatov <lav@etersoft.ru>
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by
...@@ -54,6 +54,9 @@ case $PMTYPE in ...@@ -54,6 +54,9 @@ case $PMTYPE in
zypper-rpm) zypper-rpm)
docmd zypper sl -d docmd zypper sl -d
;; ;;
packagekit-*)
docmd pkcon repo-list
;;
emerge) emerge)
docmd eselect profile list docmd eselect profile list
docmd layman -L docmd layman -L
......
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2012-2013, 2016, 2018 Etersoft # Copyright (C) 2012-2013, 2016, 2018, 2019 Etersoft
# Copyright (C) 2012-2013, 2016, 2018 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012-2013, 2016, 2018, 2019 Vitaly Lipatov <lav@etersoft.ru>
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by
...@@ -61,7 +61,9 @@ case $PMTYPE in ...@@ -61,7 +61,9 @@ case $PMTYPE in
#return #return
CMD="apt-cache depends" CMD="apt-cache depends"
fi fi
;;
packagekit-*)
CMD="pkcon required-by"
;; ;;
#zypper-rpm) #zypper-rpm)
# # FIXME: use hi level commands # # FIXME: use hi level commands
......
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2012, 2013, 2016-2018 Etersoft # Copyright (C) 2012, 2013, 2016-2019 Etersoft
# Copyright (C) 2012, 2013, 2016-2018 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012, 2013, 2016-2019 Vitaly Lipatov <lav@etersoft.ru>
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by
...@@ -34,6 +34,9 @@ case $PMTYPE in ...@@ -34,6 +34,9 @@ case $PMTYPE in
deepsolver-rpm) deepsolver-rpm)
CMD="ds-require --" CMD="ds-require --"
;; ;;
packagekit-*)
CMD="pkcon search name"
;;
urpm-rpm) urpm-rpm)
# urpmq does not support -- # urpmq does not support --
CMD="urpmq -y" CMD="urpmq -y"
......
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2012, 2016, 2017 Etersoft # Copyright (C) 2012, 2016, 2017, 2019 Etersoft
# Copyright (C) 2012, 2016, 2017 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012, 2016, 2017, 2019 Vitaly Lipatov <lav@etersoft.ru>
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by
...@@ -61,6 +61,9 @@ case $PMTYPE in ...@@ -61,6 +61,9 @@ case $PMTYPE in
sudocmd apt-file update sudocmd apt-file update
docmd apt-file search $pkg_filenames docmd apt-file search $pkg_filenames
return ;; return ;;
packagekit-*)
CMD="pkcon search file"
;;
yum-rpm) yum-rpm)
# TODO # TODO
info "Search by full packages list is not implemented yet" info "Search by full packages list is not implemented yet"
......
...@@ -475,12 +475,16 @@ if [ -n "$FORCEPM" ] ; then ...@@ -475,12 +475,16 @@ if [ -n "$FORCEPM" ] ; then
return return
fi fi
# TODO: in more appropriate way
#which pkcon 2>/dev/null >/dev/null && info "You can run $ PMTYPE=packagekit epm to use packagekit backend"
# TODO: move it in distr_vendor? # TODO: move it in distr_vendor?
# FIXME: some problems with multibased distros (Server Edition on CentOS and Desktop Edition on Ubuntu) # FIXME: some problems with multibased distros (Server Edition on CentOS and Desktop Edition on Ubuntu)
case $DISTRNAME in case $DISTRNAME in
ALTLinux) ALTLinux)
CMD="apt-rpm" CMD="apt-rpm"
#which ds-install 2>/dev/null >/dev/null && CMD=deepsolver-rpm #which ds-install 2>/dev/null >/dev/null && CMD=deepsolver-rpm
#which pkcon 2>/dev/null >/dev/null && CMD=packagekit-rpm
;; ;;
PCLinux) PCLinux)
CMD="apt-rpm" CMD="apt-rpm"
......
...@@ -38,6 +38,9 @@ case $PMTYPE in ...@@ -38,6 +38,9 @@ case $PMTYPE in
#sudocmd apt-get -f install || exit #sudocmd apt-get -f install || exit
#sudocmd apt-get autoremove #sudocmd apt-get autoremove
;; ;;
packagekit-*)
docmd pkcon refresh
;;
#snappy) #snappy)
# sudocmd snappy # sudocmd snappy
# ;; # ;;
......
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2012, 2014, 2016 Etersoft # Copyright (C) 2012, 2014, 2016, 2019 Etersoft
# Copyright (C) 2012, 2014, 2016 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012, 2014, 2016, 2019 Vitaly Lipatov <lav@etersoft.ru>
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by
...@@ -41,6 +41,10 @@ epm_upgrade() ...@@ -41,6 +41,10 @@ epm_upgrade()
aptitude-dpkg) aptitude-dpkg)
CMD="aptitude dist-upgrade" CMD="aptitude dist-upgrade"
;; ;;
packagekit-*)
docmd pkcon update
return
;;
yum-rpm) yum-rpm)
local OPTIONS="$(subst_option non_interactive -y)" local OPTIONS="$(subst_option non_interactive -y)"
# can do update repobase automagically # can do update repobase automagically
......
...@@ -44,6 +44,9 @@ case $PMTYPE in ...@@ -44,6 +44,9 @@ case $PMTYPE in
aptitude-dpkg) aptitude-dpkg)
CMD="aptitude why" CMD="aptitude why"
;; ;;
packagekit-*)
CMD="pkcon depends-on"
;;
yum-rpm) yum-rpm)
CMD="repoquery --whatrequires" CMD="repoquery --whatrequires"
;; ;;
......
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