void-packages/srcpkgs/pps-tools/patches/ppsfind-fixes.patch

44 lines
1.2 KiB
Diff
Raw Normal View History

# src: https://github.com/redlab-i/pps-tools/commit/e2b25049df9a4da28168b7378016f1650d0dfa6b.patch
From e2b25049df9a4da28168b7378016f1650d0dfa6b Mon Sep 17 00:00:00 2001
From: Alexander GQ Gerasiov <gq@cs.msu.su>
Date: Wed, 24 Oct 2018 12:47:07 +0300
Subject: [PATCH] ppsfind: Use /bin/sh, fix possible issues.
Signed-off-by: Alexander GQ Gerasiov <gq@cs.msu.su>
---
ppsfind | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/ppsfind b/ppsfind
index 2ff7abc..adbcab9 100644
--- ppsfind
+++ ppsfind
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
# ppsfind -- find pps device by name
#
# Copyright (C) 2005-2007 Rodolfo Giometti <giometti@linux.it>
@@ -15,16 +15,14 @@
SYS="/sys/class/pps/"
-if [ $# -lt 1 ] ; then
+if [ $# -ne 1 ] ; then
echo "usage: ppsfind <name>" >&2
exit 1
fi
-for d in $(ls $SYS) ; do
- if grep $1 $SYS/$d/name >& /dev/null || \
- grep $1 $SYS/$d/path >& /dev/null ; then
- echo "$d: name=$(cat $SYS/$d/name) path=$(cat $SYS/$d/path)"
- fi
+for dev in $SYS/* ; do
+ grep -q "$1" "$dev/name" || grep -q "$1" "$dev/path" && \
+ echo "$(basename "$dev"): name=$(cat $dev/name) path=$(cat $dev/path)"
done
exit 0