CVS commit: src/usr.bin/sys_info

2020-07-13 Thread Jeremy C. Reed
Module Name:src
Committed By:   reed
Date:   Tue Jul 14 01:01:05 UTC 2020

Modified Files:
src/usr.bin/sys_info: sys_info.sh

Log Message:
show the verbose commands for bozohttpd and calendar too

And bump the version.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/usr.bin/sys_info/sys_info.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/sys_info/sys_info.sh
diff -u src/usr.bin/sys_info/sys_info.sh:1.17 src/usr.bin/sys_info/sys_info.sh:1.18
--- src/usr.bin/sys_info/sys_info.sh:1.17	Thu Sep 28 18:08:04 2017
+++ src/usr.bin/sys_info/sys_info.sh	Tue Jul 14 01:01:05 2020
@@ -1,6 +1,6 @@
 #! /bin/sh
 
-# $NetBSD: sys_info.sh,v 1.17 2017/09/28 18:08:04 agc Exp $
+# $NetBSD: sys_info.sh,v 1.18 2020/07/14 01:01:05 reed Exp $
 
 # Copyright (c) 2016 Alistair Crooks 
 # All rights reserved.
@@ -26,7 +26,7 @@
 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #
 
-SYS_INFO_VERSION=20170928
+SYS_INFO_VERSION=20200714
 
 PATH=$(sysctl -n user.cs_path)
 export PATH
@@ -110,7 +110,7 @@ getversion() {
 		run "named -v | awk '{ gsub(\"-\", \"\", \$2); gsub(\"P\", \"pl\", \$2); print tolower(\$1) \"-\" \$2 }'"
 		$all || return 0 ;&
 	bozohttpd|httpd)
-		v=$(run "${destdir}/usr/libexec/httpd -G" 2>/dev/null)
+		v=$(run "${destdir}/usr/libexec/httpd -G")
 		case "${v}" in
 		"")
 			run  "strings -a ${destdir}/usr/libexec/httpd | awk -F/ '\$1 == \"bozohttpd\" && NF == 2 { print \$1 \"-\" \$2; exit }'"
@@ -124,7 +124,7 @@ getversion() {
 		run  "bzip2 --help 2>&1 | awk '{ sub(\",\", \"\", \$7); print \"bzip2-\" \$7; exit }'"
 		$all || return 0 ;&
 	calendar)
-		v=$(run "calendar -v" 2>/dev/null || true)
+		v=$(run "calendar -v" || true)
 		case "${v}" in
 		"")	printf '%s\n' "calendar-20150701" ;;
 		*)	printf '%s\n' "${v}" ;;



CVS commit: src/usr.bin/sys_info

2020-07-07 Thread Jeremy C. Reed
Module Name:src
Committed By:   reed
Date:   Wed Jul  8 00:06:33 UTC 2020

Modified Files:
src/usr.bin/sys_info: README

Log Message:
Remove -a from example

(removed from script and manual in the 20170821 version)


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/sys_info/README

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/sys_info/README
diff -u src/usr.bin/sys_info/README:1.1 src/usr.bin/sys_info/README:1.2
--- src/usr.bin/sys_info/README:1.1	Sat Jun  4 15:27:11 2016
+++ src/usr.bin/sys_info/README	Wed Jul  8 00:06:33 2020
@@ -4,7 +4,7 @@ on most libraries.
 
 Its use is as follow:
 
-	[19:41:13] agc@netbsd-002 ...external/bsd/sys_info [4568] > ./sys_info -a
+	[19:41:13] agc@netbsd-002 ...external/bsd/sys_info [4568] > ./sys_info
 	awk-20121220
 	bind-9.10.3pl3
 	bzip2-1.0.6
@@ -35,9 +35,6 @@ Its use is as follow:
 	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.
 



CVS commit: src/usr.bin/sys_info

2017-09-28 Thread Alistair G. Crooks
Module Name:src
Committed By:   agc
Date:   Thu Sep 28 18:08:04 UTC 2017

Modified Files:
src/usr.bin/sys_info: sys_info.sh

Log Message:
Also report versions of tcpdump, libpcap, and wpa_supplicant

Bump sys_info version to 20170928


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/usr.bin/sys_info/sys_info.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/sys_info/sys_info.sh
diff -u src/usr.bin/sys_info/sys_info.sh:1.16 src/usr.bin/sys_info/sys_info.sh:1.17
--- src/usr.bin/sys_info/sys_info.sh:1.16	Thu Sep 21 07:07:28 2017
+++ src/usr.bin/sys_info/sys_info.sh	Thu Sep 28 18:08:04 2017
@@ -1,6 +1,6 @@
 #! /bin/sh
 
-# $NetBSD: sys_info.sh,v 1.16 2017/09/21 07:07:28 wiz Exp $
+# $NetBSD: sys_info.sh,v 1.17 2017/09/28 18:08:04 agc Exp $
 
 # Copyright (c) 2016 Alistair Crooks 
 # All rights reserved.
@@ -26,7 +26,7 @@
 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #
 
-SYS_INFO_VERSION=20170920
+SYS_INFO_VERSION=20170928
 
 PATH=$(sysctl -n user.cs_path)
 export PATH
@@ -187,6 +187,11 @@ getversion() {
 	openssl)
 		run "openssl version 2>/dev/null | awk '{ print tolower(\$1) \"-\" \$2 }'"
 		$all || return 0 ;&
+	pcap)
+		if which_prog tcpdumppath tcpdump; then
+			run "${tcpdumppath} -h 2>&1 | awk '\$1 == \"libpcap\" { sub(\" version \", \"-\"); print }'"
+		fi
+		$all || return 0 ;&
 	pkg_info|pkg_install)
 		if which_prog infopath pkg_info; then
 			run "printf 'pkg_install-%s\n' \$(${infopath} -V)"
@@ -201,6 +206,11 @@ getversion() {
 	sys_info)
 		run "printf '%s\n' sys_info-${SYS_INFO_VERSION}"
 		$all || return 0 ;&
+	tcpdump)
+		if which_prog tcpdumppath tcpdump; then
+			run "${tcpdumppath} -h 2>&1 | awk '\$1 == \"tcpdump\" { sub(\" version \", \"-\"); print }'"
+		fi
+		$all || return 0 ;&
 	tcsh)
 		if which_prog tcshpath tcsh; then
 			run "${tcshpath} --version | awk '{ print \$1 \"-\" \$2 }'"
@@ -223,6 +233,11 @@ getversion() {
 	[uU]ser[lL]and|release)
 		run "sed <${destdir}/etc/release -e 's/ /-/g' -e 's/^/userland-/' -e 1q"
 		$all || return 0 ;&
+	wpa_supplicant)
+		if which_prog wpapath wpa_supplicant; then
+			run "${wpapath} -v | awk 'NF == 2 { sub(\" v\", \"-\"); print }'"
+		fi
+		$all || return 0 ;&
 	xz)
 		run "xz --version | awk '{ print \$1 \"-\" \$4; exit }'"
 		$all || return 0 ;&



CVS commit: src/usr.bin/sys_info

2017-09-21 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Thu Sep 21 07:07:28 UTC 2017

Modified Files:
src/usr.bin/sys_info: sys_info.1 sys_info.sh

Log Message:
Sort options and their descriptions in man page and usage.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/usr.bin/sys_info/sys_info.1
cvs rdiff -u -r1.15 -r1.16 src/usr.bin/sys_info/sys_info.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/sys_info/sys_info.1
diff -u src/usr.bin/sys_info/sys_info.1:1.7 src/usr.bin/sys_info/sys_info.1:1.8
--- src/usr.bin/sys_info/sys_info.1:1.7	Thu Sep 21 01:15:45 2017
+++ src/usr.bin/sys_info/sys_info.1	Thu Sep 21 07:07:28 2017
@@ -1,4 +1,4 @@
-.\" $NetBSD: sys_info.1,v 1.7 2017/09/21 01:15:45 agc Exp $
+.\" $NetBSD: sys_info.1,v 1.8 2017/09/21 07:07:28 wiz Exp $
 .\"
 .\" Copyright (c) 2016 Alistair Crooks 
 .\" All rights reserved.
@@ -31,10 +31,10 @@
 .Nd script to show system version information
 .Sh SYNOPSIS
 .Nm
+.Op Fl v
+.Op Fl d Ar destination-dir
 .Op Fl L Ar lib-path
 .Op Fl P Ar path
-.Op Fl d Ar destination-dir
-.Op Fl v
 .Op Ar component No ...
 .Sh DESCRIPTION
 The
@@ -49,6 +49,15 @@ information from the installed utilities
 .Sh OPTIONS
 The following options are available:
 .Bl -tag -width inits
+.It Fl d
+This option provides a destination directory, used
+as the root directory of an alternative set of programs
+and libraries.
+This can be useful for finding versions of utilities
+and libraries rooted in the file system directory,
+such as the destination directory from a
+.Dv build.sh
+run.
 .It Fl L
 Give a list of directories
 .Pq "colon separated"
@@ -67,15 +76,6 @@ via
 is used.
 To use the current value of $PATH from the caller, use:
 .Dl -P \*q$PATH\*q
-.It Fl d
-This option provides a destination directory, used
-as the root directory of an alternative set of programs
-and libraries.
-This can be useful for finding versions of utilities
-and libraries rooted in the file system directory,
-such as the destination directory from a
-.Dv build.sh
-run.
 .It Fl v
 Show the commands used to obtain the version information
 for each component

Index: src/usr.bin/sys_info/sys_info.sh
diff -u src/usr.bin/sys_info/sys_info.sh:1.15 src/usr.bin/sys_info/sys_info.sh:1.16
--- src/usr.bin/sys_info/sys_info.sh:1.15	Thu Sep 21 01:15:45 2017
+++ src/usr.bin/sys_info/sys_info.sh	Thu Sep 21 07:07:28 2017
@@ -1,6 +1,6 @@
 #! /bin/sh
 
-# $NetBSD: sys_info.sh,v 1.15 2017/09/21 01:15:45 agc Exp $
+# $NetBSD: sys_info.sh,v 1.16 2017/09/21 07:07:28 wiz Exp $
 
 # Copyright (c) 2016 Alistair Crooks 
 # All rights reserved.
@@ -251,7 +251,7 @@ while getopts "L:P:d:v" a; do
 		destdir=${OPTARG};;
 	v)	verbose=true;;
 	\?)	printf >&2 '%s\n' \
-		"Usage: $0 [-P path] [-L libdirs] [-d destdir] [-v] [system...]"
+		"Usage: $0 [-v] [-d destdir] [-L libdirs] [-P path] [system...]"
 		exit 2
 	esac
 done



CVS commit: src/usr.bin/sys_info

2017-09-20 Thread Alistair G. Crooks
Module Name:src
Committed By:   agc
Date:   Thu Sep 21 01:15:45 UTC 2017

Modified Files:
src/usr.bin/sys_info: sys_info.1 sys_info.sh

Log Message:
Update sys_info to 20170920

+ add a -d  option, which allows the versions of programs
in a directory tree rooted at "" to be reported on, rather
than the programs and libraries rooted under /. This is useful, for
example, for finding out the versions of utilities and libraries
after a build.sh run:

% sys_info
awk-20121220
bind-9.10.5pl2
bozohttpd-20170201
bzip2-1.0.6
calendar-20160601
dhcpcd-7.0.0-rc1
dtc-1.4.4
ftpd-20110904
g++-5.4.0
gcc-5.4.0
grep-2.5.1anb1
gzip-20170803
libc-12.208
...
% sys_info -d /data/8/build/dest/x86_64
awk-20121220
bind-9.10.5pl1
bozohttpd-20170201
bzip2-1.0.6
calendar-20160601
dhcpcd-7.0.0-rc1
ftpd-20110904
g++-5.4.0
gcc-5.4.0
grep-2.5.1anb1
gzip-20150113
libc-12.207
...
%


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/usr.bin/sys_info/sys_info.1
cvs rdiff -u -r1.14 -r1.15 src/usr.bin/sys_info/sys_info.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/sys_info/sys_info.1
diff -u src/usr.bin/sys_info/sys_info.1:1.6 src/usr.bin/sys_info/sys_info.1:1.7
--- src/usr.bin/sys_info/sys_info.1:1.6	Sun Aug 27 20:39:26 2017
+++ src/usr.bin/sys_info/sys_info.1	Thu Sep 21 01:15:45 2017
@@ -1,4 +1,4 @@
-.\" $NetBSD: sys_info.1,v 1.6 2017/08/27 20:39:26 wiz Exp $
+.\" $NetBSD: sys_info.1,v 1.7 2017/09/21 01:15:45 agc Exp $
 .\"
 .\" Copyright (c) 2016 Alistair Crooks 
 .\" All rights reserved.
@@ -23,7 +23,7 @@
 .\" (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 August 23, 2017
+.Dd September 20, 2017
 .Dt SYS_INFO 1
 .Os
 .Sh NAME
@@ -31,9 +31,10 @@
 .Nd script to show system version information
 .Sh SYNOPSIS
 .Nm
-.Op Fl v
 .Op Fl L Ar lib-path
 .Op Fl P Ar path
+.Op Fl d Ar destination-dir
+.Op Fl v
 .Op Ar component No ...
 .Sh DESCRIPTION
 The
@@ -66,6 +67,15 @@ via
 is used.
 To use the current value of $PATH from the caller, use:
 .Dl -P \*q$PATH\*q
+.It Fl d
+This option provides a destination directory, used
+as the root directory of an alternative set of programs
+and libraries.
+This can be useful for finding versions of utilities
+and libraries rooted in the file system directory,
+such as the destination directory from a
+.Dv build.sh
+run.
 .It Fl v
 Show the commands used to obtain the version information
 for each component

Index: src/usr.bin/sys_info/sys_info.sh
diff -u src/usr.bin/sys_info/sys_info.sh:1.14 src/usr.bin/sys_info/sys_info.sh:1.15
--- src/usr.bin/sys_info/sys_info.sh:1.14	Sat Sep  9 14:12:09 2017
+++ src/usr.bin/sys_info/sys_info.sh	Thu Sep 21 01:15:45 2017
@@ -1,6 +1,6 @@
 #! /bin/sh
 
-# $NetBSD: sys_info.sh,v 1.14 2017/09/09 14:12:09 jmcneill Exp $
+# $NetBSD: sys_info.sh,v 1.15 2017/09/21 01:15:45 agc Exp $
 
 # Copyright (c) 2016 Alistair Crooks 
 # All rights reserved.
@@ -26,7 +26,7 @@
 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #
 
-SYS_INFO_VERSION=20170909
+SYS_INFO_VERSION=20170920
 
 PATH=$(sysctl -n user.cs_path)
 export PATH
@@ -110,10 +110,10 @@ getversion() {
 		run "named -v | awk '{ gsub(\"-\", \"\", \$2); gsub(\"P\", \"pl\", \$2); print tolower(\$1) \"-\" \$2 }'"
 		$all || return 0 ;&
 	bozohttpd|httpd)
-		v=$(run "/usr/libexec/httpd -G" 2>/dev/null)
+		v=$(run "${destdir}/usr/libexec/httpd -G" 2>/dev/null)
 		case "${v}" in
 		"")
-			run  "strings -a /usr/libexec/httpd | awk -F/ '\$1 == \"bozohttpd\" && NF == 2 { print \$1 \"-\" \$2; exit }'"
+			run  "strings -a ${destdir}/usr/libexec/httpd | awk -F/ '\$1 == \"bozohttpd\" && NF == 2 { print \$1 \"-\" \$2; exit }'"
 			;;
 		*)
 			printf '%s\n' "bozohttpd-${v##*/}"
@@ -207,8 +207,8 @@ getversion() {
 		fi
 		$all || return 0 ;&
 	tzdata)
-		if [ -f /usr/share/zoneinfo/TZDATA_VERSION ]; then
-			run "cat /usr/share/zoneinfo/TZDATA_VERSION"
+		if [ -f ${destdir}/usr/share/zoneinfo/TZDATA_VERSION ]; then
+			run "cat ${destdir}/usr/share/zoneinfo/TZDATA_VERSION"
 		else
 			run "printf '%s\n' tzdata-too-old-to-matter"
 		fi
@@ -221,7 +221,7 @@ getversion() {
 		fi
 		$all || return 0 ;&
 	[uU]ser[lL]and|release)
-		run "sed &2 '%s\n' \
-		"Usage: $0 [-v] [-L lib-path] [-P path] [component ...]"
+		"Usage: $0 [-P path] [-L libdirs] [-d destdir] [-v] [system...]"
 		exit 2
 	esac
 done



CVS commit: src/usr.bin/sys_info

2017-09-09 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Sep  9 14:12:09 UTC 2017

Modified Files:
src/usr.bin/sys_info: sys_info.sh

Log Message:
add dtc (Device Tree Compiler) version info


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/usr.bin/sys_info/sys_info.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/sys_info/sys_info.sh
diff -u src/usr.bin/sys_info/sys_info.sh:1.13 src/usr.bin/sys_info/sys_info.sh:1.14
--- src/usr.bin/sys_info/sys_info.sh:1.13	Sun Aug 27 20:40:22 2017
+++ src/usr.bin/sys_info/sys_info.sh	Sat Sep  9 14:12:09 2017
@@ -1,6 +1,6 @@
 #! /bin/sh
 
-# $NetBSD: sys_info.sh,v 1.13 2017/08/27 20:40:22 wiz Exp $
+# $NetBSD: sys_info.sh,v 1.14 2017/09/09 14:12:09 jmcneill Exp $
 
 # Copyright (c) 2016 Alistair Crooks 
 # All rights reserved.
@@ -26,7 +26,7 @@
 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #
 
-SYS_INFO_VERSION=20170824
+SYS_INFO_VERSION=20170909
 
 PATH=$(sysctl -n user.cs_path)
 export PATH
@@ -133,6 +133,9 @@ getversion() {
 	dhcpcd)
 		run  "dhcpcd --version | sed -e 's/ /-/g' -e 1q"
 		$all || return 0 ;&
+	dtc)
+		run "dtc --version | sed 's/Version: DTC /dtc-/'"
+		$all || return 0 ;&
 	ftpd)
 		run "strings -a /usr/libexec/ftpd | awk '\$1 == \"NetBSD-ftpd\" { print \"ftpd-\" \$2 }'"
 		$all || return 0 ;&



CVS commit: src/usr.bin/sys_info

2017-08-27 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sun Aug 27 20:40:22 UTC 2017

Modified Files:
src/usr.bin/sys_info: sys_info.sh

Log Message:
Sync usage with man page.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/usr.bin/sys_info/sys_info.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/sys_info/sys_info.sh
diff -u src/usr.bin/sys_info/sys_info.sh:1.12 src/usr.bin/sys_info/sys_info.sh:1.13
--- src/usr.bin/sys_info/sys_info.sh:1.12	Thu Aug 24 01:43:42 2017
+++ src/usr.bin/sys_info/sys_info.sh	Sun Aug 27 20:40:22 2017
@@ -1,6 +1,6 @@
 #! /bin/sh
 
-# $NetBSD: sys_info.sh,v 1.12 2017/08/24 01:43:42 kre Exp $
+# $NetBSD: sys_info.sh,v 1.13 2017/08/27 20:40:22 wiz Exp $
 
 # Copyright (c) 2016 Alistair Crooks 
 # All rights reserved.
@@ -244,7 +244,7 @@ while getopts "L:P:v" a; do
 	L)	LIBRARY_PATH=${OPTARG};;
 	P)	PATH=${OPTARG};;
 	\?)	printf >&2 '%s\n' \
-		"Usage: $0 [-P path] [-L libdirs] [-v] [system...]"
+		"Usage: $0 [-v] [-L lib-path] [-P path] [component ...]"
 		exit 2
 	esac
 done



CVS commit: src/usr.bin/sys_info

2017-08-27 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sun Aug 27 20:39:27 UTC 2017

Modified Files:
src/usr.bin/sys_info: sys_info.1

Log Message:
Use Nm.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/sys_info/sys_info.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/sys_info/sys_info.1
diff -u src/usr.bin/sys_info/sys_info.1:1.5 src/usr.bin/sys_info/sys_info.1:1.6
--- src/usr.bin/sys_info/sys_info.1:1.5	Sun Aug 27 20:38:39 2017
+++ src/usr.bin/sys_info/sys_info.1	Sun Aug 27 20:39:26 2017
@@ -1,4 +1,4 @@
-.\" $NetBSD: sys_info.1,v 1.5 2017/08/27 20:38:39 wiz Exp $
+.\" $NetBSD: sys_info.1,v 1.6 2017/08/27 20:39:26 wiz Exp $
 .\"
 .\" Copyright (c) 2016 Alistair Crooks 
 .\" All rights reserved.
@@ -71,7 +71,8 @@ Show the commands used to obtain the ver
 for each component
 .El
 .Pp
-Arguments may be given to sys_info.
+Arguments may be given to
+.Nm .
 If any arguments are specified, they are assumed
 to be names of programs, or shared libraries,
 installed on the system.



CVS commit: src/usr.bin/sys_info

2017-08-27 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sun Aug 27 20:38:39 UTC 2017

Modified Files:
src/usr.bin/sys_info: sys_info.1

Log Message:
Fix xref.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/sys_info/sys_info.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/sys_info/sys_info.1
diff -u src/usr.bin/sys_info/sys_info.1:1.4 src/usr.bin/sys_info/sys_info.1:1.5
--- src/usr.bin/sys_info/sys_info.1:1.4	Thu Aug 24 01:43:42 2017
+++ src/usr.bin/sys_info/sys_info.1	Sun Aug 27 20:38:39 2017
@@ -1,4 +1,4 @@
-.\" $NetBSD: sys_info.1,v 1.4 2017/08/24 01:43:42 kre Exp $
+.\" $NetBSD: sys_info.1,v 1.5 2017/08/27 20:38:39 wiz Exp $
 .\"
 .\" Copyright (c) 2016 Alistair Crooks 
 .\" All rights reserved.
@@ -62,7 +62,7 @@ Set
 If not given, the system default path, as obtained from
 .Ic user.cs_path
 via
-.Xr sysctl 1
+.Xr sysctl 8
 is used.
 To use the current value of $PATH from the caller, use:
 .Dl -P \*q$PATH\*q
@@ -88,8 +88,8 @@ otherwise, with status 0.
 .Xr awk 1 ,
 .Xr sed 1 ,
 .Xr strings 1 ,
-.Xr sysctl 1 ,
-.Xr uname 1
+.Xr uname 1 ,
+.Xr sysctl 8
 .Sh HISTORY
 The
 .Nm



CVS commit: src/usr.bin/sys_info

2017-08-23 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Thu Aug 24 01:43:42 UTC 2017

Modified Files:
src/usr.bin/sys_info: sys_info.1 sys_info.sh

Log Message:
Get rid of the arg sorting - it doesn't work properly, and makes it
impossible to support component names containing embedded \n's (the
similar embedded space problem would have been trivial to fix.)
Deleting the sorting makes those issues moot, the args are no longer
processed, hence can be anything.

An alternative would be to sort the results - but that would separate
the -v output from the real output (-v stuff is not rationally sortable)
and also makes it much more difficult to get the error code for an
unknown component (like one containing an embedded \n !) as the pipe
to strt that would be used would cause the while loop to run in a sub-shell
(effectively.)


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/sys_info/sys_info.1
cvs rdiff -u -r1.11 -r1.12 src/usr.bin/sys_info/sys_info.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/sys_info/sys_info.1
diff -u src/usr.bin/sys_info/sys_info.1:1.3 src/usr.bin/sys_info/sys_info.1:1.4
--- src/usr.bin/sys_info/sys_info.1:1.3	Wed Aug 23 01:17:46 2017
+++ src/usr.bin/sys_info/sys_info.1	Thu Aug 24 01:43:42 2017
@@ -1,4 +1,4 @@
-.\" $NetBSD: sys_info.1,v 1.3 2017/08/23 01:17:46 kre Exp $
+.\" $NetBSD: sys_info.1,v 1.4 2017/08/24 01:43:42 kre Exp $
 .\"
 .\" Copyright (c) 2016 Alistair Crooks 
 .\" All rights reserved.
@@ -79,9 +79,6 @@ If no arguments are provided, then all o
 items that are known to
 .Nm
 are reported.
-.Pp
-If arguments are provided, the output is displayed in
-alphabetical order, and duplicates are removed.
 .Sh EXIT STATUS
 .Nm
 exits with status 2 if an unknown option is given,
@@ -103,5 +100,3 @@ The
 .Nm
 script was written by
 .An Alistair Crooks Aq Mt a...@netbsd.org .
-.Sh BUGS
-Component names containing spaces given as arguments do not work.

Index: src/usr.bin/sys_info/sys_info.sh
diff -u src/usr.bin/sys_info/sys_info.sh:1.11 src/usr.bin/sys_info/sys_info.sh:1.12
--- src/usr.bin/sys_info/sys_info.sh:1.11	Wed Aug 23 21:18:57 2017
+++ src/usr.bin/sys_info/sys_info.sh	Thu Aug 24 01:43:42 2017
@@ -1,6 +1,6 @@
 #! /bin/sh
 
-# $NetBSD: sys_info.sh,v 1.11 2017/08/23 21:18:57 agc Exp $
+# $NetBSD: sys_info.sh,v 1.12 2017/08/24 01:43:42 kre Exp $
 
 # Copyright (c) 2016 Alistair Crooks 
 # All rights reserved.
@@ -26,7 +26,7 @@
 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #
 
-SYS_INFO_VERSION=20170823
+SYS_INFO_VERSION=20170824
 
 PATH=$(sysctl -n user.cs_path)
 export PATH
@@ -102,8 +102,7 @@ run() {
 getversion() {
 	case "$1" in
 	'')
-		# arriving here implies all==true, not possible otherwise
-		;&
+		$all || return 0 ;&
 	awk)
 		run "awk --version | awk '{ print \$1 \"-\" \$3 }'"
 		$all || return 0 ;&
