summaryrefslogtreecommitdiff
path: root/user/consolekit2
diff options
context:
space:
mode:
Diffstat (limited to 'user/consolekit2')
-rw-r--r--user/consolekit2/0001-busybox-reboot-and-poweroff-support.patch40
-rw-r--r--user/consolekit2/APKBUILD63
-rw-r--r--user/consolekit2/ac_disable_static.patch13
-rw-r--r--user/consolekit2/add-listseats.patch100
-rw-r--r--user/consolekit2/consolekit2.initd9
-rw-r--r--user/consolekit2/pam-foreground-compat.ck17
6 files changed, 242 insertions, 0 deletions
diff --git a/user/consolekit2/0001-busybox-reboot-and-poweroff-support.patch b/user/consolekit2/0001-busybox-reboot-and-poweroff-support.patch
new file mode 100644
index 000000000..2db9f032b
--- /dev/null
+++ b/user/consolekit2/0001-busybox-reboot-and-poweroff-support.patch
@@ -0,0 +1,40 @@
+From 5e557dd212657f7e75a0c4bd70d11ca06ccb3f84 Mon Sep 17 00:00:00 2001
+From: Natanael Copa <ncopa@alpinelinux.org>
+Date: Mon, 4 Apr 2011 18:46:25 +0000
+Subject: [PATCH] busybox reboot and poweroff support
+
+---
+ tools/linux/ck-system-restart | 3 +++
+ tools/linux/ck-system-stop | 3 +++
+ 2 files changed, 6 insertions(+), 0 deletions(-)
+
+diff --git a/tools/linux/ck-system-restart b/tools/linux/ck-system-restart
+index 8e0664e..5cabb3d 100755
+--- a/tools/linux/ck-system-restart
++++ b/tools/linux/ck-system-restart
+@@ -7,6 +7,9 @@ if [ -x "/sbin/shutdown" ] ; then
+ elif [ -x "/usr/sbin/shutdown" ] ; then
+ /usr/sbin/shutdown -r now
+ exit $?
++elif [ -x "/sbin/reboot" ]; then
++ /sbin/reboot
++ exit $?
+ else
+ exit 1
+ fi
+diff --git a/tools/linux/ck-system-stop b/tools/linux/ck-system-stop
+index e26bca3..a0be3ac 100755
+--- a/tools/linux/ck-system-stop
++++ b/tools/linux/ck-system-stop
+@@ -7,6 +7,9 @@ if [ -x "/sbin/shutdown" ] ; then
+ elif [ -x "/usr/sbin/shutdown" ] ; then
+ /usr/sbin/shutdown -h now
+ exit $?
++elif [ -x "/sbin/poweroff" ] ; then
++ /sbin/poweroff
++ exit $?
+ else
+ exit 1
+ fi
+--
+1.7.4.2
diff --git a/user/consolekit2/APKBUILD b/user/consolekit2/APKBUILD
new file mode 100644
index 000000000..3273092ed
--- /dev/null
+++ b/user/consolekit2/APKBUILD
@@ -0,0 +1,63 @@
+# Contributor: Bart Ribbers <bribbers@disroot.org>
+# Maintainer: Bart Ribbers <bribbers@disroot.org>
+pkgbase=ConsoleKit2
+pkgname=consolekit2
+pkgver=1.2.0
+pkgrel=6
+pkgdesc="A framework for defining and tracking users, login sessions, and seats"
+provides="consolekit=$pkgver"
+replaces=consolekit
+arch=all
+url="https://consolekit2.github.io/ConsoleKit2"
+license=GPL2
+depends="polkit eudev"
+makedepends="git automake autoconf gettext-dev glib-dev zlib-dev libxslt-dev
+ polkit-dev eudev-dev libdrm-dev libnih-dev libtool linux-pam-dev
+ xorg-server-dev acl-dev xmlto docbook-xml libevdev-dev"
+checkdepends="libxml2-utils"
+source="$pkgname-$pkgver.tar.gz::https://github.com/${pkgname}/${pkgname}/archive/${pkgver}.tar.gz
+ consolekit2.initd
+ ac_disable_static.patch
+ 0001-busybox-reboot-and-poweroff-support.patch
+ add-listseats.patch
+ pam-foreground-compat.ck"
+subpackages="$pkgname-dev $pkgname-doc $pkgname-lang $pkgname-openrc"
+builddir="$srcdir"/$pkgbase-$pkgver
+
+prepare() {
+ default_prepare
+
+ cd "$builddir"
+
+ NOCONFIGURE=1 ./autogen.sh
+}
+
+build() {
+ cd "$builddir"
+ XMLTO_FLAGS='--skip-validation' ./configure \
+ --prefix=/usr --sysconfdir=/etc --localstatedir=/var \
+ --disable-static --enable-pam-module --enable-udev-acl \
+ --enable-tests --enable-docbook-docs --enable-polkit
+ sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
+ make
+}
+
+check() {
+ cd "$builddir"
+ make check
+}
+
+package() {
+ cd "$builddir"
+ make DESTDIR="$pkgdir" install
+ install -m 755 "$srcdir"/pam-foreground-compat.ck \
+ "$pkgdir"/usr/lib/ConsoleKit/run-session.d/
+ install -D -m755 "$srcdir"/consolekit2.initd \
+ "$pkgdir"/etc/init.d/consolekit
+}
+sha512sums="30f2ceec14044669f40676e9b17513874350e2b70f0a918be934f7e64309c8595dbec4ac0937044c98dda51eb97c99443dc9d1de33f08365d72da8600296ad78 consolekit2-1.2.0.tar.gz
+8c16c452707475bdd4a50d3ade367d52ad92a6560be48b4e21e5b5eadef6e56c39d3d03d3a64f9b45a59eca50179cf5aa9c11978904d5d101db7498fb9bc0339 consolekit2.initd
+0f628fd1589b1790ad9adcb2278de504b75cc6b4ec7284a1cbda44ebd34b9966014989f47f343cb936d8503acc4eeec43ddff07cb11f55388e47256b8420e2e8 ac_disable_static.patch
+ec0c88e640afac0561c84131d63fa8c9e2e29611b789ae5c163cd11465b22017602d88dc853866624f57bce2ee466ab63af075d083a9ba6e87327ad8d0a0769f 0001-busybox-reboot-and-poweroff-support.patch
+c2adfad3f7f6d5f880e0b7e7ed99f62bd7f2bd510492bba5634f0b2391bacd43cb3246a072400392c508d42acdba114cb920f5d498b0c4339d86cf19f691b6fa add-listseats.patch
+3b114fbbe74cfba0bfd4dad0eb1b85d08b4979a998980c1cbcd7f44b8a16b0ceca224680d4f4a1644cd24698f8817e5e8bdfcdc4ead87a122d0e323142f47910 pam-foreground-compat.ck"
diff --git a/user/consolekit2/ac_disable_static.patch b/user/consolekit2/ac_disable_static.patch
new file mode 100644
index 000000000..38d6f12ac
--- /dev/null
+++ b/user/consolekit2/ac_disable_static.patch
@@ -0,0 +1,13 @@
+diff --git a/configure.ac b/configure.ac
+index 071a0d8..7469697 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -30,7 +30,6 @@ AC_SEARCH_LIBS([strerror],[cposix])
+ AC_PROG_CC
+ AM_PROG_CC_C_O
+ AC_HEADER_STDC
+-AC_DISABLE_STATIC
+-LT_INIT
++LT_INIT([disable-static])
+ AC_HEADER_STDC
+ AC_FUNC_FORK
diff --git a/user/consolekit2/add-listseats.patch b/user/consolekit2/add-listseats.patch
new file mode 100644
index 000000000..44bc034c8
--- /dev/null
+++ b/user/consolekit2/add-listseats.patch
@@ -0,0 +1,100 @@
+diff --git a/data/ConsoleKit.conf b/data/ConsoleKit.conf
+index 6c10476..216a0e9 100644
+--- a/data/ConsoleKit.conf
++++ b/data/ConsoleKit.conf
+@@ -80,6 +80,9 @@
+ send_member="CloseSession"/>
+ <allow send_destination="org.freedesktop.ConsoleKit"
+ send_interface="org.freedesktop.ConsoleKit.Manager"
++ send_member="ListSeats"/>
++ <allow send_destination="org.freedesktop.ConsoleKit"
++ send_interface="org.freedesktop.ConsoleKit.Manager"
+ send_member="GetSeats"/>
+ <allow send_destination="org.freedesktop.ConsoleKit"
+ send_interface="org.freedesktop.ConsoleKit.Manager"
+diff --git a/src/ck-manager.c b/src/ck-manager.c
+index 4722bdb..7d8b8b2 100644
+--- a/src/ck-manager.c
++++ b/src/ck-manager.c
+@@ -3841,6 +3841,44 @@ dbus_unlock_session (ConsoleKitManager *ckmanager,
+ }
+
+ static gboolean
++dbus_list_seats (ConsoleKitManager *ckmanager,
++ GDBusMethodInvocation *context)
++{
++ CkManager *manager;
++ GVariantBuilder seat_builder;
++ GVariant *seat;
++ GHashTableIter seat_iter;
++ const gchar *key;
++ CkSeat *value;
++
++ TRACE ();
++
++ manager = CK_MANAGER (ckmanager);
++
++ g_return_val_if_fail (CK_IS_MANAGER (manager), FALSE);
++
++ /* if we don't have seats, we need to return NULL */
++ if (g_hash_table_size (manager->priv->seats) == 0) {
++ throw_error (context, CK_MANAGER_ERROR_NO_SEATS, _("User has no seats"));
++ return TRUE;
++ }
++
++ g_variant_builder_init (&seat_builder, G_VARIANT_TYPE_ARRAY);
++
++ g_hash_table_iter_init (&seat_iter, manager->priv->seats);
++ while (g_hash_table_iter_next (&seat_iter, &key, &value)) {
++ seat = g_variant_new("(so)",
++ console_kit_seat_get_name( CONSOLE_KIT_SEAT(value) ),
++ key);
++
++ g_variant_builder_add_value (&seat_builder, seat);
++ }
++
++ console_kit_manager_complete_list_seats (ckmanager, context, g_variant_builder_end (&seat_builder));
++ return TRUE;
++}
++
++static gboolean
+ dbus_get_seats (ConsoleKitManager *ckmanager,
+ GDBusMethodInvocation *context)
+ {
+@@ -4134,6 +4172,7 @@ ck_manager_iface_init (ConsoleKitManagerIface *iface)
+ iface->handle_stop = dbus_stop;
+ iface->handle_suspend = dbus_suspend;
+ iface->handle_close_session = dbus_close_session;
++ iface->handle_list_seats = dbus_list_seats;
+ iface->handle_get_seats = dbus_get_seats;
+ iface->handle_get_sessions = dbus_get_sessions;
+ iface->handle_get_sessions_for_unix_user = dbus_get_sessions_for_unix_user;
+diff --git a/src/org.freedesktop.ConsoleKit.Manager.xml b/src/org.freedesktop.ConsoleKit.Manager.xml
+index a44880c..024a3e2 100644
+--- a/src/org.freedesktop.ConsoleKit.Manager.xml
++++ b/src/org.freedesktop.ConsoleKit.Manager.xml
+@@ -531,6 +531,24 @@
+ </doc:doc>
+ </method>
+
++ <method name="ListSeats">
++ <arg name="seats" direction="out" type="a(so)">
++ <doc:doc>
++ <doc:summary>an array of seat names and IDs</doc:summary>
++ </doc:doc>
++ </arg>
++ <doc:doc>
++ <doc:description>
++ <doc:para>Retrieves a list of all <doc:ref type="interface" to="Seat">Seats</doc:ref>
++ that are present on the system.</doc:para>
++ <doc:para>Like the logind method of the same name, this returns both the seat's name
++ (such as "seat0") and the D-Bus object path for the seat object that implements the
++ <doc:ref type="interface" to="Seat">Seat</doc:ref> interface.</doc:para>
++ </doc:description>
++ <doc:seealso><doc:ref type="method" to="Manager.GetSeats">GetSeats()</doc:ref></doc:seealso>
++ </doc:doc>
++ </method>
++
+ <method name="GetSeats">
+ <arg name="seats" direction="out" type="ao">
+ <doc:doc>
diff --git a/user/consolekit2/consolekit2.initd b/user/consolekit2/consolekit2.initd
new file mode 100644
index 000000000..697eea8f9
--- /dev/null
+++ b/user/consolekit2/consolekit2.initd
@@ -0,0 +1,9 @@
+#!/sbin/openrc-run
+
+description="Tracks sessions and seats"
+pidfile="/var/run/ConsoleKit/pid"
+command="/usr/sbin/console-kit-daemon"
+
+depend() {
+ need dbus
+}
diff --git a/user/consolekit2/pam-foreground-compat.ck b/user/consolekit2/pam-foreground-compat.ck
new file mode 100644
index 000000000..c9255503c
--- /dev/null
+++ b/user/consolekit2/pam-foreground-compat.ck
@@ -0,0 +1,17 @@
+#!/bin/sh
+TAGDIR=/var/run/console
+
+[ -n "$CK_SESSION_USER_UID" ] || exit 1
+[ "$CK_SESSION_IS_LOCAL" = "true" ] || exit 0
+
+TAGFILE="$TAGDIR/`getent passwd $CK_SESSION_USER_UID | cut -f 1 -d:`"
+
+if [ "$1" = "session_added" ]; then
+ mkdir -p "$TAGDIR"
+ echo "$CK_SESSION_ID" >> "$TAGFILE"
+fi
+
+if [ "$1" = "session_removed" ] && [ -e "$TAGFILE" ]; then
+ sed -i "\%^$CK_SESSION_ID\$%d" "$TAGFILE"
+ [ -s "$TAGFILE" ] || rm -f "$TAGFILE"
+fi