mirror of
https://github.com/opnsense/src.git
synced 2026-04-11 20:40:03 -04:00
Variables must be quoted if they contain non-alphanumeric characters. Warner noted in the review that the lack of quoting causing problems here is rather an edge case. I believe that it's worth adding the quotes here anyway because this is what the specification says and there is no good reason not to follow it. Reviewed by: imp Approved by: imp (src) MFC after: 7 days
45 lines
962 B
Bash
Executable file
45 lines
962 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}"
|
|
rcvar="osrelease_enable"
|
|
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"
|