Results 1 to 5 of 5

Thread: Resetting debconf values bash

  1. #1
    Join Date
    Aug 2006
    Beans
    6

    Resetting debconf values bash

    So I've had a bit of success creating a .deb file and the installation going correctly the first time. I'd like users to be able to reinstall / reconfigure the package with different values, but it seems that debconf is keeping the values stored in the database.

    What command do I use in bash to reset these values so I can reprompt the user ? I've tried db_reset and db_purge to no avail. Thanks for the help in advance

  2. #2
    Join Date
    Jun 2007
    Beans
    17,337

    Re: Resetting debconf values bash

    sudo dpkg-reconfigure package
    ck. man dpkg-reconfigure for more info

  3. #3
    Join Date
    Aug 2006
    Beans
    6

    Re: Resetting debconf values bash

    Maybe this will help clarify. Here is an excerpt of the script I'm using

    Code:
    # I'd like to reset the value in the db here if possible before I get the value
    db_get interface/outface
    OUT_FACE=$RET
    So what happens is that when someone re-runs the install script, it will default to the value they provided as a string the previous time. How can I clear this value?

    Also, is there a way to dynamically build questions based on the system in debconf? I wan't to prompt the user about the interfaces they are using instead of asking them to input the string of the interface they're using, but I cannot seem to find a way to do this.
    Last edited by McJuicy; August 16th, 2015 at 02:05 AM. Reason: Hid the package name I'm working on.

  4. #4
    Join Date
    Aug 2006
    Beans
    6

    Re: Resetting debconf values bash

    So I had some dice on the command line when I "fset" the seen flag to false. Seems to work using the old value as the default value:

    Code:
    # outface
    db_fset pkg/outface seen false
    db_input high pkg/outface || true
    db_go
    
    # inface
    db_fset pkg/inface seen false
    db_input high pkg/inface || true
    db_go
    Now if I could only construct these question templates dynamically...

  5. #5
    Join Date
    Feb 2006
    Location
    Santa Cruz, CA
    Beans
    107
    Distro
    Ubuntu

    Re: Resetting debconf values bash

    Quote Originally Posted by McJuicy View Post
    Now if I could only construct these question templates dynamically...
    Figured it out. Put a substitution variable into the templates file ("choices" below):

    Code:
    Template: pkg/interfaces
    Type: select
    Choices: ${choices}
    Description: .....
    And in the config file use the db_subst to fill in the choices variable:
    Code:
    declare -a options;
    count=0;
    
    ## Get interfaces from the operating system
    for interface in $(ip link show | awk '/^[0-9]/ {print $2;} ' | sed 's/:$//');
    do
        if [ $interface != "lo" ] && [ $interface != "" ] ;
        then
            options[$count]=$interface;
            count=$((count+1));
        fi
    done
    
    # Set the choices the user has
    db_subst pkg/outface choices $options
    And everyone thought I was crazy because all I wanted was noodles noodles noodles noodles noodles noodles noodles noodles...

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •