This page will be updated once the simple upgrade case is nailed down

FIXME: define what is complex upgrade vs simple upgrade

FIXME: explain default value problem

Only customized values are dumped with -dump option:

$ config-edit-approx -dump
max_wait=12
distributions:debian=http://ftp.fr.debian.org/debian -

In old-prerm script, customized values can be saved as:

config-edit -model Approx -dump /var/lib/config-model/upgrade/etc/approx/approx.cds 

or ( /!\ still being discussed on debian-perl list)

config-edit -model Approx -save_for_upgrade

/!\ Actual config-edit command may change

and reloaded in postinst script with

   config-edit -model Approx -load /etc/approx/approx.cds -ui none

or ( /!\ still being discussed on debian-perl list)

config-edit -model Approx -upgrade

/!\ FIXME: how to use a helper script (dh_ like) that will help in setting up the instructions mentioned above in the package scripts.

Complex upgrade case may require to save config data before package upgrade in debian/approx.prerm script:

cds_file=/etc/approx/approx.cds
cfg_file=/etc/approx/approx.conf

case "$1" in
    remove)
       if [ -e $cds_file ] ; then
           rm -rf $cds_file ;
       fi
       ;;
    *)
       if [ -e $cfg_file ] ; then
           config-edit -model Approx -dump /etc/approx/approx.cds || true
       fi
       ;;
esac

In this case, saved data needs to be loaded in debian/approx.postinst :

if [ -e /etc/approx/approx.cds ] ; then
    config-edit -model Approx -load /etc/approx/approx.cds -ui none \
        && rm -f /etc/approx/approx.cds
fi

package upgrade

package downgrade

Mostly the same scenario as upgrade apply except:

package purge

Any leftover approx.cds is removed by prerm script

More complex upgrade cases

So far, we've reviewed the simple upgrade cases where no configuration changes were brought by package changes.

But, Config::Model can also handle more complex cases where:

{*} Reader, feel free to add your upgrade case {*}

These cases are not required for Approx model, but they will be for other packages.