Showing message to the user during a Debian unattended preseeded installation
You will be pretty limited by debconf
and it may not be worth the effort. I don't think you'll be able to do it at all with a script run in-target
. I did have success using the following preseed snippet and script with Debian Buster. It changes the text where Running Preseed...
is displayed three times. It will show
Step A
Step B
-
Running c...
(the "fallback" option)
Partial preseed file to download and run a script.
d-i preseed/late_command string \
wget -P /run http://REDACTED/my_script.sh ; \
chmod 755 /run/my_script.sh ; \
/run/my_script.sh
Contents of my_script.sh
.
#!/bin/sh
. /usr/share/debconf/confmodule
set -e
# create a templates file with the strings for debconf to display
cat > /run/my_script.templates << 'EOF'
Template: my_script/progress/a
Type: text
Description: Step A
Template: my_script/progress/b
Type: text
Description: Step B
Template: my_script/progress/fallback
Type: text
Description: Running ${STEP}...
EOF
# use the utility to load the generated template file
debconf-loadtemplate my_script /run/my_script.templates
# pause just to show "Running Preseed..."
sleep 2
# foreach 3 steps tell debconf which template string to display
for step in a b c; do
if ! db_progress INFO my_script/progress/$step; then
db_subst my_script/progress/fallback STEP "$step"
db_progress INFO my_script/progress/fallback
fi
case $step in
"a")
# run commands or scripts in the installer environment (this uses the sleep command in the installer environment)
sleep 10
;;
"b")
# run commands or scripts in the chroot environment (this uses the sleep command from the installed system)
in-target sleep 10
;;
"c")
# just another sample step
sleep 10
;;
esac
done
The script and the templates file generated are based on the finish-install
(debian-installer
package) script and templates.