The example file for preseeding bionic as linked to here contains both
# Individual additional packages to install #d-i pkgsel/include string openssh-server build-essential ```
and
# This command is run just before the install finishes, but when there is # still a usable /target directory. You can chroot to /target and use it # directly, or use the apt-install and in-target commands to easily install # packages and run commands in the target system. #d-i preseed/late_command string apt-install zsh; in-target chsh -s /bin/zsh ```
How do I decide whether I want to use the preseed/late_command
version or the pkgsel/include
version?
My question What is the difference between apt-install and in-target apt-get install? is related but complementary. I expect it to be separate enough of a question.
When installing the system using a preseed file, one of the steps is to define where are the installation components located (such as main, universe..). This could be a CD, NFS server, FTP or WEB servers, either official or non official. This can be done only once.
When including packages you need to make sure that all of them exist in the selected repository, the repo holds any dependencies (if needed) and are supported by your version. Your automated installation may fail or halt if one of the packages failed to install from any reason.
Any
late_command
is executed when your system installation finished and you have a proper working OS. This allows you to execute regular commands as if you are connected to the machine. It also does not unmount your installation media if you still need it.An example for a useful apt-get related late command is to edit the
/etc/apt/sources.list
file with other repos, preformapt update
and then useapt-get
on packages you did not have while installing the OS.