]>
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
'Execute update again to trigger removal of' 'Rex Expired key'
46 testsuccess
--nomsg aptkey
--fakeroot update
48 aptkey list
| grep '^pub' > aptkey.list
49 testfileequal .
/aptkey.list
'pub 2048R/DBAC8DAE 2010-08-18'
51 msgtest
"Try to remove a key which exists, but isn't in the" 'forced keyring'
52 testsuccess
--nomsg aptkey
--fakeroot --keyring rootdir
/etc
/apt
/trusted.gpg del DBAC8DAE
54 aptkey list
| grep '^pub' > aptkey.list
55 testfileequal .
/aptkey.list
'pub 2048R/DBAC8DAE 2010-08-18'
57 testsuccess aptkey
--fakeroot del DBAC8DAE
60 msgtest
'Test key removal with' 'single key in real file'
62 cp -a keys
/joesixpack.pub rootdir
/etc
/apt
/trusted.gpg.d
/joesixpack.gpg
63 testsuccess
--nomsg aptkey
--fakeroot del DBAC8DAE
65 testsuccess
test ! -e rootdir
/etc
/apt
/trusted.gpg.d
/joesixpack.gpg
66 testsuccess
cmp keys
/joesixpack.pub rootdir
/etc
/apt
/trusted.gpg.d
/joesixpack.gpg~
68 msgtest
'Test key removal with' 'single key in softlink'
70 ln -s $(readlink -f ./keys/joesixpack.pub) rootdir
/etc
/apt
/trusted.gpg.d
/joesixpack.gpg
71 testsuccess
--nomsg aptkey
--fakeroot del DBAC8DAE
73 testsuccess
test ! -e rootdir
/etc
/apt
/trusted.gpg.d
/joesixpack.gpg
74 testsuccess
test -L rootdir
/etc
/apt
/trusted.gpg.d
/joesixpack.gpg~
77 testsuccess aptkey
--fakeroot add .
/keys
/joesixpack.pub
78 testsuccess aptkey
--fakeroot add .
/keys
/marvinparanoid.pub
79 aptkey list
| grep '^pub' > aptkey.list
80 testfileequal .
/aptkey.list
'pub 2048R/DBAC8DAE 2010-08-18
81 pub 2048R/528144E2 2011-01-16'
82 cp -a rootdir
/etc
/apt
/trusted.gpg keys
/testcase
-multikey.pub
# store for reuse
84 msgtest
'Test key removal with' 'multi key in real file'
86 cp -a keys
/testcase
-multikey.pub rootdir
/etc
/apt
/trusted.gpg.d
/multikey.gpg
87 testsuccess
--nomsg aptkey
--fakeroot del DBAC8DAE
88 aptkey list
| grep '^pub' > aptkey.list
89 testfileequal .
/aptkey.list
'pub 2048R/528144E2 2011-01-16'
90 testsuccess
cmp keys
/testcase
-multikey.pub rootdir
/etc
/apt
/trusted.gpg.d
/multikey.gpg~
92 msgtest
'Test key removal with' 'multi key in softlink'
94 ln -s $(readlink -f ./keys/testcase-multikey.pub) rootdir
/etc
/apt
/trusted.gpg.d
/multikey.gpg
95 testsuccess
--nomsg aptkey
--fakeroot del DBAC8DAE
96 aptkey list
| grep '^pub' > aptkey.list
97 testfileequal .
/aptkey.list
'pub 2048R/528144E2 2011-01-16'
98 testsuccess
cmp keys
/testcase
-multikey.pub rootdir
/etc
/apt
/trusted.gpg.d
/multikey.gpg~
99 testsuccess
test ! -L rootdir
/etc
/apt
/trusted.gpg.d
/multikey.gpg
100 testsuccess
test -L rootdir
/etc
/apt
/trusted.gpg.d
/multikey.gpg~
102 msgtest
'Test key removal with' 'multiple files including key'
104 cp -a keys
/joesixpack.pub rootdir
/etc
/apt
/trusted.gpg.d
/joesixpack.gpg
105 cp -a keys
/testcase
-multikey.pub rootdir
/etc
/apt
/trusted.gpg.d
/multikey.gpg
106 testsuccess
--nomsg aptkey
--fakeroot del DBAC8DAE
107 aptkey list
| grep '^pub' > aptkey.list
108 testfileequal .
/aptkey.list
'pub 2048R/528144E2 2011-01-16'
109 testsuccess
test ! -e rootdir
/etc
/apt
/trusted.gpg.d
/joesixpack.gpg
110 testsuccess
cmp keys
/joesixpack.pub rootdir
/etc
/apt
/trusted.gpg.d
/joesixpack.gpg~
111 testsuccess
cmp keys
/testcase
-multikey.pub rootdir
/etc
/apt
/trusted.gpg.d
/multikey.gpg~
115 echo "APT::Key::GPGCommand \"$1\";" > rootdir
/etc
/apt
/apt.conf.d
/00gpgcmd
116 msgtest
'Test that apt-key uses for the following tests command' "$1"
117 aptkey adv
--version >aptkey.version
2>&1
118 if grep -q "^Executing: $1 --" aptkey.version
; then
126 # run with default (whatever this is)
129 setupgpgcommand
'gpg'
131 setupgpgcommand
'gpg2'