1#!/bin/sh 2# 3# 4 5# PROVIDE: os-release 6# REQUIRE: mountcritremote FILESYSTEMS 7# BEFORE: LOGIN 8 9. /etc/rc.subr 10 11: ${osrelease_file:=/var/run/os-release} 12: ${osrelease_perms:=444} 13name="osrelease" 14desc="Update ${osrelease_file}" 15rcvar="osrelease_enable" 16start_cmd="osrelease_start" 17stop_cmd=":" 18 19osrelease_start() 20{ 21 local _version _version_id 22 23 startmsg -n "Updating ${osrelease_file} " 24 _version=$(freebsd-version -u) 25 _version_id=${_version%%[^0-9.]*} 26 t=$(mktemp -t os-release) 27 cat > "$t" <<-__EOF__ 28 NAME=FreeBSD 29 VERSION="$_version" 30 VERSION_ID="$_version_id" 31 ID=freebsd 32 ANSI_COLOR="0;31" 33 PRETTY_NAME="FreeBSD $_version" 34 CPE_NAME="cpe:/o:freebsd:freebsd:$_version_id" 35 HOME_URL="https://FreeBSD.org/" 36 BUG_REPORT_URL="https://bugs.FreeBSD.org/" 37__EOF__ 38 install -C -o root -g wheel -m ${osrelease_perms} "$t" "${osrelease_file}" 39 rm -f "$t" 40 startmsg 'done.' 41} 42 43load_rc_config $name 44run_rc_command "$1" 45