Changeset View
Changeset View
Standalone View
Standalone View
libexec/rc/rc.d/os-release
- This file was added.
Property | Old Value | New Value |
---|---|---|
File Mode | null | 100755 |
#!/bin/sh | |||||
# | |||||
# $FreeBSD$ | |||||
# | |||||
# PROVIDE: os-release | |||||
# REQUIRE: mountcritremote FILESYSTEMS | |||||
# BEFORE: LOGIN | |||||
. /etc/rc.subr | |||||
name="osrelease" | |||||
desc="Update /var/run/os-release" | |||||
start_cmd="osrelease_start" | |||||
se: The value of $desc could take a user-defined setting of $osrelease_file into account if moved… | |||||
Done Inline ActionsI'll include that in the next update. Thanks imp: I'll include that in the next update. Thanks | |||||
stop_cmd=":" | |||||
: ${osrelease_file:=/var/run/os-release} | |||||
osrelease_start() | |||||
{ | |||||
check_startmsgs && echo -n 'Updating os-release' | |||||
( | |||||
VERSION=`freebsd-version -u` | |||||
VERSION_ID=`echo "$VERSION" | sed "s/^\([0-9\.]*\).*$/\1/"` | |||||
brooksUnsubmitted Done Inline ActionsI'd use VERSION_ID=${VERSION%%[^0-9.]*} brooks: I'd use
```
VERSION_ID=${VERSION%%[^0-9.]*}
``` | |||||
Not Done Inline ActionsIt is just a minor thing, but shouldn't we use local variables here like local _version to match other rc scripts? 0mp: It is just a minor thing, but shouldn't we use local variables here like `local _version` to… | |||||
echo "NAME=FreeBSD" | |||||
Not Done Inline Actionss/motd/os-release/ ? vangyzen: `s/motd/os-release/` ? | |||||
echo "VERSION=$VERSION" | |||||
echo "VERSION_ID=$VERSION_ID" | |||||
echo "ID=freebsd" | |||||
echo "ANSI_COLOR=\"0;31\"" | |||||
echo "PRETTY_NAME=\"FreeBSD $VERSION\"" | |||||
echo "CPE_NAME=cpe:/o:freebsd:freebsd:$VERSION_ID" | |||||
echo "HOME_URL=https://freebsd.org/" | |||||
echo "BUG_REPORT_URL=https://bugs.freebsd.org" | |||||
cemUnsubmitted Done Inline ActionsSuggest adding a canonical trailing "/" to BUG_REPORT_URL. (Used to be "/bugzilla/" was required, but it seems we have a working redirect now, so "/" is fine.) cem: Suggest adding a canonical trailing "/" to BUG_REPORT_URL.
(Used to be "/bugzilla/" was… | |||||
) > ${osrelease_file} | |||||
brooksUnsubmitted Done Inline ActionsI'd tend to save a subshell and a bunch of quotes with a heardoc. brooks: I'd tend to save a subshell and a bunch of quotes with a heardoc. | |||||
check_startmsgs && echo '.' | |||||
Not Done Inline ActionsShould we perhaps follow the usual way of spelling our URL as FreeBSD.org? trasz: Should we perhaps follow the usual way of spelling our URL as FreeBSD.org?
| |||||
} | |||||
load_rc_config $name | |||||
run_rc_command "$1" |
The value of $desc could take a user-defined setting of $osrelease_file into account if moved down 4 lines (or if setting default values for osrelease_file and os_release_perms was moved up to above name=...)