Thank you very much @kbrannen for your initial idea to get interactivity in this installer. I implemented this and it worked great but was not what I wanted. Today I remembered my firstboot script which I use to get around a gnome flaw and it is working wonderful:
How to get interactivity during autoinstall using whiptail
First create a script which contains your commands:
- |
cat <<'EOF' | tee -a /get_userdetails.sh
#Change to tty3 to display the dialog
if ! chvt 3 &>/dev/null; then
break
fi
export TERM=linux
export NCURSES_NO_UTF8_ACS=1
printf "\ec"
# Hostname dialog
default_hostname=focal-ai
custom_hostname=$(whiptail --inputbox "Please enter a Hostname:\n\nDefault: [$default_hostname]" 9 30 --clear --nocancel --ok-button "Enter" 3>&1 1>&2 2>&3)
if [[ -z $custom_hostname ]]; then
custom_hostname=$default_hostname
fi
sed -i 's/focal-autoinstall/'"$custom_hostname"'/' /autoinstall.yaml
#Change back to tty1
if ! chvt 1 &>/dev/null; then
break
fi
EOF
Then call the script the following way to block the installer from continuing:
- bash /get_userdetails.sh <> /dev/tty3 >&0 2>&1
Preinsert whatever you want to replace or however you want it:
# User section
user-data:
hostname: focal-autoinstall
Have fun with nice whiptail dialogs
EDIT: Not tested but might work for late-commands, too