]> git.saurik.com Git - apt.git/blame - test/integration/test-apt-key
Fix conffile prompt regression (LP: #1260297)
[apt.git] / test / integration / test-apt-key
CommitLineData
80f3aeb0
DK
1#!/bin/sh
2set -e
3
4TESTDIR=$(readlink -f $(dirname $0))
5. $TESTDIR/framework
6
7setupenvironment
8configarchitecture 'amd64'
9
10msgtest 'Check that paths in list output are not' 'double-slashed'
11aptkey list 2>&1 | grep -q '//' && msgfail || msgpass
12
13msgtest 'Check that paths in finger output are not' 'double-slashed'
14aptkey finger 2>&1 | grep -q '//' && msgfail || msgpass
15
16echo 'APT::Key::ArchiveKeyring "./keys/joesixpack.pub";
17APT::Key::RemovedKeys "./keys/rexexpired.pub";' > rootdir/etc/apt/apt.conf.d/aptkey.conf
18
19aptkey list | grep '^pub' > aptkey.list
20testfileequal ./aptkey.list 'pub 2048R/DBAC8DAE 2010-08-18'
21
22testequal 'gpg: key DBAC8DAE: "Joe Sixpack (APT Testcases Dummy) <joe@example.org>" not changed
23gpg: Total number processed: 1
24gpg: unchanged: 1' aptkey --fakeroot update
25
26aptkey list | grep '^pub' > aptkey.list
27testfileequal ./aptkey.list 'pub 2048R/DBAC8DAE 2010-08-18'
28
29testsuccess aptkey --fakeroot add ./keys/rexexpired.pub
30
31aptkey list | grep '^pub' > aptkey.list
32testfileequal ./aptkey.list 'pub 2048R/27CE74F9 2013-07-12 [expired: 2013-07-13]
33pub 2048R/DBAC8DAE 2010-08-18'
34
35msgtest 'Execute update again to trigger removal of' 'Rex Expired key'
36testsuccess --nomsg aptkey --fakeroot update
37
38aptkey list | grep '^pub' > aptkey.list
39testfileequal ./aptkey.list 'pub 2048R/DBAC8DAE 2010-08-18'
04937adc
DK
40
41msgtest "Try to remove a key which exists, but isn't in the" 'forced keyring'
42testsuccess --nomsg aptkey --fakeroot --keyring rootdir/etc/apt/trusted.gpg del DBAC8DAE
43
44aptkey list | grep '^pub' > aptkey.list
45testfileequal ./aptkey.list 'pub 2048R/DBAC8DAE 2010-08-18'
46
47testsuccess aptkey --fakeroot del DBAC8DAE
48testempty aptkey list
49
50# start from a clean plate again
51cleanplate() {
52 rm -rf rootdir/etc/apt/trusted.gpg.d/ rootdir/etc/apt/trusted.gpg
53 mkdir rootdir/etc/apt/trusted.gpg.d/
54}
55
56msgtest 'Test key removal with' 'single key in real file'
57cleanplate
58cp -a keys/joesixpack.pub rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg
59testsuccess --nomsg aptkey --fakeroot del DBAC8DAE
60testempty aptkey list
61testsuccess test ! -e rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg
62testsuccess cmp keys/joesixpack.pub rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg~
63
64msgtest 'Test key removal with' 'single key in softlink'
65cleanplate
66ln -s $(readlink -f ./keys/joesixpack.pub) rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg
67testsuccess --nomsg aptkey --fakeroot del DBAC8DAE
68testempty aptkey list
69testsuccess test ! -e rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg
70testsuccess test -L rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg~
71
72cleanplate
73testsuccess aptkey --fakeroot add ./keys/joesixpack.pub
74testsuccess aptkey --fakeroot add ./keys/marvinparanoid.pub
75aptkey list | grep '^pub' > aptkey.list
76testfileequal ./aptkey.list 'pub 2048R/DBAC8DAE 2010-08-18
77pub 2048R/528144E2 2011-01-16'
78cp -a rootdir/etc/apt/trusted.gpg keys/testcase-multikey.pub # store for reuse
79
80msgtest 'Test key removal with' 'multi key in real file'
81cleanplate
82cp -a keys/testcase-multikey.pub rootdir/etc/apt/trusted.gpg.d/multikey.gpg
83testsuccess --nomsg aptkey --fakeroot del DBAC8DAE
84aptkey list | grep '^pub' > aptkey.list
85testfileequal ./aptkey.list 'pub 2048R/528144E2 2011-01-16'
86testsuccess cmp keys/testcase-multikey.pub rootdir/etc/apt/trusted.gpg.d/multikey.gpg~
87
88msgtest 'Test key removal with' 'multi key in softlink'
89cleanplate
90ln -s $(readlink -f ./keys/testcase-multikey.pub) rootdir/etc/apt/trusted.gpg.d/multikey.gpg
91testsuccess --nomsg aptkey --fakeroot del DBAC8DAE
92aptkey list | grep '^pub' > aptkey.list
93testfileequal ./aptkey.list 'pub 2048R/528144E2 2011-01-16'
94testsuccess cmp keys/testcase-multikey.pub rootdir/etc/apt/trusted.gpg.d/multikey.gpg~
95testsuccess test ! -L rootdir/etc/apt/trusted.gpg.d/multikey.gpg
96testsuccess test -L rootdir/etc/apt/trusted.gpg.d/multikey.gpg~
97
98msgtest 'Test key removal with' 'multiple files including key'
99cleanplate
100cp -a keys/joesixpack.pub rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg
101cp -a keys/testcase-multikey.pub rootdir/etc/apt/trusted.gpg.d/multikey.gpg
102testsuccess --nomsg aptkey --fakeroot del DBAC8DAE
103aptkey list | grep '^pub' > aptkey.list
104testfileequal ./aptkey.list 'pub 2048R/528144E2 2011-01-16'
105testsuccess test ! -e rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg
106testsuccess cmp keys/joesixpack.pub rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg~
107testsuccess cmp keys/testcase-multikey.pub rootdir/etc/apt/trusted.gpg.d/multikey.gpg~