gbde (136209) | gbde (136212) |
---|---|
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 136209 2004-10-07 06:00:06Z pjd $ | 6# $FreeBSD: head/etc/rc.d/gbde 136212 2004-10-07 10:02:46Z pjd $ |
7# 8 9# PROVIDE: disks 10# KEYWORD: FreeBSD nojail 11 12. /etc/rc.subr 13 14name="gbde" --- 59 unchanged lines hidden (view full) --- 74 esac 75 76 return 0 77} 78 79gbde_start() 80{ 81 for device in $gbde_devices; do | 7# 8 9# PROVIDE: disks 10# KEYWORD: FreeBSD nojail 11 12. /etc/rc.subr 13 14name="gbde" --- 59 unchanged lines hidden (view full) --- 74 esac 75 76 return 0 77} 78 79gbde_start() 80{ 81 for device in $gbde_devices; do |
82 parentdev=${device%.bde} 83 parent=${parentdev#/dev/} | 82 parent=${device%.bde} 83 parent=${parent#/dev/} |
84 eval "lock=\${gbde_lock_${parent}-\"${gbde_lockdir}/${parent}.lock\"}" | 84 eval "lock=\${gbde_lock_${parent}-\"${gbde_lockdir}/${parent}.lock\"}" |
85 if [ -e "/dev/${parent}" -a ! -e "${device}" ]; then 86 echo "Configuring Disk Encryption for ${device}." | 85 if [ -e "/dev/${parent}" -a ! -e "/dev/${parent}.bde" ]; then 86 echo "Configuring Disk Encryption for ${parent}." |
87 88 count=1 89 while [ ${count} -le ${gbde_attach_attempts} ]; do 90 if [ -e "${lock}" ]; then | 87 88 count=1 89 while [ ${count} -le ${gbde_attach_attempts} ]; do 90 if [ -e "${lock}" ]; then |
91 gbde attach ${parentdev} -l ${lock} | 91 gbde attach ${parent} -l ${lock} |
92 else | 92 else |
93 gbde attach ${parentdev} | 93 gbde attach ${parent} |
94 fi | 94 fi |
95 if [ -e ${device} ]; then | 95 if [ -e "/dev/${parent}.bde" ]; then |
96 break 97 fi 98 echo "Attach failed; attempt ${count} of ${gbde_attach_attempts}." 99 count=$((${count} + 1)) 100 done | 96 break 97 fi 98 echo "Attach failed; attempt ${count} of ${gbde_attach_attempts}." 99 count=$((${count} + 1)) 100 done |
101 | |
102 fi 103 done 104} 105 106gbde_stop() 107{ 108 for device in $gbde_devices; do | 101 fi 102 done 103} 104 105gbde_stop() 106{ 107 for device in $gbde_devices; do |
109 umount ${device} 110 gbde detach ${device%.bde} | 108 parent=${device%.bde} 109 parent=${parent#/dev/} 110 if [ -e "/dev/${parent}.bde" ]; then 111 umount "/dev/${parent}.bde" 2>/dev/null 112 gbde detach "${parent}" 113 fi |
111 done 112} 113 114load_rc_config $name 115run_rc_command "$1" | 114 done 115} 116 117load_rc_config $name 118run_rc_command "$1" |