Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F141000153
D25705.id74569.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D25705.id74569.diff
View Options
Index: bin/freebsd-version/freebsd-version.1
===================================================================
--- bin/freebsd-version/freebsd-version.1
+++ bin/freebsd-version/freebsd-version.1
@@ -34,6 +34,7 @@
.Sh SYNOPSIS
.Nm
.Op Fl kru
+.Op Fl j Ar jail
.Sh DESCRIPTION
The
.Nm
@@ -60,13 +61,20 @@
These are hardcoded into
.Nm
during the build.
+.It Fl j Ar jail
+Print the version and patch level of the installed userland in the
+given jail specified by
+.Va jid
+or
+.Va name .
.El
.Pp
If several of the above options are specified,
.Nm
will print the installed kernel version first, then the running kernel
-version, and finally the userland version, on separate lines.
-If neither is specified, it will print the userland version only.
+version, next the userland version, and finally the userland version
+of the specified jail, on separate lines. If neither is specified, it
+will print the userland version only.
.Sh IMPLEMENTATION NOTES
The
.Nm
Index: bin/freebsd-version/freebsd-version.sh.in
===================================================================
--- bin/freebsd-version/freebsd-version.sh.in
+++ bin/freebsd-version/freebsd-version.sh.in
@@ -85,10 +85,17 @@
}
#
+# Print the hardcoded userland version of a jail.
+#
+jail_version() {
+ jexec -- $jail freebsd-version
+}
+
+#
# Print a usage string and exit.
#
usage() {
- echo "usage: $progname [-kru]" >&2
+ echo "usage: $progname [-kru] [-j jail]" >&2
exit 1
}
@@ -97,7 +104,8 @@
#
main() {
# parse command-line arguments
- while getopts "kru" option ; do
+ local OPTIND=1 OPTARG option
+ while getopts "kruj:" option ; do
case $option in
k)
opt_k=1
@@ -108,6 +116,10 @@
u)
opt_u=1
;;
+ j)
+ opt_j=1
+ jail="$OPTARG"
+ ;;
*)
usage
;;
@@ -118,7 +130,7 @@
fi
# default is -u
- if [ $((opt_k + opt_r + opt_u)) -eq 0 ] ; then
+ if [ $((opt_k + opt_r + opt_u + opt_j)) -eq 0 ] ; then
opt_u=1
fi
@@ -135,6 +147,11 @@
# print userland version
if [ $opt_u ] ; then
userland_version
+ fi
+
+ # print jail version
+ if [ $opt_j ] ; then
+ jail_version
fi
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Dec 31, 2:39 PM (11 h, 17 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
27414086
Default Alt Text
D25705.id74569.diff (2 KB)
Attached To
Mode
D25705: freebsd-version(1): Add -j flag to support jails
Attached
Detach File
Event Timeline
Log In to Comment