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