Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src Following positive feedback on tech-userlevel, move the sys_...



details:   https://anonhg.NetBSD.org/src/rev/3eee8208c0ff
branches:  trunk
changeset: 345665:3eee8208c0ff
user:      agc <agc%NetBSD.org@localhost>
date:      Sat Jun 04 15:27:11 2016 +0000

description:
Following positive feedback on tech-userlevel, move the sys_info
script from othersrc to usr.bin/sys_info

        The sys_info script is a small script which will show the version
        information for installed utilities.  It also works on the kernel, and
        on most libraries.

        Its use is as follow:

                [19:41:13] agc@netbsd-002 ...external/bsd/sys_info [4568] > ./sys_info -a
                awk-20121220
                bind-9.10.3pl3
                bzip2-1.0.6
                calendar-20160601
                ftpd-20110904
                g++-4.8.5
                gcc-4.8.5
                grep-2.5.1anb1
                gzip-20150113
                bozohttpd-20151231
                NetBSD-7.99.26
                netpgp-3.99.17
                netpgpverify-20160214
                ntp-4.2.8pl5
                openssl-1.0.1r
                sqlite3-3.12.2
                openssh-7.1
                opensshd-7.1
                tcsh-6.19.00
                xz-5.2.1
                [19:41:20] agc@netbsd-002 ...external/bsd/sys_info [4569] > ./sys_info ntp ssh netpgp
                ntp-4.2.8pl5
                openssh-7.1
                netpgp-3.99.17
                [19:41:31] agc@netbsd-002 ...external/bsd/sys_info [4570] > ./sys_info ntp ssh netbsd
                ntp-4.2.8pl5
                openssh-7.1
                NetBSD-7.99.26
                [19:41:38] agc@netbsd-002 ...external/bsd/sys_info [4571] >

        The -a option can be given to the script to print out the information
        on all known components.

        The sys_info script also works on libraries, returning their
        "versions" as given by the shared object version numbers.

                [19:45:06] agc@netbsd-002 ...external/bsd/sys_info [4572] > ./sys_info libevent libXfont libc netbsd
                libevent-4.0
                libXfont-3.0
                libc-12.200
                NetBSD-7.99.26
                [19:45:27] agc@netbsd-002 ...external/bsd/sys_info [4573] >

        Alistair Crooks
        Wed Jun  1 19:44:01 PDT 2016

diffstat:

 distrib/sets/lists/base/mi   |    3 +-
 distrib/sets/lists/man/mi    |    5 +-
 doc/CHANGES                  |    4 +-
 usr.bin/Makefile             |    5 +-
 usr.bin/sys_info/Makefile    |    8 ++
 usr.bin/sys_info/README      |   52 +++++++++++++++
 usr.bin/sys_info/sys_info.1  |   66 +++++++++++++++++++
 usr.bin/sys_info/sys_info.sh |  146 +++++++++++++++++++++++++++++++++++++++++++
 8 files changed, 284 insertions(+), 5 deletions(-)

diffs (truncated from 372 to 300 lines):

diff -r bf60cca8adcb -r 3eee8208c0ff distrib/sets/lists/base/mi
--- a/distrib/sets/lists/base/mi        Sat Jun 04 11:25:43 2016 +0000
+++ b/distrib/sets/lists/base/mi        Sat Jun 04 15:27:11 2016 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1125 2016/06/01 08:17:39 pgoyette Exp $
+# $NetBSD: mi,v 1.1126 2016/06/04 15:27:11 agc Exp $
 #
 # Note:        Don't delete entries from here - mark them as "obsolete" instead,
 #      unless otherwise stated below.
@@ -911,6 +911,7 @@
 ./usr/bin/string2key                           base-krb5-bin           kerberos
 ./usr/bin/su                                   base-util-bin
 ./usr/bin/sum                                  base-util-bin
+./usr/bin/sys_info                             base-util-bin
 ./usr/bin/sysstat                              base-util-bin
 ./usr/bin/systat                               base-util-bin
 ./usr/bin/tabs                                 base-util-bin
diff -r bf60cca8adcb -r 3eee8208c0ff distrib/sets/lists/man/mi
--- a/distrib/sets/lists/man/mi Sat Jun 04 11:25:43 2016 +0000
+++ b/distrib/sets/lists/man/mi Sat Jun 04 15:27:11 2016 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1524 2016/05/01 10:21:01 nonaka Exp $
+# $NetBSD: mi,v 1.1525 2016/06/04 15:27:11 agc Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -541,6 +541,7 @@
 ./usr/share/man/cat1/sum.0                     man-util-catman         .cat
 ./usr/share/man/cat1/sup.0                     man-sup-catman          .cat
 ./usr/share/man/cat1/suspend.0                 man-util-catman         .cat
+./usr/share/man/cat1/sys_info.0                        man-util-catman         .cat
 ./usr/share/man/cat1/sysstat.0                 man-util-catman         .cat
 ./usr/share/man/cat1/systat.0                  man-util-catman         .cat
 ./usr/share/man/cat1/systrace.0                        man-obsolete            obsolete
