#!/bin/sh -e PROG=freeb CFG=/etc/${PROG}.conf PKG=${PROG} # DEBCONF_DEBUG=developer FreeBGetOption() { sed -e "s/[#;].*//" \ -e "/^[[:space:]]*$/d" ${CFG} | \ perl -ne "\$flag=0; do { if ( \$flag==1 && /$2\s+=\s+(\S+)/ ) { print \$1; exit; } ; if ( /$1/ ) { \$flag=1; } } while ( <> ) ; " } . /usr/share/debconf/confmodule db_version 2.0 if [ -e ${CFG} ]; then # if config file exists, read values and set debconf database accordingly # to keep user defined values ClientURL=`FreeBGetOption client url` [ -s ${ClientURL} ] && db_set ${PKG}/clienturl $ClientURL ClientUsername=`FreeBGetOption client username` [ -s ${ClientUsername} ] && db_set ${PKG}/clientusername $ClientUsername ClientPassword=`FreeBGetOption client password` [ -s ${ClientPassword} ] && db_set ${PKG}/clientpassword $ClientPassword MCSIUsername=`FreeBGetOption mcsi username` [ -s ${MCSIUsername} ] && db_set ${PKG}/mcsiusername $MCSIUsername MCSIPassword=`FreeBGetOption mcsi password` [ -s ${MCSIPassword} ] && db_set ${PKG}/mcsipassword $MCSIPassword # debug ... should be removed because echo is broken in debconf scripts !!! #echo "ClientURL = $ClientURL" > /tmp/${PROG}.conf.debug #echo "ClientUsername = $ClientUsername" >> /tmp/${PROG}.conf.debug #echo "ClientPassword = $ClientPassword" >> /tmp/${PROG}.conf.debug #echo "MCSIUsername = $MCSIUsername" >> /tmp/${PROG}.conf.debug #echo "MCSIPassword = $MCSIPassword" >> /tmp/${PROG}.conf.debug fi db_input medium ${PKG}/clienturl || true db_input medium ${PKG}/clientusername || true db_input medium ${PKG}/clientpassword || true db_input medium ${PKG}/mcsiusername || true db_input medium ${PKG}/mcsipassword || true db_go || true