summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cryptfs.bin.in23
1 files changed, 10 insertions, 13 deletions
diff --git a/cryptfs.bin.in b/cryptfs.bin.in
index 8bfa29a..435058f 100644
--- a/cryptfs.bin.in
+++ b/cryptfs.bin.in
@@ -28,10 +28,10 @@ give_all_parent_dirs() {
inner_fs_to_mountorder() {
{
- echo "${fstab}" | \
+ printf '%s\n' "${fstab}" | \
grep "^$1 " | \
awk '{print "x " $3}'
- echo "${fstab}" | \
+ printf '%s\n' "${fstab}" | \
sed -n '
s|^\(\S\+\) \S\+ \(\S\+\)\( .*\)\?$|\1 \2|
T
@@ -52,7 +52,7 @@ inner_fs_to_mountorder() {
mountpoint_to_file() {
{
- echo "${fstab}" | \
+ printf '%s\n' "${fstab}" | \
awk '{print $1 " " $3}'
give_all_parent_dirs "$1" | \
awk '{print "x " $2}'
@@ -66,7 +66,7 @@ mountpoint_to_file() {
mountorder_to_device() {
{
printf 'x %s\n' "$1"
- echo "${fstab}" | \
+ printf '%s\n' "${fstab}" | \
awk '{print $1 " " $2}' | \
sort -k2,2 -u
} | \
@@ -81,13 +81,10 @@ crypttab=$(
/^\s*#/d
/^\s*$/d
s/\s\+/ /g
- ' '#ETCDIR#/crypttab' | \
- sort -u | \
- sed '
- s|UUID=|#UUIDDIR#/|
- s/\s\+/ /g
+ s|UUID=|#UUIDDIR#/|g
s/^ //
- '
+ ' '#ETCDIR#/crypttab' | \
+ sort -u
)
fstab=$(
sed '
@@ -103,12 +100,12 @@ fstab=$(
s|UUID=|#UUIDDIR#/|
s/\s\+/ /g
s/^ //
- s/ \+$//
+ s/ $//
'
)
mount_details() {
- echo "${fstab}" | \
+ printf '%s\n' "${fstab}" | \
grep "^$2 " | \
while read -r _ source dest fs opts _; do
case "$1" in
@@ -241,7 +238,7 @@ do_crypt_open() {
fi
}
-echo "${crypttab}" | \
+printf '%s\n' "${crypttab}" | \
grep -vxF '' | \
while read -r name raw key; do
key="${key%% *}"