@@ -3677,6 +3678,7 @@
 ./usr/share/man/html1/sum.html                 man-util-htmlman        html
 ./usr/share/man/html1/sup.html                 man-sup-htmlman         html
 ./usr/share/man/html1/suspend.html             man-util-htmlman        html
+./usr/share/man/html1/sys_info.html            man-util-htmlman        html
 ./usr/share/man/html1/sysstat.html             man-util-htmlman        html
 ./usr/share/man/html1/systat.html              man-util-htmlman        html
 ./usr/share/man/html1/tabs.html                        man-util-htmlman        html
@@ -6465,6 +6467,7 @@
 ./usr/share/man/man1/sum.1                     man-util-man            .man
 ./usr/share/man/man1/sup.1                     man-sup-man             .man
 ./usr/share/man/man1/suspend.1                 man-util-man            .man
+./usr/share/man/man1/sys_info.1                        man-util-man            .man
 ./usr/share/man/man1/sysstat.1                 man-util-man            .man
 ./usr/share/man/man1/systat.1                  man-util-man            .man
 ./usr/share/man/man1/systrace.1                        man-obsolete            obsolete
diff -r bf60cca8adcb -r 3eee8208c0ff doc/CHANGES
--- a/doc/CHANGES       Sat Jun 04 11:25:43 2016 +0000
+++ b/doc/CHANGES       Sat Jun 04 15:27:11 2016 +0000
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:                   <$Revision: 1.2169 $>
+# LIST OF CHANGES FROM LAST RELEASE:                   <$Revision: 1.2170 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -316,3 +316,5 @@
                there [christos 20160527]
        zoneinfo: Import tzdata2016d. [agc 20160531]
        ntp: Import ntp 4.2.8p8. [christos 20160603]
+       sys_info: Import a script to return version information for system
+               libraries and utilities [agc 20160604]
diff -r bf60cca8adcb -r 3eee8208c0ff usr.bin/Makefile
--- a/usr.bin/Makefile  Sat Jun 04 11:25:43 2016 +0000
+++ b/usr.bin/Makefile  Sat Jun 04 15:27:11 2016 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.224 2016/01/24 17:08:16 christos Exp $
+#      $NetBSD: Makefile,v 1.225 2016/06/04 15:27:11 agc Exp $
 #      from: @(#)Makefile      8.3 (Berkeley) 1/7/94
 
 .include <bsd.own.mk>
@@ -25,7 +25,8 @@
        renice rev revoke rfcomm_sppd rlogin rpcgen rpcinfo rs rsh \
        rup ruptime rusers rwall rwho \
        script sdiff sdpquery sed seq shar shlock \
-       showmount shuffle sockstat sort sortinfo spell split stat su systat \
+       showmount shuffle sockstat sort sortinfo \
+       spell split stat su sys_info systat \
        tabs tail talk tcopy tee telnet tftp tic time timeout tip touch \
        tpfmt tput \
        tr true tset tsort tty ul uname unexpand unifdef \
