#!/bin/bash -e CONFFILE_NEW=/etc/dibbler/client.conf-dpkg-new CONFFILE=/etc/dibbler/client.conf PATH=$PATH:. if [ -e confmodule ]; then . confmodule else . /usr/share/debconf/confmodule fi case "$1" in configure) # continue below ;; abort-upgrade|abort-remove|abort-deconfigure) exit 0 ;; *) echo "postinst called with unknown argument \`$1'" >&2 exit 0 ;; esac if [ -e ${CONFFILE_NEW} ]; then rm ${CONFFILE_NEW} fi db_version 2.0 #db_capb backup db_settitle dibbler-client/title # Step 1: Do you want dibbler-client to be started? db_get dibbler-client/start START="$RET" # Step 2: What interfaces should be configured? db_get dibbler-client/interfaces IFACES="$RET" # Step 3: What addtional options you you want to get? db_get dibbler-client/options OPTS="$RET" [ -r "${CONFFILE}" ] || { echo Generating ${CONFFILE_NEW}... >&2 cat >${CONFFILE_NEW} <<'EOFMAGIC' # Defaults for dibbler-client. # installed at /etc/dibbler/client.conf by the maintainer scripts # 8 (Debug) is most verbose. 7 (Info) is usually the best option log-level 7 # To perform stateless (i.e. options only) configuration, uncomment # this line below and remove any "ia" keywords from interface definitions # stateless EOFMAGIC } for i in ${IFACES}; do echo "iface $i {" >> ${CONFFILE_NEW} echo "# ask for address" >> ${CONFFILE_NEW} echo " ia" >> ${CONFFILE_NEW} echo "" >> ${CONFFILE_NEW} # insert options echo "# ask for options" >> ${CONFFILE_NEW} for j in ${OPTS}; do j=${j%,} if [ $j == "dns" ]; then echo " option dns-server" >> ${CONFFILE_NEW} else echo "# option dns-server" >> ${CONFFILE_NEW} fi if [ $j == "domain" ]; then echo " option domain" >> ${CONFFILE_NEW} else echo "# option domain" >> ${CONFFILE_NEW} fi done echo "# option ntp-server" >> ${CONFFILE_NEW} echo "# option time-zone" >> ${CONFFILE_NEW} echo "# option sip-server" >> ${CONFFILE_NEW} echo "# option sip-domain" >> ${CONFFILE_NEW} echo "# option nis-server" >> ${CONFFILE_NEW} echo "# option nis-domain" >> ${CONFFILE_NEW} echo "# option nis+-server" >> ${CONFFILE_NEW} echo "# option nis+-domain" >> ${CONFFILE_NEW} echo "}" >> ${CONFFILE_NEW} echo "" >> ${CONFFILE_NEW} done # register this config test -x /usr/bin/ucf && ucf --debconf-ok ${CONFFILE_NEW} ${CONFFILE} db_stop # Start service if necessary if [ $START == "true" ]; then # Automatically added by dh_installinit/13.2.1 if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then if [ -x "/etc/init.d/dibbler-client" ]; then update-rc.d dibbler-client defaults >/dev/null if [ -n "$2" ]; then _dh_action=restart else _dh_action=start fi invoke-rc.d dibbler-client $_dh_action || exit 1 fi fi # End automatically added section fi