summaryrefslogtreecommitdiff
path: root/pcr/openrc-misc/init.d.NetworkManager
diff options
context:
space:
mode:
authorfreaj <freaj@riseup.net>2015-03-30 11:08:25 +0200
committerfreaj <freaj@riseup.net>2015-03-30 11:08:25 +0200
commitcec37e643f4889b4b8652bdfce886b1e5e81f2bd (patch)
treec992d8325923324f5d318f57b4c05dd5fe494988 /pcr/openrc-misc/init.d.NetworkManager
parent7385c6143c1b587bca68deade6e5989d11879767 (diff)
downloadabslibre-cec37e643f4889b4b8652bdfce886b1e5e81f2bd.tar.gz
abslibre-cec37e643f4889b4b8652bdfce886b1e5e81f2bd.tar.bz2
abslibre-cec37e643f4889b4b8652bdfce886b1e5e81f2bd.zip
openrc-misc: add new package to [pcr]
Diffstat (limited to 'pcr/openrc-misc/init.d.NetworkManager')
-rw-r--r--pcr/openrc-misc/init.d.NetworkManager57
1 files changed, 57 insertions, 0 deletions
diff --git a/pcr/openrc-misc/init.d.NetworkManager b/pcr/openrc-misc/init.d.NetworkManager
new file mode 100644
index 000000000..8465449d8
--- /dev/null
+++ b/pcr/openrc-misc/init.d.NetworkManager
@@ -0,0 +1,57 @@
+#!/sbin/runscript
+# Copyright (c) 2008 Saleem Abdulrasool <compnerd@compnerd.org>
+# Distributed under the terms of the GNU General Purpose License v2
+# $Header: /var/cvsroot/gentoo-x86/net-misc/networkmanager/files/init.d.NetworkManager,v 1.1 2013/01/28 07:05:05 tetromino Exp $
+
+description="NetworkManager daemon. The service is marked as started only \
+when a network connection is established."
+
+depend() {
+ need dbus
+ provide net
+}
+
+start() {
+ # If we are re-called by a dispatcher event, we want to mark the service
+ # as started without starting the daemon again
+ yesno "${IN_BACKGROUND}" && return 0
+
+ [ -z "${INACTIVE_TIMEOUT}" ] && INACTIVE_TIMEOUT="1"
+
+ ebegin "Starting NetworkManager"
+ start-stop-daemon --start --quiet --pidfile /run/NetworkManager/NetworkManager.pid \
+ --exec /usr/sbin/NetworkManager -- --pid-file /run/NetworkManager/NetworkManager.pid
+ local _retval=$?
+ eend "${_retval}"
+ if [ "x${_retval}" = 'x0' ] && ! nm-online -t "${INACTIVE_TIMEOUT}"; then
+ einfo "Marking NetworkManager as inactive. It will automatically be marked"
+ einfo "as started after a network connection has been established."
+ mark_service_inactive
+ fi
+ return "${_retval}"
+}
+
+stop() {
+ # If we are re-called by a dispatcher event, we want to mark the service
+ # as inactive without stopping the daemon
+ if yesno "${IN_BACKGROUND}"; then
+ mark_service_inactive "${SVCNAME}"
+ return 0
+ fi
+
+ ebegin "Stopping NetworkManager"
+ local pidfile=/run/NetworkManager/NetworkManager.pid
+ if [ ! -e "${pidfile}" ] && [ -e /var/run/NetworkManager.pid ]; then
+ # Try stopping the pid file used by <0.9.7
+ pidfile=/var/run/NetworkManager.pid
+ start-stop-daemon --stop --quiet --pidfile "${pidfile}"
+ ret=$?
+ [ ${ret} = 0 ] && [ -e "${pidfile}" ] && rm "${pidfile}"
+ eend ${ret}
+ else
+ start-stop-daemon --stop --quiet --pidfile "${pidfile}"
+ eend $?
+ fi
+}
+
+# vim: set ft=gentoo-init-d ts=4 :