1#!/bin/sh 2# 3# $FreeBSD$ 4# 5 6# PROVIDE: os-release 7# REQUIRE: mountcritremote FILESYSTEMS 8# BEFORE: LOGIN 9 10. /etc/rc.subr 11 12: ${osrelease_file:=/var/run/os-release} 13: ${osrelease_perms:=444} 14name="osrelease" 15desc="Update ${osrelease_file}" 16start_cmd="osrelease_start" 17stop_cmd=":" 18 19osrelease_start() 20{ 21 local _version _version_id 22 23 check_startmsgs && echo -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 check_startmsgs && echo 'done.' 41} 42 43load_rc_config $name 44run_rc_command "$1" 45