From 15644d6b3c6deccfa54ed520b4a55ffa88e000d0 Mon Sep 17 00:00:00 2001 From: pjd Date: Sun, 23 Jan 2005 16:43:55 +0000 Subject: We cannot use sed(1), because rc.d/gbde has to be called before rc.d/mountcritlocal and sed(1) is placed in /usr/bin/. Other useful tools for this task are also placed in /usr/ (tr(1), awk(1)), so I implemented local_tr() function which works simlar to tr(1). Reported by: Amir Shalem MFC after: 1 week --- etc/rc.d/gbde | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'etc') diff --git a/etc/rc.d/gbde b/etc/rc.d/gbde index 5071ab9..4ab9abc 100644 --- a/etc/rc.d/gbde +++ b/etc/rc.d/gbde @@ -17,6 +17,25 @@ stop_precmd="find_gbde_devices stop" start_cmd="gbde_start" stop_cmd="gbde_stop" +# Change every ${_src} in ${_str} to ${_dst}. +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 @@ -81,7 +100,7 @@ gbde_start() for device in $gbde_devices; do parent=${device%.bde} parent=${parent#/dev/} - parent_=`echo ${parent} | sed "s/\//_/g"` + parent_=`local_tr ${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}." -- cgit v1.1