diff -r bf60cca8adcb -r 3eee8208c0ff usr.bin/sys_info/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.bin/sys_info/Makefile Sat Jun 04 15:27:11 2016 +0000
@@ -0,0 +1,8 @@
+# $NetBSD: Makefile,v 1.1 2016/06/04 15:27:11 agc Exp $
+
+SCRIPTS=       sys_info
+SCRIPTSDIR=    /usr/bin
+MAN=           sys_info.1
+CLEANFILES+=   ${SCRIPTS}
+
+.include <bsd.prog.mk>
diff -r bf60cca8adcb -r 3eee8208c0ff usr.bin/sys_info/README
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.bin/sys_info/README   Sat Jun 04 15:27:11 2016 +0000
@@ -0,0 +1,52 @@
+The sys_info script is a small script which will show the version
+information for installed utilities.  It also works on the kernel, and
+on most libraries.
+
+Its use is as follow:
+
+       [19:41:13] agc@netbsd-002 ...external/bsd/sys_info [4568] > ./sys_info -a
+       awk-20121220
+       bind-9.10.3pl3
+       bzip2-1.0.6
+       calendar-20160601
+       ftpd-20110904
+       g++-4.8.5
+       gcc-4.8.5
+       grep-2.5.1anb1
+       gzip-20150113
+       bozohttpd-20151231
+       NetBSD-7.99.26
+       netpgp-3.99.17
+       netpgpverify-20160214
+       ntp-4.2.8pl5
+       openssl-1.0.1r
+       sqlite3-3.12.2
+       openssh-7.1
+       opensshd-7.1
+       tcsh-6.19.00
+       xz-5.2.1
+       [19:41:20] agc@netbsd-002 ...external/bsd/sys_info [4569] > ./sys_info ntp ssh netpgp
+       ntp-4.2.8pl5
+       openssh-7.1
+       netpgp-3.99.17
+       [19:41:31] agc@netbsd-002 ...external/bsd/sys_info [4570] > ./sys_info ntp ssh netbsd
+       ntp-4.2.8pl5
+       openssh-7.1
+       NetBSD-7.99.26
+       [19:41:38] agc@netbsd-002 ...external/bsd/sys_info [4571] >
+
+The -a option can be given to the script to print out the information
+on all known components.
+
+The sys_info script also works on libraries, returning their
+"versions" as given by the shared object version numbers.
+
+       [19:45:06] agc@netbsd-002 ...external/bsd/sys_info [4572] > ./sys_info libevent libXfont libc netbsd
+       libevent-4.0
+       libXfont-3.0
+       libc-12.200
+       NetBSD-7.99.26
+       [19:45:27] agc@netbsd-002 ...external/bsd/sys_info [4573] >
+
+Alistair Crooks
+Wed Jun  1 19:44:01 PDT 2016
diff -r bf60cca8adcb -r 3eee8208c0ff usr.bin/sys_info/sys_info.1
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.bin/sys_info/sys_info.1       Sat Jun 04 15:27:11 2016 +0000
@@ -0,0 +1,66 @@
+.\" $NetBSD: sys_info.1,v 1.1 2016/06/04 15:27:11 agc Exp $
+.\"
+.\" Copyright (c) 2016 Alistair Crooks <agc%NetBSD.org@localhost>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"    notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"    notice, this list of conditions and the following disclaimer in the
+.\"    documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.Dd June 1, 2016
+.Dt SYS_INFO 1
+.Os
+.Sh NAME
+.Nm sys_info
+.Nd script to show versioning information
+.Sh SYNOPSIS
+.Nm
+.Op Fl av
+.Op Ar
+.Sh DESCRIPTION
+The
+.Nm
+script displays version numbers for system components.
+It is useful for finding out the installed versions of
+the components of a system.
+The
+.Nm
+utility uses a combination of ways to retrieve version
+information from the installed utilities.
+.Sh OPTIONS
+The following options are available:
+.Bl -tag -width inits
+.It Fl a
+Show the version numbers of all components.
+.It Fl v
+Perform the operations in a verbose manner.
+.El
+.Sh SEE ALSO
+.Xr awk 1 ,
+.Xr strings 1
+.Sh HISTORY
+The
+.Nm
+program was first seen in
+.Nx 8 .
+.Sh AUTHORS
+The
+.Nm
+script was written by
+.An Alistair Crooks Aq Mt agc%NetBSD.org@localhost .
diff -r bf60cca8adcb -r 3eee8208c0ff usr.bin/sys_info/sys_info.sh
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.bin/sys_info/sys_info.sh      Sat Jun 04 15:27:11 2016 +0000
@@ -0,0 +1,146 @@
+#! /bin/sh
+
+# $NetBSD: sys_info.sh,v 1.1 2016/06/04 15:27:11 agc Exp $
+
+# Copyright (c) 2016 Alistair Crooks <agc%NetBSD.org@localhost>
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+LD_LIBRARY_PATH=${LD_LIBRARY_PATH:-/usr/lib:/usr/X11R7/lib}
+
+# print out the version for the given argument
+getversion() {
+       case "$1" in
+       awk)
+               awk --version | awk '{ print $1 "-" $3 }'
+               ;;
+       bind|named)
+               named -v | awk '{ gsub("-", "", $2); gsub("P", "pl", $2); print tolower($1) "-" $2 }'
+               ;;
+       bzip2)
+               bzip2 --help 2>&1 | awk '{ sub(",", "", $7); print "bzip2-" $7; exit }'
+               ;;
+       calendar)
+               v=$(calendar -v 2>/dev/null || true)
+               case "${v}" in
+               "")     echo "calendar-20150701" ;;
+               *)      echo ${v} ;;
+               esac
+               ;;
+       ftpd)
+               strings -a /usr/libexec/ftpd | awk '$1 == "NetBSD-ftpd" { print "ftpd-" $2 }'
+               ;;
+       g++|c++)
+               g++ --version | awk '{ print $1 "-" $4; exit }'
+               ;;
+       gcc|cc)
+               gcc --version | awk '{ print $1 "-" $4; exit }'
+               ;;
+       grep)
+               grep --version | awk '{ print $1 "-" $4 $5; exit }'
+               ;;
+       gzip)
+               gzip --version 2>&1 | awk '{ print $2 "-" $3 }'
+               ;;
+       httpd|bozohttpd)
+               v=$(/usr/libexec/httpd -G 2>/dev/null || true)
+               case "${v}" in
+               "")
+                       strings -a /usr/libexec/httpd | awk -F/ '$1 == "bozohttpd" && NF == 2 { print $1 "-" $2; exit }'
+                       ;;
+               *)
+                       echo bozohttpd-${v##*/}
+                       ;;
+               esac



Home | Main Index | Thread Index | Old Index