Automated server install reference

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 :slight_smile:

EDIT: Not tested but might work for late-commands, too

While update is defined, it doesn’t look like updates is. This appears to only have the option of security (default) or all pertaining to which updates are ran post install. It may be worth defining the declaration. This was a fairly recent addition:

https://github.com/canonical/subiquity/blob/a0e2e244bd3fb32430ea9f5fd2d3a5fe1b73f43c/subiquity/server/controllers/updates.py

1 Like

Throws a syntax error at @. Additionally, I can find no rsyslog class in cloudinit/reporting/handlers.py