From a3636daedf3568dd671cad5a2dcd3b8d6865837b Mon Sep 17 00:00:00 2001 From: Duncan Mac-Vicar P Date: Thu, 16 Jul 2009 17:09:05 +0200 Subject: [PATCH] - add support to the package-manager script to use kpackagekit or gnome-packagekit if available, which allows to install local rpms with one click from file manager following desktop policies and fetching other dependencies if required. (fate #306526) - version 6.10.5 (10) --- VERSION.cmake | 2 +- package/libzypp.changes | 10 +++++ tools/package-manager/package-manager | 78 ++++++++++++++++++++++++++++------- 3 files changed, 74 insertions(+), 16 deletions(-) diff --git a/VERSION.cmake b/VERSION.cmake index 9113d51..bfcb013 100644 --- a/VERSION.cmake +++ b/VERSION.cmake @@ -61,7 +61,7 @@ SET(LIBZYPP_MAJOR "6") SET(LIBZYPP_COMPATMINOR "10") SET(LIBZYPP_MINOR "10") -SET(LIBZYPP_PATCH "4") +SET(LIBZYPP_PATCH "5") # # LAST RELEASED: 6.10.4 (10) # (The number in parenthesis is LIBZYPP_COMPATMINOR) diff --git a/package/libzypp.changes b/package/libzypp.changes index 948f569..0a3b3a3 100644 --- a/package/libzypp.changes +++ b/package/libzypp.changes @@ -1,4 +1,14 @@ ------------------------------------------------------------------- +Thu Jul 16 17:05:27 CEST 2009 - dmacvicar@suse.de + +- add support to the package-manager script to use kpackagekit + or gnome-packagekit if available, which allows to install local + rpms with one click from file manager following desktop policies + and fetching other dependencies if required. + (fate #306526) +- version 6.10.5 (10) + +------------------------------------------------------------------- Thu Jul 16 16:25:24 CEST 2009 - ma@suse.de - New solver.upgradeTestcasesToKeep option in zypp.conf. It tells diff --git a/tools/package-manager/package-manager b/tools/package-manager/package-manager index af879b3..863619b 100755 --- a/tools/package-manager/package-manager +++ b/tools/package-manager/package-manager @@ -21,6 +21,7 @@ function mkCmd() { done } +# check what we have HAVE_ZLM=false if rpm -q zen-updater >/dev/null; then HAVE_ZLM=true @@ -29,6 +30,14 @@ HAVE_OPENSUSE=false if rpm -q yast2-packager >/dev/null; then HAVE_OPENSUSE=true fi +HAVE_KPACKAGEKIT=false +if rpm -q kpackagekit >/dev/null; then + HAVE_KPACKAGEKIT=true +fi +HAVE_GPACKAGEKIT=false +if rpm -q gnome-packagekit >/dev/null; then + HAVE_GPACKAGEKIT=true +fi if $HAVE_ZLM; then if $HAVE_OPENSUSE; then @@ -58,6 +67,23 @@ else fi fi +METHOD=yast +# determine what we can use +if [[ $HAVE_KPACKAGEKIT && $KDE_FULL_SESSION ]] +then + METHOD=kpackagekit +elif [[ $HAVE_GPACKAGEKIT && "$WINDOWMANAGER" == "/usr/bin/gnome" ]] +then + METHOD=gnome-packagekit +else + if [ "$STACK" == "zlm" ]; then + METHOD="zlm" + else + METHOD="yast" + fi +fi + + xsu() { # a copy of xdg-su. package-manager-su -c "$(mkCmd "$@")" @@ -66,27 +92,49 @@ xsu() { # do_* fall back to yast for STACK=ugh do_update() { - if [ $STACK = zlm ]; then - zen-updater --no-tray "$@" - else - xsu /sbin/yast2 --update "$@" - fi + case "${METHOD}" in + yast) + xsu /sbin/yast2 --update "$@" + ;; + zlm) + zen-updater --no-tray "$@" + ;; + kpackagekit) + kpackagekit --updates "$@" + ;; + gnome-packagekit) + /usr/bin/gpk-update-viewer2 "$@" + ;; + esac } do_remove() { - if [ $STACK = zlm ]; then - zen-remover "$@" - else - xsu /sbin/yast2 --remove "$@" - fi + # not all support remove + case "${METHOD}" in + yast|kpackagekit|gnome-packagekit) + xsu /sbin/yast2 --remove "$@" + ;; + zlm) + zen-remover "$@" + ;; + esac } do_install() { - if [ $STACK = zlm ]; then - zen-installer "$@" - else - xsu /sbin/yast2 --install "$@" - fi + case "${METHOD}" in + yast) + xsu /sbin/yast2 --install "$@" + ;; + zlm) + zen-installer "$@" + ;; + kpackagekit) + kpackagekit "$@" + ;; + gnome-packagekit) + /usr/bin/gpk-install-local-file "$@" + ;; + esac } if [ "x$1" = "x--update" -a $# = 2 ]; then -- 2.7.4