From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1242701-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id CD0721382C5
	for <garchives@archives.gentoo.org>; Mon, 18 Jan 2021 13:04:21 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 072B6E0843;
	Mon, 18 Jan 2021 13:04:21 +0000 (UTC)
Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id DC721E0843
	for <gentoo-commits@lists.gentoo.org>; Mon, 18 Jan 2021 13:04:20 +0000 (UTC)
Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 72506340FC5
	for <gentoo-commits@lists.gentoo.org>; Mon, 18 Jan 2021 13:04:19 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 233D03A6
	for <gentoo-commits@lists.gentoo.org>; Mon, 18 Jan 2021 13:04:18 +0000 (UTC)
From: "Lars Wendler" <polynomial-c@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Lars Wendler" <polynomial-c@gentoo.org>
Message-ID: <1610974914.72b3a820214fc50d50b8ac0f031491106d8d8634.polynomial-c@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: polynomial-c
X-VCS-Committer-Name: Lars Wendler
X-VCS-Revision: 72b3a820214fc50d50b8ac0f031491106d8d8634
X-VCS-Branch: master
Date: Mon, 18 Jan 2021 13:04:18 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply
X-Archives-Salt: c668e369-f5ea-47a3-b2dd-5bfedac6d1e1
X-Archives-Hash: 2efa2c2491edd244094a706a6f8c6424

commit:     72b3a820214fc50d50b8ac0f031491106d8d8634
Author:     Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
AuthorDate: Mon Jan 18 13:01:54 2021 +0000
Commit:     Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
CommitDate: Mon Jan 18 13:01:54 2021 +0000
URL:        https://gitweb.gentoo.org/proj/netifrc.git/commit/?id=72b3a820

net/pppd.sh: Completely overhauled pppd version check

Thanks-to: Kerin Millar <kfm <AT> plushkava.net>
Bug: https://bugs.gentoo.org/729920

Signed-off-by: Lars Wendler <polynomial-c <AT> gentoo.org>

 net/pppd.sh | 24 +++---------------------
 1 file changed, 3 insertions(+), 21 deletions(-)

diff --git a/net/pppd.sh b/net/pppd.sh
index 2182497..22644f2 100644
--- a/net/pppd.sh
+++ b/net/pppd.sh
@@ -23,28 +23,10 @@ requote()
 
 pppd_is_ge_248()
 {
-	local ver_str="$(/usr/sbin/pppd --version 2>&1 | awk '/pppd version/ {print $3}')"
-	local maj_ver="$(echo ${ver_str} | cut -d . -f 1)"
-	local min_ver="$(echo ${ver_str} | cut -d . -f 2)"
-	local patch_ver="$(echo ${ver_str} | cut -d . -f 3)"
+	local ver_str="$(/usr/sbin/pppd --version 2>&1 | awk '/pppd version/ {print $3}' | tr '.' ' ')"
 
-	if [ "${maj_ver}" -gt 2 ] ; then
-		return 0
-	elif [ "${maj_ver}" -eq 2 ] ; then
-		if [ "${min_ver}" -gt 4 ] ; then
-			return 0
-		elif [ "${min_ver}" -eq 4 ] ; then
-			if [ "${patch_ver}" -ge 8 ] ; then
-				return 0
-			else
-				return 1
-			fi
-		else
-			return 1
-		fi
-	else
-		return 1
-	fi
+	# 002004008 is v2.4.8
+	[ "$(printf '%03d' ${ver_str})" -ge 002004008 ]
 }
 
 pppd_pre_start()