diff --git a/temp/dbus-elogind/APKBUILD b/temp/dbus-elogind/APKBUILD new file mode 100644 index 000000000..a5c2731a5 --- /dev/null +++ b/temp/dbus-elogind/APKBUILD @@ -0,0 +1,106 @@ +# Forked to build against elogind +pkgname=dbus-elogind +pkgver=1.12.16 +pkgrel=0 +pkgdesc="Freedesktop.org message bus system" +options="!check" # Introduces circular dependency with xorg-server (xvfb-run -> xvfb) +url="https://www.freedesktop.org/Software/dbus" +pkggroups="messagebus" +arch="all" +license="AFL-2.1 OR GPL-2.0-or-later" +subpackages="$pkgname-dev $pkgname-doc $pkgname-libs $pkgname-x11 $pkgname-openrc" +triggers="$pkgname.trigger=/etc/dbus-1/system.d" +depends_dev="util-linux-dev" +makedepends="$depends_dev expat-dev libx11-dev autoconf autoconf-archive automake libtool xmlto + libsm-dev glib-dev elogind-dev" +checkdepends="xvfb-run" +install="$pkgname.pre-install $pkgname.post-install" +provides="dbus" +source="https://dbus.freedesktop.org/releases/dbus/dbus-$pkgver.tar.gz + $pkgname.initd + elogind_support.patch + " +builddir="$srcdir/dbus-$pkgver" + +# secfixes: +# 1.12.16-r0: +# - CVE-2019-12749 + +prepare() { + default_prepare + + autoreconf -fi +} + +build() { + ./configure \ + --build=$CBUILD \ + --host=$CHOST \ + --prefix=/usr \ + --sysconfdir=/etc \ + --localstatedir=/var \ + --with-xml=expat \ + --with-dbus-user=messagebus \ + --with-system-pid-file=/var/run/dbus.pid \ + --disable-verbose-mode \ + --disable-static \ + --enable-inotify \ + --disable-dnotify \ + --enable-modular-tests=yes \ + --disable-asserts \ + --enable-user-session \ + --enable-xml-docs \ + --with-session-socket-dir=/tmp \ + --with-x \ + --enable-elogind + make +} + +check() { + cd "$builddir" + xvfb-run make check +} + +package() { + make -j1 DESTDIR="$pkgdir" install + install -Dm755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/dbus + rm -rf "$pkgdir"/usr/lib/systemd +} + +dev() { + provides="dbus-dev" + + default_dev +} + +doc() { + provides="dbus-doc" + + default_doc +} + +libs() { + pkgdesc="D-BUS access libraries" + replaces="dbus" + provides="dbus-libs" + mkdir -p "$subpkgdir"/usr/lib + mv "$pkgdir"/usr/lib/lib*.so.* "$subpkgdir"/usr/lib/ +} + +openrc() { + provides="dbus-openrc" + + default_openrc +} + +x11() { + pkgdesc="X11 add-ons for D-BUS" + depends="dbus=$pkgver-r$pkgrel" + provides="dbus-x11" + mkdir -p "$subpkgdir"/usr/bin + mv "$pkgdir"/usr/bin/dbus-launch "$subpkgdir"/usr/bin/ +} + +sha512sums="27ae805170e9515a8bb0fba5f29d414edc70e3b6b28b7b65bbea47035b8eafa9ac4820cdc92645be6035f6748f8aa45679e1ffc84ba74a64859a3056d318b9bb dbus-1.12.16.tar.gz +4c6beba2382416e60a3adfa85ef843d90d93ca5f38c23f573e058ffca6d4fc3850d11d40938c74383bba61599569b7fdfb1fcf3b9d2f1463e6b2e2cc81097c84 dbus-elogind.initd +113ce264dab48a303664fac54127b97be5167ab8096941299257034cdb6dbe0fd57890a66a42c985ab34c0f2af95cac9bb2d6b0e249d0a61d894631129dfc5a8 elogind_support.patch" diff --git a/temp/dbus-elogind/dbus-elogind.initd b/temp/dbus-elogind/dbus-elogind.initd new file mode 100644 index 000000000..2fbd3e546 --- /dev/null +++ b/temp/dbus-elogind/dbus-elogind.initd @@ -0,0 +1,38 @@ +#!/sbin/openrc-run +# Copyright 1999-2016 Gentoo Foundation +# Distributed under the terms of the GNU General Public License, v2 or later + +supervisor=supervise-daemon + +name="System Message Bus" +description="D-Bus System Message Bus" + +command="/usr/bin/dbus-daemon" +command_args="--system" +command_args_foreground="--nofork" + +extra_started_commands="reload" + +depend() { + need localmount + after bootmisc +} + +start_pre() { + /usr/bin/dbus-uuidgen --ensure=/etc/machine-id + + # We need to test if /var/run/dbus exists, since script will fail if it does not + [ -e /var/run/dbus ] || mkdir /var/run/dbus +} + +stop_post() { + [ ! -S /var/run/dbus/system_bus_socket ] || rm -f /var/run/dbus/system_bus_socket +} + +reload() { + ebegin "Reloading $name configuration" + /usr/bin/dbus-send --print-reply --system --type=method_call \ + --dest=org.freedesktop.DBus \ + / org.freedesktop.DBus.ReloadConfig > /dev/null + eend $? +} diff --git a/temp/dbus-elogind/dbus-elogind.post-install b/temp/dbus-elogind/dbus-elogind.post-install new file mode 100644 index 000000000..1120ec204 --- /dev/null +++ b/temp/dbus-elogind/dbus-elogind.post-install @@ -0,0 +1,3 @@ +#!/bin/sh + +exec dbus-uuidgen --ensure=/etc/machine-id diff --git a/temp/dbus-elogind/dbus-elogind.pre-install b/temp/dbus-elogind/dbus-elogind.pre-install new file mode 100644 index 000000000..2623d00c5 --- /dev/null +++ b/temp/dbus-elogind/dbus-elogind.pre-install @@ -0,0 +1,6 @@ +#!/bin/sh + +addgroup -S messagebus 2>/dev/null +adduser -S -D -H -h /dev/null -s /sbin/nologin -G messagebus -g messagebus messagebus 2>/dev/null + +exit 0 diff --git a/temp/dbus-elogind/dbus-elogind.trigger b/temp/dbus-elogind/dbus-elogind.trigger new file mode 100644 index 000000000..a537bd8df --- /dev/null +++ b/temp/dbus-elogind/dbus-elogind.trigger @@ -0,0 +1,4 @@ +#!/bin/sh + +dbus-send --system --type=method_call --dest=org.freedesktop.DBus / \ + org.freedesktop.DBUS.ReloadConfig >/dev/null 2>&1 || : diff --git a/temp/dbus-elogind/elogind_support.patch b/temp/dbus-elogind/elogind_support.patch new file mode 100644 index 000000000..8abd41ed5 --- /dev/null +++ b/temp/dbus-elogind/elogind_support.patch @@ -0,0 +1,96 @@ +From 8cfeaf9711602c11ce66d7fe217ecca58bbaa405 Mon Sep 17 00:00:00 2001 +From: Cameron Nemo +Date: Tue, 27 Nov 2018 18:51:46 -0800 +Subject: [PATCH] Allow building with elogind at_console support + +Signed-off-by: Cameron Nemo +--- + configure.ac | 28 +++++++++++++++++++++++++--- + dbus/dbus-userdb-util.c | 4 +++- + 2 files changed, 28 insertions(+), 4 deletions(-) + +diff --git a/configure.ac b/configure.ac +index 2d78b7cf..d7c04fb3 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -216,6 +216,10 @@ AC_ARG_ENABLE(inotify, AS_HELP_STRING([--enable-inotify],[build with inotify sup + AC_ARG_ENABLE(kqueue, AS_HELP_STRING([--enable-kqueue],[build with kqueue support]),enable_kqueue=$enableval,enable_kqueue=auto) + AC_ARG_ENABLE(console-owner-file, AS_HELP_STRING([--enable-console-owner-file],[enable console owner file]),enable_console_owner_file=$enableval,enable_console_owner_file=auto) + AC_ARG_ENABLE(launchd, AS_HELP_STRING([--enable-launchd],[build with launchd auto-launch support]),enable_launchd=$enableval,enable_launchd=auto) ++AC_ARG_ENABLE([elogind], ++ [AS_HELP_STRING([--enable-elogind],[build with elogind at_console support])], ++ [enable_elogind=$enableval], ++ [enable_elogind=auto]) + AC_ARG_ENABLE(systemd, AS_HELP_STRING([--enable-systemd],[build with systemd at_console support]),enable_systemd=$enableval,enable_systemd=auto) + + AC_ARG_WITH(session-socket-dir, AS_HELP_STRING([--with-session-socket-dir=[dirname]],[Where to put sockets for the per-login-session message bus])) +@@ -1022,6 +1026,24 @@ fi + + AM_CONDITIONAL(HAVE_CONSOLE_OWNER_FILE, test x$have_console_owner_file = xyes) + ++dnl elogind and systemd exclusion ++AS_IF([test "x$enable_elogind" = "xyes" && test "x$enable_systemd" = "xyes"], ++ [AC_MSG_ERROR([Explicitly requested systemd and elogind support, but they are mutually exclusive])]) ++ ++dnl elogind detection ++AS_IF([test "x$enable_elogind" = "xno"], ++ [have_elogind=no], ++ [PKG_CHECK_MODULES([ELOGIND], ++ [libelogind >= 209], ++ [have_elogind=yes], ++ [have_elogind=no])]) ++ ++AS_IF([test "x$have_elogind" = "xyes"], ++ [AC_DEFINE(HAVE_ELOGIND, 1, [Have elogind])]) ++ ++AS_IF([test "x$enable_elogind" = "xyes" && test "x$have_elogind" != "xyes"], ++ [AC_MSG_ERROR([Explicitly requested elogind support, but libelogind not found])]) ++ + dnl systemd detection + if test x$enable_systemd = xno ; then + have_systemd=no; +@@ -1035,9 +1057,8 @@ else + [have_systemd=no])]) + fi + +-if test x$have_systemd = xyes; then +- AC_DEFINE(HAVE_SYSTEMD,1,[Have systemd]) +-fi ++AS_IF([test "x$have_systemd" = "xyes" && test "x$enable_elogind" != "xyes"], ++ [AC_DEFINE(HAVE_SYSTEMD, 1, [Have systemd])]) + + if test x$enable_systemd = xyes -a x$have_systemd != xyes ; then + AC_MSG_ERROR([Explicitly requested systemd support, but systemd not found]) +@@ -1786,6 +1807,7 @@ echo " + Building AppArmor support: ${have_apparmor} + Building inotify support: ${have_inotify} + Building kqueue support: ${have_kqueue} ++ Building elogind support: ${have_elogind} + Building systemd support: ${have_systemd} + Building X11 code: ${have_x11} + Building Doxygen docs: ${enable_doxygen_docs} +diff --git a/dbus/dbus-userdb-util.c b/dbus/dbus-userdb-util.c +index 7f719b26..1e2f1354 100644 +--- a/dbus/dbus-userdb-util.c ++++ b/dbus/dbus-userdb-util.c +@@ -38,6 +38,8 @@ + + #ifdef HAVE_SYSTEMD + #include ++#elif defined(HAVE_ELOGIND) ++#include + #endif + + /** +@@ -61,7 +63,7 @@ _dbus_is_console_user (dbus_uid_t uid, + const DBusUserInfo *info; + dbus_bool_t result = FALSE; + +-#ifdef HAVE_SYSTEMD ++#if defined(HAVE_SYSTEMD) || defined(HAVE_ELOGIND) + /* check if we have logind */ + if (access ("/run/systemd/seats/", F_OK) >= 0) + { +-- +2.22.0 +