diff options
author | 2023-05-28 16:07:47 -0400 | |
---|---|---|
committer | 2023-05-28 18:49:02 -0400 | |
commit | 0ac293faa15b49f08830120e7b5fa1e4523f19e5 (patch) | |
tree | 01cde3b4bb7d066f8acf6630a1aa78240cc17ecf | |
parent | net/Makefile: include iwd (diff) | |
download | netifrc-0ac293faa15b49f08830120e7b5fa1e4523f19e5.tar.gz netifrc-0ac293faa15b49f08830120e7b5fa1e4523f19e5.tar.bz2 netifrc-0ac293faa15b49f08830120e7b5fa1e4523f19e5.zip |
Update pidfile path for ppp-2.5.0
Bug: https://bugs.gentoo.org/907311
Signed-off-by: Mike Gilbert <floppym@gentoo.org>
-rw-r--r-- | net/pppd.sh | 38 |
1 files 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 <roy@marples.name> # 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}" |