From: Alexander Kapshuk <alexander.kapshuk@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: gregkh@linuxfoundation.org, jim.epost@gmail.com, richard@nod.at,
tytso@mit.edu, Alexander Kapshuk <alexander.kapshuk@gmail.com>
Subject: [PATCH 04/22] ver_linux: util-linux, 'fdformat' not ubiquitous any longer
Date: Mon, 12 Oct 2015 21:39:44 +0300 [thread overview]
Message-ID: <1444675202-1375-4-git-send-email-alexander.kapshuk@gmail.com> (raw)
In-Reply-To: <1444675202-1375-1-git-send-email-alexander.kapshuk@gmail.com>
The current implementation relies on 'fdformat' to output the version of
'util-linux'. This does not seem to be reliable any longer, as 'fdformat'
does not seem to come preinstalled in all ditros these days.
The proposed implementation uses 'mount' to output both the version
of 'util-linux' and 'mount' proper, as 'mount' is also a part of the
'util-linux' package.
Tested on:
Gentoo Linux
Debian 6.0.10
Oracle Linux Server release 7.1
Rely on regex to find the version number, rather than a field number.
Signed-off-by: Alexander Kapshuk <alexander.kapshuk@gmail.com>
---
scripts/ver_linux | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/scripts/ver_linux b/scripts/ver_linux
index 1fea749..28e7640 100755
--- a/scripts/ver_linux
+++ b/scripts/ver_linux
@@ -32,11 +32,12 @@ awk '/[0-9]+([.]?[0-9]+)+/ && !/not found$/{
substr($0,RSTART,RLENGTH))
}'
-echo -n "util-linux "
-fdformat --version | awk '{print $NF}' | sed -e s/^util-linux-// -e s/\)$//
-
-echo -n "mount "
-mount --version | awk '{print $NF}' | sed -e s/^mount-// -e s/\)$//
+mount --version 2>&1 |
+awk '/[0-9]+([.]?[0-9]+)+/ && !/not found$/{
+ match($0, /[0-9]+([.]?[0-9]+)+/)
+ $0 = substr($0,RSTART,RLENGTH)
+ printf("Util-linux\t\t%s\nMount\t\t\t%s\n",$0,$0)
+}'
depmod -V 2>&1 | awk 'NR==1 {print "module-init-tools ",$NF}'
--
2.4.9
next prev parent reply other threads:[~2015-10-12 18:40 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-12 18:39 [PATCH 01/22] ver_linux: gcc -dumpversion, use regex to find version number Alexander Kapshuk
2015-10-12 18:39 ` [PATCH 02/22] ver_linux: make --version, " Alexander Kapshuk
2015-10-12 18:39 ` [PATCH 03/22] ver_linux: binutils, fix inaccurate output Alexander Kapshuk
2015-10-12 18:39 ` Alexander Kapshuk [this message]
2015-10-12 22:04 ` [PATCH 04/22] ver_linux: util-linux, 'fdformat' not ubiquitous any longer Jim Davis
2015-10-12 18:39 ` [PATCH 05/22] ver_linux: module-init-tools, look for numerical input, not field number Alexander Kapshuk
2015-10-12 18:39 ` [PATCH 06/22] ver_linux: e2fsprogs, " Alexander Kapshuk
2015-10-12 18:39 ` [PATCH 07/22] ver_linux: jfsutils, " Alexander Kapshuk
2015-10-12 18:39 ` [PATCH 08/22] ver_linux: reiserfsprogs, " Alexander Kapshuk
2015-10-12 18:39 ` [PATCH 09/22] ver_linux: xfsprogs, " Alexander Kapshuk
2015-10-12 18:39 ` [PATCH 10/22] ver_linux: pcmciautils, " Alexander Kapshuk
2015-10-12 18:39 ` [PATCH 11/22] ver_linux: quota-tools, " Alexander Kapshuk
2015-10-12 18:39 ` [PATCH 12/22] ver_linux: ppp, " Alexander Kapshuk
2015-10-12 18:39 ` [PATCH 13/22] ver_linux: libc, input redirection to sed fails in some distros Alexander Kapshuk
2015-10-12 18:39 ` [PATCH 14/22] ver_linux: ldd, look for numerical input, not field number Alexander Kapshuk
2015-10-12 18:39 ` [PATCH 15/22] ver_linux: libcpp, fix missing output Alexander Kapshuk
2015-10-12 18:39 ` [PATCH 16/22] ver_linux: procps, look for numerical input, not field number Alexander Kapshuk
2015-10-12 18:39 ` [PATCH 17/22] ver_linux: net-tools, " Alexander Kapshuk
2015-10-12 18:39 ` [PATCH 18/22] ver_linux: loadkeys, " Alexander Kapshuk
2015-10-12 18:39 ` [PATCH 19/22] ver_linux: sh-utils, " Alexander Kapshuk
2015-10-12 18:40 ` [PATCH 20/22] ver_linux: use 'udevadm', instead of 'udevinfo' Alexander Kapshuk
2015-10-12 18:40 ` [PATCH 21/22] ver_linux: wireless-tools, look for numerical input, not field number Alexander Kapshuk
2015-10-12 18:40 ` [PATCH 22/22] ver_linux: proc/modules, limit text processing to 'sed' Alexander Kapshuk
2015-10-12 20:22 ` Jim Davis
2015-10-13 17:33 ` Alexander Kapshuk
2015-10-13 23:21 ` [PATCH 01/22] ver_linux: gcc -dumpversion, use regex to find version number Jim Davis
2015-10-14 9:29 ` Alexander Kapshuk
2015-10-14 21:43 ` Jim Davis
2015-12-02 14:24 ` Pavel Machek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1444675202-1375-4-git-send-email-alexander.kapshuk@gmail.com \
--to=alexander.kapshuk@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=jim.epost@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=richard@nod.at \
--cc=tytso@mit.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome