Index: etc/Makefile =================================================================== --- etc/Makefile +++ etc/Makefile @@ -57,6 +57,8 @@ ${_+_}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} -T "package=unbound" \ Index: libexec/rc/rc.conf =================================================================== --- libexec/rc/rc.conf +++ libexec/rc/rc.conf @@ -676,6 +676,9 @@ 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) Index: libexec/rc/rc.d/Makefile =================================================================== --- libexec/rc/rc.d/Makefile +++ libexec/rc/rc.d/Makefile @@ -77,6 +77,7 @@ nsswitch \ ntpdate \ ${_opensm} \ + os-release \ pf \ pflog \ pfsync \ Index: libexec/rc/rc.d/os-release =================================================================== --- /dev/null +++ libexec/rc/rc.d/os-release @@ -0,0 +1,42 @@ +#!/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() +{ + 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"