--- cryptroot.scripts 2015-12-28 03:03:14.000000000 -0800 +++ cryptroot.scripts.mod 2015-12-28 03:03:09.000000000 -0800 @@ -102,6 +102,7 @@ ;; header=*) cryptheader=${x#header=} + # [Comment] Shouldn't these be -f since the header is a regular file? if [ ! -e "$cryptheader" ] && [ -e "/conf/conf.d/cryptheader/$cryptheader" ]; then cryptheader="/conf/conf.d/cryptheader/$cryptheader" fi @@ -185,7 +186,17 @@ return 1 fi - if [ -n "$cryptheader" ] && ! type "$cryptheader" >/dev/null; then + # [Error] "type" is proper for a script, such as keyscript, but not for a file + # [Comment:] There is one more error here. There are two reasons why + # parse_options() may have left $cryptheader unset. One is that there was no + # "header=" option in crypttab, in which case it is proper to skip the + # following conditional. The other is that the option appeared improperly + # with an empty filename. In that case, we don't want to skip the conditional. + # We want the message to be printed. So this distinction needs to be flagged. + # [Comment:] Also, perhaps we should use -f rather than -e as the header is a + # regular file. + # Was: if [ -n "$cryptheader" ] && ! type "$cryptheader" >/dev/null; then + if [ -n "$cryptheader" ] && [ ! -e "$cryptheader" ]; then message "cryptsetup: error - LUKS header \"$cryptheader\" missing" return 1 fi