During the late_command
step of an unattended installation, I'm running a shell script :
d-i preseed/late_command string in-target /bin/sh -c './execute-script.sh'
When the late_command step is reached, the UI (blue background, grey window) displays a "Running preseed..." message :
I'm wondering if there is any way to lively displaying other messages based on what the execute-script.sh
is doing.
I naively thought that using the regular STDOUT with echoes would do the trick but it seems more complicated.
My searches so far brought to my attention a potential use of debconf
but I haven't been able to find any way.
Current version of my script reshaped according to @Andrew answer :
#!/bin/sh
. /usr/share/debconf/confmodule
. "./variables.sh"
logFile="/target${INSTALLATION_LOG_LOCATION}"
templatePath="/target/tmp/deployment_progress_tracker.templates"
cat > "${templatePath}" << 'EOF'
Template: deployment_progress_tracker/progress/fallback
Type: text
Description: ${STEP}...
EOF
debconf-loadtemplate deployment_progress_tracker "${templatePath}"
db_progress START 0 1 deployment_progress_tracker/progress
watchLogs () {
deploymentDone=false
while ! $deploymentDone
do
if [ -f "${logFile}" ]; then
step=$(grep -E -o -a -h "Progress-step: .*" "${logFile}" | tail -1 | sed 's/Progress-step: //')
if [ -z "${step##*$DEPLOYMENT_FINISHED*}" ]; then
deploymentDone=true
elif [ -n "${step}" ]; then
db_subst deployment_progress_tracker/progress/fallback STEP "${step}"
db_progress INFO deployment_progress_tracker/progress/fallback
fi
fi
sleep 3
done
}
(
watchLogs;
rm -f "${templatePath}";
db_progress SET 1;
sleep 1;
db_progress STOP;
db_unregister deployment_progress_tracker/progress;
) &
The previous script will result in the following :
And leads back to the installer menu (choosing Finish the installation will actually run again the preseeded part and fail, choosing Abort will not unmount the ISO and reboot, anyways, I'm trying to have both the unmounting and the reboot automically done) :