Author: imp
Date: Fri Jan 31 13:18:25 2020
New Revision: 357333
URL: https://svnweb.freebsd.org/changeset/base/357333

Log:
  MFC r354922
  
  > Author: imp <imp@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
  > Date:   Wed Nov 20 23:45:31 2019 +0000
  >
  >    Create /etc/os-release file.
  >
  >    Each boot, regenerate /var/run/os-release based on the currently running
  >    system. Create a /etc/os-release symlink pointing to this file (so that 
this
  >    doesn't create a new reason /etc can not be mounted read-only).
  >
  >    This is compatible with what other systems do and is what the 
sysutil/os-release
  >    port attempted to do, but in an incomplete way. Linux, Solaris and 
DragonFly all
  >    implement this natively as well. The complete standard can be found at
  >    https://www.freedesktop.org/software/systemd/man/os-release.html
  >
  >    Moving this to the base solves both the non-standard location problem 
with the
  >    port, as well as the lack of update of this file on system update.
  >
  >    Bump __FreeBSD_version to 1300060
  >
  >    PR: 238953
  >    Differential Revision:  https://reviews.freebsd.org/D22271
  
  Execpt bump __FreeBSD_version to 1201511

Added:
  stable/12/libexec/rc/rc.d/os-release
     - copied unchanged from r354922, head/libexec/rc/rc.d/os-release
  stable/12/share/man/man5/os-release.5
     - copied unchanged from r354922, head/share/man/man5/os-release.5
Modified:
  stable/12/etc/Makefile
  stable/12/libexec/rc/rc.conf
  stable/12/libexec/rc/rc.d/Makefile
  stable/12/share/man/man5/Makefile
  stable/12/sys/sys/param.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/etc/Makefile
==============================================================================
--- stable/12/etc/Makefile      Fri Jan 31 12:39:51 2020        (r357332)
+++ stable/12/etc/Makefile      Fri Jan 31 13:18:25 2020        (r357333)
@@ -82,6 +82,8 @@ distribution:
        ${_+_}cd ${.CURDIR}/mtree; ${MAKE} install
        ${_+_}cd ${SRCTOP}/share/termcap; ${MAKE} etc-termcap
        ${_+_}cd ${SRCTOP}/usr.sbin/rmt; ${MAKE} etc-rmt
+       ${INSTALL_SYMLINK} ../var/run/os-release \
+               ${DESTDIR}/etc/os-release
 .if ${MK_UNBOUND} != "no"
        if [ ! -e ${DESTDIR}/etc/unbound ]; then \
                ${INSTALL_SYMLINK} ../var/unbound ${DESTDIR}/etc/unbound; \

Modified: stable/12/libexec/rc/rc.conf
==============================================================================
--- stable/12/libexec/rc/rc.conf        Fri Jan 31 12:39:51 2020        
(r357332)
+++ stable/12/libexec/rc/rc.conf        Fri Jan 31 13:18:25 2020        
(r357333)
@@ -680,6 +680,9 @@ entropy_save_sz="4096"      # Size of the entropy cache fil
 entropy_save_num="8"   # Number of entropy cache files to save.
 harvest_mask="511"     # Entropy device harvests all but the very invasive 
sources.
                        # (See 'sysctl kern.random.harvest' and random(4))
+osrelease_enable="YES" # Update /var/run/os-release on boot (or NO).
+osrelease_file="/var/run/os-release" # File to update for os-release.
+osrelease_perms="444"  # Default permission for os-release file.
 dmesg_enable="YES"     # Save dmesg(8) to /var/run/dmesg.boot
 watchdogd_enable="NO"  # Start the software watchdog daemon
 watchdogd_flags=""     # Flags to watchdogd (if enabled)

Modified: stable/12/libexec/rc/rc.d/Makefile
==============================================================================
--- stable/12/libexec/rc/rc.d/Makefile  Fri Jan 31 12:39:51 2020        
(r357332)
+++ stable/12/libexec/rc/rc.d/Makefile  Fri Jan 31 13:18:25 2020        
(r357333)
@@ -80,6 +80,7 @@ CONFS=        DAEMON \
        nsswitch \
        ntpdate \
        ${_opensm} \
+       os-release \
        pf \
        pflog \
        pfsync \

Copied: stable/12/libexec/rc/rc.d/os-release (from r354922, 
head/libexec/rc/rc.d/os-release)
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/12/libexec/rc/rc.d/os-release        Fri Jan 31 13:18:25 2020        
(r357333, copy of r354922, head/libexec/rc/rc.d/os-release)
@@ -0,0 +1,44 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+# PROVIDE: os-release
+# REQUIRE: mountcritremote FILESYSTEMS
+# BEFORE:  LOGIN
+
+. /etc/rc.subr
+
+: ${osrelease_file:=/var/run/os-release}
+: ${osrelease_perms:=444}
+name="osrelease"
+desc="Update ${osrelease_file}"
+start_cmd="osrelease_start"
+stop_cmd=":"
+
+osrelease_start()
+{
+       local _version _version_id
+
+       check_startmsgs && echo -n "Updating ${osrelease_file} "
+       _version=$(freebsd-version -u)
+       _version_id=${_version%%[^0-9.]*}
+       t=$(mktemp -t os-release)
+       cat > "$t" <<-__EOF__
+               NAME=FreeBSD
+               VERSION=$_version
+               VERSION_ID=$_version_id
+               ID=freebsd
+               ANSI_COLOR="0;31"
+               PRETTY_NAME="FreeBSD $_version"
+               CPE_NAME=cpe:/o:freebsd:freebsd:$_version_id
+               HOME_URL=https://FreeBSD.org/
+               BUG_REPORT_URL=https://bugs.FreeBSD.org/
+__EOF__
+       install -C -o root -g wheel -m ${osrelease_perms} "$t" 
"${osrelease_file}"
+       rm -f "$t"
+       check_startmsgs && echo 'done.'
+}
+
+load_rc_config $name
+run_rc_command "$1"

Modified: stable/12/share/man/man5/Makefile
==============================================================================
--- stable/12/share/man/man5/Makefile   Fri Jan 31 12:39:51 2020        
(r357332)
+++ stable/12/share/man/man5/Makefile   Fri Jan 31 13:18:25 2020        
(r357333)
@@ -48,6 +48,7 @@ MAN=  acct.5 \
        nsmb.conf.5 \
        nsswitch.conf.5 \
        nullfs.5 \
+       os-release.5 \
        passwd.5 \
        pbm.5 \
        periodic.conf.5 \

Copied: stable/12/share/man/man5/os-release.5 (from r354922, 
head/share/man/man5/os-release.5)
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/12/share/man/man5/os-release.5       Fri Jan 31 13:18:25 2020        
(r357333, copy of r354922, head/share/man/man5/os-release.5)
@@ -0,0 +1,130 @@
+.\" Copyright (c) 2019 M. Warner Losh.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"    notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"    notice, this list of conditions and the following disclaimer in the
+.\"    documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 9, 2019
+.Dt OS-RELEASE 5
+.Os
+.Sh NAME
+.Nm os-release
+.Nd file describing the current OS and some of its attributes
+.Sh DESCRIPTION
+The
+.Nm
+file is a new-line separated list of key value pairs.
+The syntax of this file is a reduced
+.Xr sh 1
+variable assignment with the
+following restrictions:
+.Bl -bullet
+.It
+Strings cannot be concatenated together
+.It
+No variable expansion is done
+.It
+All shell special characters must be quoted as documented in
+.Xr sh 1
+.It
+Variable assignments must be included inside of double quotes
+if they contain characters outside of A-Z, a-z and 0-9
+.It
+All strings should be UTF-8 format
+.It
+Non-printable characters should not be used in the strings
+.El
+.Pp
+Lines starting with the character
+.Ql #
+are ignored as comments.
+.Sh VARIABLES
+The following variables are defined by the standard.
+.Bl -tag -width XXXXXXXXXX -compact
+.It Dv NAME
+A string describing the preferred OS name.
+.It Dv VERSION
+Version string for the OS, in its usual and customary format.
+.It Dv ID
+Lower case version of the name with only a-z, 0-9,
+.Ql . ,
+.Ql - ,
+and
+.Ql _ .
+.It Dv VERSION_ID
+Lower case version of the version with only a-z, 0-9,
+.Ql . ,
+.Ql - ,
+and
+.Ql _ .
+.It Dv PRETTY_NAME
+A pretty version of the name presented to the user.
+May contain release information.
+.It Dv ANSI_COLOR
+Suggested color presentation for the OS.
+This string should be suitable for inclusion within an ESC [ m ANSI/ECMA-48
+escape sequence to render the OS in its preferred color.
+This variable is optional.
+.It Dv CPE_NAME
+A CPE name for the operating system.
+This field shall follow the NIST Common Platform Enumeration specification.
+.It Dv HOME_URL
+.It Dv SUPPORT_URL
+.It Dv BUG_REPORT_URL
+.It Dv PRIVACY_POLICY_URL
+Links on the internet, in RFC 3986 format for different aspects of this OS.
+These variables are optional.
+.It Dv BUILD_ID
+A string identifying the build.
+This variable is optional.
+.It Dv VARIANT
+A string describing the variant of this operating system.
+This variable is optional.
+.It Dv VARIANT_ID
+Lower case version of the variant with only a-z, 0-9,
+.Ql . ,
+.Ql - ,
+and
+.Ql _ .
+This variable is optional.
+.El
+.Pp
+All other variables have no standard-defined meaning.
+.Sh FILES
+.Bl -tag -width XXXXXXXXXX -compact
+.It Pa /etc/os-release
+Symbolic link to actual
+.Pa os-release
+file.
+.It Pa /var/run/os-release
+Generated os-release file describing the currently running system.
+.Sh SEE ALSO
+.Bl -tag -width XXXXXXXXXX -compact
+.It CPE Specification
+.Lk 
https://csrc.nist.gov/projects/security-content-automation-protocol/scap-specifications/cpe
+.It RFC 3986
+.Lk https://tools.ietf.org/html/rfc3986
+.It os-release Specification
+.Lk https://www.linux.org/docs/man5/os-release.html
+.Sh HISTORY
+This file first appeared in
+.Fx 13.0 .

Modified: stable/12/sys/sys/param.h
==============================================================================
--- stable/12/sys/sys/param.h   Fri Jan 31 12:39:51 2020        (r357332)
+++ stable/12/sys/sys/param.h   Fri Jan 31 13:18:25 2020        (r357333)
@@ -60,7 +60,7 @@
  *             in the range 5 to 9.
  */
 #undef __FreeBSD_version
-#define __FreeBSD_version 1201510      /* Master, propagated to newvers */
+#define __FreeBSD_version 1201511      /* Master, propagated to newvers */
 
 /*
  * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to