@@ -255,8 +254,6 @@ if [ $# -eq 0 ]; then
 	set -- ''
 	all=true
 else
-	# note this deletes any attempt to use '' as an arg.
-	set -- $( printf '%s\n' "$@" | sort -u )
 	all=false
 fi
 



CVS commit: src/usr.bin/sys_info

2017-08-23 Thread Alistair G. Crooks
Module Name:src
Committed By:   agc
Date:   Wed Aug 23 21:18:57 UTC 2017

Modified Files:
src/usr.bin/sys_info: sys_info.sh

Log Message:
Move back to a simple version string for sys_info.  The way of using
CVS's $ Date $ expansion to calculate the date, whilst being more
accurate, runs into issues with reproducible builds, and alternate
repository software. Simplicity wins here.

Add yacc to the list of utilities to report on


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/usr.bin/sys_info/sys_info.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/sys_info/sys_info.sh
diff -u src/usr.bin/sys_info/sys_info.sh:1.10 src/usr.bin/sys_info/sys_info.sh:1.11
--- src/usr.bin/sys_info/sys_info.sh:1.10	Wed Aug 23 19:18:38 2017
+++ src/usr.bin/sys_info/sys_info.sh	Wed Aug 23 21:18:57 2017
@@ -1,6 +1,6 @@
 #! /bin/sh
 
-# $NetBSD: sys_info.sh,v 1.10 2017/08/23 19:18:38 kre Exp $
+# $NetBSD: sys_info.sh,v 1.11 2017/08/23 21:18:57 agc Exp $
 
 # Copyright (c) 2016 Alistair Crooks 
 # All rights reserved.
@@ -26,8 +26,7 @@
 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #
 
-SYS_INFO_VERSION=$( D="\$Date: 2017/08/23 19:18:38 $"; set -f;
-			IFS=" /"; set -- $D; printf %s "$2$3$4" )
+SYS_INFO_VERSION=20170823
 
 PATH=$(sysctl -n user.cs_path)
 export PATH
@@ -225,6 +224,9 @@ getversion() {
 	xz)
 		run "xz --version | awk '{ print \$1 \"-\" \$4; exit }'"
 		$all || return 0 ;&
+	yacc)
+		run "yacc -V | sed -e 's| ||g'"
+		$all || return 0 ;&
 
 	'')			# never matches
 		;;		# but terminates ;& sequence



CVS commit: src/usr.bin/sys_info

2017-08-23 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Wed Aug 23 19:18:38 UTC 2017

Modified Files:
src/usr.bin/sys_info: sys_info.sh

Log Message:
Add a \ -- allows sys_info -v pkg_install to tell us who the version info
is obtained, rather than just how we go about printing the result.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/usr.bin/sys_info/sys_info.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/sys_info/sys_info.sh
diff -u src/usr.bin/sys_info/sys_info.sh:1.9 src/usr.bin/sys_info/sys_info.sh:1.10
--- src/usr.bin/sys_info/sys_info.sh:1.9	Wed Aug 23 18:15:53 2017
+++ src/usr.bin/sys_info/sys_info.sh	Wed Aug 23 19:18:38 2017
@@ -1,6 +1,6 @@
 #! /bin/sh
 
-# $NetBSD: sys_info.sh,v 1.9 2017/08/23 18:15:53 agc Exp $
+# $NetBSD: sys_info.sh,v 1.10 2017/08/23 19:18:38 kre Exp $
 
 # Copyright (c) 2016 Alistair Crooks 
 # All rights reserved.
@@ -26,7 +26,7 @@
 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #
 
-SYS_INFO_VERSION=$( D="\$Date: 2017/08/23 18:15:53 $"; set -f;
+SYS_INFO_VERSION=$( D="\$Date: 2017/08/23 19:18:38 $"; set -f;
 			IFS=" /"; set -- $D; printf %s "$2$3$4" )
 
 PATH=$(sysctl -n user.cs_path)
@@ -188,7 +188,7 @@ getversion() {
 		$all || return 0 ;&
 	pkg_info|pkg_install)
 		if which_prog infopath pkg_info; then
-			run "printf 'pkg_install-%s\n' $(${infopath} -V)"
+			run "printf 'pkg_install-%s\n' \$(${infopath} -V)"
 		fi
 		$all || return 0 ;&
 	sh)



CVS commit: src/usr.bin/sys_info

2017-08-23 Thread Alistair G. Crooks
Module Name:src
Committed By:   agc
Date:   Wed Aug 23 18:15:53 UTC 2017

Modified Files:
src/usr.bin/sys_info: sys_info.sh

Log Message:
add pkg_install to the list of programs reported

don't throw a warning if tcsh is not found in the path


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/usr.bin/sys_info/sys_info.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/sys_info/sys_info.sh
diff -u src/usr.bin/sys_info/sys_info.sh:1.8 src/usr.bin/sys_info/sys_info.sh:1.9
--- src/usr.bin/sys_info/sys_info.sh:1.8	Wed Aug 23 01:17:46 2017
+++ src/usr.bin/sys_info/sys_info.sh	Wed Aug 23 18:15:53 2017
@@ -1,6 +1,6 @@
 #! /bin/sh
 
-# $NetBSD: sys_info.sh,v 1.8 2017/08/23 01:17:46 kre Exp $
+# $NetBSD: sys_info.sh,v 1.9 2017/08/23 18:15:53 agc Exp $
 
 # Copyright (c) 2016 Alistair Crooks 
 # All rights reserved.
@@ -26,7 +26,7 @@
 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #
 
-SYS_INFO_VERSION=$( D="\$Date: 2017/08/23 01:17:46 $"; set -f;
+SYS_INFO_VERSION=$( D="\$Date: 2017/08/23 18:15:53 $"; set -f;
 			IFS=" /"; set -- $D; printf %s "$2$3$4" )
 
 PATH=$(sysctl -n user.cs_path)
@@ -186,6 +186,11 @@ getversion() {
 	openssl)
 		run "openssl version 2>/dev/null | awk '{ print tolower(\$1) \"-\" \$2 }'"
 		$all || return 0 ;&
+	pkg_info|pkg_install)
+		if which_prog infopath pkg_info; then
+			run "printf 'pkg_install-%s\n' $(${infopath} -V)"
+		fi
+		$all || return 0 ;&
 	sh)
 		run "set -- \$NETBSD_SHELL; case \"\$1+\$2\" in *+BUILD*) ;; +) set -- ancient;; *) set -- \"\$1\";;esac; printf 'sh-%s\\n' \$1\${2:+-\${2#BUILD:}}"
 		$all || return 0 ;&
@@ -198,8 +203,6 @@ getversion() {
 	tcsh)
 		if which_prog tcshpath tcsh; then
 			run "${tcshpath} --version | awk '{ print \$1 \"-\" \$2 }'"
-		else
-			$all || printf >&2 '%s\n' "tcsh: not found"
 		fi
 		$all || return 0 ;&
 	tzdata)



CVS commit: src/usr.bin/sys_info

2017-08-22 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Wed Aug 23 01:17:46 UTC 2017

Modified Files:
src/usr.bin/sys_info: sys_info.1 sys_info.sh

Log Message:
Put back getopts - it is easier to get correct than hand rolled code.
Add -L and -P flags to allow the library/cmd search paths to be set.
Add support for getting vers info from sh, dhcpcd, and userland (/etc/release).
Stop abusing "sh -x" to support -v - do it properly.  Get rid of the duplicate
list of components used when there are no args, instead make better use of sh
capabilities to just process everything.  Better use of what sh can do for us
other places too.   Add a (more or less random) set of libraries to include
in output when no args are given.

OK agc (well, earlier version...)


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/sys_info/sys_info.1
cvs rdiff -u -r1.7 -r1.8 src/usr.bin/sys_info/sys_info.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/sys_info/sys_info.1
diff -u src/usr.bin/sys_info/sys_info.1:1.2 src/usr.bin/sys_info/sys_info.1:1.3
--- src/usr.bin/sys_info/sys_info.1:1.2	Mon Aug 21 19:22:31 2017
+++ src/usr.bin/sys_info/sys_info.1	Wed Aug 23 01:17:46 2017
@@ -1,4 +1,4 @@
-.\" $NetBSD: sys_info.1,v 1.2 2017/08/21 19:22:31 agc Exp $
+.\" $NetBSD: sys_info.1,v 1.3 2017/08/23 01:17:46 kre Exp $
 .\"
 .\" Copyright (c) 2016 Alistair Crooks 
 .\" All rights reserved.
@@ -23,16 +23,18 @@
 .\" (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 August 21, 2017
+.Dd August 23, 2017
 .Dt SYS_INFO 1
 .Os
 .Sh NAME
 .Nm sys_info
-.Nd script to show versioning information
+.Nd script to show system version information
 .Sh SYNOPSIS
 .Nm
 .Op Fl v
-.Op Ar
+.Op Fl L Ar lib-path
+.Op Fl P Ar path
+.Op Ar component No ...
 .Sh DESCRIPTION
 The
 .Nm
@@ -44,10 +46,29 @@ The
 utility uses a combination of ways to retrieve version
 information from the installed utilities.
 .Sh OPTIONS
-The following option is available:
+The following options are available:
 .Bl -tag -width inits
+.It Fl L
+Give a list of directories
+.Pq "colon separated"
+that are used when searching for libraries.
+If not given the value of
+.Ev LD_LIBRARY_PATH
+is used if set in the environment, or otherwise
+a standard (built-in) set of directories.
+.It Fl P
+Set
+.Ev PATH .
+If not given, the system default path, as obtained from
+.Ic user.cs_path
+via
+.Xr sysctl 1
+is used.
+To use the current value of $PATH from the caller, use:
+.Dl -P \*q$PATH\*q
 .It Fl v
-Perform operations in a verbose manner.
+Show the commands used to obtain the version information
+for each component
 .El
 .Pp
 Arguments may be given to sys_info.
@@ -61,9 +82,17 @@ are reported.
 .Pp
 If arguments are provided, the output is displayed in
 alphabetical order, and duplicates are removed.
+.Sh EXIT STATUS
+.Nm
+exits with status 2 if an unknown option is given,
+otherwise with status 1 if an unknown component is specified,
+otherwise, with status 0.
 .Sh SEE ALSO
 .Xr awk 1 ,
-.Xr strings 1
+.Xr sed 1 ,
+.Xr strings 1 ,
+.Xr sysctl 1 ,
+.Xr uname 1
 .Sh HISTORY
 The
 .Nm
@@ -74,3 +103,5 @@ The
 .Nm
 script was written by
 .An Alistair Crooks Aq Mt a...@netbsd.org .
+.Sh BUGS
+Component names containing spaces given as arguments do not work.

Index: src/usr.bin/sys_info/sys_info.sh
diff -u src/usr.bin/sys_info/sys_info.sh:1.7 src/usr.bin/sys_info/sys_info.sh:1.8
--- src/usr.bin/sys_info/sys_info.sh:1.7	Mon Aug 21 19:51:32 2017
+++ src/usr.bin/sys_info/sys_info.sh	Wed Aug 23 01:17:46 2017
@@ -1,6 +1,6 @@
 #! /bin/sh
 
-# $NetBSD: sys_info.sh,v 1.7 2017/08/21 19:51:32 agc Exp $
+# $NetBSD: sys_info.sh,v 1.8 2017/08/23 01:17:46 kre Exp $
 
 # Copyright (c) 2016 Alistair Crooks 
 # All rights reserved.
@@ -26,23 +26,52 @@
 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #
 
-SYS_INFO_VERSION=20170821
-LD_LIBRARY_PATH=${LD_LIBRARY_PATH:-/usr/lib:/usr/X11R7/lib}
+SYS_INFO_VERSION=$( D="\$Date: 2017/08/23 01:17:46 $"; set -f;
+			IFS=" /"; set -- $D; printf %s "$2$3$4" )
+
+PATH=$(sysctl -n user.cs_path)
+export PATH
+
+LIBRARY_PATH=${LD_LIBRARY_PATH:-/usr/lib:/usr/X11R7/lib}
+
+# default libraries when no args are given (sorted...)
+LIBS=
+LIBS="${LIBS} libc"
+LIBS="${LIBS} libcurses"
+LIBS="${LIBS} libdrm"
+LIBS="${LIBS} libm"
+LIBS="${LIBS} libresolv"
+LIBS="${LIBS} libsqlite"
+LIBS="${LIBS} libssh"
+LIBS="${LIBS} libstdc++"
+LIBS="${LIBS} libterminfo"
+LIBS="${LIBS} libutil"
+LIBS="${LIBS} libX11"
+LIBS="${LIBS} libXaw7"
+LIBS="${LIBS} libXcb"
+LIBS="${LIBS} libXfont"
+LIBS="${LIBS} libXft"
+LIBS="${LIBS} libXrandr"
+LIBS="${LIBS} libXt"
 
 # short script to look for an executable $2, and if found, to place
 # path in $1
 # taken from pkgsrc bootstrap
 which_prog()
 {
+	local IFS _var _name _d -
+	set -f
+
 	

CVS commit: src/usr.bin/sys_info

2017-08-21 Thread Alistair G. Crooks
Module Name:src
Committed By:   agc
Date:   Mon Aug 21 19:51:32 UTC 2017

Modified Files:
src/usr.bin/sys_info: sys_info.sh

Log Message:
also add tzdata versioning information


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/usr.bin/sys_info/sys_info.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/sys_info/sys_info.sh
diff -u src/usr.bin/sys_info/sys_info.sh:1.6 src/usr.bin/sys_info/sys_info.sh:1.7
--- src/usr.bin/sys_info/sys_info.sh:1.6	Mon Aug 21 19:36:57 2017
+++ src/usr.bin/sys_info/sys_info.sh	Mon Aug 21 19:51:32 2017
@@ -1,6 +1,6 @@
 #! /bin/sh
 
-# $NetBSD: sys_info.sh,v 1.6 2017/08/21 19:36:57 agc Exp $
+# $NetBSD: sys_info.sh,v 1.7 2017/08/21 19:51:32 agc Exp $
 
 # Copyright (c) 2016 Alistair Crooks 
 # All rights reserved.
@@ -141,6 +141,11 @@ getversion() {
 			echo "tcsh: not found"
 		fi
 		;;
+	tzdata)
+		if [ -f /usr/share/zoneinfo/TZDATA_VERSION ]; then
+			cat /usr/share/zoneinfo/TZDATA_VERSION
+		fi
+		;;
 	unbound)
 		if which_prog unboundpath unbound-control; then
 			${unboundpath} -h | awk '/^Version/ { print "unbound-" $2 }'
