[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: debconf and program generated config



Hi,

Am 2005-04-04 20:08:45, schrieb Justin Pryzby:

>   templates: defines the interactive prompts
>   config: this is a shell script which asks the questions defined by
>     templates.  It handles things like "if you answer yes to X, then
>     ask Y, but not if you answer no".  It exists such that the
>     package can be "preconfigured" (otherwise config would just be in
>     postinst).
>   postinst: this is run after a packages files have been extracted.
>     It should create any non-conffile configuration files.  It might
>     read in some values from debconf to do so.

OK

> >   __( '/home/michelle.konzack/src/tddyndns-0.9.0/debian/postinst' )_____
> >  /
> > | #!/bin/sh -e
> > | 
> > | tddyndns >/dev/null 2>&1
> This creates an initial config file?

If run as non debian package it output a message,
that the $ADMIN should edit the file /etc/tddyndns.

Because I like to use debconf I suppress the output of the program.

> And then you have to modify that file based on dd_email_{to,from} and
> dd_smtp_options?

yes

> Debconf is the thing that the config script does, and it is the thing
> from which the postinst script will retrieve the values which you will
> use to modify the configuration file (with sed, say).

I have copied the three files from "ssmtp" and modified it.
Sniplet:

  __( '/home/michelle.konzack/src/tddyndns-0.9.0/debian/templates' )____
 /
| Template: tddyndns/dd_email_to
| Type: string
| Default: root
| Description:The receiving E-Mail for the Notifications.
|  You can supply more then one, but seperate it with a comma.
| 
| Template: tddyndns/dd_email_from
| Type: string
| Default: root
| Description: Where the E-Mail seens to come from.
<snip>
 \______________________________________________________________________

  __( '/home/michelle.konzack/src/tddyndns-0.9.0/debian/config' )_______
 /
| #!/bin/sh -e
| 
| . /usr/share/debconf/confmodule
| 
| if [ -f /etc/tddyndns.conf ]
| then
|   for v in `grep -E "^(DD_EMAIL_TO|DD_EMAIL_FROM|DD_SMTP_OPTIONS|IP_SE
| RVER|DD_ROUTER|DD_ROUTER_USER|DD_ROUTER_PASS|DD_ROUTER_IP|DD_USER|DD_P
| ASS|DD_HOST|DD_SYSTEM|DD_WILDCARD|DD_MYIP|DD_OFFLINE|DD_MX|DD_BACKMX)=
| " /etc/tddyndns.conf`
|   do
|     export $v
|   done
|   db_set tddyndns/dd_email_to     "$DD_EMAIL_TO"
|   db_set tddyndns/dd_email_from   "$DD_EMAIL_FROM"
|   db_set tddyndns/dd_smtp_options "$DD_SMTP_OPTIONS"
|   db_set tddyndns/ip_server       "$IP_SERVER"
<snip>
| fi
| 
| db_input medium tddyndns/dd_email_to     || true
| db_go
| db_input medium tddyndns/dd_email_from   || true
| db_go
| db_input medium tddyndns/dd_smtp_options || true
<snip>
| # Program End
| exit 0
 \______________________________________________________________________


So, because "config" read first the /etc/tddyndns.conf
it use the given values as default ?

Now I hope, all is correct...

> Justin

Greetings
Michelle

-- 
Linux-User #280138 with the Linux Counter, http://counter.li.org/ 
Michelle Konzack   Apt. 917                  ICQ #328449886
                   50, rue de Soultz         MSM LinuxMichi
0033/3/88452356    67100 Strasbourg/France   IRC #Debian (irc.icq.com)

Attachment: signature.pgp
Description: Digital signature


Reply to: