From 5f825f7339fdb8a412733053e030b6857878b6ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Canek=20Pel=C3=A1ez=20Vald=C3=A9s?= Date: Sat, 4 Dec 2010 14:42:22 -0600 Subject: [PATCH] NetworkManager ebuild with systemd use flag so it doesn't call OpenRC in the backend. --- net-misc/networkmanager/Manifest | 5 + .../files/networkmanager-0.8.2-accept-gw.patch | 135 ++++++++++++++++++ .../networkmanager-0.8.2-gentoo-no-openrc.patch | 14 ++ .../files/nm-system-settings.conf-ifnet | 6 + .../networkmanager/networkmanager-0.8.2-r1.ebuild | 150 ++++++++++++++++++++ 5 files changed, 310 insertions(+), 0 deletions(-) create mode 100644 net-misc/networkmanager/Manifest create mode 100644 net-misc/networkmanager/files/networkmanager-0.8.2-accept-gw.patch create mode 100644 net-misc/networkmanager/files/networkmanager-0.8.2-gentoo-no-openrc.patch create mode 100644 net-misc/networkmanager/files/nm-system-settings.conf-ifnet create mode 100644 net-misc/networkmanager/networkmanager-0.8.2-r1.ebuild diff --git a/net-misc/networkmanager/Manifest b/net-misc/networkmanager/Manifest new file mode 100644 index 0000000..2015fae --- /dev/null +++ b/net-misc/networkmanager/Manifest @@ -0,0 +1,5 @@ +AUX networkmanager-0.8.2-accept-gw.patch 3679 RMD160 b163afa5215f0eb52ba2562d22c65ec5e0bd3380 SHA1 a71f25413abf0c359439add74a73545790604ac9 SHA256 631ccad5bc4c2d880b5235bc8e6ace494467bad1734023ded9d8bcd52b9177af +AUX networkmanager-0.8.2-gentoo-no-openrc.patch 606 RMD160 84de6a175233c29e4fa9e7c481257e7a1e5c2f37 SHA1 092e1ef9140f5ce5ca1b183d53927464aa9ed0da SHA256 92420b22e7891160c34246d20124dcba8125e259784674f4152fcb870ad8fd85 +AUX nm-system-settings.conf-ifnet 70 RMD160 c0d2be147383999b62cead86ab4333169e4ef277 SHA1 679ec8052b610969c148a2d34cd4da7a41484a76 SHA256 34f53d9ac1ad65eda6942dc3059117f60f6321059ca23f4fbfcc2f2edcae151f +DIST NetworkManager-0.8.2.tar.bz2 1629296 RMD160 d5ef4adfc74db4a77fadcbeb545175b2f49dfd9c SHA1 2c9a9f0317d2ad4fd8a05631211cfd6040070f8e SHA256 58e49dcd83cb641a9dcaad4fd566a08196c862479ad3086c00f28f03768eb4f1 +EBUILD networkmanager-0.8.2-r1.ebuild 4235 RMD160 f67dfafd392c8af14af3a71be63409d2f4b657ce SHA1 a3a01c7fbeb53a41ec810448a422fa30bf804478 SHA256 67bebf0d30d39bc5aed6879a695756ff7aa869c39885b0750cc98e6cb29ac2c6 diff --git a/net-misc/networkmanager/files/networkmanager-0.8.2-accept-gw.patch b/net-misc/networkmanager/files/networkmanager-0.8.2-accept-gw.patch new file mode 100644 index 0000000..b2911db --- /dev/null +++ b/net-misc/networkmanager/files/networkmanager-0.8.2-accept-gw.patch @@ -0,0 +1,135 @@ +--- NetworkManager_Patched/system-settings/plugins/ifnet/net_utils.c 2010-11-04 04:10:52.000000000 +0800 ++++ NetworkManager-0.8.2/system-settings/plugins/ifnet/net_utils.c 2010-11-23 15:11:08.024000011 +0800 +@@ -19,7 +19,6 @@ + * Copyright (C) 1999-2010 Gentoo Foundation, Inc. + */ + +-#include + #include + #include + #include +@@ -194,6 +193,32 @@ + return error_quark; + } + ++static char * ++find_default_gateway_str (char *str) ++{ ++ char *tmp; ++ ++ if ((tmp = strstr (str, "default via ")) != NULL) { ++ return tmp + strlen ("default via "); ++ } else if ((tmp = strstr (str, "default gw ")) != NULL) { ++ return tmp + strlen ("default gw "); ++ } ++ return NULL; ++} ++ ++static char * ++find_gateway_str (char *str) ++{ ++ char *tmp; ++ ++ if ((tmp = strstr (str, "via ")) != NULL) { ++ return tmp + strlen ("via "); ++ } else if ((tmp = strstr (str, "gw ")) != NULL) { ++ return tmp + strlen ("gw "); ++ } ++ return NULL; ++} ++ + gboolean + reload_parsers () + { +@@ -362,11 +387,10 @@ + if (!tmp) + return FALSE; + routes = g_strdup (tmp); +- tmp = strstr (routes, "default via "); ++ tmp = find_default_gateway_str (routes); + if (!tmp) { + goto error; + } +- tmp += strlen ("default via "); + g_strstrip (tmp); + if ((end = strstr (tmp, "\"")) != NULL) + *end = '\0'; +@@ -483,8 +507,13 @@ + + if (!gateway) + return 0; +- tmp = strstr (gateway, "via "); +- tmp = g_strdup (tmp + strlen ("via ")); ++ tmp = find_gateway_str(gateway); ++ if (!tmp) { ++ PLUGIN_WARN (IFNET_PLUGIN_NAME, ++ "Couldn't obtain gateway in \"%s\"", gateway); ++ return 0; ++ } ++ tmp = g_strdup (tmp); + strip_string (tmp, ' '); + strip_string (tmp, '"'); + if ((split = strstr (tmp, "\"")) != NULL) +@@ -509,8 +538,13 @@ + + if (!next_hop) + return 0; +- tmp = strstr (next_hop, "via "); +- tmp = g_strdup (tmp + strlen ("via ")); ++ tmp = find_gateway_str(next_hop); ++ if (!tmp) { ++ PLUGIN_WARN (IFNET_PLUGIN_NAME, ++ "Couldn't obtain next_hop in \"%s\"", next_hop); ++ return 0; ++ } ++ tmp = g_strdup (tmp); + strip_string (tmp, ' '); + strip_string (tmp, '"'); + g_strstrip (tmp); +@@ -671,8 +705,8 @@ + length = g_strv_length (ipset); + for (i = 0; i < length; i++) { + ip = ipset[i]; +- if (strstr (ip, "default via ") || strstr (ip, "::") +- || !strstr (ip, "via")) ++ if (find_default_gateway_str (ip) || strstr (ip, "::") ++ || !find_gateway_str (ip)) + continue; + ip = strip_string (ip, '"'); + iblock = create_ip4_block (ip); +@@ -712,9 +746,7 @@ + ip = strip_string (ip, '"'); + if (ip[0] == '\0') + continue; +- printf ("ip:%s\n", ip); +- if ((tmp_addr = strstr (ip, "default via ")) != NULL) { +- tmp_addr += strlen ("default via "); ++ if ((tmp_addr = find_default_gateway_str (ip)) != NULL) { + if (!is_ip6_address (tmp_addr)) + continue; + else { +@@ -855,7 +887,7 @@ + void + get_dhcp_hostname_and_client_id (char **hostname, char **client_id) + { +- gchar *dhcp_client = ifnet_get_global_setting ("main", "dhcp"); ++ gchar *dhcp_client = NULL; + const gchar *dhcpcd_conf = "/etc/dhcpcd.conf"; + const gchar *dhclient_conf = "/etc/dhcp/dhclient.conf"; + gchar *line = NULL, *tmp = NULL, *contents = NULL; +@@ -864,6 +896,7 @@ + + *hostname = NULL; + *client_id = NULL; ++ dhcp_client = ifnet_get_global_setting ("main", "dhcp"); + if (dhcp_client) { + if (!strcmp (dhcp_client, "dhclient")) + g_file_get_contents (dhclient_conf, &contents, NULL, +@@ -871,6 +904,7 @@ + else if (!strcmp (dhcp_client, "dhcpcd")) + g_file_get_contents (dhcpcd_conf, &contents, NULL, + NULL); ++ g_free (dhcp_client); + } else { + if (g_file_test (dhclient_conf, G_FILE_TEST_IS_REGULAR)) + g_file_get_contents (dhclient_conf, &contents, NULL, diff --git a/net-misc/networkmanager/files/networkmanager-0.8.2-gentoo-no-openrc.patch b/net-misc/networkmanager/files/networkmanager-0.8.2-gentoo-no-openrc.patch new file mode 100644 index 0000000..ed35485 --- /dev/null +++ b/net-misc/networkmanager/files/networkmanager-0.8.2-gentoo-no-openrc.patch @@ -0,0 +1,14 @@ +diff -burN NetworkManager-0.8.2/src/backends/NetworkManagerGentoo.c NetworkManager-0.8.2.systemd/src/backends/NetworkManagerGentoo.c +--- NetworkManager-0.8.2/src/backends/NetworkManagerGentoo.c 2010-10-07 14:09:52.000000000 -0500 ++++ NetworkManager-0.8.2.systemd/src/backends/NetworkManagerGentoo.c 2010-12-04 13:29:32.000000000 -0600 +@@ -44,9 +44,7 @@ + */ + void nm_system_enable_loopback (void) + { +- /* No need to run net.lo if it is already running */ +- if (nm_spawn_process ("/etc/init.d/net.lo status") != 0) +- nm_spawn_process("/etc/init.d/net.lo start"); ++ nm_generic_enable_loopback (); + } + + /* diff --git a/net-misc/networkmanager/files/nm-system-settings.conf-ifnet b/net-misc/networkmanager/files/nm-system-settings.conf-ifnet new file mode 100644 index 0000000..4d14ee7 --- /dev/null +++ b/net-misc/networkmanager/files/nm-system-settings.conf-ifnet @@ -0,0 +1,6 @@ +[main] +plugins=ifnet,keyfile + +[ifnet] +managed=true +auto_refresh=false diff --git a/net-misc/networkmanager/networkmanager-0.8.2-r1.ebuild b/net-misc/networkmanager/networkmanager-0.8.2-r1.ebuild new file mode 100644 index 0000000..8a8e217 --- /dev/null +++ b/net-misc/networkmanager/networkmanager-0.8.2-r1.ebuild @@ -0,0 +1,150 @@ +# Copyright 1999-2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-misc/networkmanager/networkmanager-0.8.2-r1.ebuild,v 1.1 2010/11/30 09:35:18 qiaomuf Exp $ + +EAPI="2" + +inherit gnome.org linux-info + +# NetworkManager likes itself with capital letters +MY_PN=${PN/networkmanager/NetworkManager} +MY_P=${MY_PN}-${PV} + +DESCRIPTION="Network configuration and management in an easy way. Desktop environment independent." +HOMEPAGE="http://www.gnome.org/projects/NetworkManager/" +SRC_URI="${SRC_URI//${PN}/${MY_PN}}" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64 ~arm ~ppc ~ppc64 ~x86" +IUSE="avahi bluetooth doc nss gnutls dhclient dhcpcd kernel_linux resolvconf connection-sharing systemd" + +RDEPEND=">=sys-apps/dbus-1.2 + >=dev-libs/dbus-glib-0.75 + >=net-wireless/wireless-tools-28_pre9 + >=sys-fs/udev-145[extras] + >=dev-libs/glib-2.18 + >=sys-auth/polkit-0.92 + >=dev-libs/libnl-1.1 + >=net-misc/modemmanager-0.4 + >=net-wireless/wpa_supplicant-0.5.10[dbus] + bluetooth? ( net-wireless/bluez ) + || ( sys-libs/e2fsprogs-libs =dev-libs/nss-3.11 ) + !nss? ( dev-libs/libgcrypt + net-libs/gnutls ) ) + !gnutls? ( >=dev-libs/nss-3.11 ) + dhclient? ( + dhcpcd? ( >=net-misc/dhcpcd-4.0.0_rc3 ) + !dhcpcd? ( net-misc/dhcp ) ) + !dhclient? ( >=net-misc/dhcpcd-4.0.0_rc3 ) + resolvconf? ( net-dns/openresolv ) + connection-sharing? ( + net-dns/dnsmasq + net-firewall/iptables )" + +DEPEND="${RDEPEND} + dev-util/pkgconfig + dev-util/intltool + >=net-dialup/ppp-2.4.5 + doc? ( >=dev-util/gtk-doc-1.8 )" + +S=${WORKDIR}/${MY_P} + +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_setup() { + + 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 +} + +src_prepare() { + # accept "gw" in /etc/conf.d/net (bug #339215) + epatch "${FILESDIR}/${P}-accept-gw.patch" + + if use systemd; then + epatch "${FILESDIR}/networkmanager-0.8.2-gentoo-no-openrc.patch" + fi +} + +src_configure() { + ECONF="--disable-more-warnings + --localstatedir=/var + --with-distro=gentoo + --with-dbus-sys-dir=/etc/dbus-1/system.d + --with-udev-dir=/etc/udev + --with-iptables=/sbin/iptables + $(use_enable doc gtk-doc) + $(use_with doc docs) + $(use_with resolvconf)" + + # default is dhcpcd (if none or both are specified), ISC dchclient otherwise + if use dhclient ; then + if use dhcpcd ; then + ECONF="${ECONF} --with-dhcpcd --without-dhclient" + else + ECONF="${ECONF} --with-dhclient --without-dhcpcd" + fi + else + ECONF="${ECONF} --with-dhcpcd --without-dhclient" + fi + + # default is NSS (if none or both are specified), GnuTLS otherwise + if use gnutls ; then + if use nss ; then + ECONF="${ECONF} --with-crypto=nss" + else + ECONF="${ECONF} --with-crypto=gnutls" + fi + else + ECONF="${ECONF} --with-crypto=nss" + fi + + econf ${ECONF} +} + +src_install() { + emake DESTDIR="${D}" install || die "emake install failed" + + # 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 + + dodoc AUTHORS ChangeLog NEWS README TODO || die "dodoc failed" + + # Add keyfile plugin support + keepdir /etc/NetworkManager/system-connections + insinto /etc/NetworkManager + newins "${FILESDIR}/nm-system-settings.conf-ifnet" nm-system-settings.conf \ + || die "newins failed" +} + +pkg_postinst() { + elog "You will need to reload DBus if this is your first time installing" + elog "NetworkManager, or if you're upgrading from 0.7 or older." + elog "" +} -- 1.7.2.2