Ubuntu Preseed and Templating

723 views Asked by At

I'm loading and executing this bash file from my preseed file on Ubuntu 18.04.1. The install works perfectly and my bash file is downloaded and executes but with errors.

Error message: "activation/ask does not exist". I tried troubleshooting this and reading the debconf dev configuration but can't really identify what I'm doing wrong. Any ideas? Thanks

EDIT: If i go to shell during installation and wget, chmod this post.sh script, everything works just fine. Any ideas?

#!/bin/sh

# Library to interact with debconf.
. /usr/share/debconf/confmodule

# Create the template file
cat > /tmp/activate.template <<EOL
Template: activation/title
Type: text
Description: Activate

Template: activation/ask
Type: string
Description: Enter Activation Code
EOL

# Load your template
debconf-loadtemplate activation /tmp/activate.template

# Set title for dialogue box
db_settitle activation/title

# Input activation code
db_input critical activation/ask
db_go

# Fetch input from user
db_get activation/ask

# Save it to a file
echo "$RET" > /root/answer.value

#Error message: activation/ask does not exist

The templates are renamed, so don't worry about the mismatch there. Thanks

error

1

There are 1 answers

0
user3323307 On

This had to do with how the script was executed.

d-i preseed/late_command string \
in-target /usr/bin/wget -O /root/post.sh http://<ip>/preseed/post.sh; \
in-target /bin/chmod +x /root/post.sh; \
in-target /bin/bash /root/post.sh