s390x: simplify 's390x-se-luks-gencpio' script

This commit is contained in:
Nikita Dubrovskii committed 2022-09-05 12:08:35 +02:00
1 parent 49ce9b0289
commit 769ac686f1
2 files changed
+33 -28

No files matched your search

+6 -12
View File
@@ -1,22 +1,16 @@
#!/bin/bash
# This script creates new initramdisk with LUKS config within
# This script appends LUKS keys and config to initrd
set -euo pipefail
old_initrd=$1
new_initrd=$2
currdir=$PWD
# Copying existing initramdisk
cp ${old_initrd} ${new_initrd}
initrd=$1
tmpdir=$2
# Appending LUKS root keys and crypttab config to the end of initrd
workdir=$(mktemp -d -p /tmp se-initramfs-XXXXXX)
cd ${workdir}
cd ${tmpdir}
mkdir -p etc/luks
cp -f /etc/luks/* etc/luks/
cp -f /etc/crypttab etc/
find . -mindepth 1 | cpio --quiet -H newc -o | gzip -9 -n >> ${new_initrd}
find . -mindepth 1 | cpio --quiet -H newc -o | gzip -9 -n >> ${initrd}
# Cleanup
cd ${currdir}
rm -rf ${workdir}
rm -rf etc/