Originally Posted by
McJuicy
Now if I could only construct these question templates dynamically...
Figured it out. Put a substitution variable into the templates file ("choices" below):
Code:
Template: pkg/interfaces
Type: select
Choices: ${choices}
Description: .....
And in the config file use the db_subst to fill in the choices variable:
Code:
declare -a options;
count=0;
## Get interfaces from the operating system
for interface in $(ip link show | awk '/^[0-9]/ {print $2;} ' | sed 's/:$//');
do
if [ $interface != "lo" ] && [ $interface != "" ] ;
then
options[$count]=$interface;
count=$((count+1));
fi
done
# Set the choices the user has
db_subst pkg/outface choices $options
Bookmarks