# $NetBSD: rc.subr,v 1.6 1999/03/24 18:59:47 mellon Exp $ # functions used by various rc scripts # # checkyesno # Test $1 variable, and warn if not set to YES or NO. # return 0 if it's "yes" (et al), nonzero otherwise # checkyesno() { eval value=\$${1} case $value in # "yes", "true", "on", or "1" [Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1) return 0 ;; # "no", "false", "off", or "0" [Nn][Oo]|[Ff][Aa][Ll][Ss][Ee]|[Oo][Ff][Ff]|0) return 1 ;; *) logger -s "WARNING: \$${1} is not set properly." return 1 ;; esac } # # mount_critical_filesystems # Go through the list of critical filesystems, checking each one # to see if it is mounted, and if it is not, mounting it. # mount_critical_filesystems() { for fs in /usr /var $critical_filesystems; do mount | ( ismounted=no while read what _on on _type type; do if [ $on = $fs ]; then ismounted=yes fi done if [ $ismounted = no ]; then mount $fs >/dev/null 2>&1 fi ) done }