9574 Package Manager should use user's GNOME proxy settings
authorPadraig O'Briain <padraig.obriain@sun.com>
Tue, 23 Jun 2009 09:28:03 +0100
changeset 1172 fc39dcc70f84
parent 1171 97c5eaf255aa
child 1173 549cc04bdcf7
9574 Package Manager should use user's GNOME proxy settings
src/gui/data/addmoresoftware.desktop.in
src/gui/data/packagemanager.desktop.in
src/launch.py
src/pkgdefs/SUNWipkg-gui/prototype
src/setup.py
src/um/data/updatemanager.desktop.in
--- a/src/gui/data/addmoresoftware.desktop.in	Wed Jun 17 21:48:07 2009 -0700
+++ b/src/gui/data/addmoresoftware.desktop.in	Tue Jun 23 09:28:03 2009 +0100
@@ -2,7 +2,7 @@
 _Name=Add More Software
 _GenericName=Add More Software
 _Comment=Install, update and remove software packages
-Exec=gksu /usr/bin/packagemanager
+Exec=/usr/lib/pm-launch /usr/bin/packagemanager
 Icon=packagemanager
 Terminal=false
 MultipleArgs=false
--- a/src/gui/data/packagemanager.desktop.in	Wed Jun 17 21:48:07 2009 -0700
+++ b/src/gui/data/packagemanager.desktop.in	Tue Jun 23 09:28:03 2009 +0100
@@ -2,7 +2,7 @@
 _Name=Package Manager
 _GenericName=Package Manager
 _Comment=Install, update and remove software packages
-Exec=gksu /usr/bin/packagemanager
+Exec=/usr/lib/pm-launch /usr/bin/packagemanager
 Icon=packagemanager
 Terminal=false
 MultipleArgs=false
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/launch.py	Tue Jun 23 09:28:03 2009 +0100
@@ -0,0 +1,56 @@
+#!/usr/bin/python2.4
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+HTTP_PROXY_HOST='/system/http_proxy/host'
+HTTP_PROXY_PORT='/system/http_proxy/port'
+HTTP_PROXY_USE = "/system/http_proxy/use_http_proxy"
+HTTP_PROXY_VARIABLE='http_proxy'
+HTTPS_PROXY_VARIABLE='https_proxy'
+
+import gconf
+import os
+import sys
+import subprocess
+
+def get_http_proxy():
+        host= client.get_string(HTTP_PROXY_HOST)
+        port = client.get_int(HTTP_PROXY_PORT)
+        return 'http://' + host + ':' + str(port) + '/'
+
+if __name__ == '__main__':
+        client = gconf.client_get_default()
+        use_http_proxy= client.get_bool(HTTP_PROXY_USE)
+        if use_http_proxy:
+                http_proxy = get_http_proxy()
+                if os.getenv(HTTP_PROXY_VARIABLE) == None:
+                        os.putenv(HTTP_PROXY_VARIABLE, http_proxy)
+                if os.getenv(HTTPS_PROXY_VARIABLE) == None:
+                        os.putenv(HTTPS_PROXY_VARIABLE, http_proxy)
+        args = ''
+        for i in range(1, len(sys.argv)):
+                args = args + sys.argv[i]
+                if i < len(sys.argv) - 1:
+                        args = args + ' '
+        command = subprocess.Popen(["/usr/bin/gksu", args], close_fds=True)
--- a/src/pkgdefs/SUNWipkg-gui/prototype	Wed Jun 17 21:48:07 2009 -0700
+++ b/src/pkgdefs/SUNWipkg-gui/prototype	Tue Jun 23 09:28:03 2009 +0100
@@ -8,6 +8,7 @@
 d none usr/bin 755 root bin
 f none usr/bin/packagemanager 755 root bin
 d none usr/lib 755 root bin
+f none usr/lib/pm-launch 755 root bin
 d none usr/lib/python2.4 755 root bin
 d none usr/lib/python2.4/vendor-packages 755 root bin
 d none usr/lib/python2.4/vendor-packages/pkg 755 root bin
--- a/src/setup.py	Wed Jun 17 21:48:07 2009 -0700
+++ b/src/setup.py	Tue Jun 23 09:28:03 2009 +0100
@@ -152,6 +152,7 @@
         lib_dir: [
                 ['depot.py', 'pkg.depotd'],
                 ['updatemanagernotifier.py', 'updatemanagernotifier'],
+                ['launch.py', 'pm-launch'],
                 ],
         svc_method_dir: [
                 ['svc/svc-pkg-depot', 'svc-pkg-depot'],
--- a/src/um/data/updatemanager.desktop.in	Wed Jun 17 21:48:07 2009 -0700
+++ b/src/um/data/updatemanager.desktop.in	Tue Jun 23 09:28:03 2009 +0100
@@ -2,7 +2,7 @@
 _Name=Update Manager
 _GenericName=Update Manager
 _Comment=Install available updates
-Exec=gksu /usr/bin/pm-updatemanager -r
+Exec=/usr/lib/pm-launch /usr/bin/pm-updatemanager -r
 Icon=updatemanager
 Terminal=false
 MultipleArgs=false