rc.subr (158723) | rc.subr (159828) |
---|---|
1# $NetBSD: rc.subr,v 1.66 2006/04/01 10:05:50 he Exp $ | 1# $NetBSD: rc.subr,v 1.66 2006/04/01 10:05:50 he Exp $ |
2# $FreeBSD: head/etc/rc.subr 158723 2006-05-18 16:04:56Z flz $ | 2# $FreeBSD: head/etc/rc.subr 159828 2006-06-21 09:42:55Z yar $ |
3# 4# Copyright (c) 1997-2004 The NetBSD Foundation, Inc. 5# All rights reserved. 6# 7# This code is derived from software contributed to The NetBSD Foundation 8# by Luke Mewburn. 9# 10# Redistribution and use in source and binary forms, with or without --- 1340 unchanged lines hidden (view full) --- 1351mount_md() 1352{ 1353 if [ -n "$3" ]; then 1354 flags="$3" 1355 fi 1356 /sbin/mdmfs $flags -s $1 md $2 1357} 1358 | 3# 4# Copyright (c) 1997-2004 The NetBSD Foundation, Inc. 5# All rights reserved. 6# 7# This code is derived from software contributed to The NetBSD Foundation 8# by Luke Mewburn. 9# 10# Redistribution and use in source and binary forms, with or without --- 1340 unchanged lines hidden (view full) --- 1351mount_md() 1352{ 1353 if [ -n "$3" ]; then 1354 flags="$3" 1355 fi 1356 /sbin/mdmfs $flags -s $1 md $2 1357} 1358 |
1359# Code common to scripts that need to load a kernel module 1360# if it isn't in the kernel yet. Syntax: 1361# load_kld [-e regexp] [-m modname] filename 1362# where -e or -m chooses the way to check if the module 1363# is already loaded: 1364# regexp is egrep'd in the output from `kldstat -v', 1365# modname is passed to `kldstat -m'. 1366# The default way is as though `-m filename' were specified. 1367load_kld() 1368{ 1369 local _loaded _mod _opt _re 1370 1371 while getopts "e:m:" _opt; do 1372 case "$_opt" in 1373 e) _re="$OPTARG" ;; 1374 m) _mod="$OPTARG" ;; 1375 esac 1376 done 1377 shift $(($OPTIND - 1)) 1378 _mod=${_mod:-$1} 1379 _loaded=false 1380 if [ -n "$_re" ]; then 1381 if kldstat -v | egrep -q -e "$_re"; then 1382 _loaded=true 1383 fi 1384 else 1385 if kldstat -q -m "$_mod"; then 1386 _loaded=true 1387 fi 1388 fi 1389 if ! $_loaded; then 1390 if ! kldload "$1"; then 1391 warn "Unable to load kernel module $1" 1392 return 1 1393 fi 1394 fi 1395 return 0 1396} 1397 |
|
1359# ltr str src dst 1360# Change every $src in $str to $dst. 1361# Useful when /usr is not yet mounted and we cannot use tr(1), sed(1) nor 1362# awk(1). 1363ltr() 1364{ 1365 local _str _src _dst _out _com 1366 _str=$1 --- 99 unchanged lines hidden --- | 1398# ltr str src dst 1399# Change every $src in $str to $dst. 1400# Useful when /usr is not yet mounted and we cannot use tr(1), sed(1) nor 1401# awk(1). 1402ltr() 1403{ 1404 local _str _src _dst _out _com 1405 _str=$1 --- 99 unchanged lines hidden --- |