浏览代码

init commit

Noah Vogt 3 年之前
当前提交
d6294db691
共有 5 个文件被更改,包括 433 次插入0 次删除
  1. 46 0
      .SRCINFO
  2. 95 0
      PKGBUILD
  3. 73 0
      dbus-enable-elogind.patch
  4. 206 0
      dbus-launch-Move-dbus-autolaunch-stuff-to-runuser.patch
  5. 13 0
      no-fatal-warnings.diff

+ 46 - 0
.SRCINFO

@@ -0,0 +1,46 @@
+pkgbase = dbus
+	pkgdesc = Freedesktop.org message bus system - but do not create a ~/.dbus directory (for non-systemd systems)
+	pkgver = 1.12.20
+	pkgrel = 1
+	url = https://wiki.freedesktop.org/www/Software/dbus/
+	arch = x86_64
+	license = GPL
+	license = custom
+	makedepends = elogind
+	makedepends = xmlto
+	makedepends = docbook-xsl
+	makedepends = python
+	makedepends = yelp-tools
+	makedepends = doxygen
+	makedepends = git
+	makedepends = autoconf-archive
+	depends = libx11
+	depends = libelogind
+	depends = expat
+	depends = audit
+	provides = dbus
+	conflicts = dbus
+	source = https://gitlab.freedesktop.org/dbus/dbus/-/archive/dbus-1.12.20/dbus-dbus-1.12.20.tar.gz
+	source = dbus-enable-elogind.patch
+	source = no-fatal-warnings.diff
+	source = dbus-launch-Move-dbus-autolaunch-stuff-to-runuser.patch
+	sha256sums = SKIP
+	sha256sums = faffcaa5b295f49fcedeed2c9ece5298949096be3062fd99a4bf1a6ac3ad1ea0
+	sha256sums = 6958eeec07557b92a28419eb1702331ee2f0a6fd17285e37dfb6130b9fa4cf6e
+	sha256sums = 691a84ca6543ac8d1cd19e915fee7dc967dae106e72200d58b682748265501fc
+
+pkgname = dbus-xdg-elogind
+	depends = libx11
+	depends = libelogind
+	depends = expat
+	depends = audit
+	depends = libelogind.so
+	depends = libaudit.so
+	provides = libdbus
+	provides = libdbus-1.so
+	conflicts = libdbus
+	replaces = libdbus
+
+pkgname = dbus-docs
+	pkgdesc = Freedesktop.org message bus system - but do not create a ~/.dbus directory (for non-systemd systems) (documentation)
+	depends = 

+ 95 - 0
PKGBUILD

