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 | |||||
: ${osrelease_file:=/var/run/os-release} | |||||
: ${osrelease_perms:=444} | |||||
name="osrelease" | |||||
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 | |||||
desc="Update ${osrelease_file}" | |||||
start_cmd="osrelease_start" | |||||
stop_cmd=":" | |||||
osrelease_start() | |||||
{ | |||||
check_startmsgs && echo -n 'Updating ${osrelease_file} ' | |||||
VERSION=$(freebsd-version -u) | |||||
0mpUnsubmitted 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… | |||||
VERSION_ID=${VERSION%%[^0-9.]*} | |||||
t=$(mktemp -t os-release) | |||||
Done Inline ActionsI'd use VERSION_ID=${VERSION%%[^0-9.]*} brooks: I'd use
```
VERSION_ID=${VERSION%%[^0-9.]*}
``` | |||||
cat > "$t" <<-__EOF__ | |||||
Not Done Inline Actionss/motd/os-release/ ? vangyzen: `s/motd/os-release/` ? | |||||
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/ | |||||
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… | |||||
__EOF__ | |||||
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. | |||||
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?
| |||||
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" |
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=...)