View | Details | Raw Unified | Return to bug 251316 | Differences between
and this patch

Collapse All | Expand All

(-)b/bin/freebsd-version/freebsd-version.1 (-2 / +4 lines)
Lines 25-31 Link Here
25
.\"
25
.\"
26
.\" $FreeBSD$
26
.\" $FreeBSD$
27
.\"
27
.\"
28
.Dd October 1, 2021
28
.Dd November 15, 2021
29
.Dt FREEBSD-VERSION 1
29
.Dt FREEBSD-VERSION 1
30
.Os
30
.Os
31
.Sh NAME
31
.Sh NAME
Lines 33-39 Link Here
33
.Nd print the version and patch level of the installed system
33
.Nd print the version and patch level of the installed system
34
.Sh SYNOPSIS
34
.Sh SYNOPSIS
35
.Nm
35
.Nm
36
.Op Fl kru
36
.Op Fl kruv
37
.Op Fl j Ar jail
37
.Op Fl j Ar jail
38
.Sh DESCRIPTION
38
.Sh DESCRIPTION
39
The
39
The
Lines 61-66 Print the version and patch level of the installed userland. Link Here
61
These are hardcoded into
61
These are hardcoded into
62
.Nm
62
.Nm
63
during the build.
63
during the build.
64
.It Fl v
65
Enable printing out verbose information, for kernel and/or userland.
64
.It Fl j Ar jail
66
.It Fl j Ar jail
65
Print the version and patch level of the installed userland in the
67
Print the version and patch level of the installed userland in the
66
given jail specified by
68
given jail specified by
(-)b/bin/freebsd-version/freebsd-version.sh.in (-2 / +12 lines)
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
progverb=0
42
43
43
#
44
#
44
# Print an error message and exit.
45
# Print an error message and exit.
Lines 67-72 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
71
	[ $progverb -gt 0 ] && \
72
		what -qs "$kernfile" || \
70
	what -qs "$kernfile" | sed -n "s/$KERNEL_RE/\\1/p"
73
	what -qs "$kernfile" | sed -n "s/$KERNEL_RE/\\1/p"
71
}
74
}
72
75
Lines 74-79 kernel_version() { Link Here
74
# Print the version of the currently running kernel.
77
# Print the version of the currently running kernel.
75
#
78
#
76
running_version() {
79
running_version() {
80
	[ $progverb -gt 0 ] && \
81
 		echo `sysctl -n kern.osrelease kern.osreldate` || \
77
	sysctl -n kern.osrelease
82
	sysctl -n kern.osrelease
78
}
83
}
79
84
Lines 81-86 running_version() { Link Here
81
# Print the hardcoded userland version.
86
# Print the hardcoded userland version.
82
#
87
#
83
userland_version() {
88
userland_version() {
89
	[ $progverb -gt 0 ] && \
90
		echo $USERLAND_VERSION `uname -U` || \
84
	echo $USERLAND_VERSION
91
	echo $USERLAND_VERSION
85
}
92
}
86
93
Lines 97-103 jail_version() { Link Here
97
# Print a usage string and exit.
104
# Print a usage string and exit.
98
#
105
#
99
usage() {
106
usage() {
100
	echo "usage: $progname [-kru] [-j jail]" >&2
107
	echo "usage: $progname [-kruv] [-j jail]" >&2
101
	exit 1
108
	exit 1
102
}
109
}
103
110
Lines 107-113 usage() { Link Here
107
main() {
114
main() {
108
	# parse command-line arguments
115
	# parse command-line arguments
109
	local OPTIND=1 OPTARG option
116
	local OPTIND=1 OPTARG option
110
	while getopts "kruj:" option ; do
117
	while getopts "kruvj:" option ; do
111
		case $option in
118
		case $option in
112
		k)
119
		k)
113
			opt_k=1
120
			opt_k=1
Lines 118-123 main() { Link Here
118
		u)
125
		u)
119
			opt_u=1
126
			opt_u=1
120
			;;
127
			;;
128
		v)
129
			progverb=1
130
			;;
121
		j)
131
		j)
122
			if [ $opt_j ] ; then
132
			if [ $opt_j ] ; then
123
				jail="$jail $OPTARG"
133
				jail="$jail $OPTARG"

Return to bug 251316