From 1b9148f12f85f326cb8127665ecfc2136c9822d5 Mon Sep 17 00:00:00 2001
From: Ondrej Kozina <okozina@redhat.com>
Date: Wed, 18 Oct 2017 09:57:03 +0200
Subject: [PATCH] dracut-reencrypt: add --progress-frequency parameter
---
misc/dracut_90reencrypt/reencrypt.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/misc/dracut_90reencrypt/reencrypt.sh b/misc/dracut_90reencrypt/reencrypt.sh
index e6f87e0..b4960d7 100755
--- a/misc/dracut_90reencrypt/reencrypt.sh
+++ b/misc/dracut_90reencrypt/reencrypt.sh
@@ -18,7 +18,7 @@ else
device="$1"
fi
-PARAMS="$device -T 1 --use-fsync -B 32"
+PARAMS="$device -T 1 --use-fsync --progress-frequency 5 -B 32"
if [ "$3" != "any" ]; then
PARAMS="$PARAMS -S $3"
fi
--
1.8.3.1
From cda0a8ac7f30f120cdf5fadf16484715e8f9a040 Mon Sep 17 00:00:00 2001
From: Ondrej Kozina <okozina@redhat.com>
Date: Thu, 19 Jul 2018 17:33:58 +0200
Subject: [PATCH 2/2] Indicate running in initrd phase.
---
misc/dracut_90reencrypt/reencrypt.sh | 2 ++
1 file changed, 2 insertions(+)
diff --git a/misc/dracut_90reencrypt/reencrypt.sh b/misc/dracut_90reencrypt/reencrypt.sh
index e6f87e0..24c7716 100755
--- a/misc/dracut_90reencrypt/reencrypt.sh
+++ b/misc/dracut_90reencrypt/reencrypt.sh
@@ -11,6 +11,8 @@
. /lib/dracut-lib.sh
+export CRYPT_REENCRYPT_IN_INITRD=1
+
# if device name is /dev/dm-X, convert to /dev/mapper/name
if [ "${1##/dev/dm-}" != "$1" ]; then
device="/dev/mapper/$(dmsetup info -c --noheadings -o name "$1")"
--
1.8.3.1
From 5da5e7f095e09c9501179864f6a20293dd9cada5 Mon Sep 17 00:00:00 2001
From: Ondrej Kozina <okozina@redhat.com>
Date: Mon, 16 Jul 2018 17:17:45 +0200
Subject: [PATCH] Redirect stdout to stderr during reencryption in initrd.
Stdout is not printed in initrd unless user invokes debug mode.
It's inconvenient to have users waiting for reencryption to
finish with no input at all.
---
misc/dracut_90reencrypt/module-setup.sh | 1 +
misc/dracut_90reencrypt/reencrypt-verbose.sh | 5 +++++
misc/dracut_90reencrypt/reencrypt.sh | 4 ++--
3 files changed, 8 insertions(+), 2 deletions(-)
create mode 100755 misc/dracut_90reencrypt/reencrypt-verbose.sh
diff --git a/misc/dracut_90reencrypt/module-setup.sh b/misc/dracut_90reencrypt/module-setup.sh
index 2ec9953..fcd7c92 100755
--- a/misc/dracut_90reencrypt/module-setup.sh
+++ b/misc/dracut_90reencrypt/module-setup.sh
@@ -28,4 +28,5 @@ install() {
# shellcheck disable=SC2154
inst_hook cmdline 30 "$moddir/parse-reencrypt.sh"
inst_simple "$moddir"/reencrypt.sh /sbin/reencrypt
+ inst_simple "$moddir"/reencrypt-verbose.sh /sbin/cryptsetup-reencrypt-verbose
}
diff --git a/misc/dracut_90reencrypt/reencrypt-verbose.sh b/misc/dracut_90reencrypt/reencrypt-verbose.sh
new file mode 100755
index 0000000..5db75d5
--- /dev/null
+++ b/misc/dracut_90reencrypt/reencrypt-verbose.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+# Route stdout to stderr in initrd. Otherwise output is invisible
+# unless we run in debug mode.
+/sbin/cryptsetup-reencrypt $@ 1>&2
diff --git a/misc/dracut_90reencrypt/reencrypt.sh b/misc/dracut_90reencrypt/reencrypt.sh
index b4960d7..4243773 100755
--- a/misc/dracut_90reencrypt/reencrypt.sh
+++ b/misc/dracut_90reencrypt/reencrypt.sh
@@ -50,10 +50,10 @@ reenc_run() {
fi
/bin/plymouth ask-for-password \
--prompt "$_prompt" \
- --command="/sbin/cryptsetup-reencrypt $PARAMS"
+ --command="/sbin/cryptsetup-reencrypt-verbose $PARAMS"
else
info "REENCRYPT using key $1"
- reenc_readkey "$1" | /sbin/cryptsetup-reencrypt -d - $PARAMS
+ reenc_readkey "$1" | /sbin/cryptsetup-reencrypt-verbose -d - $PARAMS
fi
_ret=$?
cd $cwd
--
1.8.3.1