Module Name: othersrc
Committed By: agc
Date: Thu Jun 2 02:47:56 UTC 2016
Added Files:
othersrc/external/bsd/sys_info: Makefile README sys_info.1 sys_info.sh
Log Message:
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
To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 othersrc/external/bsd/sys_info/Makefile \
othersrc/external/bsd/sys_info/README \
othersrc/external/bsd/sys_info/sys_info.1 \
othersrc/external/bsd/sys_info/sys_info.sh
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Added files:
Index: othersrc/external/bsd/sys_info/Makefile
diff -u /dev/null othersrc/external/bsd/sys_info/Makefile:1.1
--- /dev/null Thu Jun 2 02:47:56 2016
+++ othersrc/external/bsd/sys_info/Makefile Thu Jun 2 02:47:56 2016
@@ -0,0 +1,8 @@
+# $NetBSD: Makefile,v 1.1 2016/06/02 02:47:56 agc Exp $
+
+SCRIPTS= sys_info
+SCRIPTSDIR= /usr/sbin
+MAN= sys_info.1
+CLEANFILES+= ${SCRIPTS}
+
+.include <bsd.prog.mk>
Index: othersrc/external/bsd/sys_info/README
diff -u /dev/null othersrc/external/bsd/sys_info/README:1.1
--- /dev/null Thu Jun 2 02:47:56 2016
+++ othersrc/external/bsd/sys_info/README Thu Jun 2 02:47:56 2016
@@ -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
Index: othersrc/external/bsd/sys_info/sys_info.1
diff -u /dev/null othersrc/external/bsd/sys_info/sys_info.1:1.1
--- /dev/null Thu Jun 2 02:47:56 2016
+++ othersrc/external/bsd/sys_info/sys_info.1 Thu Jun 2 02:47:56 2016
@@ -0,0 +1,67 @@
+.\" $NetBSD: sys_info.1,v 1.1 2016/06/02 02:47:56 agc Exp $
+.\"
+.\" Copyright (c) 2016 Alistair Crooks <[email protected]>
+.\" 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
+.Pp
+.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 [email protected] .
Index: othersrc/external/bsd/sys_info/sys_info.sh
diff -u /dev/null othersrc/external/bsd/sys_info/sys_info.sh:1.1
--- /dev/null Thu Jun 2 02:47:56 2016
+++ othersrc/external/bsd/sys_info/sys_info.sh Thu Jun 2 02:47:56 2016
@@ -0,0 +1,146 @@
+#! /bin/sh
+
+# $NetBSD: sys_info.sh,v 1.1 2016/06/02 02:47:56 agc Exp $
+
+# Copyright (c) 2016 Alistair Crooks <[email protected]>
+# 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 "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 ${v##*/}
+ ;;
+ esac
+ ;;
+ lib*)
+ dlist=$(echo ${LD_LIBRARY_PATH} | awk '{ gsub(":", " "); print }')
+ for d in ${dlist}; do
+ if [ -e ${d}/$1.so ]; then
+ ls -al ${d}/$1.so | awk '{ sub(".*/", "", $11); sub("\\.so\\.", "-", $11); print $11 }'
+ break
+ fi
+ done
+ ;;
+ netbsd)
+ uname -sr | awk '{ print $1 "-" $2 }'
+ ;;
+ netpgp)
+ netpgp -V | awk '{ sub("/.*", "", $3); print "netpgp-" $3; exit }'
+ ;;
+ netpgpverify)
+ netpgpverify -v | awk '{ print $1 "-" $3 }'
+ ;;
+ ntp)
+ ntpq --version | awk '{ sub("-.", ""); sub("p", "pl", $2); print "ntp-" $2 }'
+ ;;
+ openssl)
+ openssl version 2>/dev/null | awk '{ print tolower($1) "-" $2 }'
+ ;;
+ sqlite|sqlite3)
+ sqlite3 --version | awk '{ print "sqlite3-" $1 }'
+ ;;
+ ssh|openssh)
+ ssh -V 2>&1 | awk '{ sub("_", "-", $1); print tolower($1) }'
+ ;;
+ sshd)
+ sshd -V 2>&1 | awk '/OpenSSH/ { sub("_", "D-", $1); print tolower($1) }'
+ ;;
+ tcsh)
+ tcsh -c 'echo $version' | awk '{ print $1 "-" $2 }'
+ ;;
+ unbound)
+ case $(uname -s) in
+ FreeBSD)
+ unbound-control -h | awk '/^Version/ { print "unbound-" $2 }'
+ ;;
+ esac
+ ;;
+ xz)
+ xz --version | awk '{ print $1 "-" $4; exit }'
+ ;;
+ esac
+}
+
+all=false
+while [ $# -gt 0 ]; do
+ case "$1" in
+ -a) all=true ;;
+ -v) set -x ;;
+ *) break ;;
+ esac
+ shift
+done
+
+# if we want to do every one, then let's get the arguments
+# not really scalable
+if ${all}; then
+ args='awk bind bzip2 calendar ftpd g++ gcc grep gzip httpd netbsd netpgp'
+ args="${args} netpgpverify ntp openssl sqlite ssh sshd tcsh unbound xz"
+ set -- ${args}
+fi
+
+while [ $# -gt 0 ]; do
+ getversion $1
+ shift
+done