From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 91BA715806E for ; Mon, 29 May 2023 00:18:00 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id C109DE07F2; Mon, 29 May 2023 00:17:59 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 9F3D8E07F2 for ; Mon, 29 May 2023 00:17:59 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id B17D533BE23 for ; Mon, 29 May 2023 00:17:58 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 4E733A67 for ; Mon, 29 May 2023 00:17:57 +0000 (UTC) From: "Mike Gilbert" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Mike Gilbert" Message-ID: <1685314142.0ac293faa15b49f08830120e7b5fa1e4523f19e5.floppym@OpenRC> Subject: [gentoo-commits] proj/netifrc:master commit in: net/ X-VCS-Repository: proj/netifrc X-VCS-Files: net/pppd.sh X-VCS-Directories: net/ X-VCS-Committer: floppym X-VCS-Committer-Name: Mike Gilbert X-VCS-Revision: 0ac293faa15b49f08830120e7b5fa1e4523f19e5 X-VCS-Branch: master Date: Mon, 29 May 2023 00:17:57 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: f1cdcfc0-48f2-4153-b422-249ac41d2df7 X-Archives-Hash: b800f55667cf6f4cdd8221ddfec9eb23 commit: 0ac293faa15b49f08830120e7b5fa1e4523f19e5 Author: Mike Gilbert gentoo org> AuthorDate: Sun May 28 20:07:47 2023 +0000 Commit: Mike Gilbert gentoo org> CommitDate: Sun May 28 22:49:02 2023 +0000 URL: https://gitweb.gentoo.org/proj/netifrc.git/commit/?id=0ac293fa Update pidfile path for ppp-2.5.0 Bug: https://bugs.gentoo.org/907311 Signed-off-by: Mike Gilbert gentoo.org> net/pppd.sh | 38 ++++++++++++++++++++++++++++++-------- 1 file changed, 30 insertions(+), 8 deletions(-) diff --git a/net/pppd.sh b/net/pppd.sh index 22644f2..1b14fed 100644 --- a/net/pppd.sh +++ b/net/pppd.sh @@ -1,4 +1,4 @@ -# Copyright (c) 2005-2007 Gentoo Foundation +# Copyright (c) 2005-2023 Gentoo Authors # Copyright (c) 2007-2008 Roy Marples # Released under the 2-clause BSD license. # shellcheck shell=sh disable=SC1008 @@ -21,12 +21,28 @@ requote() printf "'%s' " "$@" } +pppd_version_int() { + # 002004008 is v2.4.8 + printf '%03d' $(/usr/sbin/pppd --version | awk '/pppd version/ {print $3}' | tr '.' ' ') +} + pppd_is_ge_248() { - local ver_str="$(/usr/sbin/pppd --version 2>&1 | awk '/pppd version/ {print $3}' | tr '.' ' ')" + [ $(pppd_version_int) -ge 002004008 ] +} - # 002004008 is v2.4.8 - [ "$(printf '%03d' ${ver_str})" -ge 002004008 ] +pppd_is_ge_250() +{ + [ $(pppd_version_int) -ge 002005000 ] +} + +pppd_pidfile() +{ + if pppd_is_ge_250; then + echo "/run/pppd/ppp-${IFACE}.pid" + else + echo "/run/ppp-${IFACE}.pid" + fi } pppd_pre_start() @@ -207,16 +223,18 @@ pppd_pre_start() fi [ "${insert_link_in_opts}" = "0" ] || opts="${link} ${opts}" + local pidfile="$(pppd_pidfile)" + ebegin "Starting pppd in ${IFACE}" mark_service_inactive if [ -n "${username}" ] \ && [ -n "${password}" -o -z "${passwordset}" ]; then printf "%s" "${password}" | \ eval start-stop-daemon --start --exec /usr/sbin/pppd \ - --pidfile "/run/ppp-${IFACE}.pid" -- "${opts}" >/dev/null + --pidfile "${pidfile}" -- "${opts}" >/dev/null else eval start-stop-daemon --start --exec /usr/sbin/pppd \ - --pidfile "/run/ppp-${IFACE}.pid" -- "${opts}" >/dev/null + --pidfile "${pidfile}" -- "${opts}" >/dev/null fi if ! eend $? "Failed to start PPP"; then @@ -243,9 +261,13 @@ pppd_start() pppd_stop() { yesno ${IN_BACKGROUND} && return 0 - local pidfile="/run/ppp-${IFACE}.pid" - [ ! -s "${pidfile}" ] && return 0 + local pidfile="$(pppd_pidfile)" + if [ ! -s "${pidfile}" ]; then + # Try the old path. + pidfile="/run/ppp-${IFACE}.pid" + [ -s "${pidfile}" ] || return 0 + fi # Give pppd at least 30 seconds do die, #147490 einfo "Stopping pppd on ${IFACE}"