public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Pacho Ramos" <pacho@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: net-misc/networkmanager/files/, net-misc/networkmanager/
Date: Wed, 17 Jul 2024 12:12:03 +0000 (UTC)	[thread overview]
Message-ID: <1721218292.c13f2ea9b95e4f3aef7764637113cddea32f173a.pacho@gentoo> (raw)

commit:     c13f2ea9b95e4f3aef7764637113cddea32f173a
Author:     Pacho Ramos <pacho <AT> gentoo <DOT> org>
AuthorDate: Wed Jul 17 12:00:47 2024 +0000
Commit:     Pacho Ramos <pacho <AT> gentoo <DOT> org>
CommitDate: Wed Jul 17 12:11:32 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c13f2ea9

net-misc/networkmanager: Port init script to elogind

Closes: https://bugs.gentoo.org/734028
Signed-off-by: Pacho Ramos <pacho <AT> gentoo.org>

 .../networkmanager/files/init.d.NetworkManager-r3  | 62 ++++++++++++++++++++++
 .../networkmanager/networkmanager-1.48.4.ebuild    |  2 +-
 2 files changed, 63 insertions(+), 1 deletion(-)

diff --git a/net-misc/networkmanager/files/init.d.NetworkManager-r3 b/net-misc/networkmanager/files/init.d.NetworkManager-r3
new file mode 100644
index 000000000000..b2d240fc76ad
--- /dev/null
+++ b/net-misc/networkmanager/files/init.d.NetworkManager-r3
@@ -0,0 +1,62 @@
+#!/sbin/openrc-run
+# Copyright (c) 2008 Saleem Abdulrasool <compnerd@compnerd.org>
+# Copyright 2013-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+description="NetworkManager daemon. The service is marked as started only \
+when a network connection is established."
+
+depend() {
+	need dbus
+	use elogind
+	provide net
+}
+
+start_pre() {
+	checkpath -q -d -m 0755 /run/NetworkManager
+}
+
+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 :

diff --git a/net-misc/networkmanager/networkmanager-1.48.4.ebuild b/net-misc/networkmanager/networkmanager-1.48.4.ebuild
index 870aa4de8f3b..c2f656d25ebd 100644
--- a/net-misc/networkmanager/networkmanager-1.48.4.ebuild
+++ b/net-misc/networkmanager/networkmanager-1.48.4.ebuild
@@ -311,7 +311,7 @@ multilib_src_install() {
 multilib_src_install_all() {
 	! use systemd && readme.gentoo_create_doc
 
-	newinitd "${FILESDIR}/init.d.NetworkManager-r2" NetworkManager
+	newinitd "${FILESDIR}/init.d.NetworkManager-r3" NetworkManager
 	newconfd "${FILESDIR}/conf.d.NetworkManager" NetworkManager
 
 	# Need to keep the /etc/NetworkManager/dispatched.d for dispatcher scripts


             reply	other threads:[~2024-07-17 12:12 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-17 12:12 Pacho Ramos [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-05-31  2:00 [gentoo-commits] repo/gentoo:master commit in: net-misc/networkmanager/files/, net-misc/networkmanager/ Matt Turner
2021-04-13 16:20 Matt Turner
2021-03-18  1:00 Thomas Deutschmann
2020-11-05  2:43 Thomas Deutschmann
2020-03-12  9:15 Lars Wendler
2019-10-21 19:43 Matt Turner
2017-01-26 10:56 Mart Raudsepp
2017-01-15 16:44 Pacho Ramos
2016-09-29 20:09 Pacho Ramos
2016-08-04 17:27 Mike Gilbert
2016-01-16 10:48 Pacho Ramos

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1721218292.c13f2ea9b95e4f3aef7764637113cddea32f173a.pacho@gentoo \
    --to=pacho@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox