SHA256
1
0
forked from pool/grub2

Accepting request 1037003 from home:michael-chang:branches:Base:System

- Fix regression of reverting back to asking password twice when a keyfile is
  already used (bsc#1205309)
  * 0010-templates-import-etc-crypttab-to-grub.cfg.patch

OBS-URL: https://build.opensuse.org/request/show/1037003
OBS-URL: https://build.opensuse.org/package/show/Base:System/grub2?expand=0&rev=427
This commit is contained in:
Michael Chang 2022-11-22 07:46:19 +00:00 committed by Git OBS Bridge
parent fd4fd3a935
commit 2edffea20f
2 changed files with 33 additions and 20 deletions

View File

@ -11,35 +11,30 @@ This script can be used to import relevant /etc/crypptab entry to grub.cfg.
Signed-off-by: Michael Chang <mchang@suse.com> Signed-off-by: Michael Chang <mchang@suse.com>
--- ---
Makefile.util.def | 7 +++++++ Makefile.util.def | 7 ++++++
util/grub.d/05_crypttab.in | 36 ++++++++++++++++++++++++++++++++++++ util/grub.d/05_crypttab.in | 50 +++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 43 insertions(+) 2 files changed, 57 insertions(+)
create mode 100644 util/grub.d/05_crypttab.in create mode 100644 util/grub.d/05_crypttab.in
diff --git a/Makefile.util.def b/Makefile.util.def
index 08f681cd8b..5e0ba22f3d 100644
--- a/Makefile.util.def --- a/Makefile.util.def
+++ b/Makefile.util.def +++ b/Makefile.util.def
@@ -476,6 +476,13 @@ script = { @@ -477,6 +477,13 @@
installdir = grubconf;
}; };
+script = { script = {
+ name = '05_crypttab'; + name = '05_crypttab';
+ common = util/grub.d/05_crypttab.in; + common = util/grub.d/05_crypttab.in;
+ installdir = grubconf; + installdir = grubconf;
+ condition = COND_HOST_LINUX; + condition = COND_HOST_LINUX;
+}; +};
+ +
script = { +script = {
name = '10_windows'; name = '10_windows';
common = util/grub.d/10_windows.in; common = util/grub.d/10_windows.in;
diff --git a/util/grub.d/05_crypttab.in b/util/grub.d/05_crypttab.in installdir = grubconf;
new file mode 100644
index 0000000000..c539bc061e
--- /dev/null --- /dev/null
+++ b/util/grub.d/05_crypttab.in +++ b/util/grub.d/05_crypttab.in
@@ -0,0 +1,36 @@ @@ -0,0 +1,50 @@
+#! /bin/sh +#! /bin/sh
+set -e +set -e
+ +
@ -71,11 +66,22 @@ index 0000000000..c539bc061e
+CRYPTTAB=/etc/crypttab +CRYPTTAB=/etc/crypttab
+ +
+if [ -r "$CRYPTTAB" ]; then +if [ -r "$CRYPTTAB" ]; then
+ awk '/UUID=/ { sub(/UUID=/,"",$2); \ + awk '
+ gsub(/-/,"",$2); \ + $3 ~ /(^\/dev\/|^\/proc\/|^\/sys\/|:)/ { next }
+ printf("crypttab_entry %s %s %s\n",$1,$2,$3) \ + { key[0] = $3 }
+ }' "$CRYPTTAB" + $3 ~ /(^$|none|-)/ {
+ key[0] = "/etc/cryptsetup-keys.d/" $1 ".key"
+ key[1] = "/run/cryptsetup-keys.d/" $1 ".key"
+ }
+ {
+ for (d in key)
+ if (system("test -f " key[d]) == 0)
+ next
+ }
+ /UUID=/ {
+ sub(/UUID=/,"",$2);
+ gsub(/-/,"",$2);
+ printf("crypttab_entry %s %s %s\n",$1,$2,$3)
+ }
+ ' "$CRYPTTAB"
+fi +fi
--
2.34.1

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Mon Nov 21 02:10:28 UTC 2022 - Michael Chang <mchang@suse.com>
- Fix regression of reverting back to asking password twice when a keyfile is
already used (bsc#1205309)
* 0010-templates-import-etc-crypttab-to-grub.cfg.patch
------------------------------------------------------------------- -------------------------------------------------------------------
Wed Nov 16 02:36:23 UTC 2022 - Michael Chang <mchang@suse.com> Wed Nov 16 02:36:23 UTC 2022 - Michael Chang <mchang@suse.com>