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 14, 2017 .Dt FREEBSD-VERSION 1 .Os .Sh NAME @@ -34,7 +34,6 @@ .Sh SYNOPSIS .Nm .Op Fl kru -.Op Fl j Ar jail .Sh DESCRIPTION The .Nm @@ -61,20 +60,12 @@ 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 . -This option can be specified multiple times. .El .Pp If several of the above options are specified, .Nm will print the installed kernel version first, then the running kernel -version, next the userland version, and finally the userland version -of the specified jails, on separate lines. +version, and finally the userland version, on separate lines. If neither is specified, it will print the userland version only. .Sh IMPLEMENTATION NOTES The 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 @@ -84,20 +84,11 @@ echo $USERLAND_VERSION } -# -# Print the hardcoded userland version of a jail. -# -jail_version() { - for i in $jail; do - jexec -- $i freebsd-version - done -} - # # Print a usage string and exit. # usage() { - echo "usage: $progname [-kru] [-j jail]" >&2 + echo "usage: $progname [-kru]" >&2 exit 1 } @@ -106,8 +97,7 @@ # main() { # parse command-line arguments - local OPTIND=1 OPTARG option - while getopts "kruj:" option ; do + while getopts "kru" option ; do case $option in k) opt_k=1 @@ -118,14 +108,6 @@ u) opt_u=1 ;; - j) - if [ $opt_j ] ; then - jail="$jail $OPTARG" - else - opt_j=1 - jail="$OPTARG" - fi - ;; *) usage ;; @@ -136,7 +118,7 @@ fi # default is -u - if [ $((opt_k + opt_r + opt_u + opt_j)) -eq 0 ] ; then + if [ $((opt_k + opt_r + opt_u)) -eq 0 ] ; then opt_u=1 fi @@ -154,11 +136,6 @@ if [ $opt_u ] ; then userland_version fi - - # print jail version - if [ $opt_j ] ; then - jail_version - fi } main "$@" diff --git a/usr.sbin/freebsd-update/freebsd-update.sh b/usr.sbin/freebsd-update/freebsd-update.sh --- a/usr.sbin/freebsd-update/freebsd-update.sh +++ b/usr.sbin/freebsd-update/freebsd-update.sh @@ -328,11 +328,17 @@ # Get the Jail's path and the version of its installed userland config_TargetJail () { JAIL=$1 - UNAME_r=$(freebsd-version -j ${JAIL}) - BASEDIR=$(jls -j ${JAIL} -h path | awk 'NR == 2 {print}') - if [ -z ${BASEDIR} ] || [ -z ${UNAME_r} ]; then - echo "The specified jail either doesn't exist or" \ - "does not have freebsd-version." + if [ -z ${JAIL} ] ; then + return 1 + fi + BASEDIR=$(jls -j ${JAIL} path) + if [ -z ${BASEDIR} ] || ! [ -d ${BASEDIR} ] ; then + echo "The specified jail does not exist." + exit 1 + fi + UNAME_r=$(${BASEDIR}/bin/freebsd-version) + if [ -z ${UNAME_r} ]; then + echo "The specified jail does not have freebsd-version." exit 1 fi export UNAME_r