summaryrefslogtreecommitdiff
path: root/libexec
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2019-11-20 23:45:31 +0000
committerWarner Losh <imp@FreeBSD.org>2019-11-20 23:45:31 +0000
commit6467506baf5c2958d7d19546cf4076d19a8586c2 (patch)
tree390cb9030923021327350dc295f1d76a8ae41911 /libexec
parent599d032a6dfbb7950906a2e26c6b3035f39e3ac7 (diff)
downloadsrc-test2-6467506baf5c2958d7d19546cf4076d19a8586c2.tar.gz
src-test2-6467506baf5c2958d7d19546cf4076d19a8586c2.zip
Notes
Diffstat (limited to 'libexec')
-rw-r--r--libexec/rc/rc.conf3
-rw-r--r--libexec/rc/rc.d/Makefile1
-rwxr-xr-xlibexec/rc/rc.d/os-release44
3 files changed, 48 insertions, 0 deletions
diff --git a/libexec/rc/rc.conf b/libexec/rc/rc.conf
index a58ed1670b53..1b7b235f47c4 100644
--- a/libexec/rc/rc.conf
+++ b/libexec/rc/rc.conf
@@ -678,6 +678,9 @@ entropy_save_sz="4096" # Size of the entropy cache files.
entropy_save_num="8" # Number of entropy cache files to save.
harvest_mask="511" # Entropy device harvests all but the very invasive sources.
# (See 'sysctl kern.random.harvest' and random(4))
+osrelease_enable="YES" # Update /var/run/os-release on boot (or NO).
+osrelease_file="/var/run/os-release" # File to update for os-release.
+osrelease_perms="444" # Default permission for os-release file.
dmesg_enable="YES" # Save dmesg(8) to /var/run/dmesg.boot
watchdogd_enable="NO" # Start the software watchdog daemon
watchdogd_flags="" # Flags to watchdogd (if enabled)
diff --git a/libexec/rc/rc.d/Makefile b/libexec/rc/rc.d/Makefile
index 69f1f84fcaff..ca417fdf657b 100644
--- a/libexec/rc/rc.d/Makefile
+++ b/libexec/rc/rc.d/Makefile
@@ -77,6 +77,7 @@ CONFS= DAEMON \
nsswitch \
ntpdate \
${_opensm} \
+ os-release \
pf \
pflog \
pfsync \
diff --git a/libexec/rc/rc.d/os-release b/libexec/rc/rc.d/os-release
new file mode 100755
index 000000000000..411348a43668
--- /dev/null
+++ b/libexec/rc/rc.d/os-release
@@ -0,0 +1,44 @@
+#!/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"