127b9777cSCy Schubert#!/bin/sh 227b9777cSCy Schubert 327b9777cSCy Schubert# PROVIDE: var_run 427b9777cSCy Schubert# REQUIRE: mountcritlocal 527b9777cSCy Schubert# BEFORE: cleanvar 6*b77b3099SCy Schubert# KEYWORD: shutdown 727b9777cSCy Schubert 827b9777cSCy Schubert. /etc/rc.subr 927b9777cSCy Schubert 1027b9777cSCy Schubertname=var_run 1127b9777cSCy Schubertrcvar=var_run_enable 1227b9777cSCy Schubertextra_commands="load save" 1327b9777cSCy Schubertstart_cmd="_var_run_start" 1427b9777cSCy Schubertload_cmd="_var_run_load" 1527b9777cSCy Schubertsave_cmd="_var_run_save" 1627b9777cSCy Schubertstop_cmd="_var_run_stop" 1727b9777cSCy Schubert 1827b9777cSCy Schubertload_rc_config $name 1927b9777cSCy Schubert 2027b9777cSCy Schubert_var_run_load() { 2127b9777cSCy Schubert test -f ${var_run_mtree} && 2227b9777cSCy Schubert mtree -U -i -q -f ${var_run_mtree} -p /var/run > /dev/null 2327b9777cSCy Schubert} 2427b9777cSCy Schubert 2527b9777cSCy Schubert_var_run_save() { 2627b9777cSCy Schubert if [ ! -d $(dirname ${var_run_mtree}) ]; then 2727b9777cSCy Schubert mkdir -p ${var_run_mtree} 2827b9777cSCy Schubert fi 2927b9777cSCy Schubert mtree -dcbj -p /var/run > ${var_run_mtree} 3027b9777cSCy Schubert} 3127b9777cSCy Schubert 3227b9777cSCy Schubert_var_run_start() { 3327b9777cSCy Schubert df -ttmpfs /var/run > /dev/null 2>&1 && 3427b9777cSCy Schubert _var_run_load 3527b9777cSCy Schubert} 3627b9777cSCy Schubert 3727b9777cSCy Schubert_var_run_stop() { 3827b9777cSCy Schubert df -ttmpfs /var/run > /dev/null 2>&1 && 3927b9777cSCy Schubert checkyesno var_run_autosave && 4027b9777cSCy Schubert _var_run_save 4127b9777cSCy Schubert} 4227b9777cSCy Schubert 4327b9777cSCy Schubertrun_rc_command "$1" 44