]> git.saurik.com Git - apt.git/blame_incremental - test/integration/test-apt-extracttemplates
fix foldmarkers in fileutl.cc
[apt.git] / test / integration / test-apt-extracttemplates
... / ...
CommitLineData
1#!/bin/sh
2set -e
3
4TESTDIR=$(readlink -f $(dirname $0))
5. $TESTDIR/framework
6
7setupenvironment
8configarchitecture 'amd64'
9
10# apt-extracttemplates needs this
11insertinstalledpackage 'debconf' 'amd64' '1.5'
12insertinstalledpackage 'pkg-with-template' 'amd64' '1.0'
13
14# build a simple package that contains a config and a tempalte
15mkdir -p DEBIAN
16TEMPLATE_STR="Template: foo/bar
17Type: string
18Description: Some bar var
19"
20echo "$TEMPLATE_STR" > DEBIAN/templates
21
22CONFIG_STR="#!/bin/sh
23random shell stuff
24"
25echo "$CONFIG_STR" > DEBIAN/config
26
27buildsimplenativepackage 'pkg-with-template' 'amd64' '0.8.15' 'stable' '' 'pkg with template' '' '' './DEBIAN'
28
29# ensure we get the right stuff out of the file
30mkdir extracttemplates-out
31OUT="$(aptextracttemplates -t ./extracttemplates-out incoming/pkg-with-template*.deb)"
32
33PKG=$(printf "$OUT" | cut -f1 -d' ')
34INSTALLED_VER=$(printf "$OUT" | cut -f2 -d' ')
35TEMPLATE=$(printf "$OUT" | cut -f3 -d' ')
36CONFIG=$(printf "$OUT" | cut -f4 -d' ')
37
38testequal "$CONFIG_STR" cat $CONFIG
39testequal "$TEMPLATE_STR" cat $TEMPLATE
40
41# ensure that the format of the output string has the right number of dots
42for s in "$CONFIG" "$TEMPLATE"; do
43 NR_DOTS=$(basename "$s" | tr -c -d .)
44 testequal ".." echo $NR_DOTS
45done