[arch-commits] Commit in (6 files)

Jan de Groot jgc at archlinux.org
Sat Aug 23 05:09:50 EDT 2008


    Date: Saturday, August 23, 2008 @ 05:09:50
  Author: jgc
Revision: 10015

Add policykit. This is a requirement for the next version of GNOME.
The postinstall could be shorter, but there's an AUR package that creates the policykit user with different (dynamic) userid.
There's one patch applied to make it work with ConsoleKit 0.3.

Added:
  policykit/
  policykit/repos/
  policykit/trunk/
  policykit/trunk/PKGBUILD
  policykit/trunk/pk-ck-api-change.patch
  policykit/trunk/policykit.install

------------------------+
 PKGBUILD               |   37 ++++++++++++++++++++
 pk-ck-api-change.patch |   83 +++++++++++++++++++++++++++++++++++++++++++++++
 policykit.install      |   30 ++++++++++++++++
 3 files changed, 150 insertions(+)

Added: policykit/trunk/PKGBUILD
===================================================================
--- policykit/trunk/PKGBUILD	                        (rev 0)
+++ policykit/trunk/PKGBUILD	2008-08-23 09:09:50 UTC (rev 10015)
@@ -0,0 +1,37 @@
+# $Id: $
+# Maintainer: Jan de Groot <jgc at archlinux.org>
+
+pkgname=policykit
+pkgver=0.9
+pkgrel=2
+pkgdesc="Hardware Abstraction Layer"
+arch=(i686 x86_64)
+license=('custom')
+url="http://hal.freedesktop.org/docs/PolicyKit/"
+depends=('dbus-glib>=0.76' 'expat>=2.0.1' 'pam')
+makedepends=('intltool')
+options=('!libtool')
+install=policykit.install
+source=(http://hal.freedesktop.org/releases/PolicyKit-${pkgver}.tar.gz
+	polkit.pam
+	pk-ck-api-change.patch)
+md5sums=('802fd13ae41f73d79359e5ecb0a98716'
+	 '6564f95878297b954f0572bc1610dd15'
+	 '15b42b41e98410d8d7ec4f91d0cff190')
+
+build() {
+  cd ${srcdir}/PolicyKit-${pkgver}
+  patch -Np1 -i ${srcdir}/pk-ck-api-change.patch || return 1
+  ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var \
+              --libexecdir=/usr/lib/PolicyKit --disable-static \
+	      --with-polkit-user=102 --with-polkit-group=102 || return 1
+  make || return 1
+  make DESTDIR=${pkgdir} install || return 1
+  sed -i -e 's/102/policykit/g' ${pkgdir}/etc/dbus-1/system.d/*.conf || return 1
+
+  install -m755 -d ${pkgdir}/usr/share/licenses/${pkgname}
+  install -m644 COPYING ${pkgdir}/usr/share/licenses/${pkgname}/ || return 1
+
+  rm -rf ${pkgdir}/etc/profile.d
+  install -m644 ${srcdir}/polkit.pam ${pkgdir}/etc/pam.d/polkit || return 1
+}

Added: policykit/trunk/pk-ck-api-change.patch
===================================================================
--- policykit/trunk/pk-ck-api-change.patch	                        (rev 0)
+++ policykit/trunk/pk-ck-api-change.patch	2008-08-23 09:09:50 UTC (rev 10015)
@@ -0,0 +1,83 @@
+diff --git a/src/polkit-dbus/polkit-dbus.c b/src/polkit-dbus/polkit-dbus.c
+index f7be03f..cad4a76 100644
+--- a/src/polkit-dbus/polkit-dbus.c
++++ b/src/polkit-dbus/polkit-dbus.c
+@@ -214,11 +214,17 @@ polkit_session_new_from_objpath (DBusConnection *con, const char *objpath, uid_t
+                                 dbus_message_unref (reply);
+                         goto out;
+                 }
++                /* GetUnixUser API Changed in CK 0.3.0 */
+                 if (!dbus_message_get_args (reply, NULL,
+-                                            DBUS_TYPE_INT32, &uid,
++                                            DBUS_TYPE_UINT32, &uid,
+                                             DBUS_TYPE_INVALID)) {
+-                        kit_warning ("Invalid GetUnixUser reply from CK");
+-                        goto out;
++                        /* try the older API */
++                        if (!dbus_message_get_args (reply, NULL,
++                                                    DBUS_TYPE_INT32, &uid,
++                                                    DBUS_TYPE_INVALID)) {
++                                kit_warning ("Invalid GetUnixUser reply from CK");
++                                goto out;
++                        }
+                 }
+                 dbus_message_unref (message);
+                 dbus_message_unref (reply);
+@@ -1326,16 +1332,21 @@ polkit_tracker_dbus_func (PolKitTracker *pk_tracker, DBusMessage *message)
+ 
+                 dbus_error_init (&error);
+                 seat_objpath = dbus_message_get_path (message);
+-                if (!dbus_message_get_args (message, &error, 
+-                                            DBUS_TYPE_STRING, &session_objpath, 
++                /* API fixed in CK 0.3 to match spec */
++                if (!dbus_message_get_args (message, &error,
++                                            DBUS_TYPE_OBJECT_PATH, &session_objpath,
+                                             DBUS_TYPE_INVALID)) {
++                        if (!dbus_message_get_args (message, &error,
++                                                    DBUS_TYPE_STRING, &session_objpath,
++                                                    DBUS_TYPE_INVALID)) {
+ 
+-                        /* TODO: should be _pk_critical */
+-                        kit_warning ("The SessionAdded signal on the org.freedesktop.ConsoleKit.Seat "
+-                                   "interface for object %s has the wrong signature! "
+-                                   "Your system is misconfigured.", seat_objpath);
++                                /* TODO: should be _pk_critical */
++                                kit_warning ("The SessionAdded signal on the org.freedesktop.ConsoleKit.Seat "
++                                             "interface for object %s has the wrong signature! "
++                                             "Your system is misconfigured.", seat_objpath);
+ 
+-                        goto out;
++                                goto out;
++                        }
+                 }
+ 
+                 /* TODO: add to sessions - see polkit_tracker_is_authorization_relevant() */
+@@ -1353,16 +1364,21 @@ polkit_tracker_dbus_func (PolKitTracker *pk_tracker, DBusMessage *message)
+ 
+                 dbus_error_init (&error);
+                 seat_objpath = dbus_message_get_path (message);
+-                if (!dbus_message_get_args (message, &error, 
+-                                            DBUS_TYPE_STRING, &session_objpath, 
++                /* API fixed in CK 0.3 to match spec */
++                if (!dbus_message_get_args (message, &error,
++                                            DBUS_TYPE_OBJECT_PATH, &session_objpath,
+                                             DBUS_TYPE_INVALID)) {
++                        if (!dbus_message_get_args (message, &error,
++                                                    DBUS_TYPE_STRING, &session_objpath,
++                                                    DBUS_TYPE_INVALID)) {
+ 
+-                        /* TODO: should be _pk_critical */
+-                        kit_warning ("The SessionRemoved signal on the org.freedesktop.ConsoleKit.Seat "
+-                                   "interface for object %s has the wrong signature! "
+-                                   "Your system is misconfigured.", seat_objpath);
++                                /* TODO: should be _pk_critical */
++                                kit_warning ("The SessionRemoved signal on the org.freedesktop.ConsoleKit.Seat "
++                                             "interface for object %s has the wrong signature! "
++                                             "Your system is misconfigured.", seat_objpath);
+ 
+-                        goto out;
++                                goto out;
++                        }
+                 }
+ 
+                 _remove_caller_by_session (pk_tracker, session_objpath);

Added: policykit/trunk/policykit.install
===================================================================
--- policykit/trunk/policykit.install	                        (rev 0)
+++ policykit/trunk/policykit.install	2008-08-23 09:09:50 UTC (rev 10015)
@@ -0,0 +1,30 @@
+post_install() {
+  getent group policykit >/dev/null || usr/sbin/groupadd -g 102 policykit
+  getent passwd policykit >/dev/null || usr/sbin/useradd -c 'PolicyKit' -u 102 -g policykit -d '/' -s /sbin/nologin policykit
+  usr/bin/passwd -l policykit &>/dev/null
+
+  # set correct permissions in case user existed with a different uid
+  chgrp policykit var/{run,lib}/PolicyKit
+  chown policykit var/lib/PolicyKit-public
+  chown policykit:policykit var/lib/misc/PolicyKit.reload
+
+  chown policykit usr/lib/PolicyKit/polkit-set-default-helper
+  chmod u+s usr/lib/PolicyKit/polkit-set-default-helper
+
+  for i in polkit-read-auth-helper polkit-revoke-helper polkit-grant-helper polkit-explicit-grant-helper; do
+    chgrp policykit usr/lib/PolicyKit/$i
+    chmod g+s usr/lib/PolicyKit/$i
+  done
+
+  chgrp policykit usr/lib/PolicyKit/polkit-grant-helper-pam
+  chmod u+s usr/lib/PolicyKit/polkit-grant-helper-pam
+}
+
+post_upgrade() {
+  post_install
+}
+
+post_remove() {
+  usr/sbin/userdel policykit &>/dev/null
+  usr/sbin/groupdel policykit &>/dev/null
+}




More information about the arch-commits mailing list