127b9777cSCy Schubert#!/bin/sh 227b9777cSCy Schubert 327b9777cSCy Schubert# PROVIDE: var_run 427b9777cSCy Schubert# REQUIRE: mountcritlocal 527b9777cSCy Schubert# BEFORE: cleanvar 6b77b3099SCy 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 20*f99f0ee1SAlexander Leidinger# doesn't make sense to run in a svcj: config setting 21*f99f0ee1SAlexander Leidingervar_run_svcj="NO" 22*f99f0ee1SAlexander Leidinger 2327b9777cSCy Schubert_var_run_load() { 2427b9777cSCy Schubert test -f ${var_run_mtree} && 2527b9777cSCy Schubert mtree -U -i -q -f ${var_run_mtree} -p /var/run > /dev/null 2627b9777cSCy Schubert} 2727b9777cSCy Schubert 2827b9777cSCy Schubert_var_run_save() { 2927b9777cSCy Schubert if [ ! -d $(dirname ${var_run_mtree}) ]; then 3027b9777cSCy Schubert mkdir -p ${var_run_mtree} 3127b9777cSCy Schubert fi 3227b9777cSCy Schubert mtree -dcbj -p /var/run > ${var_run_mtree} 3327b9777cSCy Schubert} 3427b9777cSCy Schubert 3527b9777cSCy Schubert_var_run_start() { 3627b9777cSCy Schubert df -ttmpfs /var/run > /dev/null 2>&1 && 3727b9777cSCy Schubert _var_run_load 3827b9777cSCy Schubert} 3927b9777cSCy Schubert 4027b9777cSCy Schubert_var_run_stop() { 4127b9777cSCy Schubert df -ttmpfs /var/run > /dev/null 2>&1 && 4227b9777cSCy Schubert checkyesno var_run_autosave && 4327b9777cSCy Schubert _var_run_save 4427b9777cSCy Schubert} 4527b9777cSCy Schubert 4627b9777cSCy Schubertrun_rc_command "$1" 47