summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPacho Ramos <pacho@gentoo.org>2013-07-13 19:59:01 +0000
committerPacho Ramos <pacho@gentoo.org>2013-07-13 19:59:01 +0000
commit6add8c45284c09af2867d6ac0e87adb4d514b67e (patch)
tree6428061c329dcd31719f184350b11b1027bd1ae6 /net-misc/networkmanager/files
parentLinux patches 3.4.53, 3.9.10 and 3.10.1. (diff)
downloadgentoo-2-6add8c45284c09af2867d6ac0e87adb4d514b67e.tar.gz
gentoo-2-6add8c45284c09af2867d6ac0e87adb4d514b67e.tar.bz2
gentoo-2-6add8c45284c09af2867d6ac0e87adb4d514b67e.zip
Inherit some changes from systemd-love to make it more systemd friendly
(Portage version: 2.1.12.13/cvs/Linux x86_64, signed Manifest commit with key A188FBD4)
Diffstat (limited to 'net-misc/networkmanager/files')
-rw-r--r--net-misc/networkmanager/files/10-openrc-status-r435
1 files changed, 35 insertions, 0 deletions
diff --git a/net-misc/networkmanager/files/10-openrc-status-r4 b/net-misc/networkmanager/files/10-openrc-status-r4
new file mode 100644
index 000000000000..e195ccc19687
--- /dev/null
+++ b/net-misc/networkmanager/files/10-openrc-status-r4
@@ -0,0 +1,35 @@
+#!/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.
+
+if [ ! -e "/run/openrc/softlevel" ]; then
+ # OpenRC is not running
+ exit 0
+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) nm-online -t 0 -x &&
+ ! rc-service NetworkManager status 2>&1 | grep -q started &&
+ exec rc-service NetworkManager start ;;
+ down) nm-online -t 0 -x ||
+ rc-service NetworkManager status 2>&1 | grep -q stopped ||
+ exec rc-service NetworkManager stop ;;
+ pre-sleep) rc-service NetworkManager status 2>&1 | grep -q stopped ||
+ exec rc-service NetworkManager stop ;;
+esac
+exit 0
+# vim: set ts=4: