From ea5a82e604bec63f810c631ea98f93f29b47bb36 Mon Sep 17 00:00:00 2001 From: Bryan Joshua Pedini Date: Tue, 19 Mar 2024 11:25:49 +0100 Subject: [PATCH] added function to specify password at runtime --- unattended.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/unattended.sh b/unattended.sh index e788ed2..f400202 100755 --- a/unattended.sh +++ b/unattended.sh @@ -1,5 +1,10 @@ #!/usr/bin/env bash +# Get password from user prompt and set it in preseed +read -sp "Enter the root password: " ROOT_PASSWORD +cp -f template.cfg preseed.cfg +sed -i "s/ROOT_PASSWORD/${ROOT_PASSWORD}/" preseed.cfg + # Get the file name ISONAME=$(ls | grep "netinst.iso" | sort | tail -n1) # Remove an already existing unattended iso of this same version, if existing @@ -30,5 +35,5 @@ cd .. # Repackage all the iso files chmod a+w isofiles/isolinux/isolinux.bin docker run --interactive --tty --rm --volume $(pwd):/root/unattended debian:buster /root/unattended/docker.sh -# Remove the extracted (temporary) files -sudo rm -rf isofiles +# Remove the extracted (temporary) files and the preseed with the plaintext password +sudo rm -rf isofiles preseed.cfg