Struggling to understand timing of some preseed commands
I want to run a script at the end of my preseed.conf file. I'm reading https://www.debian.org/releases/stable/amd64/apbs05.html.en and, slowly, digging through http://hands.com/d-i/ . I can't quite wrap my head around the timing of some of these commands.
This one runs immediately before the partitioner starts:
preseed/early_command
This one just before the install finishes, but before /target is unmounted:
preseed/late_command
But when does this one run? And is /target assumed to be available?
preseed/include_command
...How about this one?
preseed/run
My goal is to fetch a custom script file from the preseed directory, and run it in a chroot within /target . This script sets up various things like changes to /etc/skel and so on, so should be run at the end. I currently do this via preseed/late_command like seen here, but this only works for network installs, and also needs tweaking when the config server's name changes. I'm trying to get a source-agnostic solution, something that will work with a network-based as well as a flash drive-based installer, so anything that relies on wget is right out.
Rant: The config commands are somewhat scattered throughout appendix B of the Debian installation guide, and that document appears to be incomplete. More of a tutorial than a reference. Is there a single resource that shows what all the d-i commands do? A comprehensive reference, or maybe a single source file?
Posted Sep 29, 2016, 3:32 AM UTC
Still trying to work out some details, but I've solved my initial problem.
In order to load a script from the preseed storage media (network or USB) and then run that script at the end, several things need to happen:
Prepare a dropper script, something that will deliver the final script I want to run at the end. I called it
hello-to-target.sh, it lives in the same directory as mypreseed.conffile, and it looks something like this:Run the dropper script in the tempfs that's running the installation. I'm not sure when this part runs, but it doesn't matter because it will deliver another script that does nothing until explicitly called at the end. I do this via:
Call the dropped script at the end of the installation:
Not exactly elegant, but it seems to get the job done.