@@ -174,7 +179,7 @@ fi
 if ${all}; then
 	args='awk bind bzip2 calendar ftpd g++ gcc grep gzip httpd netbsd netpgp'
 	args="${args} netpgpverify ntp openssl sqlite ssh sshd sys_info tcsh"
-	args="${args} unbound xz"
+	args="${args} tzdata unbound xz"
 else
 	args=$(echo $@ | tr ' ' '\n' | sort | uniq)
 fi



CVS commit: src/usr.bin/sys_info

2017-08-21 Thread Alistair G. Crooks
Module Name:src
Committed By:   agc
Date:   Mon Aug 21 19:36:57 UTC 2017

Modified Files:
src/usr.bin/sys_info: sys_info.sh

Log Message:
restore martin's change for tcsh versioning which got lost in the last update


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/sys_info/sys_info.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/sys_info/sys_info.sh
diff -u src/usr.bin/sys_info/sys_info.sh:1.5 src/usr.bin/sys_info/sys_info.sh:1.6
--- src/usr.bin/sys_info/sys_info.sh:1.5	Mon Aug 21 19:22:31 2017
+++ src/usr.bin/sys_info/sys_info.sh	Mon Aug 21 19:36:57 2017
@@ -1,6 +1,6 @@
 #! /bin/sh
 
-# $NetBSD: sys_info.sh,v 1.5 2017/08/21 19:22:31 agc Exp $
+# $NetBSD: sys_info.sh,v 1.6 2017/08/21 19:36:57 agc Exp $
 
 # Copyright (c) 2016 Alistair Crooks 
 # All rights reserved.
@@ -136,7 +136,7 @@ getversion() {
 		;;
 	tcsh)
 		if which_prog tcshpath tcsh; then
-			${tcshpath} -c 'echo $version' | awk '{ print $1 "-" $2 }'
+			${tcshpath} --version | awk '{ print $1 "-" $2 }'
 		else
 			echo "tcsh: not found"
 		fi



CVS commit: src/usr.bin/sys_info

2017-08-21 Thread Alistair G. Crooks
Module Name:src
Committed By:   agc
Date:   Mon Aug 21 19:22:31 UTC 2017

Modified Files:
src/usr.bin/sys_info: sys_info.1 sys_info.sh

Log Message:
Changes to sys_info (20170821)

+ get rid of -a argument, which was superfluous since no arguments
means provide information on everything known

+ add the shell function to check for the path of a program. Taken
from pkgsrc bootstrap script, modified for return values, and "not
found" action

+ use this shell function for tcsh and unbound, both of which may not
exist on systems

+ go back to using standard shell construct for parsing options now,
since there is only 1 option with no optargs

+ from a suggestion from Paul Goyette, run the provided arguments
through sort | uniq

+ add sys_info itself to the list of programs to report


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/sys_info/sys_info.1
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/sys_info/sys_info.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/sys_info/sys_info.1
diff -u src/usr.bin/sys_info/sys_info.1:1.1 src/usr.bin/sys_info/sys_info.1:1.2
--- src/usr.bin/sys_info/sys_info.1:1.1	Sat Jun  4 15:27:11 2016
+++ src/usr.bin/sys_info/sys_info.1	Mon Aug 21 19:22:31 2017
@@ -1,4 +1,4 @@
-.\" $NetBSD: sys_info.1,v 1.1 2016/06/04 15:27:11 agc Exp $
+.\" $NetBSD: sys_info.1,v 1.2 2017/08/21 19:22:31 agc Exp $
 .\"
 .\" Copyright (c) 2016 Alistair Crooks 
 .\" All rights reserved.
@@ -23,7 +23,7 @@
 .\" (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
+.Dd August 21, 2017
 .Dt SYS_INFO 1
 .Os
 .Sh NAME
@@ -31,7 +31,7 @@
 .Nd script to show versioning information
 .Sh SYNOPSIS
 .Nm
-.Op Fl av
+.Op Fl v
 .Op Ar
 .Sh DESCRIPTION
 The
@@ -44,13 +44,23 @@ The
 utility uses a combination of ways to retrieve version
 information from the installed utilities.
 .Sh OPTIONS
-The following options are available:
+The following option is 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.
+Perform operations in a verbose manner.
 .El
+.Pp
+Arguments may be given to sys_info.
+If any arguments are specified, they are assumed
+to be names of programs, or shared libraries,
+installed on the system.
+If no arguments are provided, then all of the
+items that are known to
+.Nm
+are reported.
+.Pp
+If arguments are provided, the output is displayed in
+alphabetical order, and duplicates are removed.
 .Sh SEE ALSO
 .Xr awk 1 ,
 .Xr strings 1

Index: src/usr.bin/sys_info/sys_info.sh
diff -u src/usr.bin/sys_info/sys_info.sh:1.4 src/usr.bin/sys_info/sys_info.sh:1.5
--- src/usr.bin/sys_info/sys_info.sh:1.4	Sun Aug 20 10:17:55 2017
+++ src/usr.bin/sys_info/sys_info.sh	Mon Aug 21 19:22:31 2017
@@ -1,6 +1,6 @@
 #! /bin/sh
 
-# $NetBSD: sys_info.sh,v 1.4 2017/08/20 10:17:55 martin Exp $
+# $NetBSD: sys_info.sh,v 1.5 2017/08/21 19:22:31 agc Exp $
 
 # Copyright (c) 2016 Alistair Crooks 
 # All rights reserved.
@@ -26,8 +26,33 @@
 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #
 
+SYS_INFO_VERSION=20170821
 LD_LIBRARY_PATH=${LD_LIBRARY_PATH:-/usr/lib:/usr/X11R7/lib}
 
+# short script to look for an executable $2, and if found, to place
+# path in $1
+# taken from pkgsrc bootstrap
+which_prog()
+{
+	_var="$1"; _name="$2"
+
+	eval _tmp=\"\$$_var\"
+	if [ "x$_tmp" != "x" ]; then
+		# Variable is already set (by the user, for example)
+		return 0
+	fi
+
+	for _d in `echo $PATH | tr ':' ' '`; do
+		if [ -f "$_d/$_name" ] && [ -x "$_d/$_name" ]; then
+			# Program found
+			eval $_var=\""$_d/$_name"\"
+			return 0
+		fi
+	done
+
+	return 1
+}
+
 # print out the version for the given argument
 getversion() {
 	case "$1" in
@@ -106,15 +131,22 @@ getversion() {
 	sshd)
 		sshd -V 2>&1 | awk '/OpenSSH/ { sub("_", "D-", $1); print tolower($1) }'
 		;;
+	sys_info)
+		echo sys_info-${SYS_INFO_VERSION}
+		;;
 	tcsh)
