| @@ -1,16 +1,16 @@ | | | @@ -1,16 +1,16 @@ |
1 | #! /bin/sh | | 1 | #! /bin/sh |
2 | | | 2 | |
3 | # $NetBSD: sys_info.sh,v 1.2 2017/08/19 03:06:50 agc Exp $ | | 3 | # $NetBSD: sys_info.sh,v 1.3 2017/08/19 18:36:31 agc Exp $ |
4 | | | 4 | |
5 | # Copyright (c) 2016 Alistair Crooks <agc@NetBSD.org> | | 5 | # Copyright (c) 2016 Alistair Crooks <agc@NetBSD.org> |
6 | # All rights reserved. | | 6 | # All rights reserved. |
7 | # | | 7 | # |
8 | # Redistribution and use in source and binary forms, with or without | | 8 | # Redistribution and use in source and binary forms, with or without |
9 | # modification, are permitted provided that the following conditions | | 9 | # modification, are permitted provided that the following conditions |
10 | # are met: | | 10 | # are met: |
11 | # 1. Redistributions of source code must retain the above copyright | | 11 | # 1. Redistributions of source code must retain the above copyright |
12 | # notice, this list of conditions and the following disclaimer. | | 12 | # notice, this list of conditions and the following disclaimer. |
13 | # 2. Redistributions in binary form must reproduce the above copyright | | 13 | # 2. Redistributions in binary form must reproduce the above copyright |
14 | # notice, this list of conditions and the following disclaimer in the | | 14 | # notice, this list of conditions and the following disclaimer in the |
15 | # documentation and/or other materials provided with the distribution. | | 15 | # documentation and/or other materials provided with the distribution. |
16 | # | | 16 | # |
| @@ -112,39 +112,40 @@ getversion() { | | | @@ -112,39 +112,40 @@ getversion() { |
112 | unbound) | | 112 | unbound) |
113 | case $(uname -s) in | | 113 | case $(uname -s) in |
114 | FreeBSD) | | 114 | FreeBSD) |
115 | unbound-control -h | awk '/^Version/ { print "unbound-" $2 }' | | 115 | unbound-control -h | awk '/^Version/ { print "unbound-" $2 }' |
116 | ;; | | 116 | ;; |
117 | esac | | 117 | esac |
118 | ;; | | 118 | ;; |
119 | xz) | | 119 | xz) |
120 | xz --version | awk '{ print $1 "-" $4; exit }' | | 120 | xz --version | awk '{ print $1 "-" $4; exit }' |
121 | ;; | | 121 | ;; |
122 | esac | | 122 | esac |
123 | } | | 123 | } |
124 | | | 124 | |
125 | case $# in | | 125 | all=false |
126 | 0) all=true ;; | | 126 | while getopts "av" a; do |
127 | *) all=false ;; | | 127 | case "${a}" in |
128 | esac | | 128 | a) all=true ;; |
129 | | | 129 | v) set -x ;; |
130 | while [ $# -gt 0 ]; do | | | |
131 | case "$1" in | | | |
132 | -a) all=true ;; | | | |
133 | -v) set -x ;; | | | |
134 | *) break ;; | | 130 | *) break ;; |
135 | esac | | 131 | esac |
136 | shift | | 132 | shift |
137 | done | | 133 | done |
138 | | | 134 | |
| | | 135 | # if no arg specified, we want them all |
| | | 136 | if [ $# -eq 0 ]; then |
| | | 137 | all=true |
| | | 138 | fi |
| | | 139 | |
139 | # if we want to do every one, then let's get the arguments | | 140 | # if we want to do every one, then let's get the arguments |
140 | # not really scalable | | 141 | # not really scalable |
141 | if ${all}; then | | 142 | if ${all}; then |
142 | args='awk bind bzip2 calendar ftpd g++ gcc grep gzip httpd netbsd netpgp' | | 143 | args='awk bind bzip2 calendar ftpd g++ gcc grep gzip httpd netbsd netpgp' |
143 | args="${args} netpgpverify ntp openssl sqlite ssh sshd tcsh unbound xz" | | 144 | args="${args} netpgpverify ntp openssl sqlite ssh sshd tcsh unbound xz" |
144 | set -- ${args} | | 145 | set -- ${args} |
145 | fi | | 146 | fi |
146 | | | 147 | |
147 | while [ $# -gt 0 ]; do | | 148 | while [ $# -gt 0 ]; do |
148 | getversion $1 | | 149 | getversion $1 |
149 | shift | | 150 | shift |
150 | done | | 151 | done |