4 TESTDIR
=$
(readlink
-f $
(dirname $0))
8 configarchitecture
'amd64'
10 # apt-extracttemplates needs this
11 insertinstalledpackage
'debconf' 'amd64' '1.5'
12 insertinstalledpackage
'pkg-with-template' 'amd64' '1.0'
14 # build a simple package that contains a config and a tempalte
16 TEMPLATE_STR
="Template: foo/bar
18 Description: Some bar var
20 echo "$TEMPLATE_STR" > DEBIAN
/templates
25 echo "$CONFIG_STR" > DEBIAN
/config
27 buildsimplenativepackage
'pkg-with-template' 'amd64' '0.8.15' 'stable' '' 'pkg with template' '' '' './DEBIAN'
29 # ensure we get the right stuff out of the file
30 mkdir extracttemplates-out
31 OUT
="$(aptextracttemplates -t ./extracttemplates-out incoming/pkg-with-template*.deb)"
33 PKG
=$
(printf "$OUT" | cut
-f1 -d' ')
34 INSTALLED_VER
=$
(printf "$OUT" | cut
-f2 -d' ')
35 TEMPLATE
=$
(printf "$OUT" | cut
-f3 -d' ')
36 CONFIG
=$
(printf "$OUT" | cut
-f4 -d' ')
38 testequal
"$CONFIG_STR" cat $CONFIG
39 testequal
"$TEMPLATE_STR" cat $TEMPLATE
41 # ensure that the format of the output string has the right number of dots
42 for s
in "$CONFIG" "$TEMPLATE"; do
43 NR_DOTS
=$
(basename "$s" |
tr -c -d .
)
44 testequal
".." echo $NR_DOTS