opnsense-src/libexec/rc/rc.d/var_run
Cy Schubert 8585680682 Revert "rc.d/var_run: Fix typo in comment"
svcj is not a typo.

Noted by:	jlduran
MFC after:	3 days

This reverts commit bef05a7537.
2024-11-25 10:43:54 -08:00

46 lines
848 B
Bash
Executable file

#!/bin/sh
# PROVIDE: var_run
# REQUIRE: mountcritlocal
# BEFORE: cleanvar
# KEYWORD: shutdown
. /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
# doesn't make sense to run in a svcj: config setting
var_run_svcj="NO"
_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 $(dirname ${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"