From 8db3786b5b291a002c780acc0ea6a74e161a5c8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Floure?= Date: Mon, 6 Jul 2020 12:37:18 +0200 Subject: [PATCH] centos7/LUKS script: take LUKS passphrase as command-line argument --- opennebula-images/centos7-build-luks-opennebula-image.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/opennebula-images/centos7-build-luks-opennebula-image.sh b/opennebula-images/centos7-build-luks-opennebula-image.sh index 367211e..3be4b61 100755 --- a/opennebula-images/centos7-build-luks-opennebula-image.sh +++ b/opennebula-images/centos7-build-luks-opennebula-image.sh @@ -16,7 +16,6 @@ ARCH=x86_64 IMAGE_PATH=centos-luks-$RELEASE-$(date --iso-8601).img IMAGE_SIZE=10G LOOPBACK_DEVICE=/dev/loop0 -LUKS_PASSPHRASE=secret LUKS_DEVICE_NAME=cryptroot LUKS_DEVICE="/dev/mapper/$LUKS_DEVICE_NAME" DISABLED_ONE_SCRIPTS="loc-20-set-username-password loc-22-ssh_public_key" @@ -24,6 +23,13 @@ DISABLED_ONE_SCRIPTS="loc-20-set-username-password loc-22-ssh_public_key" ONE_CONTEXT_RPM_URL="https://github.com/OpenNebula/addon-context-linux/releases/download/v5.10.0/one-context-5.10.0-1.el$RELEASE.noarch.rpm" ONE_CONTEXT_RPM_PATH=/root/one-context.rpm +# Get LUKS passphrase. +if [ -z "$1" ]; then + echo "Usage: centos7-build-luks-opennebula-image.sh LUKS_PASSPHRASE" + exit 1 +fi +LUKS_PASSPHRASE="$1" + cleanup() { # The order here is important. umount /mnt/dev/pts 2>/dev/null || true