[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJ1xhMXbKtAhPGkFv+DZfVvbSxvQqud4K1kY6+KH=SmonPGJXw@mail.gmail.com>
Date: Sat, 3 Oct 2015 16:10:34 +0300
From: Alexander Kapshuk <alexander.kapshuk@...il.com>
To: linux-kernel <linux-kernel@...r.kernel.org>
Cc: Greg KH <gregkh@...uxfoundation.org>
Subject: [PATCH 2/24] ver_linux: path2bin_test.patch
As suggested by Jim Davis <jim.epost@...il.com>, this patch checks for
binaries in the user's $PATH first by calling 'which name-of-binary'. If
the binary is not found there, an attempt is made to find it elsewhere
on the system. 'whereis name-of-binary' is used to that end.
Below is Jim's reasoning behind the suggestion made:
Though looking back at your patch, what might work is to look first
for depmod in the user's $PATH and then try whereis only if that fails.
I'm not convinced that's much better than just searching $PATH, but that
at least would go with the user's preference first.
Tested on:
Gentoo Linux
Debian 6.0.10
Oracle Linux Server release 7.1
Signed-off-by: Alexander Kapshuk <alexander.kapshuk@...il.com>
---
--- linux/scripts/ver_linux.orig 2015-10-03 13:41:57.118790241 +0300
+++ linux/scripts/ver_linux 2015-10-03 13:46:25.879768460 +0300
@@ -11,6 +11,166 @@
uname -a
echo ' '
+gcc=`which gcc 2>/dev/null`
+test -n "$gcc" ||
+gcc=`whereis gcc |
+ sed '/\/gcc/!d
+ s/.*:[ \t]//
+ s/[ \t].*//'
+`
+
+make=`which make 2>/dev/null`
+test -n "$make" ||
+make=`whereis make |
+ sed '/\/make/!d
+ s/.*:[ \t]//
+ s/[ \t].*//'
+`
+
+ld=`which ld 2>/dev/null`
+test -n "$ld" ||
+ld=`whereis ld |
+ sed '/\/ld/!d
+ s/.*:[ \t]//
+ s/[ \t].*//'
+`
+
+mount=`which mount 2>/dev/null`
+test -n "$mount" ||
+mount=`whereis mount |
+ sed '/\/mount/!d
+ s/.*:[ \t]//
+ s/[ \t].*//'
+`
+
+depmod=`which depmod 2>/dev/null`
+test -n "$depmod" ||
+depmod=`whereis depmod |
+ sed '/\/depmod/!d
+ s/.*:[ \t]//
+ s/[ \t].*//'
+`
+
+tune2fs=`which tune2fs 2>/dev/null`
+test -n "$tune2fs" ||
+tune2fs=`whereis tune2fs |
+ sed '/\/tune2fs/!d
+ s/.*:[ \t]//
+ s/[ \t].*//'
+`
+
+fsckjfs=`which fsck.jfs 2>/dev/null`
+test -n "$fsckjfs" ||
+fsckjfs=`whereis fsck.jfs |
+ sed '/\/fsck.jfs/!d
+ s/.*:[ \t]//
+ s/[ \t].*//'
+`
+
+reiserfsck=`which reiserfsck 2>/dev/null`
+test -n "$reiserfsck" ||
+reiserfsck=`whereis reiserfsck |
+ sed '/\/reiserfsck/!d
+ s/.*:[ \t]//
+ s/[ \t].*//'
+`
+
+xfs_db=`which xfs_db 2>/dev/null`
+test -n "$xfs_db" ||
+xfs_db=`whereis xfs_db |
+ sed '/\/xfs_db/!d
+ s/.*:[ \t]//
+ s/[ \t].*//'
+`
+
+pccardctl=`which pccardctl 2>/dev/null`
+test -n "$pccardctl" ||
+pccardctl=`whereis pccardctl |
+ sed '/\/pccardctl/!d
+ s/.*:[ \t]//
+ s/[ \t].*//'
+`
+
+quota=`which quota 2>/dev/null`
+test -n "$quota" ||
+quota=`whereis quota |
+ sed '/\/quota/!d
+ s/.*:[ \t]//
+ s/[ \t].*//'
+`
+
+pppd=`which pppd 2>/dev/null`
+test -n "$pppd" ||
+pppd=`whereis pppd |
+ sed '/\/pppd/!d
+ s/.*:[ \t]//
+ s/[ \t].*//'
+`
+
+ldd=`which ldd 2>/dev/null`
+test -n "$ldd" ||
+ldd=`whereis ldd |
+ sed '/\/ldd/!d
+ s/.*:[ \t]//
+ s/[ \t].*//'
+`
+
+ldconfig=`which ldconfig 2>/dev/null`
+test -n "$ldconfig" ||
+ldconfig=`whereis ldconfig |
+ sed '/\/ldconfig/!d
+ s/.*:[ \t]//
+ s/[ \t].*//'
+`
+
+ps=`which ps 2>/dev/null`
+test -n "$ps" ||
+ps=`whereis ps |
+ sed '/\/ps/!d
+ s/.*:[ \t]//
+ s/[ \t].*//'
+`
+
+ifconfig=`which ifconfig 2>/dev/null`
+test -n "$ifconfig" ||
+ifconfig=`whereis ifconfig |
+ sed '/\/ifconfig/!d
+ s/.*:[ \t]//
+ s/[ \t].*//'
+`
+
+loadkeys=`which loadkeys 2>/dev/null`
+test -n "$loadkeys" ||
+loadkeys=`whereis loadkeys |
+ sed '/\/loadkeys/!d
+ s/.*:[ \t]//
+ s/[ \t].*//'
+`
+
+expr=`which expr 2>/dev/null`
+test -n "$expr" ||
+expr=`whereis expr |
+ sed '/\/expr/!d
+ s/.*:[ \t]//
+ s/[ \t].*//'
+`
+
+udev=`which udevadm 2>/dev/null`
+test -n "$udev" ||
+udev=`whereis udevadm |
+ sed '/\/udevadm/!d
+ s/.*:[ \t]//
+ s/[ \t].*//'
+`
+
+iwconfig=`which iwconfig 2>/dev/null`
+test -n "$iwconfig" ||
+iwconfig=`whereis iwconfig |
+ sed '/\/iwconfig/!d
+ s/.*:[ \t]//
+ s/[ \t].*//'
+`
+
gcc -dumpversion 2>&1| awk \
'NR==1{print "Gnu C ", $1}'
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists