]>
git.saurik.com Git - apt.git/blob - test/integration/test-apt-key
4 TESTDIR
=$(readlink -f $(dirname $0))
8 configarchitecture
'amd64'
10 # start from a clean plate again
12 rm -rf rootdir
/etc
/apt
/trusted.gpg.d
/ rootdir
/etc
/apt
/trusted.gpg
13 mkdir rootdir
/etc
/apt
/trusted.gpg.d
/
16 echo 'APT::Key::ArchiveKeyring "./keys/joesixpack.pub";
17 APT::Key::RemovedKeys "./keys/rexexpired.pub";' > rootdir
/etc
/apt
/apt.conf.d
/aptkey.conf
21 ln -sf ${TMPWORKINGDIRECTORY}/keys
/joesixpack.pub rootdir
/etc
/apt
/trusted.gpg.d
/joesixpack.gpg
23 msgtest
'Check that paths in list output are not' 'double-slashed'
24 aptkey list
2>&1 | grep -q '//' && msgfail
|| msgpass
26 msgtest
'Check that paths in finger output are not' 'double-slashed'
27 aptkey
finger 2>&1 | grep -q '//' && msgfail
|| msgpass
29 aptkey list
| grep '^pub' > aptkey.list
30 testfileequal .
/aptkey.list
'pub 2048R/DBAC8DAE 2010-08-18'
32 testequal
'gpg: key DBAC8DAE: "Joe Sixpack (APT Testcases Dummy) <joe@example.org>" not changed
33 gpg: Total number processed: 1
34 gpg: unchanged: 1' aptkey
--fakeroot update
36 aptkey list
| grep '^pub' > aptkey.list
37 testfileequal .
/aptkey.list
'pub 2048R/DBAC8DAE 2010-08-18'
39 testsuccess aptkey
--fakeroot add .
/keys
/rexexpired.pub
41 aptkey list
| grep '^pub' > aptkey.list
42 testfileequal .
/aptkey.list
'pub 2048R/27CE74F9 2013-07-12 [expired: 2013-07-13]
43 pub 2048R/DBAC8DAE 2010-08-18'
45 msgtest
'Check that Sixpack key can be' 'exported'
46 aptkey
export 'Sixpack' > aptkey.
export
47 aptkey
--keyring rootdir
/etc
/apt
/trusted.gpg.d
/joesixpack.gpg exportall
> aptkey.exportall
48 testsuccess
--nomsg cmp aptkey.
export aptkey.exportall
49 testsuccess
test -s aptkey.
export
50 testsuccess
test -s aptkey.exportall
52 msgtest
'Execute update again to trigger removal of' 'Rex Expired key'
53 testsuccess
--nomsg aptkey
--fakeroot update
55 aptkey list
| grep '^pub' > aptkey.list
56 testfileequal .
/aptkey.list
'pub 2048R/DBAC8DAE 2010-08-18'
58 msgtest
"Try to remove a key which exists, but isn't in the" 'forced keyring'
59 testsuccess
--nomsg aptkey
--fakeroot --keyring rootdir
/etc
/apt
/trusted.gpg del DBAC8DAE
61 aptkey list
| grep '^pub' > aptkey.list
62 testfileequal .
/aptkey.list
'pub 2048R/DBAC8DAE 2010-08-18'
64 testsuccess aptkey
--fakeroot del DBAC8DAE
67 msgtest
'Test key removal with' 'single key in real file'
69 cp -a keys
/joesixpack.pub rootdir
/etc
/apt
/trusted.gpg.d
/joesixpack.gpg
70 testsuccess
--nomsg aptkey
--fakeroot del DBAC8DAE
72 testsuccess
test ! -e rootdir
/etc
/apt
/trusted.gpg.d
/joesixpack.gpg
73 testsuccess
cmp keys
/joesixpack.pub rootdir
/etc
/apt
/trusted.gpg.d
/joesixpack.gpg~
75 msgtest
'Test key removal with' 'single key in softlink'
77 ln -s $(readlink -f ./keys/joesixpack.pub) rootdir
/etc
/apt
/trusted.gpg.d
/joesixpack.gpg
78 testsuccess
--nomsg aptkey
--fakeroot del DBAC8DAE
80 testsuccess
test ! -e rootdir
/etc
/apt
/trusted.gpg.d
/joesixpack.gpg
81 testsuccess
test -L rootdir
/etc
/apt
/trusted.gpg.d
/joesixpack.gpg~
84 testsuccess aptkey
--fakeroot add .
/keys
/joesixpack.pub
85 testsuccess aptkey
--fakeroot add .
/keys
/marvinparanoid.pub
86 aptkey list
| grep '^pub' > aptkey.list
87 testfileequal .
/aptkey.list
'pub 2048R/DBAC8DAE 2010-08-18
88 pub 2048R/528144E2 2011-01-16'
89 cp -a rootdir
/etc
/apt
/trusted.gpg keys
/testcase
-multikey.pub
# store for reuse
91 msgtest
'Test key removal with' 'multi key in real file'
93 cp -a keys
/testcase
-multikey.pub rootdir
/etc
/apt
/trusted.gpg.d
/multikey.gpg
94 testsuccess
--nomsg aptkey
--fakeroot del DBAC8DAE
95 aptkey list
| grep '^pub' > aptkey.list
96 testfileequal .
/aptkey.list
'pub 2048R/528144E2 2011-01-16'
97 testsuccess
cmp keys
/testcase
-multikey.pub rootdir
/etc
/apt
/trusted.gpg.d
/multikey.gpg~
99 msgtest
'Test key removal with' 'multi key in softlink'
101 ln -s $(readlink -f ./keys/testcase-multikey.pub) rootdir
/etc
/apt
/trusted.gpg.d
/multikey.gpg
102 testsuccess
--nomsg aptkey
--fakeroot del DBAC8DAE
103 aptkey list
| grep '^pub' > aptkey.list
104 testfileequal .
/aptkey.list
'pub 2048R/528144E2 2011-01-16'
105 testsuccess
cmp keys
/testcase
-multikey.pub rootdir
/etc
/apt
/trusted.gpg.d
/multikey.gpg~
106 testsuccess
test ! -L rootdir
/etc
/apt
/trusted.gpg.d
/multikey.gpg
107 testsuccess
test -L rootdir
/etc
/apt
/trusted.gpg.d
/multikey.gpg~
109 msgtest
'Test key removal with' 'multiple files including key'
111 cp -a keys
/joesixpack.pub rootdir
/etc
/apt
/trusted.gpg.d
/joesixpack.gpg
112 cp -a keys
/testcase
-multikey.pub rootdir
/etc
/apt
/trusted.gpg.d
/multikey.gpg
113 testsuccess
--nomsg aptkey
--fakeroot del DBAC8DAE
114 aptkey list
| grep '^pub' > aptkey.list
115 testfileequal .
/aptkey.list
'pub 2048R/528144E2 2011-01-16'
116 testsuccess
test ! -e rootdir
/etc
/apt
/trusted.gpg.d
/joesixpack.gpg
117 testsuccess
cmp keys
/joesixpack.pub rootdir
/etc
/apt
/trusted.gpg.d
/joesixpack.gpg~
118 testsuccess
cmp keys
/testcase
-multikey.pub rootdir
/etc
/apt
/trusted.gpg.d
/multikey.gpg~
122 echo "APT::Key::GPGCommand \"$1\";" > rootdir
/etc
/apt
/apt.conf.d
/00gpgcmd
123 msgtest
'Test that apt-key uses for the following tests command' "$1"
124 aptkey adv
--version >aptkey.version
2>&1
125 if grep -q "^Executing: $1 --" aptkey.version
; then
133 # run with default (whatever this is)
136 setupgpgcommand
'gpg'
138 setupgpgcommand
'gpg2'