added function to specify password at runtime

This commit is contained in:
Bryan Joshua Pedini 2024-03-19 11:25:49 +01:00
parent 1f0682e45d
commit ea5a82e604
1 changed files with 7 additions and 2 deletions

View File

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