6467506baf
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
45 lines
927 B
Bash
Executable File
45 lines
927 B
Bash
Executable File
#!/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"
|