summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandre Rostovtsev <tetromino@gentoo.org>2012-02-01 07:46:37 +0000
committerAlexandre Rostovtsev <tetromino@gentoo.org>2012-02-01 07:46:37 +0000
commit98247fd3fb1f2e4eadd774c9126826315adb397f (patch)
tree7dc8cbfc758dbc8d43b63c2c7b648f14daf545bc /net-misc/networkmanager
parentuse tc-getCC instaed of hardcoded gcc (bug #401341, comment #1). Thanks for p... (diff)
downloadgentoo-2-98247fd3fb1f2e4eadd774c9126826315adb397f.tar.gz
gentoo-2-98247fd3fb1f2e4eadd774c9126826315adb397f.tar.bz2
gentoo-2-98247fd3fb1f2e4eadd774c9126826315adb397f.zip
Install nm-interfaces service to provide net dependency for openrc only when nm is connected (inspired by Xake's solution in bug #252137). Correctly deal with single quotes in /etc/conf.d/hostname. Do not create /var/run/NetworkManager, it's not needed in Gentoo (bug #401019, thanks to Maxim Kammerer). Drop old.
(Portage version: 2.2.0_alpha84/cvs/Linux x86_64)
Diffstat (limited to 'net-misc/networkmanager')
-rw-r--r--net-misc/networkmanager/files/10-openrc-nm-interfaces25
-rw-r--r--net-misc/networkmanager/files/networkmanager-0.9.1.95-dns-routing-unmanaged-devices.patch69
-rw-r--r--net-misc/networkmanager/files/networkmanager-0.9.1.95-glib-2.31.patch161
-rw-r--r--net-misc/networkmanager/files/networkmanager-0.9.1.95-keyfile-scheme.patch26
-rw-r--r--net-misc/networkmanager/files/networkmanager-0.9.2.0-ifnet-unquote-hostname.patch30
-rw-r--r--net-misc/networkmanager/files/nm-interfaces34
-rw-r--r--net-misc/networkmanager/networkmanager-0.9.2.0-r3.ebuild (renamed from net-misc/networkmanager/networkmanager-0.9.1.95.ebuild)25
7 files changed, 104 insertions, 266 deletions
diff --git a/net-misc/networkmanager/files/10-openrc-nm-interfaces b/net-misc/networkmanager/files/10-openrc-nm-interfaces
new file mode 100644
index 000000000000..101ba801c2ca
--- /dev/null
+++ b/net-misc/networkmanager/files/10-openrc-nm-interfaces
@@ -0,0 +1,25 @@
+#!/bin/sh
+# Copyright (c) 2012 Alexandre Rostovtsev
+# Released under the 2-clause BSD license.
+
+# Ensures that the nm-interfaces OpenRC service is marked as started if
+# NetworkManager had been started via openrc and brought up some interfaces.
+
+# Exit if no valid interface name given
+if [ -z "$1" -o "x$1" = "xnone" ]; then
+ exit 1
+fi
+
+# Exit if the NetworkManager OpenRC service is not running
+"@EPREFIX@/etc/init.d/NetworkManager" status &> /dev/null || exit 1
+
+case "$2" in
+ up)
+ exec "@EPREFIX@/etc/init.d/nm-interfaces" mark-started
+ ;;
+ down)
+ exec "@EPREFIX/etc/init.d/nm-interfaces" stop
+ ;;
+esac
+
+exit 1
diff --git a/net-misc/networkmanager/files/networkmanager-0.9.1.95-dns-routing-unmanaged-devices.patch b/net-misc/networkmanager/files/networkmanager-0.9.1.95-dns-routing-unmanaged-devices.patch
deleted file mode 100644
index 7b244dfdc45c..000000000000
--- a/net-misc/networkmanager/files/networkmanager-0.9.1.95-dns-routing-unmanaged-devices.patch
+++ /dev/null
@@ -1,69 +0,0 @@
-From fc0739a5d4e714234e1d544db838e932219c5d4d Mon Sep 17 00:00:00 2001
-From: Mathieu Trudel-Lapierre <mathieu.tl@gmail.com>
-Date: Wed, 2 Nov 2011 15:28:43 -0500
-Subject: [PATCH] dns: don't update routing and DNS if no devices were ever
- managed (lp:862134)
-
-Avoids blowing away existing routes and resolv.conf if NM never
-managed any devices.
----
- src/dns-manager/nm-dns-manager.c | 21 +++++++++++++--------
- src/nm-policy.c | 9 +++++++++
- 2 files changed, 22 insertions(+), 8 deletions(-)
-
-diff --git a/src/dns-manager/nm-dns-manager.c b/src/dns-manager/nm-dns-manager.c
-index 0203f2b..ddfd47c 100644
---- a/src/dns-manager/nm-dns-manager.c
-+++ b/src/dns-manager/nm-dns-manager.c
-@@ -1097,15 +1097,20 @@ dispose (GObject *object)
- g_slist_free (priv->plugins);
- priv->plugins = NULL;
-
-- /* If we're quitting leave a valid resolv.conf in place, not one
-- * pointing to 127.0.0.1 if any plugins were active. Thus update
-- * DNS after disposing of all plugins.
-+ /* If last_iface is NULL, this means we haven't done a DNS update before,
-+ * so no reason to try and take down entries from resolv.conf.
- */
-- if (!update_dns (self, priv->last_iface, TRUE, &error)) {
-- nm_log_warn (LOGD_DNS, "could not commit DNS changes on shutdown: (%d) %s",
-- error ? error->code : -1,
-- error && error->message ? error->message : "(unknown)");
-- g_clear_error (&error);
-+ if (priv->last_iface != NULL) {
-+ /* If we're quitting leave a valid resolv.conf in place, not one
-+ * pointing to 127.0.0.1 if any plugins were active. Thus update
-+ * DNS after disposing of all plugins.
-+ */
-+ if (!update_dns (self, priv->last_iface, TRUE, &error)) {
-+ nm_log_warn (LOGD_DNS, "could not commit DNS changes on shutdown: (%d) %s",
-+ error ? error->code : -1,
-+ error && error->message ? error->message : "(unknown)");
-+ g_clear_error (&error);
-+ }
- }
-
- g_slist_foreach (priv->configs, (GFunc) g_object_unref, NULL);
-diff --git a/src/nm-policy.c b/src/nm-policy.c
-index cd8245e..669db28 100644
---- a/src/nm-policy.c
-+++ b/src/nm-policy.c
-@@ -1042,6 +1042,15 @@ device_state_changed (NMDevice *device,
- update_routing_and_dns (policy, FALSE);
- break;
- case NM_DEVICE_STATE_UNMANAGED:
-+ if ( old_state == NM_DEVICE_STATE_UNAVAILABLE
-+ || old_state == NM_DEVICE_STATE_DISCONNECTED) {
-+ /* If the device was never activated, there's no point in
-+ * updating routing or DNS. This allows us to keep the previous
-+ * resolv.conf or routes from before NM started if no device was
-+ * ever managed by NM.
-+ */
-+ break;
-+ }
- case NM_DEVICE_STATE_UNAVAILABLE:
- update_routing_and_dns (policy, FALSE);
- break;
---
-1.7.7.2
-
diff --git a/net-misc/networkmanager/files/networkmanager-0.9.1.95-glib-2.31.patch b/net-misc/networkmanager/files/networkmanager-0.9.1.95-glib-2.31.patch
deleted file mode 100644
index be90d5c8e155..000000000000
--- a/net-misc/networkmanager/files/networkmanager-0.9.1.95-glib-2.31.patch
+++ /dev/null
@@ -1,161 +0,0 @@
-From 4d1d3b9935fca45ff98e1e705ce74540d234c41b Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
-Date: Mon, 31 Oct 2011 11:50:28 +0100
-Subject: [PATCH] core: fix building for GLib thread API changes (GLib >=
- 2.31.0) (bgo #662695)
-
----
- src/main.c | 9 +++++++++
- src/nm-policy-hostname.c | 45 ++++++++++++++++++++++++++++++++++-----------
- 2 files changed, 43 insertions(+), 11 deletions(-)
-
-diff --git a/src/main.c b/src/main.c
-index b7c0fd5..12a0b89 100644
---- a/src/main.c
-+++ b/src/main.c
-@@ -563,9 +563,18 @@ main (int argc, char *argv[])
- umask (022);
-
- g_type_init ();
-+
-+/*
-+ * Threading is always enabled starting from GLib 2.31.0.
-+ * See also http://developer.gnome.org/glib/2.31/glib-Deprecated-Thread-APIs.html.
-+ */
-+#if !GLIB_CHECK_VERSION (2,31,0)
- if (!g_thread_supported ())
- g_thread_init (NULL);
- dbus_g_thread_init ();
-+#else
-+ dbus_threads_init_default ();
-+#endif
-
- #ifndef HAVE_DBUS_GLIB_DISABLE_LEGACY_PROP_ACCESS
- #error HAVE_DBUS_GLIB_DISABLE_LEGACY_PROP_ACCESS not defined
-diff --git a/src/nm-policy-hostname.c b/src/nm-policy-hostname.c
-index 4fe69c5..f98aa9c 100644
---- a/src/nm-policy-hostname.c
-+++ b/src/nm-policy-hostname.c
-@@ -15,7 +15,7 @@
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
-- * Copyright (C) 2004 - 2010 Red Hat, Inc.
-+ * Copyright (C) 2004 - 2011 Red Hat, Inc.
- * Copyright (C) 2007 - 2008 Novell, Inc.
- */
-
-@@ -36,7 +36,11 @@
- struct HostnameThread {
- GThread *thread;
-
-+#if GLIB_CHECK_VERSION (2,31,0)
-+ GMutex lock;
-+#else
- GMutex *lock;
-+#endif
- gboolean dead;
- int ret;
-
-@@ -50,6 +54,25 @@ struct HostnameThread {
- gpointer user_data;
- };
-
-+/*
-+ * GMutex API has changed:
-+ * http://developer.gnome.org/glib/2.31/glib-Threads.html#GMutex
-+ * http://developer.gnome.org/glib/2.31/glib-Deprecated-Thread-APIs.html
-+*/
-+#if GLIB_CHECK_VERSION (2,31,0)
-+#define X_MUTEX_LOCK(mutex) g_mutex_lock (&(mutex))
-+#define X_MUTEX_UNLOCK(mutex) g_mutex_unlock (&(mutex))
-+#define X_MUTEX_INIT(mutex) g_mutex_init (&(mutex))
-+#define X_MUTEX_CLEAR(mutex) g_mutex_clear (&(mutex))
-+#define X_THREAD_CREATE(func,data) g_thread_try_new ("hostname-thread", func, data, NULL);
-+#else
-+#define X_MUTEX_LOCK(mutex) g_mutex_lock (mutex)
-+#define X_MUTEX_UNLOCK(mutex) g_mutex_unlock (mutex)
-+#define X_MUTEX_INIT(mutex) mutex = g_mutex_new ()
-+#define X_MUTEX_CLEAR(mutex) g_mutex_free (mutex)
-+#define X_THREAD_CREATE(func,data) g_thread_create (func, data, FALSE, NULL);
-+#endif
-+
- static gboolean
- hostname_thread_run_cb (gpointer user_data)
- {
-@@ -72,12 +95,12 @@ hostname_thread_worker (gpointer data)
-
- nm_log_dbg (LOGD_DNS, "(%p) starting address reverse-lookup", ht);
-
-- g_mutex_lock (ht->lock);
-+ X_MUTEX_LOCK (ht->lock);
- if (ht->dead) {
-- g_mutex_unlock (ht->lock);
-+ X_MUTEX_UNLOCK (ht->lock);
- return (gpointer) NULL;
- }
-- g_mutex_unlock (ht->lock);
-+ X_MUTEX_UNLOCK (ht->lock);
-
- ht->ret = getnameinfo (ht->addr, ht->addr_size, ht->hostname, NI_MAXHOST, NULL, 0, NI_NAMEREQD);
- if (ht->ret == 0) {
-@@ -106,7 +129,7 @@ hostname_thread_free (HostnameThread *ht)
-
- nm_log_dbg (LOGD_DNS, "(%p) freeing reverse-lookup thread", ht);
-
-- g_mutex_free (ht->lock);
-+ X_MUTEX_CLEAR (ht->lock);
- memset (ht, 0, sizeof (HostnameThread));
- g_free (ht);
- }
-@@ -123,7 +146,7 @@ hostname4_thread_new (guint32 ip4_addr,
- ht = g_malloc0 (sizeof (HostnameThread));
- g_assert (ht);
-
-- ht->lock = g_mutex_new ();
-+ X_MUTEX_INIT (ht->lock);
- ht->callback = callback;
- ht->user_data = user_data;
-
-@@ -132,7 +155,7 @@ hostname4_thread_new (guint32 ip4_addr,
- ht->addr = (struct sockaddr *) &ht->addr4;
- ht->addr_size = sizeof (ht->addr4);
-
-- ht->thread = g_thread_create (hostname_thread_worker, ht, FALSE, NULL);
-+ ht->thread = X_THREAD_CREATE (hostname_thread_worker, ht);
- if (!ht->thread) {
- hostname_thread_free (ht);
- return NULL;
-@@ -158,7 +181,7 @@ hostname6_thread_new (const struct in6_addr *ip6_addr,
- ht = g_malloc0 (sizeof (HostnameThread));
- g_assert (ht);
-
-- ht->lock = g_mutex_new ();
-+ X_MUTEX_INIT (ht->lock);
- ht->callback = callback;
- ht->user_data = user_data;
-
-@@ -167,7 +190,7 @@ hostname6_thread_new (const struct in6_addr *ip6_addr,
- ht->addr = (struct sockaddr *) &ht->addr6;
- ht->addr_size = sizeof (ht->addr6);
-
-- ht->thread = g_thread_create (hostname_thread_worker, ht, FALSE, NULL);
-+ ht->thread = X_THREAD_CREATE (hostname_thread_worker, ht);
- if (!ht->thread) {
- hostname_thread_free (ht);
- return NULL;
-@@ -189,9 +212,9 @@ hostname_thread_kill (HostnameThread *ht)
-
- nm_log_dbg (LOGD_DNS, "(%p) stopping reverse-lookup thread", ht);
-
-- g_mutex_lock (ht->lock);
-+ X_MUTEX_LOCK (ht->lock);
- ht->dead = TRUE;
-- g_mutex_unlock (ht->lock);
-+ X_MUTEX_UNLOCK (ht->lock);
- }
-
- gboolean
---
-1.7.7.2
-
diff --git a/net-misc/networkmanager/files/networkmanager-0.9.1.95-keyfile-scheme.patch b/net-misc/networkmanager/files/networkmanager-0.9.1.95-keyfile-scheme.patch
deleted file mode 100644
index 2248830a0895..000000000000
--- a/net-misc/networkmanager/files/networkmanager-0.9.1.95-keyfile-scheme.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-From 2938243e251dc10b22fecc4fd50c675f9c2ca1c4 Mon Sep 17 00:00:00 2001
-From: Florian Echtler <floe@butterbrot.org>
-Date: Tue, 1 Nov 2011 16:32:51 +0100
-Subject: [PATCH] keyfile: call correct scheme function when writing
- certificates (bgo #662836)
-
----
- src/settings/plugins/keyfile/writer.c | 2 +-
- 1 files changed, 1 insertions(+), 1 deletions(-)
-
-diff --git a/src/settings/plugins/keyfile/writer.c b/src/settings/plugins/keyfile/writer.c
-index db43b23..2babe26 100644
---- a/src/settings/plugins/keyfile/writer.c
-+++ b/src/settings/plugins/keyfile/writer.c
-@@ -679,7 +679,7 @@ cert_writer (GKeyFile *file,
- }
- g_return_if_fail (objtype != NULL);
-
-- scheme = objtypes->scheme_func (NM_SETTING_802_1X (setting));
-+ scheme = objtype->scheme_func (NM_SETTING_802_1X (setting));
- if (scheme == NM_SETTING_802_1X_CK_SCHEME_PATH) {
- path = objtype->path_func (NM_SETTING_802_1X (setting));
- g_assert (path);
---
-1.7.7.2
-
diff --git a/net-misc/networkmanager/files/networkmanager-0.9.2.0-ifnet-unquote-hostname.patch b/net-misc/networkmanager/files/networkmanager-0.9.2.0-ifnet-unquote-hostname.patch
new file mode 100644
index 000000000000..e7e6873c29ab
--- /dev/null
+++ b/net-misc/networkmanager/files/networkmanager-0.9.2.0-ifnet-unquote-hostname.patch
@@ -0,0 +1,30 @@
+From 8f3c3242a762d77fedd745273a1cdca7f9a2b2f6 Mon Sep 17 00:00:00 2001
+From: Alexandre Rostovtsev <tetromino@gentoo.org>
+Date: Tue, 31 Jan 2012 21:10:01 -0500
+Subject: [PATCH] ifnet: properly unquote hostnames with g_shell_unquote()
+
+If /etc/conf.d/hostname contains "hostname='foo'", then the hostname
+needs to be set to "foo", not "'foo'".
+
+https://bugzilla.gnome.org/show_bug.cgi?id=669148
+---
+ src/settings/plugins/ifnet/net_utils.c | 3 +--
+ 1 files changed, 1 insertions(+), 2 deletions(-)
+
+diff --git a/src/settings/plugins/ifnet/net_utils.c b/src/settings/plugins/ifnet/net_utils.c
+index b533ae3..36b465d 100644
+--- a/src/settings/plugins/ifnet/net_utils.c
++++ b/src/settings/plugins/ifnet/net_utils.c
+@@ -242,8 +242,7 @@ read_hostname (const char *path)
+ if (g_str_has_prefix (all_lines[i], "hostname")) {
+ tmp = strstr (all_lines[i], "=");
+ tmp++;
+- tmp = strip_string (tmp, '"');
+- result = g_strdup (tmp);
++ result = g_shell_unquote (tmp, NULL);
+ break;
+ }
+
+--
+1.7.8.4
+
diff --git a/net-misc/networkmanager/files/nm-interfaces b/net-misc/networkmanager/files/nm-interfaces
new file mode 100644
index 000000000000..3f276ee25dbf
--- /dev/null
+++ b/net-misc/networkmanager/files/nm-interfaces
@@ -0,0 +1,34 @@
+#!/sbin/runscript
+# Copyright (c) 2012 Alexandre Rostovtsev
+# Released under the 2-clause BSD license.
+
+description="Virtual service for interfaces configured by NetworkManager. \
+Do not start this service manually or add it to any runlevels!"
+
+depend()
+{
+ need NetworkManager
+ provide net
+}
+
+start()
+{
+ eerror "${RC_SVCNAME} should not be started manually or added to any runlevels."
+ return 1
+}
+
+# Separate function to prevent warnings on starting service multiple times
+mark_started()
+{
+ service_started && return 0
+ ebegin "Marking NetworkManager network interfaces as started"
+ mark_service_started
+ eend 0
+}
+
+stop()
+{
+ [ "x$(LC_ALL=C nmcli -t -f state nm 2> /dev/null)" = "xconnected" ] && return 1
+ ebegin "Marking NetworkManager network interfaces as stopped"
+ eend 0
+}
diff --git a/net-misc/networkmanager/networkmanager-0.9.1.95.ebuild b/net-misc/networkmanager/networkmanager-0.9.2.0-r3.ebuild
index ae7272772c41..9367e25b656d 100644
--- a/net-misc/networkmanager/networkmanager-0.9.1.95.ebuild
+++ b/net-misc/networkmanager/networkmanager-0.9.2.0-r3.ebuild
@@ -1,6 +1,6 @@
-# Copyright 1999-2011 Gentoo Foundation
+# 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.1.95.ebuild,v 1.1 2011/11/07 18:27:29 tetromino Exp $
+# $Header: /var/cvsroot/gentoo-x86/net-misc/networkmanager/networkmanager-0.9.2.0-r3.ebuild,v 1.1 2012/02/01 07:46:37 tetromino Exp $
EAPI="4"
GNOME_ORG_MODULE="NetworkManager"
@@ -95,12 +95,14 @@ src_prepare() {
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"
- # Fix building with glib-2.31, will be in next release
- epatch "${FILESDIR}/${P}-glib-2.31.patch"
- # Typo fix, will be in next release
- epatch "${FILESDIR}/${P}-keyfile-scheme.patch"
- # Do not blow away configs for devices not managed by nm; in next release
- epatch "${FILESDIR}/${P}-dns-routing-unmanaged-devices.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"
eautoreconf
default
@@ -135,12 +137,15 @@ src_configure() {
src_install() {
default
- # Need to keep the /var/run/NetworkManager directory
- keepdir /var/run/NetworkManager
# Need to keep the /etc/NetworkManager/dispatched.d for dispatcher scripts
keepdir /etc/NetworkManager/dispatcher.d
+ # Service that provides openrc net dependency only when nm is connected
+ doinitd "${FILESDIR}/nm-interfaces"
+ insinto /etc/NetworkManager/dispatcher.d
+ doins "${FILESDIR}/10-openrc-nm-interfaces"
+
# Add keyfile plugin support
keepdir /etc/NetworkManager/system-connections
chmod 0600 "${ED}"/etc/NetworkManager/system-connections/.keep* # bug #383765