diff options
author | Ben Woods <woodsb02@FreeBSD.org> | 2018-06-26 18:07:16 +0000 |
---|---|---|
committer | Ben Woods <woodsb02@FreeBSD.org> | 2018-06-26 18:07:16 +0000 |
commit | 217df2da0805f63e8d35787929aeaf92815a4c17 (patch) | |
tree | 4378f61f959ddf39cdd9109c9062f73a9b2bbccd /etc/rc.d | |
parent | 96fa53869c833944247fe2d3e95f7bb4931c1d4d (diff) | |
download | src-217df2da0805f63e8d35787929aeaf92815a4c17.tar.gz src-217df2da0805f63e8d35787929aeaf92815a4c17.zip |
Notes
Diffstat (limited to 'etc/rc.d')
-rwxr-xr-x | etc/rc.d/geli | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/etc/rc.d/geli b/etc/rc.d/geli index 57f6ddf04a98..e1442e439940 100755 --- a/etc/rc.d/geli +++ b/etc/rc.d/geli @@ -34,7 +34,7 @@ name="geli" desc="GELI disk encryption" -start_precmd='[ -n "$(geli_make_list)" ]' +start_precmd='[ -n "$(geli_make_list)" -o -n "${geli_groups}" ]' start_cmd="geli_start" stop_cmd="geli_stop" required_modules="geom_eli:g_eli" @@ -72,12 +72,48 @@ geli_start() done fi done + + for group in ${geli_groups}; do + group_=`ltr ${group} '/-' '_'` + + eval "flags=\${geli_${group_}_flags}" + if [ -z "${flags}" ]; then + flags=${geli_default_flags} + fi + + eval "providers=\${geli_${group_}_devices}" + if [ -z "${providers}" ]; then + echo "No devices listed in geli group ${group}." + continue + fi + + if [ -e "/dev/${providers%% *}" -a ! -e "/dev/${providers%% *}.eli" ]; then + echo "Configuring Disk Encryption for geli group ${group}, containing ${providers}." + count=1 + while [ ${count} -le ${geli_tries} ]; do + geli attach ${flags} ${providers} + if [ -e "/dev/${providers%% *}.eli" ]; then + break + fi + echo "Attach failed; attempt ${count} of ${geli_tries}." + count=$((count+1)) + done + fi + done } geli_stop() { devices=`geli_make_list` + for group in ${geli_groups}; do + group_=`ltr ${group} '/-' '_'` + + eval "providers=\${geli_${group_}_devices}" + + devices="${devices} ${providers}" + done + for provider in ${devices}; do if [ -e "/dev/${provider}.eli" ]; then umount "/dev/${provider}.eli" 2>/dev/null |