Clarify code and documentation (thanks @boyska)

This commit is contained in:
hellekin 2015-02-21 23:03:29 -03:00
parent 2194023287
commit 8aa1c0c6a5

12
tomb
View File

@ -278,7 +278,7 @@ _tmp_create() {
return 0 return 0
} }
# Check if a block device is encrypted # Check if a *block* device is encrypted
# Synopsis: _is_encrypted_block /path/to/block/device # Synopsis: _is_encrypted_block /path/to/block/device
# Return 0 if it is an encrypted block device # Return 0 if it is an encrypted block device
_is_encrypted_block() { _is_encrypted_block() {
@ -288,7 +288,7 @@ _is_encrypted_block() {
# Issue #163 # Issue #163
# lsblk --inverse appeared in util-linux 2.22 # lsblk --inverse appeared in util-linux 2.22
# but --version is not consistent... # but --version is not consistent...
lsblk --help | grep -q '\-\-inverse' lsblk --help | grep -Fq -- --inverse
[[ $? -eq 0 ]] && s="--inverse" [[ $? -eq 0 ]] && s="--inverse"
sudo lsblk $s -o type -n $b 2>/dev/null \ sudo lsblk $s -o type -n $b 2>/dev/null \
@ -314,7 +314,13 @@ _ensure_safe_swap() {
_message "An active swap partition is detected..." _message "An active swap partition is detected..."
for s in $=swaps; do for s in $=swaps; do
{ _is_encrypted_block $s } && { r=2 } || { r=1; break } { _is_encrypted_block $s } && { r=2 } || {
# We're dealing with unencrypted stuff.
# Maybe it lives on an encrypted filesystem anyway.
# @todo: verify it's actually on an encrypted FS (see #163 and !189)
# Well, no: bail out.
r=1; break
}
done done
if [[ $r -eq 2 ]]; then if [[ $r -eq 2 ]]; then