@@ -0,0 +1,95 @@
+# Maintainer: Noah Vogt (noahvogt) <noah@noahvogt.com>
+# Maintainer: Jan Alexander Steffens (heftig) <heftig@archlinux.org>
+# Contributor: Jan de Groot <jgc@archlinux.org>
+# Contributor: Tom Gundersen <teg@jklm.no>
+# Contributor: Link Dupont <link@subpop.net>
+
+pkgbase=dbus
+pkgname=(dbus-xdg-elogind dbus-docs)
+pkgver=1.12.20
+pkgrel=1
+pkgdesc="Freedesktop.org message bus system - but do not create a ~/.dbus directory (for non-systemd systems)"
+url="https://wiki.freedesktop.org/www/Software/dbus/"
+arch=(x86_64)
+license=(GPL custom)
+depends=(libx11 libelogind expat audit)
+makedepends=(elogind xmlto docbook-xsl python yelp-tools doxygen git autoconf-archive)
+source=("https://gitlab.freedesktop.org/dbus/dbus/-/archive/dbus-$pkgver/dbus-dbus-$pkgver.tar.gz"
+        dbus-enable-elogind.patch
+        no-fatal-warnings.diff
+        dbus-launch-Move-dbus-autolaunch-stuff-to-runuser.patch)
+sha256sums=('SKIP'
+            'faffcaa5b295f49fcedeed2c9ece5298949096be3062fd99a4bf1a6ac3ad1ea0'
+            '6958eeec07557b92a28419eb1702331ee2f0a6fd17285e37dfb6130b9fa4cf6e'
+            '691a84ca6543ac8d1cd19e915fee7dc967dae106e72200d58b682748265501fc')
+provides=('dbus')
+conflicts=('dbus')
+
+prepare() {
+  cd "$pkgbase-$pkgbase-$pkgver"
+  patch -Np 1 -i ../dbus-enable-elogind.patch
+  # Allow us to enable checks without them being fatal
+  patch -Np1 -i ../no-fatal-warnings.diff
+  patch -p1 -i ../dbus-launch-Move-dbus-autolaunch-stuff-to-runuser.patch
+
+  NOCONFIGURE=1 ./autogen.sh
+}
+
+build() {
+  cd "$pkgbase-$pkgbase-$pkgver"
+  ./configure \
+    --prefix=/usr \
+    --sysconfdir=/etc \
+    --localstatedir=/var \
+    --libexecdir=/usr/lib/dbus-1.0 \
+    --with-console-auth-dir=/run/console/ \
+    --with-dbus-user=dbus \
+    --with-system-pid-file=/run/dbus/pid \
+    --with-system-socket=/run/dbus/system_bus_socket \
+    --without-systemdsystemunitdir \
+    --enable-inotify \
+    --enable-libaudit \
+    --disable-systemd \
+    --disable-user-session \
+    --enable-xml-docs \
+    --enable-doxygen-docs \
+    --enable-ducktype-docs \
+    --disable-static \
+    --enable-elogind \
+    --enable-x11-autolaunch
+  make
+}
+
+check() {
+  make -C "$pkgbase-$pkgbase-$pkgver" check
+}
+
+package_dbus-xdg-elogind() {
+  depends+=(libelogind.so libaudit.so)
+  provides=(libdbus libdbus-1.so)
+  conflicts=(libdbus)
+  replaces=(libdbus)
+
+  DESTDIR="$pkgdir" make -C "$pkgbase-$pkgbase-$pkgver" install
+
+  rm -r "$pkgdir"/{etc,var}
+
+  # We have a pre-assigned uid (81)
+  echo 'u dbus 81 "System Message Bus"' |
+    install -Dm644 /dev/stdin "$pkgdir/usr/lib/sysusers.d/dbus.conf"
+
+  install -Dt "$pkgdir/usr/share/licenses/$pkgname" -m644 "$pkgbase-$pkgbase-$pkgver"/COPYING
+
+  # Split docs
+  mv "$pkgdir/usr/share/doc" "$srcdir"
+}
+
+package_dbus-docs() {
+  pkgdesc+=" (documentation)"
+  depends=()
+
+  install -Dt "$pkgdir/usr/share/licenses/$pkgname" -m644 "$pkgbase-$pkgbase-$pkgver"/COPYING
+  mv doc "$pkgdir/usr/share"
+}
+
+# vim:set sw=2 et:

+ 73 - 0
dbus-enable-elogind.patch

@@ -0,0 +1,73 @@
+--- a/dbus/dbus-userdb-util.c	2015-09-30 16:48:40.000000000 +0200
++++ b/dbus/dbus-userdb-util.c	2016-11-03 11:09:42.550520587 +0100
+@@ -32,6 +32,9 @@
+ #if HAVE_SYSTEMD
+ #include <systemd/sd-login.h>
+ #endif
++#if HAVE_ELOGIND
++#include <elogind/sd-login.h>
++#endif
+ 
+ /**
+  * @addtogroup DBusInternalsUtils
+@@ -54,7 +57,7 @@
+   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)
+     {
+--- a/configure.ac	2016-11-03 11:13:58.286528265 +0100
++++ b/configure.ac	2016-11-03 11:22:11.210543063 +0100
+@@ -185,6 +185,7 @@
+ 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 user seat 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(init-scripts, AS_HELP_STRING([--with-init-scripts=[redhat]],[Style of init scripts to install]))
+@@ -1184,6 +1185,24 @@
+ 
+ AM_CONDITIONAL(HAVE_CONSOLE_OWNER_FILE, test x$have_console_owner_file = xyes)
+ 
++dnl elogind detection
++if test x$enable_elogind = xno ; then
++    have_elogind=no;
++else
++    PKG_CHECK_MODULES([ELOGIND],
++        [libelogind >= 209],
++        [have_elogind=yes],
++        [have_elogind=no])
++fi
++
++if test x$have_elogind = xyes; then
++    AC_DEFINE(HAVE_ELOGIND,1,[Have elogind])
++fi
++
++if test x$enable_elogind = xyes -a x$have_elogind != xyes ; then
++    AC_MSG_ERROR([Explicitly requested elogind support, but libelogind not found])
++fi
++
+ dnl systemd detection
+ if test x$enable_systemd = xno ; then
+     have_systemd=no;
+@@ -1290,7 +1309,7 @@
+ fi
+ 
+ #### Set up final flags
+-LIBDBUS_LIBS="$THREAD_LIBS $NETWORK_libs $SYSTEMD_LIBS"
++LIBDBUS_LIBS="$THREAD_LIBS $NETWORK_libs $SYSTEMD_LIBS $ELOGIND_LIBS"
+ AC_SUBST([LIBDBUS_LIBS])
+ 
+ ### X11 detection
+@@ -1949,6 +1968,7 @@
+         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}

+ 206 - 0
dbus-launch-Move-dbus-autolaunch-stuff-to-runuser.patch

@@ -0,0 +1,206 @@
+From f595065ab70c6c310f14610f8acc46a94ede7070 Mon Sep 17 00:00:00 2001
+From: Colin Walters <walters@verbum.org>
+Date: Fri, 27 Apr 2012 14:36:01 -0400
+Subject: [PATCH] dbus-launch: Move ~/.dbus autolaunch stuff to /run/user
+
+We shouldn't be polluting the user's home directory when we have a
+per-machine per-user directory available in XDG_RUNTIME_DIR.
+
+https://bugs.freedesktop.org/show_bug.cgi?id=35887
+---
+ tools/dbus-launch-x11.c |  148 +++++++++++++++++++++++++++++++----------------
+ 1 files changed, 97 insertions(+), 51 deletions(-)
+
+diff --git a/tools/dbus-launch-x11.c b/tools/dbus-launch-x11.c
+index c7e3330..b50d43a 100644
+--- a/tools/dbus-launch-x11.c
++++ b/tools/dbus-launch-x11.c
+@@ -30,6 +30,8 @@
+ #include <sys/stat.h>
+ #include <unistd.h>
+ #include <fcntl.h>
++#include <limits.h>
++#include <stdarg.h>
+ #include <errno.h>
+ #include <stdio.h>
+ #include <string.h>
+@@ -87,16 +89,98 @@ get_homedir (void)
+   return home;
+ }
+ 
+-#define DBUS_DIR ".dbus"
+-#define DBUS_SESSION_BUS_DIR "session-bus"
++static char *
++wish_i_had_g_build_filename (const char *first,
++                             ...)
++{
++  const char *arg;
++  const char *next;
++  char *p;
++  char buf[PATH_MAX+1];
++  va_list args;
++
++  va_start (args, first);
++
++  p = &(buf[0]);
++
++  arg = first;
++  do
++    {
++      next = va_arg (args, const char *);
++      strcpy (p, arg);
++      p += strlen (arg);
++      if (next)
++        {
++          *p = '/';
++          p++;
++        }
++      arg = next;
++    }
++  while (arg != NULL);
++
++  va_end (args);
++
++  *p = '\0';
++
++  return strdup ((char*)buf);
++}
++
++static char *
++wish_i_had_g_strconcat (const char *first,
++                        ...)
++{
++  char *result;
++  const char *arg;
++  va_list args;
++
++  va_start (args, first);
++
++  result = strdup (first);
++
++  while ((arg = va_arg (args, const char *)) != NULL)
++    {
++      char *end = result + strlen (result);
++      result = realloc (result, strlen (result) + strlen (arg) + 1);
++      strcpy (end, arg);
++    }
++
++  va_end (args);
++  return result;
++}
++
++/* This used to live in ~/.dbus, but we don't want to put stuff
++ * in the user home directory for multiple reasons; see
++ * https://bugs.freedesktop.org/show_bug.cgi?id=35887
++ */
++static char *autolaunch_data_dir = NULL;
++static const char *
++get_autolaunch_data_dir (void)
++{
++  if (autolaunch_data_dir == NULL)
++    {
++      const char *datadir;
++      const char *home;
++      /* http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html */
++      datadir = getenv ("XDG_RUNTIME_DIR");
++
++      if (datadir)
++        autolaunch_data_dir = wish_i_had_g_build_filename (datadir, "dbus-autolaunch", NULL);
++      else
++        {
++          home = get_homedir ();
++          autolaunch_data_dir = wish_i_had_g_build_filename (home, ".dbus", "session-bus", NULL);
++        }
++    }
++  return autolaunch_data_dir;
++}
+ 
+ static char *
+ get_session_file (void)
+ {
+-  static const char prefix[] = "/" DBUS_DIR "/" DBUS_SESSION_BUS_DIR "/";
++  const char *autolaunch_data_dir;
+   const char *machine;
+-  const char *home;
+   char *display;
++  char *session_filename;
+   char *result;
+   char *p;
+ 
+@@ -149,23 +233,13 @@ get_session_file (void)
+         *p = '_';
+     }
+   
+-  home = get_homedir ();
+-  
+-  result = malloc (strlen (home) + strlen (prefix) + strlen (machine) +
+-                   strlen (display) + 2);
+-  if (result == NULL)
+-    {
+-      /* out of memory */
+-      free (display);
+-      return NULL;
+-    }
++  autolaunch_data_dir = get_autolaunch_data_dir ();
+ 
+-  strcpy (result, home);
+-  strcat (result, prefix);
+-  strcat (result, machine);
+-  strcat (result, "-");
+-  strcat (result, display);
+-  free (display);
++  session_filename = wish_i_had_g_strconcat (machine, "-", display, NULL);
++
++  result = wish_i_had_g_build_filename (autolaunch_data_dir, session_filename, NULL);
++
++  free (session_filename);
+ 
+   verbose ("session file: %s\n", result);
+   return result;
+@@ -174,41 +248,13 @@ get_session_file (void)
+ static void
+ ensure_session_directory (void)
+ {
+-  const char *home;
+-  char *dir;
+-  
+-  home = get_homedir ();
+-
+-  /* be sure we have space for / and nul */
+-  dir = malloc (strlen (home) + strlen (DBUS_DIR) + strlen (DBUS_SESSION_BUS_DIR) + 3);
+-  if (dir == NULL)
+-    {
+-      fprintf (stderr, "no memory\n");
+-      exit (1);
+-    }
+-  
+-  strcpy (dir, home);
+-  strcat (dir, "/");
+-  strcat (dir, DBUS_DIR);
+-
+-  if (mkdir (dir, 0700) < 0)
++  const char *autolaunch_dir = get_autolaunch_data_dir();
++  if (mkdir (autolaunch_dir, 0700) < 0)
+     {
+       /* only print a warning here, writing the session file itself will fail later */
+       if (errno != EEXIST)
+-        fprintf (stderr, "Unable to create %s\n", dir);
++        fprintf (stderr, "Unable to create %s\n", autolaunch_dir);
+     }
+-
+-  strcat (dir, "/");
+-  strcat (dir, DBUS_SESSION_BUS_DIR);
+-
+-  if (mkdir (dir, 0700) < 0)
+-    {
+-      /* only print a warning here, writing the session file itself will fail later */
+-      if (errno != EEXIST)
+-        fprintf (stderr, "Unable to create %s\n", dir);
+-    }
+-  
+-  free (dir);
+ }
+ 
+ static Display *
+-- 
+1.7.7.6

+ 13 - 0
no-fatal-warnings.diff

@@ -0,0 +1,13 @@
+diff --git i/dbus/dbus-internals.c w/dbus/dbus-internals.c
+index 267aef97..b1064e85 100644
+--- i/dbus/dbus-internals.c
++++ w/dbus/dbus-internals.c
+@@ -185,7 +185,7 @@ const char *_dbus_no_memory_message = "Not enough memory";
+ 
+ static dbus_bool_t warn_initted = FALSE;
+ static dbus_bool_t fatal_warnings = FALSE;
+-static dbus_bool_t fatal_warnings_on_check_failed = TRUE;
++static dbus_bool_t fatal_warnings_on_check_failed = FALSE;
+ 
+ static void
+ init_warnings(void)