From 76f25f287ef2ec3c0831314aecf2708859bf09a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Lesimple?= Date: Thu, 2 Mar 2023 16:08:46 +0000 Subject: [PATCH] enh: setup-encryption.sh: don't require install to be called before us --- bin/admin/setup-encryption.sh | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/bin/admin/setup-encryption.sh b/bin/admin/setup-encryption.sh index 07a99e5..42c7eb9 100755 --- a/bin/admin/setup-encryption.sh +++ b/bin/admin/setup-encryption.sh @@ -15,12 +15,17 @@ else action_done fi -action_doing "Checking whether the install script has run" +action_doing "Installing luks-config.sh template if needed" if ! [ -f "/etc/bastion/luks-config.sh" ]; then - action_error "The '/etc/bastion/luks-config.sh' file doesn't exist, did you run the '$basedir/bin/admin/install' script before?" - exit 1 + mkdir -p /etc/bastion + if ! cp "$basedir/etc/bastion/luks-config.sh.dist" "/etc/bastion/luks-config.sh"; then + action_error "Error copying $basedir/etc/bastion/luks-config.sh.dist to /etc/bastion/luks-config.sh, aborting" + exit 1 + else + action_done "installed" + fi else - action_done + action_done "already installed" fi action_doing "Checking whether /home is a separate partition"