Lines 39-44
LOADER_RE2='^\([A-Z_a-z][0-9A-Z_a-z]*="[-./0-9A-Z_a-z]\{1,\}"\).*$'
Link Here
|
39 |
KERNEL_RE='^@@TYPE@@ \([-.0-9A-Za-z]\{1,\}\) .*$' |
39 |
KERNEL_RE='^@@TYPE@@ \([-.0-9A-Za-z]\{1,\}\) .*$' |
40 |
|
40 |
|
41 |
progname=${0##*/} |
41 |
progname=${0##*/} |
|
|
42 |
progverbose=0 |
42 |
|
43 |
|
43 |
# |
44 |
# |
44 |
# Print an error message and exit. |
45 |
# Print an error message and exit. |
Lines 67-87
kernel_version() {
Link Here
|
67 |
if [ ! -f "$kernfile" -o ! -r "$kernfile" ] ; then |
68 |
if [ ! -f "$kernfile" -o ! -r "$kernfile" ] ; then |
68 |
error "unable to locate kernel" |
69 |
error "unable to locate kernel" |
69 |
fi |
70 |
fi |
70 |
what -qs "$kernfile" | sed -n "s/$KERNEL_RE/\\1/p" |
71 |
if [ $progverbose -gt 0 ] ; then |
|
|
72 |
what -qs "$kernfile" | awk -F':' '{ print $1 }' | cut -d' ' -f2- |
73 |
else |
74 |
what -qs "$kernfile" | sed -n "s/$KERNEL_RE/\\1/p" |
75 |
fi |
71 |
} |
76 |
} |
72 |
|
77 |
|
73 |
# |
78 |
# |
74 |
# Print the version of the currently running kernel. |
79 |
# Print the version of the currently running kernel. |
75 |
# |
80 |
# |
76 |
running_version() { |
81 |
running_version() { |
77 |
sysctl -n kern.osrelease |
82 |
out=$(sysctl -n kern.osrelease) |
|
|
83 |
[ $progverbose -gt 0 ] && out="${out} $(sysctl -n kern.osreldate)" |
84 |
echo "$out" |
78 |
} |
85 |
} |
79 |
|
86 |
|
80 |
# |
87 |
# |
81 |
# Print the hardcoded userland version. |
88 |
# Print the hardcoded userland version. |
82 |
# |
89 |
# |
83 |
userland_version() { |
90 |
userland_version() { |
84 |
echo $USERLAND_VERSION |
91 |
out=$USERLAND_VERSION |
|
|
92 |
[ $progverbose -gt 0 ] && out="${USERLAND_VERSION} $(uname -U)" |
93 |
echo "$out" |
85 |
} |
94 |
} |
86 |
|
95 |
|
87 |
# |
96 |
# |
Lines 97-103
jail_version() {
Link Here
|
97 |
# Print a usage string and exit. |
106 |
# Print a usage string and exit. |
98 |
# |
107 |
# |
99 |
usage() { |
108 |
usage() { |
100 |
echo "usage: $progname [-kru] [-j jail]" >&2 |
109 |
echo "usage: $progname [-kruv] [-j jail]" >&2 |
101 |
exit 1 |
110 |
exit 1 |
102 |
} |
111 |
} |
103 |
|
112 |
|
Lines 107-113
usage() {
Link Here
|
107 |
main() { |
116 |
main() { |
108 |
# parse command-line arguments |
117 |
# parse command-line arguments |
109 |
local OPTIND=1 OPTARG option |
118 |
local OPTIND=1 OPTARG option |
110 |
while getopts "kruj:" option ; do |
119 |
while getopts "kruvj:" option ; do |
111 |
case $option in |
120 |
case $option in |
112 |
k) |
121 |
k) |
113 |
opt_k=1 |
122 |
opt_k=1 |
Lines 118-123
main() {
Link Here
|
118 |
u) |
127 |
u) |
119 |
opt_u=1 |
128 |
opt_u=1 |
120 |
;; |
129 |
;; |
|
|
130 |
v) |
131 |
progverbose=1 |
132 |
;; |
121 |
j) |
133 |
j) |
122 |
if [ $opt_j ] ; then |
134 |
if [ $opt_j ] ; then |
123 |
jail="$jail $OPTARG" |
135 |
jail="$jail $OPTARG" |