Step 1. Download packer
at packer.io.
Step 2. Build the disk image
./packer build ubuntu.json
The output will be in the folder output-ubuntu1804
. The disk image is in RAW format.
scripts/post-installation.sh
: the script that runs after Ubuntu Server is installed.
For example, if the password is 12345
,
echo 12345 | sudo [command];
Adding the following to the post installation scirpt would make it sleeps until a file exists, which means you can make the file to exit. For example, if the file is /tmp/quit
, then add the following to the post installation script,
while [ ! -f /tmp/quit ] do sleep 1m done
and to exit,
touch /tmp/quit