Page MenuHomeFreeBSD

D27318.1784770686.diff
No OneTemporary

Size
2 KB
Referenced Files
None
Subscribers
None

D27318.1784770686.diff

diff --git a/bin/freebsd-version/freebsd-version.1 b/bin/freebsd-version/freebsd-version.1
--- a/bin/freebsd-version/freebsd-version.1
+++ b/bin/freebsd-version/freebsd-version.1
@@ -25,7 +25,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd October 1, 2021
+.Dd November 15, 2021
.Dt FREEBSD-VERSION 1
.Os
.Sh NAME
@@ -33,7 +33,7 @@
.Nd print the version and patch level of the installed system
.Sh SYNOPSIS
.Nm
-.Op Fl kru
+.Op Fl kruv
.Op Fl j Ar jail
.Sh DESCRIPTION
The
@@ -61,6 +61,8 @@
These are hardcoded into
.Nm
during the build.
+.It Fl v
+Enable printing out verbose information, for kernel and/or userland.
.It Fl j Ar jail
Print the version and patch level of the installed userland in the
given jail specified by
diff --git a/bin/freebsd-version/freebsd-version.sh.in b/bin/freebsd-version/freebsd-version.sh.in
--- a/bin/freebsd-version/freebsd-version.sh.in
+++ b/bin/freebsd-version/freebsd-version.sh.in
@@ -39,6 +39,7 @@
KERNEL_RE='^@@TYPE@@ \([-.0-9A-Za-z]\{1,\}\) .*$'
progname=${0##*/}
+progverb=0
#
# Print an error message and exit.
@@ -67,6 +68,8 @@
if [ ! -f "$kernfile" -o ! -r "$kernfile" ] ; then
error "unable to locate kernel"
fi
+ [ $progverb -gt 0 ] && \
+ what -qs "$kernfile" || \
what -qs "$kernfile" | sed -n "s/$KERNEL_RE/\\1/p"
}
@@ -74,6 +77,8 @@
# Print the version of the currently running kernel.
#
running_version() {
+ [ $progverb -gt 0 ] && \
+ echo `sysctl -n kern.osrelease kern.osreldate` || \
sysctl -n kern.osrelease
}
@@ -81,6 +86,8 @@
# Print the hardcoded userland version.
#
userland_version() {
+ [ $progverb -gt 0 ] && \
+ echo $USERLAND_VERSION `uname -U` || \
echo $USERLAND_VERSION
}
@@ -97,7 +104,7 @@
# Print a usage string and exit.
#
usage() {
- echo "usage: $progname [-kru] [-j jail]" >&2
+ echo "usage: $progname [-kruv] [-j jail]" >&2
exit 1
}
@@ -107,7 +114,7 @@
main() {
# parse command-line arguments
local OPTIND=1 OPTARG option
- while getopts "kruj:" option ; do
+ while getopts "kruvj:" option ; do
case $option in
k)
opt_k=1
@@ -118,6 +125,9 @@
u)
opt_u=1
;;
+ v)
+ progverb=1
+ ;;
j)
if [ $opt_j ] ; then
jail="$jail $OPTARG"

File Metadata

Mime Type
text/plain
Expires
Thu, Jul 23, 1:38 AM (8 h, 15 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29233607
Default Alt Text
D27318.1784770686.diff (2 KB)

Event Timeline