summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandre Rostovtsev <tetromino@gentoo.org>2012-02-02 00:34:59 +0000
committerAlexandre Rostovtsev <tetromino@gentoo.org>2012-02-02 00:34:59 +0000
commit01a351c0f5ba5929f374cb4b0e987ac7d1c823a0 (patch)
tree7f0152c7abc9594d3be3475898e8f8016dd64f44
parentunmask postfix-2.9 version (diff)
downloadgentoo-2-01a351c0f5ba5929f374cb4b0e987ac7d1c823a0.tar.gz
gentoo-2-01a351c0f5ba5929f374cb4b0e987ac7d1c823a0.tar.bz2
gentoo-2-01a351c0f5ba5929f374cb4b0e987ac7d1c823a0.zip
Change the NetworkManager OpenRC service to provide net; the service's status is set to 'inactive' when NetworkManager is running but has no connections up, and to 'started' when NetworkManager is connected (bug #252137, thanks to Xake). Do not keepdir /var/run/NetworkManager, it's not needed in Gentoo (bug #401019, thanks to Maxim Kammerer). Correctly parse single-quoted hostnames in /etc/conf.d/hostname.
(Portage version: 2.2.0_alpha84/cvs/Linux x86_64)
-rw-r--r--net-misc/networkmanager/ChangeLog15
-rw-r--r--net-misc/networkmanager/files/10-openrc-status27
-rw-r--r--net-misc/networkmanager/files/networkmanager-0.9.2.0-init-provide-net.patch61
-rw-r--r--net-misc/networkmanager/networkmanager-0.9.2.0-r3.ebuild171
4 files changed, 273 insertions, 1 deletions
diff --git a/net-misc/networkmanager/ChangeLog b/net-misc/networkmanager/ChangeLog
index ab067771d58b..2e60d603be2f 100644
--- a/net-misc/networkmanager/ChangeLog
+++ b/net-misc/networkmanager/ChangeLog
@@ -1,6 +1,19 @@
# 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.125 2012/02/01 08:00:19 tetromino Exp $
+# $Header: /var/cvsroot/gentoo-x86/net-misc/networkmanager/ChangeLog,v 1.126 2012/02/02 00:34:59 tetromino Exp $
+
+*networkmanager-0.9.2.0-r3 (02 Feb 2012)
+
+ 02 Feb 2012; Alexandre Rostovtsev <tetromino@gentoo.org>
+ +files/10-openrc-status, +networkmanager-0.9.2.0-r3.ebuild,
+ +files/networkmanager-0.9.2.0-ifnet-unquote-hostname.patch,
+ +files/networkmanager-0.9.2.0-init-provide-net.patch:
+ Change the NetworkManager OpenRC service to provide net; the service's status
+ is set to 'inactive' when NetworkManager is running but has no connections
+ up, and to 'started' when NetworkManager is connected (bug #252137, thanks to
+ Xake). Do not keepdir /var/run/NetworkManager, it's not needed in Gentoo (bug
+ #401019, thanks to Maxim Kammerer). Correctly parse single-quoted hostnames
+ in /etc/conf.d/hostname.
01 Feb 2012; Alexandre Rostovtsev <tetromino@gentoo.org>
-networkmanager-0.9.1.95.ebuild,
diff --git a/net-misc/networkmanager/files/10-openrc-status b/net-misc/networkmanager/files/10-openrc-status
new file mode 100644
index 000000000000..b3c5bc1340d8
--- /dev/null
+++ b/net-misc/networkmanager/files/10-openrc-status
@@ -0,0 +1,27 @@
+#!/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.
+
+# Exit if no valid interface name given
+if [ -z "$1" -o "x$1" = "xnone" ]; then
+ exit
+fi
+
+# 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|vpn-up) exec rc-service NetworkManager start ;;
+ down|vpn-down) exec rc-service NetworkManager stop ;;
+esac
diff --git a/net-misc/networkmanager/files/networkmanager-0.9.2.0-init-provide-net.patch b/net-misc/networkmanager/files/networkmanager-0.9.2.0-init-provide-net.patch
new file mode 100644
index 000000000000..886fe1a74614
--- /dev/null
+++ b/net-misc/networkmanager/files/networkmanager-0.9.2.0-init-provide-net.patch
@@ -0,0 +1,61 @@
+From dbb1ed70eca25d57da3c12534c241cd38134627b 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 | 24 +++++++++++++++++++++++-
+ 1 files changed, 23 insertions(+), 1 deletions(-)
+
+diff --git a/initscript/Gentoo/NetworkManager.in b/initscript/Gentoo/NetworkManager.in
+index 7db410b..d26996d 100755
+--- a/initscript/Gentoo/NetworkManager.in
++++ b/initscript/Gentoo/NetworkManager.in
+@@ -3,18 +3,40 @@
+ # 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.patch,v 1.1 2012/02/02 00:34:59 tetromino Exp $
+
++description="NetworkManager daemon. The service is marked as started only \
++when a network connection is established."
++
+ depend() {
+ need dbus
++ provide net
++}
++
++_is_connected() {
++ [ "x$(LC_ALL=C nmcli -t -f state nm 2> /dev/null)" = "xconnected" ]
++ return $?
+ }
+
+ start() {
++ if yesno "${IN_BACKGROUND}"; then
++ _is_connected && mark_service_started
++ return
++ fi
+ 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
++ _is_connected || mark_service_inactive
++ fi
++ return "${_retval}"
+ }
+
+ stop() {
++ if yesno "${IN_BACKGROUND}"; then
++ _is_connected || mark_service_inactive
++ return
++ 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/networkmanager-0.9.2.0-r3.ebuild b/net-misc/networkmanager/networkmanager-0.9.2.0-r3.ebuild
new file mode 100644
index 000000000000..d6f8cda1809c
--- /dev/null
+++ b/net-misc/networkmanager/networkmanager-0.9.2.0-r3.ebuild
@@ -0,0 +1,171 @@
+# 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-r3.ebuild,v 1.3 2012/02/02 00:34:59 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.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
+ doexe "${FILESDIR}/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."
+}