debconf and DTC

genfiles/change_debconf_ip.sh

#!/bin/sh -e

# Source debconf library.
. /usr/share/debconf/confmodule

db_go

# Check their answer.
db_get dtc/conf_ipaddr
conf_ipaddr=$RET
echo "IP was set as $conf_ipaddr"

if [ $# -lt 1 ]; then
echo "Usage: $0 <new IP>"
exit
fi
echo "We want the IP to be $1"

db_set dtc/conf_ipaddr $1
# Check their answer.
db_get dtc/conf_ipaddr
conf_ipaddr=$RET
echo "IP is now set as $conf_ipaddr"

Usage:
to get current IP addr:

/usr/share/dtc/admin/genfiles/change_debconf_ip.sh

to set new IP addr:
/usr/share/dtc/admin/genfiles/change_debconf_ip.sh <new IP>
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License