FreeBSD Bugzilla – Attachment 176144 Details for
Bug 213665
[PATCH] make bin/freebsd-version not depend on binutils
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Proposed patch
file_213665.txt (text/plain), 3.20 KB, created by
Dag-Erling Smørgrav
on 2016-10-25 14:33:12 UTC
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Dag-Erling Smørgrav
Created:
2016-10-25 14:33:12 UTC
Size:
3.20 KB
patch
obsolete
>Index: bin/freebsd-version/freebsd-version.1 >=================================================================== >--- bin/freebsd-version/freebsd-version.1 (revision 307769) >+++ bin/freebsd-version/freebsd-version.1 (working copy) >@@ -25,7 +25,7 @@ > .\" > .\" $FreeBSD$ > .\" >-.Dd October 5, 2013 >+.Dd October 25, 2016 > .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 ku >+.Op Fl kru > .Sh DESCRIPTION > The > .Nm >@@ -50,6 +50,11 @@ > rebooted, > .Nm > will print the version and patch level of the new kernel. >+.It Fl r >+Print the version and patch level of the running kernel. >+Unlike >+.Xr uname 1 , >+this is unaffected by environment variables. > .It Fl u > Print the version and patch level of the installed userland. > These are hardcoded into >@@ -57,14 +62,10 @@ > during the build. > .El > .Pp >-If both >-.Fl k >-and >-.Fl u >-are specified, >+If several of the above options are specified, > .Nm >-will print the kernel version first, then the userland version, on >-separate lines. >+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. > .Sh IMPLEMENTATION NOTES > The >Index: bin/freebsd-version/freebsd-version.sh.in >=================================================================== >--- bin/freebsd-version/freebsd-version.sh.in (revision 307769) >+++ bin/freebsd-version/freebsd-version.sh.in (working copy) >@@ -36,7 +36,7 @@ > : ${LOADER_CONF_FILES:=$LOADER_DIR/defaults/loader.conf $LOADER_DIR/loader.conf $LOADER_DIR/loader.conf.local} > LOADER_RE1='^\([A-Z_a-z][0-9A-Z_a-z]*=[-./0-9A-Z_a-z]\{1,\}\).*$' > LOADER_RE2='^\([A-Z_a-z][0-9A-Z_a-z]*="[-./0-9A-Z_a-z]\{1,\}"\).*$' >-KERNEL_RE='^@(#)@@TYPE@@ \([-.0-9A-Za-z]\{1,\}\) .*$' >+KERNEL_RE='^@@TYPE@@ \([-.0-9A-Za-z]\{1,\}\) .*$' > > progname=$(basename $0) > >@@ -67,10 +67,17 @@ > if [ ! -f "$kernfile" -o ! -r "$kernfile" ] ; then > error "unable to locate kernel" > fi >- strings "$kernfile" | sed -n "s/$KERNEL_RE/\\1/p" >+ what -qs "$kernfile" | sed -n "s/$KERNEL_RE/\\1/p" > } > > # >+# Print the version of the currently running kernel. >+# >+running_version() { >+ sysctl -n kern.osrelease >+} >+ >+# > # Print the hardcoded userland version. > # > userland_version() { >@@ -81,7 +88,7 @@ > # Print a usage string and exit. > # > usage() { >- echo "usage: $progname [-ku]" >&2 >+ echo "usage: $progname [-kru]" >&2 > exit 1 > } > >@@ -90,11 +97,14 @@ > # > main() { > # parse command-line arguments >- while getopts "ku" option ; do >+ while getopts "kru" option ; do > case $option in > k) > opt_k=1 > ;; >+ r) >+ opt_r=1 >+ ;; > u) > opt_u=1 > ;; >@@ -108,15 +118,20 @@ > fi > > # default is -u >- if [ $((opt_k + opt_u)) -eq 0 ] ; then >+ if [ $((opt_k + opt_r + opt_u)) -eq 0 ] ; then > opt_u=1 > fi > >- # print kernel version >+ # print installed kernel version > if [ $opt_k ] ; then > kernel_version > fi > >+ # print running kernel version >+ if [ $opt_r ] ; then >+ running_version >+ fi >+ > # print userland version > if [ $opt_u ] ; then > userland_version
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 213665
:
176011
| 176144