summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPawel Jakub Dawidek <pjd@FreeBSD.org>2005-08-14 17:28:15 +0000
committerPawel Jakub Dawidek <pjd@FreeBSD.org>2005-08-14 17:28:15 +0000
commitb3d1f1fce9db00424d637d7234a2e978a67b80e2 (patch)
tree67a9ce4fb118f27693073f244996d7a22db01941
parent9405aea2e284a709bf9251132357c31e7f1a3a8c (diff)
Notes
-rw-r--r--etc/rc.d/gbde23
-rw-r--r--etc/rc.subr23
2 files changed, 24 insertions, 22 deletions
diff --git a/etc/rc.d/gbde b/etc/rc.d/gbde
index 612fd7e255a8..6117b86ea617 100644
--- a/etc/rc.d/gbde
+++ b/etc/rc.d/gbde
@@ -17,27 +17,6 @@ stop_precmd="find_gbde_devices stop"
start_cmd="gbde_start"
stop_cmd="gbde_stop"
-# Change every ${_src} in ${_str} to ${_dst}.
-# We cannot use tr(1), sed(1) nor awk(1) here, because this script is executed
-# before /usr is mounted.
-local_tr()
-{
- _str=$1
- _src=$2
- _dst=$3
- _out=""
-
- IFS=${_src}
- for _com in ${_str}; do
- if [ -z "${_out}" ]; then
- _out="${_com}"
- else
- _out="${_out}${_dst}${_com}"
- fi
- done
- echo "${_out}"
-}
-
find_gbde_devices()
{
case "${gbde_devices-auto}" in
@@ -102,7 +81,7 @@ gbde_start()
for device in $gbde_devices; do
parent=${device%.bde}
parent=${parent#/dev/}
- parent_=`local_tr ${parent} '/' '_'`
+ parent_=`ltr ${parent} '/' '_'`
eval "lock=\${gbde_lock_${parent_}-\"${gbde_lockdir}/${parent_}.lock\"}"
if [ -e "/dev/${parent}" -a ! -e "/dev/${parent}.bde" ]; then
echo "Configuring Disk Encryption for ${parent}."
diff --git a/etc/rc.subr b/etc/rc.subr
index 6f5c1fa79f06..77f05929b148 100644
--- a/etc/rc.subr
+++ b/etc/rc.subr
@@ -1297,4 +1297,27 @@ mount_md()
/sbin/mdmfs $flags -s $1 -M md $2
}
+# ltr str src dst
+# Change every $src in $str to $dst.
+# Useful when /usr is not yet mounted and we cannot use tr(1), sed(1) nor
+# awk(1).
+ltr()
+{
+ local _str _src _dst _out _com
+ _str=$1
+ _src=$2
+ _dst=$3
+ _out=""
+
+ IFS=${_src}
+ for _com in ${_str}; do
+ if [ -z "${_out}" ]; then
+ _out="${_com}"
+ else
+ _out="${_out}${_dst}${_com}"
+ fi
+ done
+ echo "${_out}"
+}
+
fi