Changeset View
Changeset View
Standalone View
Standalone View
libexec/rc/rc.d/var_run
- This file was added.
Property | Old Value | New Value |
---|---|---|
File Mode | null | 100755 |
#!/bin/sh | |||||
# PROVIDE: kq-var-run | |||||
# REQUIRE: zfs tmp | |||||
# BEFORE: FILESYSTEMS | |||||
philip: Why does this require zfs? It looks like this will work fine on other filesystems too. | |||||
Done Inline ActionsIt needs all local filesystems. The kq- is a local thing I put in all local rc-scripts. I thought I had removed all local quirks. cy: It needs all local filesystems.
The kq- is a local thing I put in all local rc-scripts. I… | |||||
. /etc/rc.subr | |||||
name=var_run | |||||
rcvar=var_run_enable | |||||
extra_commands="load save" | |||||
start_cmd="_var_run_start" | |||||
load_cmd="_var_run_load" | |||||
save_cmd="_var_run_save" | |||||
stop_cmd="_var_run_stop" | |||||
load_rc_config $name | |||||
# Set defaults | |||||
: ${var_run_enable:="NO"} | |||||
: ${var_run_mtree:="/var/db/mtree/BSD.var-run.mtree"} | |||||
: ${var_run_autosave:="YES"} | |||||
_var_run_load() { | |||||
test -f ${var_run_mtree} && | |||||
mtree -U -i -q -f ${var_run_mtree} -p /var/run > /dev/null | |||||
} | |||||
_var_run_save() { | |||||
if [ ! -d $(dirname ${var_run_mtree}) ]; then | |||||
mkdir -p ${var_run_mtree} | |||||
fi | |||||
mtree -dcbj -p /var/run > ${var_run_mtree} | |||||
} | |||||
_var_run_start() { | |||||
df -ttmpfs /var/run > /dev/null 2>&1 && | |||||
_var_run_load | |||||
} | |||||
_var_run_stop() { | |||||
df -ttmpfs /var/run > /dev/null 2>&1 && | |||||
checkyesno var_run_autosave && | |||||
_var_run_save | |||||
} | |||||
run_rc_command "$1" |
Why does this require zfs? It looks like this will work fine on other filesystems too.
(Incidentally: what does kq in the name refer to?)