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}" 16rcvar="osrelease_enable" 17start_cmd="osrelease_start" 18stop_cmd=":" 19 20osrelease_start() 21{ 22 local _version _version_id 23 24 check_startmsgs && echo -n "Updating ${osrelease_file} " 25 _version=$(freebsd-version -u) 26 _version_id=${_version%%[^0-9.]*} 27 t=$(mktemp -t os-release) 28 cat > "$t" <<-__EOF__ 29 NAME=FreeBSD 30 VERSION=$_version 31 VERSION_ID=$_version_id 32 ID=freebsd 33 ANSI_COLOR="0;31" 34 PRETTY_NAME="FreeBSD $_version" 35 CPE_NAME=cpe:/o:freebsd:freebsd:$_version_id 36 HOME_URL=https://FreeBSD.org/ 37 BUG_REPORT_URL=https://bugs.FreeBSD.org/ 38__EOF__ 39 install -C -o root -g wheel -m ${osrelease_perms} "$t" "${osrelease_file}" 40 rm -f "$t" 41 check_startmsgs && echo 'done.' 42} 43 44load_rc_config $name 45run_rc_command "$1" 46