File: test

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 (31 lines) | stat: -rwxr-xr-x 778 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
#!/bin/sh

set -e

# Test rename example from examples/README.md

conffile=/tmp/test.conf
new_conffile=/tmp/test2.conf
DPKG_MAINTSCRIPT_PACKAGE=test-package

## Initial setup
${UCF_TEST_BINDIR}ucf input.conf $conffile 2>&1
${UCF_TEST_BINDIR}ucfr $DPKG_MAINTSCRIPT_PACKAGE $conffile

## examples/README.md
# Rename, if it exists
[ -f $conffile ] && cp $conffile $new_conffile

${UCF_TEST_BINDIR}ucf input.conf $new_conffile 2>&1
${UCF_TEST_BINDIR}ucfr $DPKG_MAINTSCRIPT_PACKAGE $new_conffile

if [ -f $conffile ]; then
    rm $conffile
else
    # The old conffile had already been deleted, do the same for the new one.
    rm $new_conffile
fi

# Purge from ucf state.
${UCF_TEST_BINDIR}ucf --purge $conffile && ${UCF_TEST_BINDIR}ucfr --purge $DPKG_MAINTSCRIPT_PACKAGE $conffile