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 <amir@boom.org.il>
MFC after:	1 week
This commit is contained in:
Pawel Jakub Dawidek 2005-01-23 16:43:55 +00:00
parent d563f671c3
commit e4d1918415

View File

@ -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}."