#!/bin/sh set -e # Some ideas stolen from the cvs package # Config script for geneweb using debconf . /usr/share/debconf/confmodule db_version 2.0 || [ $? -lt 30 ] # These will be used here and there below INITFILE=/etc/init.d/gwsetup DEFAULTPORT=2316 DEFAULTRUNMODE="Always on" RCFILE=/etc/default/gwsetup read_rcfile() { # Default values if [ -f $RCFILE ]; then PORT=$DEFAULTPORT RUN_MODE="$DEFAULTRUNMODE" . $RCFILE || true fi } set_debconf() { if [ "$RUN_MODE" ]; then db_set geneweb/run_mode "$RUN_MODE" || true fi if [ "$PORT" ]; then db_set geneweb/port "$PORT" || true fi } get_debconf() { db_get gwsetup/port PORT=$RET db_get gwsetup/run_mode RUN_MODE="$RET" } input_settings() { db_input low gwsetup/run_mode || true db_go db_get gwsetup/run_mode RUN_MODE=$RET # If not present, use default if [ -z "$RUN_MODE" ] then RUN_MODE="$DEFAULTRUNMODE" fi if [ "$RUN_MODE" = "Always on" ] then # These question will be asked only when running in daemon mode db_input low gwsetup/port || true db_go fi } ## Main program # We first read the settings file # in order to get admin-modified settings read_rcfile # Debconf-stored values are updated accordingly set_debconf # They are re-read from Debconf get_debconf # In case the package has never been configured, the settings # are asked through debconf input_settings # They are re-re-read from debconf get_debconf