- add support to the package-manager script to use kpackagekit
authorDuncan Mac-Vicar P <dmacvicar@suse.de>
Thu, 16 Jul 2009 15:09:05 +0000 (17:09 +0200)
committerDuncan Mac-Vicar P <dmacvicar@suse.de>
Thu, 16 Jul 2009 15:09:05 +0000 (17:09 +0200)
  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
package/libzypp.changes
tools/package-manager/package-manager

index 9113d51..bfcb013 100644 (file)
@@ -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)
index 948f569..0a3b3a3 100644 (file)
@@ -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 
index af879b3..863619b 100755 (executable)
@@ -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