Paul Slootman <[EMAIL PROTECTED]> wrote:

>> > I'm talking about the case where you just entered a value,
>> > interactively.
>> 
>> But I may have changed my mind, and i shouldn't be forced to use debconf
>> then.  No, I *mustn't* be forced.
>
> I'm talking about someone who wants to use debconf...

I'm talking about the freedom to switch from and to debconf as I like,
or to not switch and stick to always using it (or never using it).  Just
as it was designed.

> He chose at one time to have the fetching active, removed the cron.d
> script later, and then changed his mind again, and thinks he can
> reactivate it via debconf.

He can if it's coded properly.

> I read your bug report to mean that if the user removes the file,
> postinst should never, ever recreate it again, because that's what the
> user wants, otherwise he wouldn't have removed the file. 

Sorry if I was too short.  I never wanted to say that.

> And that's what I have a problem with,

Fine, so we don't have a problem with each other's goals :-)

> dpkg-reconfigure again and enters a fetch frequency, "I" (the postinst
> script) wouldn't be allowed to create the file again. Your exact words
> were "and indeed the postinst scripts recreates the file if it has been
> deleted.", indicating that was the problem. You didn't qualify that
> statement with "unconditionally" or so...

Sorry for that, I was just too short and assumed you'd figure out
yourself what I meant, which isn't a proper way to report a bug...

>> Is the new maintainer script available somewhere?
>
> Not yet.

So does it make sense that I start of with the old ones?  I guess I need
config, postinst and maybe the templates file.

Here's a quick shot, untested:

In wwwoffle.config:

if [ -s /etc/cron.d/wwwoffle ]; then
  ... as before ...
elif [ -n "$CONFIG_ARG2" ]; # do this only when this is not a fresh install
   db_set wwwoffle/fetchfrequency off
fi

db_get wwwoffle/fetchfrequency   ###########################################
rc=$?
- if [ $rc -eq 0 -o $rc -ge 30 ]; then # bashism, and won't catch "off"
+ if [ $rc = off ] || [ $rc -eq 0 ] || [ $rc -ge 30 ]; then
    FREQ="$RET"
    if [ "$FREQ" != off ]; then
        # convert to digits only
        FREQ=$( expr "$FREQ" : '\([0-9]*\)' )
        if [ -z "$FREQ" ]
            then FREQ=off
        elif [ "$FREQ" = 0 ]
            then FREQ=off
        fi
    fi
    if [ "$FREQ" = off ]; then
        if [ -s $CRONTAB ]; then
            # replace only first occurrence of wwwoffle.cron-fetch line
            perl -i.bak -pe 
'unless($done==1){if(s,^(\s*#\s*)*([^#]*wwwoffle.cron-fetch),# $2,){$done=1;}}' 
$CRONTAB
        else
-             ( echo "# min hr dom mon dow"
-               echo "# If you want to disable this, comment out the line"
-               echo "# below (don't simply remove this file)."
-               echo "# */30 * * * * proxy [ -x 
/etc/wwwoffle/wwwoffle.cron-fetch ] && /etc/wwwoffle/wwwoffle.cron-fetch"
-             ) > /etc/cron.d/wwwoffle
-         fi
+ :
    else

But I don't understand the purpose of the first test where I fixed the
bashism - why do you only act on the crontab file if the value is zero
or if it is at least 30?  That means that I can't set it to 20 via
debconf, doesn't it?

Regards, Frank
-- 
Frank Küster
Single Molecule Spectroscopy, Protein Folding @ Inst. f. Biochemie, Univ. Zürich
Debian Developer (teTeX)


Reply via email to