diff options
author | root <root@rshg054.dnsready.net> | 2012-09-17 00:03:15 +0000 |
---|---|---|
committer | root <root@rshg054.dnsready.net> | 2012-09-17 00:03:15 +0000 |
commit | d1d75c37c446dfbe9cbae503300e17f2973dbf44 (patch) | |
tree | b456fdc00f58cc15c7faf27ed12dfc9a0f8741b4 /testing | |
parent | 50634781b5673a447953e357a63baa66515ec868 (diff) |
Mon Sep 17 00:03:15 UTC 2012
Diffstat (limited to 'testing')
-rw-r--r-- | testing/btrfs-progs/PKGBUILD | 13 | ||||
-rw-r--r-- | testing/polkit/PKGBUILD | 46 | ||||
-rwxr-xr-x | testing/polkit/autogen.sh | 123 | ||||
-rw-r--r-- | testing/polkit/logind+ConsoleKit.patch | 638 | ||||
-rw-r--r-- | testing/polkit/polkit.install | 18 | ||||
-rw-r--r-- | testing/polkit/polkit.pam | 7 | ||||
-rw-r--r-- | testing/postgresql-old-upgrade/PKGBUILD | 41 | ||||
-rw-r--r-- | testing/postgresql/PKGBUILD | 26 | ||||
-rwxr-xr-x | testing/postgresql/postgresql-check-db-dir | 49 | ||||
-rw-r--r-- | testing/postgresql/postgresql.install | 10 | ||||
-rw-r--r-- | testing/postgresql/postgresql.service | 19 |
11 files changed, 962 insertions, 28 deletions
diff --git a/testing/btrfs-progs/PKGBUILD b/testing/btrfs-progs/PKGBUILD index e7252b7ec..f40858d29 100644 --- a/testing/btrfs-progs/PKGBUILD +++ b/testing/btrfs-progs/PKGBUILD @@ -1,8 +1,9 @@ -# $Id: PKGBUILD 164015 2012-07-24 01:22:05Z dreisner $ +# $Id: PKGBUILD 166671 2012-09-15 09:38:19Z tomegun $ # Maintainer: Tom Gundersen <teg@jklm.no> # Contributor: Tobias Powalowski <tpowa@archlinux.org> + pkgname=btrfs-progs -pkgver=0.19.20120328 +pkgver=0.19.20120904 pkgrel=4 pkgdesc="btrfs filesystem utilities" arch=(i686 x86_64) @@ -16,10 +17,6 @@ source=(ftp://ftp.archlinux.org/other/$pkgname/$pkgname-$pkgver.tar.xz 70-btrfs.rules initcpio-install-btrfs initcpio-hook-btrfs) -md5sums=('f4504e73cf9254779b78d5b2318ac570' - '345c62c8b267082361729ca5b647518f' - 'e5186ec3fe8a809b7473470128d1c4ab' - '9fb35142755b477a96cb7292f3d64839') build() { cd $srcdir/$pkgname-$pkgver @@ -44,3 +41,7 @@ package() { install -Dm644 "$srcdir/initcpio-hook-btrfs" \ "$pkgdir/usr/lib/initcpio/hooks/btrfs" } +md5sums=('d9c96e670fac7c2098a9e7ef98d4b2e2' + '345c62c8b267082361729ca5b647518f' + 'e5186ec3fe8a809b7473470128d1c4ab' + '9fb35142755b477a96cb7292f3d64839') diff --git a/testing/polkit/PKGBUILD b/testing/polkit/PKGBUILD new file mode 100644 index 000000000..2bc0b25de --- /dev/null +++ b/testing/polkit/PKGBUILD @@ -0,0 +1,46 @@ +# $Id: PKGBUILD 166700 2012-09-16 00:09:31Z heftig $ +# Maintainer: Jan de Groot <jgc@archlinux.org> + +pkgname=polkit +pkgver=0.107 +pkgrel=2 +pkgdesc="Application development toolkit for controlling system-wide privileges" +arch=(i686 x86_64) +license=('LGPL') +url="http://www.freedesktop.org/wiki/Software/PolicyKit" +depends=('glib2' 'pam' 'expat' 'libsystemd' 'js') +makedepends=('intltool' 'gtk-doc' 'gobject-introspection') +replaces=('policykit') +options=('!libtool') +install=polkit.install +source=("http://www.freedesktop.org/software/polkit/releases/$pkgname-$pkgver.tar.gz" + 'polkit.pam' + 'logind+ConsoleKit.patch' + 'autogen.sh') +md5sums=('0e4f9c53f43fd1b25ac3f0d2e09b2ae1' + '6564f95878297b954f0572bc1610dd15' + 'fb71d43442dbf24f8760198a9a79c5e7' + '38fe3119284e842e66b330b0f2ba230d') + +build() { + cd $pkgname-$pkgver + + patch -p1 <../logind+ConsoleKit.patch + + cp ../autogen.sh . + ./autogen.sh --prefix=/usr --sysconfdir=/etc \ + --localstatedir=/var --libexecdir=/usr/lib/polkit-1 \ + --with-systemdsystemunitdir=/usr/lib/systemd/system \ + --disable-static --enable-gtk-doc + make +} + +package() { + cd $pkgname-$pkgver + make DESTDIR="$pkgdir" install + + chown 102 "$pkgdir/etc/polkit-1/rules.d" + chown 102 "$pkgdir/usr/share/polkit-1/rules.d" + + install -m644 "$srcdir/polkit.pam" "$pkgdir/etc/pam.d/polkit-1" +} diff --git a/testing/polkit/autogen.sh b/testing/polkit/autogen.sh new file mode 100755 index 000000000..d08b00a49 --- /dev/null +++ b/testing/polkit/autogen.sh @@ -0,0 +1,123 @@ +#!/bin/sh +# Run this to generate all the initial makefiles, etc. + +srcdir=`dirname $0` +test -z "$srcdir" && srcdir=. + +DIE=0 + +(test -f $srcdir/configure.ac) || { + echo -n "**Error**: Directory $srcdir does not look like the" + echo " top-level package directory" + exit 1 +} + +olddir=`pwd` +cd "$srcdir" + +touch ChangeLog + +(autoconf --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "**Error**: You must have autoconf installed." + echo "Download the appropriate package for your distribution," + echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/" + DIE=1 +} + +(grep "^AM_PROG_LIBTOOL" configure.ac >/dev/null) && { + (libtoolize --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "**Error**: You must have libtool installed." + echo "You can get it from: ftp://ftp.gnu.org/pub/gnu/" + DIE=1 + } +} + +(gtkdocize --flavour no-tmpl) < /dev/null > /dev/null 2>&1 || { + echo + echo "You must have gtk-doc installed to compile $PROJECT." + echo "Install the appropriate package for your distribution," + echo "or get the source tarball at http://ftp.gnome.org/pub/GNOME/sources/gtk-doc/" + DIE=1 +} + +(automake --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "**Error**: You must have automake installed." + echo "You can get it from: ftp://ftp.gnu.org/pub/gnu/" + DIE=1 + NO_AUTOMAKE=yes +} + + +# if no automake, don't bother testing for aclocal +test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "**Error**: Missing aclocal. The version of automake" + echo "installed doesn't appear recent enough." + echo "You can get automake from ftp://ftp.gnu.org/pub/gnu/" + DIE=1 +} + + +# if no automake, don't bother testing for autoreconf +test -n "$NO_AUTOMAKE" || (autoreconf --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "**Error**: You must have autoreconf installed." + echo "You can get autoreconf from ..." + DIE=1 +} + + +if test "$DIE" -eq 1; then + exit 1 +fi + +if test -z "$*"; then + echo "**Warning**: I am going to run configure with no arguments." + echo "If you wish to pass any to it, please specify them on the" + echo $0 " command line." + echo +fi + +case $CC in +xlc ) + am_opt=--include-deps;; +esac + + aclocalinclude="$ACLOCAL_FLAGS" + + echo "Running autoreconf on test/mocklibc ..." + (cd "test/mocklibc"; autoreconf --install) + + if grep "^AM_PROG_LIBTOOL" configure.ac >/dev/null; then + if test -z "$NO_LIBTOOLIZE" ; then + echo "Running libtoolize..." + libtoolize --force --copy + fi + fi + echo "Running aclocal $aclocalinclude ..." + aclocal $aclocalinclude + if grep "^AM_CONFIG_HEADER" configure.ac >/dev/null; then + echo "Running autoheader..." + autoheader + fi + echo "Running automake --gnu -Wno-portability $am_opt ..." + automake --add-missing --gnu -Wno-portability $am_opt + echo "Running autoconf ..." + autoconf + +intltoolize --copy --force --automake || exit 1 + +cd "$olddir" + +conf_flags="--enable-maintainer-mode --enable-gtk-doc" + +if test x$NOCONFIGURE = x; then + echo "Running $srcdir/configure $conf_flags $@ ..." + $srcdir/configure $conf_flags "$@" \ + && echo "Now type make to compile." || exit 1 +else + echo "Skipping configure process." +fi diff --git a/testing/polkit/logind+ConsoleKit.patch b/testing/polkit/logind+ConsoleKit.patch new file mode 100644 index 000000000..042d1043a --- /dev/null +++ b/testing/polkit/logind+ConsoleKit.patch @@ -0,0 +1,638 @@ +From ba143769e17e4bbc1f2b0c88e735f993dfb3c873 Mon Sep 17 00:00:00 2001 +From: Tom Gundersen <teg@jklm.no> +Date: Tue, 7 Aug 2012 21:06:18 +0200 +Subject: [PATCH] session tracking: always require consolekit + +Only systemd is now optional at compile-time, and if enabled we fallback to consolekit +at runtime, if not booted with systemd. + +Bits-stolen-from: Jan Alexander Steffens <jan.steffens@gmail.com> +Signed-off-by: Tom Gundersen <teg@jklm.no> +--- + configure.ac | 6 +- + src/polkit/polkitunixsession-systemd.c | 96 ++++++- + src/polkitbackend/polkitbackendjsauthority.c | 10 +- + .../polkitbackendsessionmonitor-systemd.c | 313 +++++++++++++++++++-- + 4 files changed, 380 insertions(+), 45 deletions(-) + +diff --git a/configure.ac b/configure.ac +index 7a0d938..1d1e4ba 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -163,15 +163,15 @@ AC_ARG_ENABLE([libsystemd-login], + [enable_libsystemd_login=auto]) + if test "$enable_libsystemd_login" != "no"; then + PKG_CHECK_MODULES(LIBSYSTEMD_LOGIN, +- [libsystemd-login], ++ [libsystemd-login libsystemd-daemon], + have_libsystemd_login=yes, + have_libsystemd_login=no) + if test "$have_libsystemd_login" = "yes"; then +- SESSION_TRACKING=libsystemd-login ++ SESSION_TRACKING="libsystemd-login (with ConsoleKit runtime fallback)" + AC_DEFINE([HAVE_LIBSYSTEMD_LOGIN], 1, [Define to 1 if libsystemd-login is available]) + else + if test "$enable_libsystemd_login" = "yes"; then +- AC_MSG_ERROR([libsystemd-login support requested but libsystemd-login library not found]) ++ AC_MSG_ERROR([libsystemd-login support requested but systemd libraries not found]) + fi + fi + fi +diff --git a/src/polkit/polkitunixsession-systemd.c b/src/polkit/polkitunixsession-systemd.c +index 8a8bf65..bb89044 100644 +--- a/src/polkit/polkitunixsession-systemd.c ++++ b/src/polkit/polkitunixsession-systemd.c +@@ -1,5 +1,5 @@ + /* +- * Copyright (C) 2011 Red Hat, Inc. ++ * Copyright (C) 2008, 2011 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public +@@ -17,6 +17,7 @@ + * Boston, MA 02111-1307, USA. + * + * Author: Matthias Clasen ++ * Author: David Zeuthen <davidz@redhat.com> + */ + + #ifdef HAVE_CONFIG_H +@@ -31,6 +32,7 @@ + #include "polkitprivate.h" + + #include <systemd/sd-login.h> ++#include <systemd/sd-daemon.h> + + /** + * SECTION:polkitunixsession +@@ -367,9 +369,41 @@ polkit_unix_session_exists_sync (PolkitSubject *subject, + PolkitUnixSession *session = POLKIT_UNIX_SESSION (subject); + gboolean ret = FALSE; + uid_t uid; ++ GDBusConnection *connection; /* consolekit */ ++ GVariant *result; /* consolekit */ + +- if (sd_session_get_uid (session->session_id, &uid) == 0) +- ret = TRUE; ++ if (sd_booted()) ++ { ++ if (sd_session_get_uid (session->session_id, &uid) == 0) ++ ret = TRUE; ++ } ++ else /* consolekit */ ++ { ++ connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, cancellable, error); ++ if (connection == NULL) ++ goto out; ++ ++ result = g_dbus_connection_call_sync (connection, ++ "org.freedesktop.ConsoleKit", /* name */ ++ session->session_id, /* object path */ ++ "org.freedesktop.ConsoleKit.Session", /* interface name */ ++ "GetUser", /* method */ ++ NULL, /* parameters */ ++ G_VARIANT_TYPE ("(u)"), ++ G_DBUS_CALL_FLAGS_NONE, ++ -1, ++ cancellable, ++ error); ++ if (result == NULL) ++ goto out; ++ ++ ret = TRUE; ++ g_variant_unref (result); ++ ++ out: ++ if (connection != NULL) ++ g_object_unref (connection); ++ } + + return ret; + } +@@ -451,29 +485,61 @@ polkit_unix_session_initable_init (GInitable *initable, + PolkitUnixSession *session = POLKIT_UNIX_SESSION (initable); + gboolean ret = FALSE; + char *s; ++ GDBusConnection *connection; /* consolekit */ ++ GVariant *result; /* consolekit */ ++ connection = NULL; /* consolekit */ + + if (session->session_id != NULL) + { + /* already set, nothing to do */ +- ret = TRUE; +- goto out; ++ return TRUE; + } + +- if (sd_pid_get_session (session->pid, &s) == 0) ++ if (sd_booted()) ++ { ++ if (sd_pid_get_session (session->pid, &s) == 0) ++ { ++ session->session_id = g_strdup (s); ++ free (s); ++ return TRUE; ++ } ++ ++ g_set_error (error, ++ POLKIT_ERROR, ++ POLKIT_ERROR_FAILED, ++ "No session for pid %d", ++ (gint) session->pid); ++ } ++ else /* consolekit */ + { +- session->session_id = g_strdup (s); +- free (s); ++ connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, cancellable, error); ++ if (connection == NULL) ++ goto out; ++ ++ result = g_dbus_connection_call_sync (connection, ++ "org.freedesktop.ConsoleKit", /* name */ ++ "/org/freedesktop/ConsoleKit/Manager", /* object path */ ++ "org.freedesktop.ConsoleKit.Manager", /* interface name */ ++ "GetSessionForUnixProcess", /* method */ ++ g_variant_new ("(u)", session->pid), /* parameters */ ++ G_VARIANT_TYPE ("(o)"), ++ G_DBUS_CALL_FLAGS_NONE, ++ -1, ++ cancellable, ++ error); ++ if (result == NULL) ++ goto out; ++ ++ g_variant_get (result, "(o)", &session->session_id); ++ g_variant_unref (result); ++ + ret = TRUE; +- goto out; + } + +- g_set_error (error, +- POLKIT_ERROR, +- POLKIT_ERROR_FAILED, +- "No session for pid %d", +- (gint) session->pid); ++ out: ++ if (connection != NULL) /* consolekit */ ++ g_object_unref (connection); + +-out: + return ret; + } + +diff --git a/src/polkitbackend/polkitbackendjsauthority.c b/src/polkitbackend/polkitbackendjsauthority.c +index bdfaa73..ee38739 100644 +--- a/src/polkitbackend/polkitbackendjsauthority.c ++++ b/src/polkitbackend/polkitbackendjsauthority.c +@@ -36,6 +36,7 @@ + + #ifdef HAVE_LIBSYSTEMD_LOGIN + #include <systemd/sd-login.h> ++#include <systemd/sd-daemon.h> + #endif /* HAVE_LIBSYSTEMD_LOGIN */ + + #include <jsapi.h> +@@ -731,11 +732,14 @@ subject_to_jsval (PolkitBackendJsAuthority *authority, + } + + #ifdef HAVE_LIBSYSTEMD_LOGIN +- if (sd_pid_get_session (pid, &session_str) == 0) ++ if (sd_booted()) + { +- if (sd_session_get_seat (session_str, &seat_str) == 0) ++ if (sd_pid_get_session (pid, &session_str) == 0) + { +- /* do nothing */ ++ if (sd_session_get_seat (session_str, &seat_str) == 0) ++ { ++ /* do nothing */ ++ } + } + } + #endif /* HAVE_LIBSYSTEMD_LOGIN */ +diff --git a/src/polkitbackend/polkitbackendsessionmonitor-systemd.c b/src/polkitbackend/polkitbackendsessionmonitor-systemd.c +index 58593c3..5114dfa 100644 +--- a/src/polkitbackend/polkitbackendsessionmonitor-systemd.c ++++ b/src/polkitbackend/polkitbackendsessionmonitor-systemd.c +@@ -26,11 +26,15 @@ + #include <string.h> + #include <glib/gstdio.h> + #include <systemd/sd-login.h> ++#include <systemd/sd-daemon.h> + #include <stdlib.h> + + #include <polkit/polkit.h> + #include "polkitbackendsessionmonitor.h" + ++/* consolekit */ ++#define CKDB_PATH "/var/run/ConsoleKit/database" ++ + /* <internal> + * SECTION:polkitbackendsessionmonitor + * @title: PolkitBackendSessionMonitor +@@ -126,6 +130,11 @@ struct _PolkitBackendSessionMonitor + GDBusConnection *system_bus; + + GSource *sd_source; ++ ++ /* consolekit */ ++ GKeyFile *database; ++ GFileMonitor *database_monitor; ++ time_t database_mtime; + }; + + struct _PolkitBackendSessionMonitorClass +@@ -148,6 +157,101 @@ G_DEFINE_TYPE (PolkitBackendSessionMonitor, polkit_backend_session_monitor, G_TY + + /* ---------------------------------------------------------------------------------------------------- */ + ++/* consolekit */ ++static gboolean ++reload_database (PolkitBackendSessionMonitor *monitor, ++ GError **error) ++{ ++ gboolean ret; ++ struct stat statbuf; ++ ++ ret = FALSE; ++ ++ if (monitor->database != NULL) ++ { ++ g_key_file_free (monitor->database); ++ monitor->database = NULL; ++ } ++ ++ if (stat (CKDB_PATH, &statbuf) != 0) ++ { ++ g_set_error (error, ++ G_IO_ERROR, ++ g_io_error_from_errno (errno), ++ "Error statting file " CKDB_PATH ": %s", ++ strerror (errno)); ++ goto out; ++ } ++ ++ monitor->database_mtime = statbuf.st_mtime; ++ ++ monitor->database = g_key_file_new (); ++ if (!g_key_file_load_from_file (monitor->database, ++ CKDB_PATH, ++ G_KEY_FILE_NONE, ++ error)) ++ { ++ goto out; ++ } ++ ++ ret = TRUE; ++ ++ out: ++ return ret; ++} ++ ++static gboolean ++ensure_database (PolkitBackendSessionMonitor *monitor, ++ GError **error) ++{ ++ gboolean ret = FALSE; ++ ++ if (monitor->database != NULL) ++ { ++ struct stat statbuf; ++ ++ if (stat (CKDB_PATH, &statbuf) != 0) ++ { ++ g_set_error (error, ++ G_IO_ERROR, ++ g_io_error_from_errno (errno), ++ "Error statting file " CKDB_PATH " to check timestamp: %s", ++ strerror (errno)); ++ goto out; ++ } ++ if (statbuf.st_mtime == monitor->database_mtime) ++ { ++ ret = TRUE; ++ goto out; ++ } ++ } ++ ++ ret = reload_database (monitor, error); ++ ++ out: ++ return ret; ++} ++ ++static void ++on_file_monitor_changed (GFileMonitor *file_monitor, ++ GFile *file, ++ GFile *other_file, ++ GFileMonitorEvent event_type, ++ gpointer user_data) ++{ ++ PolkitBackendSessionMonitor *monitor = POLKIT_BACKEND_SESSION_MONITOR (user_data); ++ ++ /* throw away cache */ ++ if (monitor->database != NULL) ++ { ++ g_key_file_free (monitor->database); ++ monitor->database = NULL; ++ } ++ g_signal_emit (monitor, signals[CHANGED_SIGNAL], 0); ++} ++ ++/* consolekit - end */ ++ + static gboolean + sessions_changed (gpointer user_data) + { +@@ -163,6 +267,7 @@ static void + polkit_backend_session_monitor_init (PolkitBackendSessionMonitor *monitor) + { + GError *error; ++ GFile *file; /* consolekit */ + + error = NULL; + monitor->system_bus = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &error); +@@ -172,9 +277,41 @@ polkit_backend_session_monitor_init (PolkitBackendSessionMonitor *monitor) + g_error_free (error); + } + +- monitor->sd_source = sd_source_new (); +- g_source_set_callback (monitor->sd_source, sessions_changed, monitor, NULL); +- g_source_attach (monitor->sd_source, NULL); ++ if (sd_booted()) ++ { ++ monitor->sd_source = sd_source_new (); ++ g_source_set_callback (monitor->sd_source, sessions_changed, monitor, NULL); ++ g_source_attach (monitor->sd_source, NULL); ++ } ++ else /* consolekit */ ++ { ++ error = NULL; ++ if (!ensure_database (monitor, &error)) ++ { ++ g_printerr ("Error loading " CKDB_PATH ": %s", error->message); ++ g_error_free (error); ++ } ++ ++ error = NULL; ++ file = g_file_new_for_path (CKDB_PATH); ++ monitor->database_monitor = g_file_monitor_file (file, ++ G_FILE_MONITOR_NONE, ++ NULL, ++ &error); ++ g_object_unref (file); ++ if (monitor->database_monitor == NULL) ++ { ++ g_printerr ("Error monitoring " CKDB_PATH ": %s", error->message); ++ g_error_free (error); ++ } ++ else ++ { ++ g_signal_connect (monitor->database_monitor, ++ "changed", ++ G_CALLBACK (on_file_monitor_changed), ++ monitor); ++ } ++ } + } + + static void +@@ -191,6 +328,14 @@ polkit_backend_session_monitor_finalize (GObject *object) + g_source_unref (monitor->sd_source); + } + ++ /* consolekit */ ++ if (monitor->database_monitor != NULL) ++ g_object_unref (monitor->database_monitor); ++ ++ if (monitor->database != NULL) ++ g_key_file_free (monitor->database); ++ /* consolekit - end */ ++ + if (G_OBJECT_CLASS (polkit_backend_session_monitor_parent_class)->finalize != NULL) + G_OBJECT_CLASS (polkit_backend_session_monitor_parent_class)->finalize (object); + } +@@ -258,6 +403,8 @@ polkit_backend_session_monitor_get_user_for_subject (PolkitBackendSessionMonitor + GError **error) + { + PolkitIdentity *ret; ++ GError *local_error; /* consolekit */ ++ gchar *group; /* consolekit */ + guint32 uid; + + ret = NULL; +@@ -300,16 +447,38 @@ polkit_backend_session_monitor_get_user_for_subject (PolkitBackendSessionMonitor + else if (POLKIT_IS_UNIX_SESSION (subject)) + { + +- if (sd_session_get_uid (polkit_unix_session_get_session_id (POLKIT_UNIX_SESSION (subject)), &uid) < 0) ++ if (sd_booted()) + { +- g_set_error (error, +- POLKIT_ERROR, +- POLKIT_ERROR_FAILED, +- "Error getting uid for session"); +- goto out; ++ if (sd_session_get_uid (polkit_unix_session_get_session_id (POLKIT_UNIX_SESSION (subject)), &uid) < 0) ++ { ++ g_set_error (error, ++ POLKIT_ERROR, ++ POLKIT_ERROR_FAILED, ++ "Error getting uid for session"); ++ goto out; ++ } ++ ++ ret = polkit_unix_user_new (uid); ++ } ++ else /* consolekit */ ++ { ++ if (!ensure_database (monitor, error)) ++ { ++ g_prefix_error (error, "Error getting user for session: Error ensuring CK database at " CKDB_PATH ": "); ++ goto out; ++ } ++ ++ group = g_strdup_printf ("Session %s", polkit_unix_session_get_session_id (POLKIT_UNIX_SESSION (subject))); ++ local_error = NULL; ++ uid = g_key_file_get_integer (monitor->database, group, "uid", &local_error); ++ if (local_error != NULL) ++ { ++ g_propagate_prefixed_error (error, local_error, "Error getting uid using " CKDB_PATH ": "); ++ g_free (group); ++ goto out; ++ } ++ g_free (group); + } +- +- ret = polkit_unix_user_new (uid); + } + + out: +@@ -337,20 +506,43 @@ polkit_backend_session_monitor_get_session_for_subject (PolkitBackendSessionMoni + + if (POLKIT_IS_UNIX_PROCESS (subject)) + { +- gchar *session_id; +- pid_t pid; ++ if (sd_booted()) ++ { ++ gchar *session_id; ++ pid_t pid; + +- pid = polkit_unix_process_get_pid (POLKIT_UNIX_PROCESS (subject)); +- if (sd_pid_get_session (pid, &session_id) < 0) +- goto out; ++ pid = polkit_unix_process_get_pid (POLKIT_UNIX_PROCESS (subject)); ++ if (sd_pid_get_session (pid, &session_id) < 0) ++ goto out; + +- session = polkit_unix_session_new (session_id); +- free (session_id); ++ session = polkit_unix_session_new (session_id); ++ free (session_id); ++ } ++ else /* consolekit */ ++ { ++ const gchar *session_id; ++ GVariant *result; ++ result = g_dbus_connection_call_sync (monitor->system_bus, ++ "org.freedesktop.ConsoleKit", ++ "/org/freedesktop/ConsoleKit/Manager", ++ "org.freedesktop.ConsoleKit.Manager", ++ "GetSessionForUnixProcess", ++ g_variant_new ("(u)", polkit_unix_process_get_pid (POLKIT_UNIX_PROCESS (subject))), ++ G_VARIANT_TYPE ("(o)"), ++ G_DBUS_CALL_FLAGS_NONE, ++ -1, /* timeout_msec */ ++ NULL, /* GCancellable */ ++ error); ++ if (result == NULL) ++ goto out; ++ g_variant_get (result, "(&o)", &session_id); ++ session = polkit_unix_session_new (session_id); ++ g_variant_unref (result); ++ } + } + else if (POLKIT_IS_SYSTEM_BUS_NAME (subject)) + { + guint32 pid; +- gchar *session_id; + GVariant *result; + + result = g_dbus_connection_call_sync (monitor->system_bus, +@@ -369,11 +561,35 @@ polkit_backend_session_monitor_get_session_for_subject (PolkitBackendSessionMoni + g_variant_get (result, "(u)", &pid); + g_variant_unref (result); + +- if (sd_pid_get_session (pid, &session_id) < 0) +- goto out; ++ if (sd_booted()) ++ { ++ gchar *session_id; ++ if (sd_pid_get_session (pid, &session_id) < 0) ++ goto out; + +- session = polkit_unix_session_new (session_id); +- free (session_id); ++ session = polkit_unix_session_new (session_id); ++ free (session_id); ++ } ++ else /* consolekit */ ++ { ++ const gchar *session_id; ++ result = g_dbus_connection_call_sync (monitor->system_bus, ++ "org.freedesktop.ConsoleKit", ++ "/org/freedesktop/ConsoleKit/Manager", ++ "org.freedesktop.ConsoleKit.Manager", ++ "GetSessionForUnixProcess", ++ g_variant_new ("(u)", pid), ++ G_VARIANT_TYPE ("(o)"), ++ G_DBUS_CALL_FLAGS_NONE, ++ -1, /* timeout_msec */ ++ NULL, /* GCancellable */ ++ error); ++ if (result == NULL) ++ goto out; ++ g_variant_get (result, "(&o)", &session_id); ++ session = polkit_unix_session_new (session_id); ++ g_variant_unref (result); ++ } + } + else + { +@@ -389,12 +605,58 @@ polkit_backend_session_monitor_get_session_for_subject (PolkitBackendSessionMoni + return session; + } + ++static gboolean ++get_boolean (PolkitBackendSessionMonitor *monitor, ++ PolkitSubject *session, ++ const gchar *key_name) ++{ ++ gboolean ret; ++ gchar *group; ++ GError *error; ++ ++ ret = FALSE; ++ ++ group = g_strdup_printf ("Session %s", polkit_unix_session_get_session_id (POLKIT_UNIX_SESSION (session))); ++ ++ error = NULL; ++ if (!ensure_database (monitor, &error)) ++ { ++ g_printerr ("Error getting boolean `%s' in group `%s': Error ensuring CK database at " CKDB_PATH ": %s", ++ key_name, ++ group, ++ error->message); ++ g_error_free (error); ++ goto out; ++ } ++ ++ error = NULL; ++ ret = g_key_file_get_boolean (monitor->database, group, key_name, &error); ++ if (error != NULL) ++ { ++ g_printerr ("Error looking %s using " CKDB_PATH " for %s: %s\n", ++ key_name, ++ group, ++ error->message); ++ g_error_free (error); ++ goto out; ++ } ++ ++ out: ++ g_free (group); ++ return ret; ++} ++ + gboolean + polkit_backend_session_monitor_is_session_local (PolkitBackendSessionMonitor *monitor, + PolkitSubject *session) + { + char *seat; + ++ if (!sd_booted()) /* consolekit */ ++ { ++ return get_boolean (monitor, session, "is_local"); ++ } ++ + if (!sd_session_get_seat (polkit_unix_session_get_session_id (POLKIT_UNIX_SESSION (session)), &seat)) + { + free (seat); +@@ -409,6 +671,9 @@ gboolean + polkit_backend_session_monitor_is_session_active (PolkitBackendSessionMonitor *monitor, + PolkitSubject *session) + { +- return sd_session_is_active (polkit_unix_session_get_session_id (POLKIT_UNIX_SESSION (session))); ++ if (sd_booted()) ++ return sd_session_is_active (polkit_unix_session_get_session_id (POLKIT_UNIX_SESSION (session))); ++ else /* consolekit */ ++ return get_boolean (monitor, session, "is_active"); + } + +-- +1.7.11.4 + diff --git a/testing/polkit/polkit.install b/testing/polkit/polkit.install new file mode 100644 index 000000000..fbb98919e --- /dev/null +++ b/testing/polkit/polkit.install @@ -0,0 +1,18 @@ +post_install() { + getent group polkitd >/dev/null || groupadd -g 102 polkitd + getent passwd polkitd >/dev/null || useradd -c 'Policy Kit Daemon' -u 102 -g polkitd -d '/' -s /bin/false polkitd + passwd -l polkitd &>/dev/null +} + +post_upgrade() { + post_install +} + +post_remove() { + if getent passwd polkitd >/dev/null; then + userdel polkitd + fi + if getent group polkitd >/dev/null; then + groupdel polkitd + fi +} diff --git a/testing/polkit/polkit.pam b/testing/polkit/polkit.pam new file mode 100644 index 000000000..04f53e0db --- /dev/null +++ b/testing/polkit/polkit.pam @@ -0,0 +1,7 @@ +auth requisite pam_nologin.so +auth required pam_env.so +auth required pam_unix.so +account required pam_unix.so +session required pam_limits.so +session required pam_unix.so +password required pam_unix.so diff --git a/testing/postgresql-old-upgrade/PKGBUILD b/testing/postgresql-old-upgrade/PKGBUILD new file mode 100644 index 000000000..0334899a9 --- /dev/null +++ b/testing/postgresql-old-upgrade/PKGBUILD @@ -0,0 +1,41 @@ +# $Id: PKGBUILD 166685 2012-09-15 16:03:08Z dan $ +# Maintainer: Dan McGee <dan@archlinux.org> + +pkgname=postgresql-old-upgrade +pkgver=9.1.5 +_majorver=${pkgver%.*} +pkgrel=1 +pkgdesc="Minimal PostgreSQL build for migrating between major versions with pg_upgrade" +arch=('i686' 'x86_64') +url="http://www.postgresql.org/" +license=('custom:PostgreSQL') +depends=("postgresql-libs>=${_majorver}" 'libxml2' 'openssl>=1.0.0') +source=(ftp://ftp.postgresql.org/pub/source/v${pkgver}/postgresql-${pkgver}.tar.bz2) + +build() { + cd "${srcdir}/postgresql-${pkgver}" + + ./configure --prefix=/opt/pgsql-${_majorver} \ + --with-libxml --with-openssl --without-perl \ + --without-python --with-pam --without-readline \ + --with-system-tzdata=/usr/share/zoneinfo --disable-nls \ + --enable-thread-safety + + make -C src all +} + +package() { + cd "${srcdir}/postgresql-${pkgver}" + + # install + make DESTDIR="${pkgdir}" -C src install + + # install license + install -D -m644 COPYRIGHT "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE" + + # clean up unneeded installed items + rm -rf "${pkgdir}/opt/pgsql-${_majorver}/include/" +} + +md5sums=('c784decb60615aa94c6a31601bc6ffd2') +sha256sums=('0b889c132426fc68d8c2eb1bf112bf99cc653e9c95b5f4bbebc55cd9a8d6ce44') diff --git a/testing/postgresql/PKGBUILD b/testing/postgresql/PKGBUILD index e7f743d8e..7a79156d6 100644 --- a/testing/postgresql/PKGBUILD +++ b/testing/postgresql/PKGBUILD @@ -1,32 +1,32 @@ -# $Id: PKGBUILD 165398 2012-08-17 23:34:22Z heftig $ +# $Id: PKGBUILD 166687 2012-09-15 16:47:20Z dan $ # Maintainer: Dan McGee <dan@archlinux.org> pkgbase=postgresql pkgname=('postgresql-libs' 'postgresql-docs' 'postgresql') -pkgver=9.1.4 +pkgver=9.2.0 _majorver=${pkgver%.*} -pkgrel=2 +pkgrel=1 arch=('i686' 'x86_64') url="http://www.postgresql.org/" license=('custom:PostgreSQL') makedepends=('krb5' 'libxml2' 'python2' 'perl' 'tcl' 'openssl>=1.0.0') -source=(ftp://ftp.postgresql.org/pub/source/v${pkgver}/postgresql-${pkgver}.tar.bz2 +source=(http://ftp.postgresql.org/pub/source/v${pkgver}/postgresql-${pkgver}.tar.bz2 postgresql.rcd postgresql.confd postgresql.pam postgresql.logrotate - postgresql.service postgresql-initdb) -md5sums=('a8035688dba988b782725ac1aec60186' + postgresql.service postgresql-check-db-dir) +md5sums=('8c4c32a4abe8cf61b02c8366181ede50' '1ddd1df8010549f237e7983bb326025e' 'a54d09a20ab1672adf08f037df188d53' '96f82c38f3f540b53f3e5144900acf17' 'd28e443f9f65a5712c52018b84e27137' - '1ec1fbf1ce998324248c543e6cc2c5e6' - '1488a98a5d5d96a04416e4f5872223bf') -sha256sums=('a0795a8eb3ae2d1a2914b63bf143d20182835d90699915ff43567c041d3c9712' + 'f0d46e63198db0a1e51dcd4a0599cd33' + '505e0e4abfc746cae9558584d471a03c') +sha256sums=('3731c607df492bbb57f37917b49f57719c0d6f823720426431fff10d82b1fe33' '9f6307b1358892e304f9474a456f0cb9160cfb8812a9da0430abe647f8a9cf45' '3de5c059eead8816db15c2c5588e6196d6c4b0d704faf1a20912796cf589ba81' '57dfd072fd7ef0018c6b0a798367aac1abb5979060ff3f9df22d1048bb71c0d5' '6abb842764bbed74ea4a269d24f1e73d1c0b1d8ecd6e2e6fb5fb10590298605e' - '7014ccc8f3bbac8be9473a43fca2ed4037ee04e56d8e07d6027b3b4ef0317c89' - 'c22f82a3cf5b555935039853fab2d7e5ff6188cdb1fb528fa9171a87b94f42b0') + 'af41dd8c1e6b124880fb4347c9fa4adabdef5b6e6bd13601cac25eb9e7bc7774' + '3a3279d290f556bf7a362670e32b491794f47ed218f6b8c6acef366a3291f669') build() { cd "${srcdir}/postgresql-${pkgver}" @@ -139,8 +139,8 @@ package_postgresql() { install -D -m755 "${srcdir}/postgresql.rcd" "${pkgdir}/etc/rc.d/postgresql" install -D -m644 "${srcdir}/postgresql.service" \ "${pkgdir}/usr/lib/systemd/system/postgresql.service" - install -D -m755 "${srcdir}/postgresql-initdb" \ - "${pkgdir}/usr/lib/systemd/scripts/postgresql-initdb" + install -D -m755 "${srcdir}/postgresql-check-db-dir" \ + "${pkgdir}/usr/bin/postgresql-check-db-dir" # install conf file install -D -m644 ${srcdir}/postgresql.confd \ diff --git a/testing/postgresql/postgresql-check-db-dir b/testing/postgresql/postgresql-check-db-dir new file mode 100755 index 000000000..542c82209 --- /dev/null +++ b/testing/postgresql/postgresql-check-db-dir @@ -0,0 +1,49 @@ +#!/bin/sh + +# This script verifies that the postgresql data directory has been correctly +# initialized. We do not want to automatically initdb it, because that has +# a risk of catastrophic failure (ie, overwriting a valuable database) in +# corner cases, such as a remotely mounted database on a volume that's a +# bit slow to mount. But we can at least emit a message advising newbies +# what to do. + +PGDATA="$1" + +if [ -z "$PGDATA" ] +then + echo "Usage: $0 database-path" + exit 1 +fi + +# PGMAJORVERSION is major version +PGMAJORVERSION=9.2 +# PREVMAJORVERSION is the previous major version, e.g., 8.4, for upgrades +PREVMAJORVERSION=9.1 + +# Check for the PGDATA structure +if [ -f "$PGDATA/PG_VERSION" ] && [ -d "$PGDATA/base" ] +then + # Check version of existing PGDATA + if [ x`cat "$PGDATA/PG_VERSION"` = x"$PGMAJORVERSION" ] + then + : A-OK + elif [ x`cat "$PGDATA/PG_VERSION"` = x"$PREVMAJORVERSION" ] + then + echo $"An old version of the database format was found." + echo $"See https://wiki.archlinux.org/index.php/PostgreSQL#Upgrading_PostgreSQL" + exit 1 + else + echo $"An old version of the database format was found." + echo $"You need to dump and reload before using PostgreSQL $PGMAJORVERSION." + echo $"See http://www.postgresql.org/docs/9.2/static/upgrading.html" + exit 1 + fi +else + # No existing PGDATA! Warn the user to initdb it. + echo $"\"$PGDATA\" is missing or empty. Use a command like" + echo $" su - postgres -c \"initdb --locale en_US.UTF-8 -D '$PGDATA'\"" + echo $"with relevant options, to initialize the database cluster." + exit 1 +fi + +exit 0 diff --git a/testing/postgresql/postgresql.install b/testing/postgresql/postgresql.install index c52432271..7b73f6fa9 100644 --- a/testing/postgresql/postgresql.install +++ b/testing/postgresql/postgresql.install @@ -2,9 +2,13 @@ post_install() { if [ ! -d '/var/lib/postgres' ]; then mkdir -p '/var/lib/postgres' fi - getent group postgres >/dev/null || groupadd -g 88 postgres - getent passwd postgres >/dev/null || useradd -c 'PostgreSQL user' -u 88 -g postgres -d '/var/lib/postgres' -s /bin/bash postgres - passwd -l postgres >/dev/null + if ! getent group postgres >/dev/null; then + groupadd -g 88 postgres + fi + if ! getent passwd postgres >/dev/null; then + useradd -c 'PostgreSQL user' -u 88 -g postgres -d '/var/lib/postgres' -s /bin/bash postgres + passwd -l postgres >/dev/null + fi } post_upgrade() { diff --git a/testing/postgresql/postgresql.service b/testing/postgresql/postgresql.service index 2fcd3e93d..bea14e01e 100644 --- a/testing/postgresql/postgresql.service +++ b/testing/postgresql/postgresql.service @@ -1,19 +1,26 @@ [Unit] Description=PostgreSQL database server +After=network.target [Service] Type=forking +TimeoutSec=120 +User=postgres +Group=postgres + +Environment=PGROOT=/var/lib/postgres +Environment=PGLOG=/var/log/postgresql.log + SyslogIdentifier=postgres PIDFile=/var/lib/postgres/data/postmaster.pid -# initdb script takes care for symlinking $PGROOT to /var/lib/postgres -ExecStartPre=/usr/lib/systemd/scripts/postgresql-initdb -ExecStart= /bin/su - postgres -m -c "/usr/bin/pg_ctl -s -D /var/lib/postgres/data start" -ExecReload=/bin/su - postgres -m -c "/usr/bin/pg_ctl -s -D /var/lib/postgres/data reload" -ExecStop= /bin/su - postgres -m -c "/usr/bin/pg_ctl -s -D /var/lib/postgres/data stop -m fast" +ExecStartPre=/usr/bin/postgresql-check-db-dir ${PGROOT}/data +ExecStart= /usr/bin/pg_ctl -s -D ${PGROOT}/data start -w -t 120 +ExecReload=/usr/bin/pg_ctl -s -D ${PGROOT}/data reload +ExecStop= /usr/bin/pg_ctl -s -D ${PGROOT}/data stop -m fast # Due to PostgreSQL's use of shared memory, OOM killer is often overzealous in -# killing Postgres +# killing Postgres, so adjust it downward OOMScoreAdjust=-200 [Install] |