File: README.md

package info (click to toggle)
ucf 3.0052
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,204 kB
  • sloc: sh: 1,384; perl: 397; makefile: 31
file content (49 lines) | stat: -rw-r--r-- 1,526 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
Basic usage examples
====================

This directory contains basic examples of *ucf*(1) usage.

Automatic generation of the necessary fragments for common cases can also be
achieved with *dh_ucf*(1) from *debhelper*(7).

Further examples
================

Remove a ucf controlled conffile during package upgrade
---------------------------------------------------------

    conffile=<Destination>
    IFS=: read -r cf pkg exists modified <<EOF
    $(ucfq -w $conffile)
    EOF
    # Sanity checks
    [ "$cf" = "$conffile" ] || error_exit # Bad, should never happen
    [ "$pkg" = "$DPKG_MAINTSCRIPT_PACKAGE" ] || return # Not our conffile
    # Remove $conffile if it exists and is unmodified.
    if [ "$exists" = Yes ] && [ "$modified" = No ]; then
        rm $conffile
    fi
    # Purge from ucf state.
    ucf --purge $conffile && ucfr --purge $DPKG_MAINTSCRIPT_PACKAGE $conffile


Rename a ucf controlled conffile during package upgrade
-------------------------------------------------------

    conffile=<Old>
    new_conffile=<New>
    # Copy if it exists
    [ -f $conffile ] && cp $conffile $new_conffile
    # Register new
    ucf input.conf $new_conffile
    ucfr $DPKG_MAINTSCRIPT_PACKAGE $new_conffile
    # Removals
    if [ -f $conffile ]; then
        rm $conffile
    else
        # The old conffile had been deleted, so
        # do the same for the new one.
        rm $new_conffile
    fi
    # Purge from ucf state.
    ucf --purge $conffile && ucfr --purge $DPKG_MAINTSCRIPT_PACKAGE $conffile