summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandre Rostovtsev <tetromino@gentoo.org>2012-07-05 02:33:10 +0000
committerAlexandre Rostovtsev <tetromino@gentoo.org>2012-07-05 02:33:10 +0000
commit6f0e412da3121825a420bab747cc48aaa10d3ea4 (patch)
treee97415f32fb1ac1a0e6a858d00a7df9a83f31822 /net-misc/networkmanager/files/10-openrc-status-r2
parentChange manifest to new hashes. (diff)
downloadgentoo-2-6f0e412da3121825a420bab747cc48aaa10d3ea4.tar.gz
gentoo-2-6f0e412da3121825a420bab747cc48aaa10d3ea4.tar.bz2
gentoo-2-6f0e412da3121825a420bab747cc48aaa10d3ea4.zip
Fix the hang in 10-openrc-status that resulted in networkmanager getting marked as 'inactive' on resuming from suspend; many thanks to Travis Hansen for the solution (bugs #410661, #417283). Fix incompatibility with net-misc/dhcp[-ipv6] (bug #335147, thanks to Rick Harris). Move polkit rules.d file to /usr/share (bug #421577 comment #12, thanks to Dennis Lissov).
(Portage version: 2.2.0_alpha115/cvs/Linux x86_64)
Diffstat (limited to 'net-misc/networkmanager/files/10-openrc-status-r2')
-rw-r--r--net-misc/networkmanager/files/10-openrc-status-r223
1 files changed, 23 insertions, 0 deletions
diff --git a/net-misc/networkmanager/files/10-openrc-status-r2 b/net-misc/networkmanager/files/10-openrc-status-r2
new file mode 100644
index 000000000000..967c56600a54
--- /dev/null
+++ b/net-misc/networkmanager/files/10-openrc-status-r2
@@ -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 -x && exec rc-service NetworkManager start ;;
+ down) nm-online -t 0 -x || exec rc-service NetworkManager stop ;;
+ pre-sleep) exec rc-service NetworkManager stop ;;
+esac