diff options
author | pjd <pjd@FreeBSD.org> | 2005-01-23 16:43:55 +0000 |
---|---|---|
committer | pjd <pjd@FreeBSD.org> | 2005-01-23 16:43:55 +0000 |
commit | 15644d6b3c6deccfa54ed520b4a55ffa88e000d0 (patch) | |
tree | 39ff5439125d0b916bc930235734fa0aed4aac43 | |
parent | 837efbda5bba08588eb1e2e5e707b223f0887718 (diff) | |
download | FreeBSD-src-15644d6b3c6deccfa54ed520b4a55ffa88e000d0.zip FreeBSD-src-15644d6b3c6deccfa54ed520b4a55ffa88e000d0.tar.gz |
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
-rw-r--r-- | etc/rc.d/gbde | 21 |
1 files changed, 20 insertions, 1 deletions
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}." |