summaryrefslogtreecommitdiff
path: root/rc.shutdown
diff options
context:
space:
mode:
authorVictor Lowther <victor.lowther@gmail.com>2010-06-09 10:52:15 -0500
committerVictor Lowther <victor.lowther@gmail.com>2010-07-23 15:57:07 -0500
commit5a8e472335e58f3e2310b8d8161384af95f4c2a6 (patch)
tree6537ab71214243ed349bb55f903a864f4f799c1d /rc.shutdown
parent3ddbc5dbde6cb92b1058a10c11c31accf756dcac (diff)
Rewrite /etc/crypttab processing.
Split out reading /etc/crypttab and procssing the individual lines into their own helper functions, and bashify the resulting shorter code. Processing this file is still ugly, though. :(
Diffstat (limited to 'rc.shutdown')
-rwxr-xr-xrc.shutdown38
1 files changed, 11 insertions, 27 deletions
diff --git a/rc.shutdown b/rc.shutdown
index 07061e8..84003dd 100755
--- a/rc.shutdown
+++ b/rc.shutdown
@@ -65,34 +65,18 @@ stat_busy "Unmounting Filesystems"
stat_done
# Kill non-root encrypted partition mappings
-if [[ -f /etc/crypttab ]]; then
+if [[ -f /etc/crypttab && $CS ]]; then
stat_busy "Deactivating encrypted volumes:"
- # Arch cryptsetup packages traditionally contained the binaries
- # /usr/sbin/cryptsetup
- # /sbin/cryptsetup.static
- # By default, initscripts used the /sbin/cryptsetup.static.
- # Newer packages will only have /sbin/cryptsetup and no static binary
- # This ensures maximal compatibility with the old and new layout
- for CS in /sbin/cryptsetup /usr/sbin/cryptsetup \
- /sbin/cryptsetup.static ''; do
- [[ -x $CS ]] && break
- done
- if [[ ! $CS ]]; then
- stat_append " Failed, unable to find cryptsetup."
- stat_fail
- else
- while read name src passwd opts; do
- [[ ! $name || ${name:0:1} = '#']] && continue
- [[ -b /dev/mapper/$name ]] || continue
- stat_append "${1}.."
- if "$CS" remove "$name" >/dev/null 2>&1; then
- stat_append "ok "
- else
- stat_append "failed "
- fi
- done </etc/crypttab
- fi
- stat_done
+ do_lock() {
+ stat_append "${1}.."
+ if $CS remove "$1" >/dev/null 2>&1; then
+ stat_append "ok "
+ else
+ stat_append "failed "
+ fi
+ }
+ read_crypttab do_lock
+ stat_done
fi
if [[ $USELVM =~ yes|YES && -x /sbin/lvm && -d /sys/block ]]; then