-		grep '/tcsh' /etc/shells > /dev/null 2>&1 && tcsh --version | awk '{ print $1 "-" $2 }'
+		if which_prog tcshpath tcsh; then
+			${tcshpath} -c 'echo $version' | awk '{ print $1 "-" $2 }'
+		else
+			echo "tcsh: not found"
+		fi
 		;;
 	unbound)
-		case $(uname -s) in
-		FreeBSD)
-			unbound-control -h | awk '/^Version/ { print "unbound-" $2 }'
-			;;
-		esac
+		if which_prog unboundpath unbound-control; then
+			${unboundpath} -h | awk '/^Version/ { print "unbound-" $2 }'
+		else
+			echo "unbound: not found"
+		fi
 		;;
 	xz)
 		xz --version | awk '{ print $1 "-" $4; exit }'
@@ -122,16 +154,16 @@ getversion() {
 	esac
 }
 
-all=false
-while getopts "av" a; do
-	case "${a}" in
-	a)	all=true ;;
-	v)	set -x ;;
+# check if we have our only option
+while [ $# -gt 0 ]; do
+	case "$1" in
+	-v)	set -x ;;
 	*)	break ;;
 	esac
 	shift
 

CVS commit: src/usr.bin/sys_info

2017-08-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Aug 20 10:17:55 UTC 2017

Modified Files:
src/usr.bin/sys_info: sys_info.sh

Log Message:
Use tcsh --version instead of an echo $version -- the old way did not
work for me (not quite sure why not).


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/sys_info/sys_info.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/sys_info/sys_info.sh
diff -u src/usr.bin/sys_info/sys_info.sh:1.3 src/usr.bin/sys_info/sys_info.sh:1.4
--- src/usr.bin/sys_info/sys_info.sh:1.3	Sat Aug 19 18:36:31 2017
+++ src/usr.bin/sys_info/sys_info.sh	Sun Aug 20 10:17:55 2017
@@ -1,6 +1,6 @@
 #! /bin/sh
 
-# $NetBSD: sys_info.sh,v 1.3 2017/08/19 18:36:31 agc Exp $
+# $NetBSD: sys_info.sh,v 1.4 2017/08/20 10:17:55 martin Exp $
 
 # Copyright (c) 2016 Alistair Crooks 
 # All rights reserved.
@@ -107,7 +107,7 @@ getversion() {
 		sshd -V 2>&1 | awk '/OpenSSH/ { sub("_", "D-", $1); print tolower($1) }'
 		;;
 	tcsh)
-		grep '/tcsh' /etc/shells > /dev/null 2>&1 && tcsh -c 'echo $version' | awk '{ print $1 "-" $2 }'
+		grep '/tcsh' /etc/shells > /dev/null 2>&1 && tcsh --version | awk '{ print $1 "-" $2 }'
 		;;
 	unbound)
 		case $(uname -s) in



CVS commit: src/usr.bin/sys_info

2017-08-19 Thread Alistair G. Crooks
Module Name:src
Committed By:   agc
Date:   Sat Aug 19 18:36:31 UTC 2017

Modified Files:
src/usr.bin/sys_info: sys_info.sh

Log Message:
Parse the arguments to sys_info(1) a bit differently, using getopts(1)

Thanks to Paul Goyette for the nudge


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/sys_info/sys_info.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/sys_info/sys_info.sh
diff -u src/usr.bin/sys_info/sys_info.sh:1.2 src/usr.bin/sys_info/sys_info.sh:1.3
--- src/usr.bin/sys_info/sys_info.sh:1.2	Sat Aug 19 03:06:50 2017
+++ src/usr.bin/sys_info/sys_info.sh	Sat Aug 19 18:36:31 2017
@@ -1,6 +1,6 @@
 #! /bin/sh
 
-# $NetBSD: sys_info.sh,v 1.2 2017/08/19 03:06:50 agc Exp $
+# $NetBSD: sys_info.sh,v 1.3 2017/08/19 18:36:31 agc Exp $
 
 # Copyright (c) 2016 Alistair Crooks 
 # All rights reserved.
@@ -122,20 +122,21 @@ getversion() {
 	esac
 }
 
-case $# in
-0)	all=true ;;
-*)	all=false ;;
-esac
-
-while [ $# -gt 0 ]; do
-	case "$1" in
-	-a)	all=true ;;
-	-v)	set -x ;;
+all=false
+while getopts "av" a; do
+	case "${a}" in
+	a)	all=true ;;
+	v)	set -x ;;
 	*)	break ;;
 	esac
 	shift
 done
 
+# if no arg specified, we want them all
+if [ $# -eq 0 ]; then
+	all=true
+fi
+
 # if we want to do every one, then let's get the arguments
 # not really scalable
 if ${all}; then



CVS commit: src/usr.bin/sys_info

2017-08-18 Thread Alistair G. Crooks
Module Name:src
Committed By:   agc
Date:   Sat Aug 19 03:06:50 UTC 2017

Modified Files:
src/usr.bin/sys_info: sys_info.sh

Log Message:
+ don't assume that tcsh is always installed, pointed out by jmcneill - thanks!

+ a "sys_info" invocation without any args is now the equivalent of sys_info -a,
just like pkg_info


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/sys_info/sys_info.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/sys_info/sys_info.sh
diff -u src/usr.bin/sys_info/sys_info.sh:1.1 src/usr.bin/sys_info/sys_info.sh:1.2
--- src/usr.bin/sys_info/sys_info.sh:1.1	Sat Jun  4 15:27:11 2016
+++ src/usr.bin/sys_info/sys_info.sh	Sat Aug 19 03:06:50 2017
@@ -1,6 +1,6 @@
 #! /bin/sh
 
-# $NetBSD: sys_info.sh,v 1.1 2016/06/04 15:27:11 agc Exp $
+# $NetBSD: sys_info.sh,v 1.2 2017/08/19 03:06:50 agc Exp $
 
 # Copyright (c) 2016 Alistair Crooks 
 # All rights reserved.
@@ -107,7 +107,7 @@ getversion() {
 		sshd -V 2>&1 | awk '/OpenSSH/ { sub("_", "D-", $1); print tolower($1) }'
 		;;
 	tcsh)
-		tcsh -c 'echo $version' | awk '{ print $1 "-" $2 }'
+		grep '/tcsh' /etc/shells > /dev/null 2>&1 && tcsh -c 'echo $version' | awk '{ print $1 "-" $2 }'
 		;;
 	unbound)
 		case $(uname -s) in
@@ -122,7 +122,11 @@ getversion() {
 	esac
 }
 
-all=false
+case $# in
+0)	all=true ;;
+*)	all=false ;;
+esac
+
 while [ $# -gt 0 ]; do
 	case "$1" in
 	-a)	all=true ;;