centos7/LUKS script: take LUKS passphrase as command-line argument

This commit is contained in:
fnux 2020-07-06 12:37:18 +02:00
parent 1e39b0aa84
commit 8db3786b5b

View file

@ -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