summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandre Rostovtsev <tetromino@gentoo.org>2012-02-20 09:25:00 +0000
committerAlexandre Rostovtsev <tetromino@gentoo.org>2012-02-20 09:25:00 +0000
commit2e1f8875e8b051132dbb08aa8c311ef33732eb86 (patch)
tree399274f506bbbc45dd18df9039f81d8b3a6e9759
parentStable for AMD64, wrt security bug #401645 (diff)
downloadgentoo-2-2e1f8875e8b051132dbb08aa8c311ef33732eb86.tar.gz
gentoo-2-2e1f8875e8b051132dbb08aa8c311ef33732eb86.tar.bz2
gentoo-2-2e1f8875e8b051132dbb08aa8c311ef33732eb86.zip
Fix openrc service going inactive while active connections are present (bug #402613, thanks to Thomas Witt). Try to be more user-friendly by waiting a few seconds before marking the service as inactive. Dispatch a pre-sleep event to unmount network filesystems before suspending (bug #402085, thanks to Marien Zwart). Do not truncate WPA passwords at '#' character (bug #402133, thanks to John Hardin).
(Portage version: 2.2.0_alpha87/cvs/Linux x86_64)
-rw-r--r--net-misc/networkmanager/ChangeLog16
-rw-r--r--net-misc/networkmanager/files/10-openrc-status-r123
-rw-r--r--net-misc/networkmanager/files/networkmanager-0.9.2.0-ifnet-password-truncated.patch47
-rw-r--r--net-misc/networkmanager/files/networkmanager-0.9.2.0-init-provide-net-r1.patch59
-rw-r--r--net-misc/networkmanager/files/networkmanager-0.9.2.0-pre-sleep.patch232
-rw-r--r--net-misc/networkmanager/networkmanager-0.9.2.0-r4.ebuild175
6 files changed, 551 insertions, 1 deletions
diff --git a/net-misc/networkmanager/ChangeLog b/net-misc/networkmanager/ChangeLog
index 2e60d603be2f..a8617143141e 100644
--- a/net-misc/networkmanager/ChangeLog
+++ b/net-misc/networkmanager/ChangeLog
@@ -1,6 +1,20 @@
# ChangeLog for net-misc/networkmanager
# Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/net-misc/networkmanager/ChangeLog,v 1.126 2012/02/02 00:34:59 tetromino Exp $
+# $Header: /var/cvsroot/gentoo-x86/net-misc/networkmanager/ChangeLog,v 1.127 2012/02/20 09:25:00 tetromino Exp $
+
+*networkmanager-0.9.2.0-r4 (20 Feb 2012)
+
+ 20 Feb 2012; Alexandre Rostovtsev <tetromino@gentoo.org>
+ +files/10-openrc-status-r1, +networkmanager-0.9.2.0-r4.ebuild,
+ +files/networkmanager-0.9.2.0-ifnet-password-truncated.patch,
+ +files/networkmanager-0.9.2.0-init-provide-net-r1.patch,
+ +files/networkmanager-0.9.2.0-pre-sleep.patch:
+ Fix openrc service going inactive while active connections are present (bug
+ #402613, thanks to Thomas Witt). Try to be more user-friendly by waiting a
+ few seconds before marking the service as inactive. Dispatch a pre-sleep
+ event to unmount network filesystems before suspending (bug #402085, thanks
+ to Marien Zwart). Do not truncate WPA passwords at '#' character (bug
+ #402133, thanks to John Hardin).
*networkmanager-0.9.2.0-r3 (02 Feb 2012)
diff --git a/net-misc/networkmanager/files/10-openrc-status-r1 b/net-misc/networkmanager/files/10-openrc-status-r1
new file mode 100644
index 000000000000..53716b1b8478
--- /dev/null
+++ b/net-misc/networkmanager/files/10-openrc-status-r1
@@ -0,0 +1,23 @@
+#!/bin/sh
+# Copyright (c) 2012 Alexandre Rostovtsev
+# Released under the 2-clause BSD license.
+
+# Ensures that the NetworkManager OpenRC service is marked as started and
+# providing net only when it has a successful connection.
+
+# Ensure rc-service is in PATH
+PATH="${PATH}:@EPREFIX@/sbin:@EPREFIX@/usr/sbin"
+
+# Exit if the NetworkManager OpenRC service is not running
+rc-service NetworkManager status 2>&1 | grep -Eq "status: (starting|started|inactive|stopping)" || exit 0
+
+# Call rc-service in background mode so that the start/stop functions update
+# NetworkManager service status to started or inactive instead of actually
+# starting or stopping the daemon
+export IN_BACKGROUND=YES
+
+case "$2" in
+ up) nm-online -t 0 && exec rc-service NetworkManager start ;;
+ down) nm-online -t 0 || exec rc-service NetworkManager stop ;;
+ pre-sleep) exec rc-service NetworkManager stop ;;
+esac
diff --git a/net-misc/networkmanager/files/networkmanager-0.9.2.0-ifnet-password-truncated.patch b/net-misc/networkmanager/files/networkmanager-0.9.2.0-ifnet-password-truncated.patch
new file mode 100644
index 000000000000..d41c4b2e07a6
--- /dev/null
+++ b/net-misc/networkmanager/files/networkmanager-0.9.2.0-ifnet-password-truncated.patch
@@ -0,0 +1,47 @@
+From 03d80950e960031af977c3037b57d41e36701fb2 Mon Sep 17 00:00:00 2001
+From: Alexandre Rostovtsev <tetromino@gentoo.org>
+Date: Sat, 18 Feb 2012 20:03:33 -0500
+Subject: [PATCH] ifnet: do not truncate WPA passwords at '#' character
+
+We need to do the same thing as wpa_supplicant's own config file parser
+and ignore '#' characters that occur between the first and last '"'
+characters in a config file line.
+
+https://bugzilla.gnome.org/show_bug.cgi?id=670381
+---
+ src/settings/plugins/ifnet/wpa_parser.c | 13 +++++++++----
+ 1 files changed, 9 insertions(+), 4 deletions(-)
+
+diff --git a/src/settings/plugins/ifnet/wpa_parser.c b/src/settings/plugins/ifnet/wpa_parser.c
+index da2bc3b..f7a5b32 100644
+--- a/src/settings/plugins/ifnet/wpa_parser.c
++++ b/src/settings/plugins/ifnet/wpa_parser.c
+@@ -279,16 +279,21 @@ wpa_parser_init (const char *wpa_supplicant_conf)
+ } else {
+ GHashTable *network =
+ g_hash_table_new (g_str_hash, g_str_equal);
+- gchar *tmp;
+
+ do {
++ gchar *quote_start, *quote_end = NULL, *comment;
++
+ if (line[0] == '#' || line[0] == '\0') {
+ g_free (line);
+ continue;
+ }
+- /* ignore inline comments */
+- if ((tmp = strchr (line, '#')) != NULL)
+- *tmp = '\0';
++ /* ignore inline comments unless inside
++ a double-quoted string */
++ if ((quote_start = strchr (line, '"')) != NULL)
++ quote_end = strrchr (quote_start + 1, '"');
++ if ((comment = strchr ((quote_end != NULL) ?
++ quote_end : line, '#')) != NULL)
++ *comment = '\0';
+ if (strstr (line, "}") != NULL)
+ complete = TRUE;
+ add_key_value (network, line);
+--
+1.7.8.4
+
diff --git a/net-misc/networkmanager/files/networkmanager-0.9.2.0-init-provide-net-r1.patch b/net-misc/networkmanager/files/networkmanager-0.9.2.0-init-provide-net-r1.patch
new file mode 100644
index 000000000000..dbe563567cd7
--- /dev/null
+++ b/net-misc/networkmanager/files/networkmanager-0.9.2.0-init-provide-net-r1.patch
@@ -0,0 +1,59 @@
+From e99873e7583a3838e0873b1d0b1f9c3dac49f853 Mon Sep 17 00:00:00 2001
+From: Alexandre Rostovtsev <tetromino@gentoo.org>
+Date: Wed, 1 Feb 2012 05:51:20 -0500
+Subject: [PATCH] gentoo: provide net and use inactive status when not
+ connected
+
+The status will be reset to started via a dispatcher script on up/down
+events. See https://bugs.gentoo.org/show_bug.cgi?id=252137
+---
+ initscript/Gentoo/NetworkManager.in | 22 +++++++++++++++++++++-
+ 1 files changed, 21 insertions(+), 1 deletions(-)
+
+diff --git a/initscript/Gentoo/NetworkManager.in b/initscript/Gentoo/NetworkManager.in
+index 7db410b..34f19b1 100755
+--- a/initscript/Gentoo/NetworkManager.in
++++ b/initscript/Gentoo/NetworkManager.in
+@@ -3,18 +3,38 @@
+ # Distributed under the terms of the GNU General Purpose License v2
+ # $Header: /var/cvsroot/gentoo-x86/net-misc/networkmanager/files/networkmanager-0.9.2.0-init-provide-net-r1.patch,v 1.1 2012/02/20 09:24:59 tetromino Exp $
+
++description="NetworkManager daemon. The service is marked as started only \
++when a network connection is established."
++
+ depend() {
+ need dbus
++ provide net
+ }
+
+ start() {
++ # If we are re-called by a dispatcher event, we want to mark the service
++ # as started without starting the daemon again
++ yesno "${IN_BACKGROUND}" && return 0
++
+ ebegin "Starting NetworkManager"
+ start-stop-daemon --start --quiet --pidfile /var/run/NetworkManager.pid \
+ --exec /usr/sbin/NetworkManager -- --pid-file /var/run/NetworkManager.pid
+- eend $?
++ local _retval=$?
++ eend "${_retval}"
++ if [ "x${_retval}" = 'x0' ]; then
++ nm-online -t 5 || mark_service_inactive
++ fi
++ return "${_retval}"
+ }
+
+ stop() {
++ # If we are re-called by a dispatcher event, we want to mark the service
++ # as inactive without stopping the daemon
++ if yesno "${IN_BACKGROUND}"; then
++ mark_service_inactive "${SVCNAME}"
++ return 0
++ fi
++
+ ebegin "Stopping NetworkManager"
+ start-stop-daemon --stop --quiet --pidfile /var/run/NetworkManager.pid
+ eend $?
+--
+1.7.8.4
+
diff --git a/net-misc/networkmanager/files/networkmanager-0.9.2.0-pre-sleep.patch b/net-misc/networkmanager/files/networkmanager-0.9.2.0-pre-sleep.patch
new file mode 100644
index 000000000000..1280327953af
--- /dev/null
+++ b/net-misc/networkmanager/files/networkmanager-0.9.2.0-pre-sleep.patch
@@ -0,0 +1,232 @@
+From 00b5c3785f7f5ce8da6db5da3fab814680ff82bc Mon Sep 17 00:00:00 2001
+From: Alexandre Rostovtsev <tetromino@gentoo.org>
+Date: Mon, 20 Feb 2012 02:14:26 -0500
+Subject: [PATCH] Implement "pre-sleep" action dispatch
+
+Based on work by Christian Becke <christianbecke@gmail.com> in
+https://bugzilla.gnome.org/show_bug.cgi?id=387832
+
+Adds a nm_utils_call_dispatcher_with_notify variant of the dispatcher
+call, and uses it to dispatch a "pre-sleep" action before sleeping.
+---
+ callouts/nm-dispatcher-utils.c | 3 +-
+ src/NetworkManagerUtils.c | 70 ++++++++++++++++++++++++++++++++++------
+ src/NetworkManagerUtils.h | 12 +++++++
+ src/nm-manager.c | 28 ++++++++++++----
+ 4 files changed, 95 insertions(+), 18 deletions(-)
+
+diff --git a/callouts/nm-dispatcher-utils.c b/callouts/nm-dispatcher-utils.c
+index 887e80d..db66b61 100644
+--- a/callouts/nm-dispatcher-utils.c
++++ b/callouts/nm-dispatcher-utils.c
+@@ -407,7 +407,8 @@ nm_dispatcher_utils_construct_envp (const char *action,
+ g_return_val_if_fail (*out_iface == NULL, NULL);
+
+ /* Hostname changes don't require a device nor contain a connection */
+- if (!strcmp (action, "hostname"))
++ if (!strcmp (action, "hostname") ||
++ !strcmp (action, "pre-sleep"))
+ return g_new0 (char *, 1);
+
+ /* Canonicalize the VPN interface name; "" is used when passing it through
+diff --git a/src/NetworkManagerUtils.c b/src/NetworkManagerUtils.c
+index 451de6d..008b94e 100644
+--- a/src/NetworkManagerUtils.c
++++ b/src/NetworkManagerUtils.c
+@@ -44,6 +44,13 @@
+ #include "nm-setting-wireless-security.h"
+ #include "nm-manager-auth.h"
+
++typedef struct
++{
++ NMDBusManager *dbus_mgr;
++ NMUtilsDispatcherDoneCallback notify;
++ gpointer user_data;
++} NMUtilsCallDispatcherNotifyData;
++
+ /*
+ * nm_ethernet_address_is_valid
+ *
+@@ -475,18 +482,36 @@ fill_vpn_props (NMIP4Config *ip4_config,
+ static void
+ dispatcher_done_cb (DBusGProxy *proxy, DBusGProxyCall *call, gpointer user_data)
+ {
++ NMUtilsCallDispatcherNotifyData *notify_data = (NMUtilsCallDispatcherNotifyData *) user_data;
++
+ dbus_g_proxy_end_call (proxy, call, NULL, G_TYPE_INVALID);
+ g_object_unref (proxy);
++ if (notify_data->notify != NULL)
++ notify_data->notify (notify_data->user_data);
++}
++
++static void
++nm_utils_call_dispatcher_notify_data_free (NMUtilsCallDispatcherNotifyData *data)
++{
++ if (data == NULL)
++ return;
++
++ if (data->dbus_mgr != NULL)
++ g_object_unref (data->dbus_mgr);
++ g_free (data);
+ }
+
+ void
+-nm_utils_call_dispatcher (const char *action,
+- NMConnection *connection,
+- NMDevice *device,
+- const char *vpn_iface,
+- NMIP4Config *vpn_ip4_config,
+- NMIP6Config *vpn_ip6_config)
++nm_utils_call_dispatcher_with_notify (const char *action,
++ NMConnection *connection,
++ NMDevice *device,
++ const char *vpn_iface,
++ NMIP4Config *vpn_ip4_config,
++ NMIP6Config *vpn_ip6_config,
++ NMUtilsDispatcherDoneCallback notify,
++ gpointer user_data)
+ {
++ NMUtilsCallDispatcherNotifyData *notify_data;
+ NMDBusManager *dbus_mgr;
+ DBusGProxy *proxy;
+ DBusGConnection *g_connection;
+@@ -503,7 +528,8 @@ nm_utils_call_dispatcher (const char *action,
+ g_return_if_fail (action != NULL);
+
+ /* All actions except 'hostname' require a device */
+- if (strcmp (action, "hostname") != 0)
++ if (strcmp (action, "hostname") != 0 &&
++ strcmp (action, "pre-sleep") != 0)
+ g_return_if_fail (NM_IS_DEVICE (device));
+ /* VPN actions require at least an IPv4 config (for now) */
+ if (strcmp (action, "vpn-up") == 0)
+@@ -544,7 +570,8 @@ nm_utils_call_dispatcher (const char *action,
+ vpn_ip6_props = value_hash_create ();
+
+ /* hostname actions only send the hostname */
+- if (strcmp (action, "hostname") != 0) {
++ if (strcmp (action, "hostname") != 0 &&
++ strcmp (action, "pre-sleep") != 0) {
+ fill_device_props (device,
+ device_props,
+ device_ip4_props,
+@@ -555,6 +582,11 @@ nm_utils_call_dispatcher (const char *action,
+ fill_vpn_props (vpn_ip4_config, NULL, vpn_ip4_props, vpn_ip6_props);
+ }
+
++ notify_data = g_new0 (NMUtilsCallDispatcherNotifyData, 1);
++ notify_data->dbus_mgr = dbus_mgr;
++ notify_data->notify = notify;
++ notify_data->user_data = user_data;
++
+ /* Do a non-blocking call, but wait for the reply, because dbus-glib
+ * sometimes needs time to complete internal housekeeping. If we use
+ * dbus_g_proxy_call_no_reply(), that housekeeping (specifically the
+@@ -563,8 +595,8 @@ nm_utils_call_dispatcher (const char *action,
+ */
+ dbus_g_proxy_begin_call_with_timeout (proxy, "Action",
+ dispatcher_done_cb,
+- dbus_mgr, /* automatically unref the dbus mgr when call is done */
+- g_object_unref,
++ notify_data, /* automatically unref the dbus mgr when call is done */
++ (GDestroyNotify) nm_utils_call_dispatcher_notify_data_free,
+ 5000,
+ G_TYPE_STRING, action,
+ DBUS_TYPE_G_MAP_OF_MAP_OF_VARIANT, connection_hash,
+@@ -589,6 +621,24 @@ nm_utils_call_dispatcher (const char *action,
+ g_hash_table_destroy (vpn_ip6_props);
+ }
+
++void
++nm_utils_call_dispatcher (const char *action,
++ NMConnection *connection,
++ NMDevice *device,
++ const char *vpn_iface,
++ NMIP4Config *vpn_ip4_config,
++ NMIP6Config *vpn_ip6_config)
++{
++ nm_utils_call_dispatcher_with_notify (action,
++ connection,
++ device,
++ vpn_iface,
++ vpn_ip4_config,
++ vpn_ip6_config,
++ NULL,
++ NULL);
++}
++
+ gboolean
+ nm_match_spec_hwaddr (const GSList *specs, const char *hwaddr)
+ {
+diff --git a/src/NetworkManagerUtils.h b/src/NetworkManagerUtils.h
+index 1bf741e..bdc0fef 100644
+--- a/src/NetworkManagerUtils.h
++++ b/src/NetworkManagerUtils.h
+@@ -49,6 +49,18 @@ void nm_utils_call_dispatcher (const char *action,
+ NMIP4Config *vpn_ip4_config,
+ NMIP6Config *vpn_ip6_config);
+
++typedef void (*NMUtilsDispatcherDoneCallback) (gpointer user_data);
++
++void
++nm_utils_call_dispatcher_with_notify (const char *action,
++ NMConnection *connection,
++ NMDevice *device,
++ const char *vpn_iface,
++ NMIP4Config *vpn_ip4_config,
++ NMIP6Config *vpn_ip6_config,
++ NMUtilsDispatcherDoneCallback notify,
++ gpointer user_data);
++
+ gboolean nm_match_spec_hwaddr (const GSList *specs, const char *hwaddr);
+ gboolean nm_match_spec_s390_subchannels (const GSList *specs, const char *subchannels);
+
+diff --git a/src/nm-manager.c b/src/nm-manager.c
+index 7205c7a..9e70071 100644
+--- a/src/nm-manager.c
++++ b/src/nm-manager.c
+@@ -2433,6 +2433,23 @@ impl_manager_deactivate_connection (NMManager *self,
+ }
+
+ static void
++pre_sleep_dispatcher_done (gpointer user_data)
++{
++ NMManager *self = (NMManager *) user_data;
++ NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (self);
++ GSList *iter;
++
++ /* Just deactivate and down all devices from the device list,
++ * to keep things fast the device list will get resynced when
++ * the manager wakes up.
++ */
++ for (iter = priv->devices; iter; iter = iter->next)
++ nm_device_set_managed (NM_DEVICE (iter->data), FALSE, NM_DEVICE_STATE_REASON_SLEEPING);
++
++ nm_manager_update_state (self);
++}
++
++static void
+ do_sleep_wake (NMManager *self)
+ {
+ NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (self);
+@@ -2442,13 +2459,10 @@ do_sleep_wake (NMManager *self)
+ if (manager_sleeping (self)) {
+ nm_log_info (LOGD_SUSPEND, "sleeping or disabling...");
+
+- /* Just deactivate and down all devices from the device list,
+- * to keep things fast the device list will get resynced when
+- * the manager wakes up.
+- */
+- for (iter = priv->devices; iter; iter = iter->next)
+- nm_device_set_managed (NM_DEVICE (iter->data), FALSE, NM_DEVICE_STATE_REASON_SLEEPING);
+-
++ nm_utils_call_dispatcher_with_notify ("pre-sleep",
++ NULL, NULL, NULL, NULL, NULL,
++ pre_sleep_dispatcher_done, self);
++ return;
+ } else {
+ nm_log_info (LOGD_SUSPEND, "waking up and re-enabling...");
+
+--
+1.7.8.4
+
diff --git a/net-misc/networkmanager/networkmanager-0.9.2.0-r4.ebuild b/net-misc/networkmanager/networkmanager-0.9.2.0-r4.ebuild
new file mode 100644
index 000000000000..cf34fa197bfe
--- /dev/null
+++ b/net-misc/networkmanager/networkmanager-0.9.2.0-r4.ebuild
@@ -0,0 +1,175 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-misc/networkmanager/networkmanager-0.9.2.0-r4.ebuild,v 1.1 2012/02/20 09:25:00 tetromino Exp $
+
+EAPI="4"
+GNOME_ORG_MODULE="NetworkManager"
+
+inherit autotools eutils gnome.org linux-info systemd
+
+DESCRIPTION="Network configuration and management in an easy way. Desktop environment independent."
+HOMEPAGE="http://www.gnome.org/projects/NetworkManager/"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE="avahi bluetooth doc +nss gnutls dhclient +dhcpcd +introspection
+ kernel_linux +ppp resolvconf connection-sharing wimax"
+KEYWORDS="~amd64 ~arm ~ppc ~ppc64 ~x86"
+
+REQUIRED_USE="
+ ^^ ( nss gnutls )
+ ^^ ( dhclient dhcpcd )"
+
+# gobject-introspection-0.10.3 is needed due to gnome bug 642300
+# wpa_supplicant-0.7.3-r3 is needed due to bug 359271
+# libnl:1.1 is needed for linking to net-wireless/wimax libraries
+# XXX: on bump, check that net-wireless/wimax is still using libnl:1.1 !
+# TODO: Qt support?
+COMMON_DEPEND=">=sys-apps/dbus-1.2
+ >=dev-libs/dbus-glib-0.75
+ >=net-wireless/wireless-tools-28_pre9
+ || ( >=sys-fs/udev-171[gudev] >=sys-fs/udev-147[extras] )
+ >=dev-libs/glib-2.26
+ >=sys-auth/polkit-0.97
+ dev-libs/libnl:1.1
+ >=net-wireless/wpa_supplicant-0.7.3-r3[dbus]
+ bluetooth? ( >=net-wireless/bluez-4.82 )
+ avahi? ( net-dns/avahi[autoipd] )
+ gnutls? (
+ dev-libs/libgcrypt
+ net-libs/gnutls )
+ nss? ( >=dev-libs/nss-3.11 )
+ dhclient? ( net-misc/dhcp )
+ dhcpcd? ( >=net-misc/dhcpcd-4.0.0_rc3 )
+ introspection? ( >=dev-libs/gobject-introspection-0.10.3 )
+ ppp? (
+ >=net-misc/modemmanager-0.4
+ >=net-dialup/ppp-2.4.5 )
+ resolvconf? ( net-dns/openresolv )
+ connection-sharing? (
+ net-dns/dnsmasq
+ net-firewall/iptables )
+ wimax? ( >=net-wireless/wimax-1.5.1 )"
+
+RDEPEND="${COMMON_DEPEND}
+ sys-auth/consolekit"
+
+DEPEND="${COMMON_DEPEND}
+ dev-util/pkgconfig
+ >=dev-util/intltool-0.40
+ >=sys-devel/gettext-0.17
+ doc? ( >=dev-util/gtk-doc-1.8 )"
+
+sysfs_deprecated_check() {
+ ebegin "Checking for SYSFS_DEPRECATED support"
+
+ if { linux_chkconfig_present SYSFS_DEPRECATED_V2; }; then
+ eerror "Please disable SYSFS_DEPRECATED_V2 support in your kernel config and recompile your kernel"
+ eerror "or NetworkManager will not work correctly."
+ eerror "See http://bugs.gentoo.org/333639 for more info."
+ die "CONFIG_SYSFS_DEPRECATED_V2 support detected!"
+ fi
+ eend $?
+}
+
+pkg_pretend() {
+ if use kernel_linux; then
+ get_version
+ if linux_config_exists; then
+ sysfs_deprecated_check
+ else
+ ewarn "Was unable to determine your kernel .config"
+ ewarn "Please note that if CONFIG_SYSFS_DEPRECATED_V2 is set in your kernel .config, NetworkManager will not work correctly."
+ ewarn "See http://bugs.gentoo.org/333639 for more info."
+ fi
+
+ fi
+}
+
+pkg_setup() {
+ enewgroup plugdev
+}
+
+src_prepare() {
+ # Don't build tests
+ epatch "${FILESDIR}/${PN}-0.9_rc3-fix-tests.patch"
+ # Build against libnl:1.1 for net-wireless/wimax-1.5.2 compatibility
+ epatch "${FILESDIR}/${PN}-0.9.1.95-force-libnl1.1.patch"
+ # Migrate to openrc style
+ epatch "${FILESDIR}/${P}-ifnet-openrc-style.patch"
+ # Ignore per-user connections
+ epatch "${FILESDIR}/${P}-ifnet-ignore-user-connections.patch"
+ # Remove system prefix
+ epatch "${FILESDIR}/${P}-ifnet-remove-system-prefix.patch"
+ # Correctly deal with single quotes in /etc/conf.d/hostname
+ epatch "${FILESDIR}/${P}-ifnet-unquote-hostname.patch"
+ # Update init.d script to provide net and use inactive status if not connected
+ epatch "${FILESDIR}/${P}-init-provide-net-r1.patch"
+ # Bug #402133, https://bugzilla.gnome.org/show_bug.cgi?id=670381
+ epatch "${FILESDIR}/${P}-ifnet-password-truncated.patch"
+ # Bug #402085, https://bugzilla.gnome.org/show_bug.cgi?id=387832
+ epatch "${FILESDIR}/${P}-pre-sleep.patch"
+
+ eautoreconf
+ default
+}
+
+src_configure() {
+ ECONF="--disable-more-warnings
+ --disable-static
+ --localstatedir=/var
+ --with-distro=gentoo
+ --with-dbus-sys-dir=/etc/dbus-1/system.d
+ --with-udev-dir=/lib/udev
+ --with-iptables=/sbin/iptables
+ $(use_enable doc gtk-doc)
+ $(use_enable introspection)
+ $(use_enable ppp)
+ $(use_enable wimax)
+ $(use_with dhclient)
+ $(use_with dhcpcd)
+ $(use_with doc docs)
+ $(use_with resolvconf)
+ $(systemd_with_unitdir)"
+
+ if use nss ; then
+ ECONF="${ECONF} $(use_with nss crypto=nss)"
+ else
+ ECONF="${ECONF} $(use_with gnutls crypto=gnutls)"
+ fi
+
+ econf ${ECONF}
+}
+
+src_install() {
+ default
+ # /var/run/NetworkManager is used by some distros, but not by Gentoo
+ rmdir -v "${ED}/var/run/NetworkManager" || die "rmdir failed"
+
+ # Need to keep the /etc/NetworkManager/dispatched.d for dispatcher scripts
+ keepdir /etc/NetworkManager/dispatcher.d
+
+ # Provide openrc net dependency only when nm is connected
+ exeinto /etc/NetworkManager/dispatcher.d
+ newexe "${FILESDIR}/10-openrc-status-r1" 10-openrc-status
+ sed -e "s:@EPREFIX@:${EPREFIX}:g" \
+ -i "${ED}/etc/NetworkManager/dispatcher.d/10-openrc-status" || die
+
+ # Add keyfile plugin support
+ keepdir /etc/NetworkManager/system-connections
+ chmod 0600 "${ED}"/etc/NetworkManager/system-connections/.keep* # bug #383765
+ insinto /etc/NetworkManager
+ newins "${FILESDIR}/nm-system-settings.conf-ifnet" nm-system-settings.conf
+
+ # Allow users in plugdev group to modify system connections
+ insinto /etc/polkit-1/localauthority/10-vendor.d
+ doins "${FILESDIR}/01-org.freedesktop.NetworkManager.settings.modify.system.pkla"
+
+ # Remove useless .la files
+ find "${D}" -name '*.la' -exec rm -f {} + || die "la file removal failed"
+}
+
+pkg_postinst() {
+ elog "To modify system network connections without needing to enter the"
+ elog "root password, add your user account to the 'plugdev' group."
+}