Le lundi 20 décembre 2010 à 18:26 +0100, Ludovico Cavedon a écrit :

> But now I have a question without answer: if
> -the question about the password was never asked, and
> -there is no way to ask the user (e.g. running non-interactive)
> should the postinst phase:
> -fail, or
> -set a randomly generated password?
> 
> I am going for the second one. Thoughts?
> 
> Thanks,
> Ludovico
> 

I came up with, ie let it fail but only if the password is not already
in the database and has not changed:
set_password() {
    while true; do
        db_input high ntop/admin_password || true
        db_go
        db_get ntop/admin_password

        if [ -z "$RET" ]; then
            db_input critical ntop/password_empty
            db_go
        else
            curpass=$RET
            db_get ntop/admin_password_again
            againpass=$RET

            if [ "$curpass" != "$againpass" ]; then
              db_input critical ntop/admin_password_again
              db_go
              db_get ntop/admin_password_again
              againpass=$RET
            fi
            break
        fi
    done
}



Also:

Preconfiguring packages ...
/tmp/ntop.config.191211: line 98: ntop: command not found
ntop failed to preconfigure, with exit status 127



It looks like the binary path should be included too (this is from a
purge then reinstall test of the previous issue).
ie:

if ! [ -f /var/lib/ntop/ntop_pw.db ]; then
    while true; do
        set_password
        if [ "$curpass" != "$againpass" ]; then
            db_input critical ntop/password_mismatch
            db_go
        else
            /usr/sbin/ntop --set-admin-password="$curpass"
            break
        fi
    done








-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to