gbde (141038) | gbde (149049) |
---|---|
1#!/bin/sh 2# 3# This file, originally written by Garrett A. Wollman, is in the public 4# domain. 5# | 1#!/bin/sh 2# 3# This file, originally written by Garrett A. Wollman, is in the public 4# domain. 5# |
6# $FreeBSD: head/etc/rc.d/gbde 141038 2005-01-30 11:04:13Z pjd $ | 6# $FreeBSD: head/etc/rc.d/gbde 149049 2005-08-14 17:28:15Z pjd $ |
7# 8 9# PROVIDE: disks 10# KEYWORD: nojail 11 12. /etc/rc.subr 13 14name="gbde" 15start_precmd="find_gbde_devices start" 16stop_precmd="find_gbde_devices stop" 17start_cmd="gbde_start" 18stop_cmd="gbde_stop" 19 | 7# 8 9# PROVIDE: disks 10# KEYWORD: nojail 11 12. /etc/rc.subr 13 14name="gbde" 15start_precmd="find_gbde_devices start" 16stop_precmd="find_gbde_devices stop" 17start_cmd="gbde_start" 18stop_cmd="gbde_stop" 19 |
20# Change every ${_src} in ${_str} to ${_dst}. 21# We cannot use tr(1), sed(1) nor awk(1) here, because this script is executed 22# before /usr is mounted. 23local_tr() 24{ 25 _str=$1 26 _src=$2 27 _dst=$3 28 _out="" 29 30 IFS=${_src} 31 for _com in ${_str}; do 32 if [ -z "${_out}" ]; then 33 _out="${_com}" 34 else 35 _out="${_out}${_dst}${_com}" 36 fi 37 done 38 echo "${_out}" 39} 40 | |
41find_gbde_devices() 42{ 43 case "${gbde_devices-auto}" in 44 [Aa][Uu][Tt][Oo]) 45 gbde_devices="" 46 ;; 47 *) 48 return 0 --- 48 unchanged lines hidden (view full) --- 97 return 0 98} 99 100gbde_start() 101{ 102 for device in $gbde_devices; do 103 parent=${device%.bde} 104 parent=${parent#/dev/} | 20find_gbde_devices() 21{ 22 case "${gbde_devices-auto}" in 23 [Aa][Uu][Tt][Oo]) 24 gbde_devices="" 25 ;; 26 *) 27 return 0 --- 48 unchanged lines hidden (view full) --- 76 return 0 77} 78 79gbde_start() 80{ 81 for device in $gbde_devices; do 82 parent=${device%.bde} 83 parent=${parent#/dev/} |
105 parent_=`local_tr ${parent} '/' '_'` | 84 parent_=`ltr ${parent} '/' '_'` |
106 eval "lock=\${gbde_lock_${parent_}-\"${gbde_lockdir}/${parent_}.lock\"}" 107 if [ -e "/dev/${parent}" -a ! -e "/dev/${parent}.bde" ]; then 108 echo "Configuring Disk Encryption for ${parent}." 109 110 count=1 111 while [ ${count} -le ${gbde_attach_attempts} ]; do 112 if [ -e "${lock}" ]; then 113 gbde attach ${parent} -l ${lock} --- 27 unchanged lines hidden --- | 85 eval "lock=\${gbde_lock_${parent_}-\"${gbde_lockdir}/${parent_}.lock\"}" 86 if [ -e "/dev/${parent}" -a ! -e "/dev/${parent}.bde" ]; then 87 echo "Configuring Disk Encryption for ${parent}." 88 89 count=1 90 while [ ${count} -le ${gbde_attach_attempts} ]; do 91 if [ -e "${lock}" ]; then 92 gbde attach ${parent} -l ${lock} --- 27 unchanged lines hidden --- |