test-apt-key 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342
  1. #!/bin/sh
  2. set -e
  3. # apt-key is a shell script, so relatively prune to be effected by 'crazy' things:
  4. # confuses config parser as there exists no way of escaping " currently.
  5. #TMPDIR="$(mktemp -d)/This is \"fü\$\$ing cràzy\", \$(man man | head -n1 | cut -d' ' -f 1)\$!"
  6. # gpg doesn't like | in path names – documented e.g. in the man gpg2 --agent-program
  7. #TMPDIR="$(mktemp -d)/This is fü\$\$ing cràzy, \$(man man | head -n1 | cut -d' ' -f 1)\$!"
  8. TMPDIR_ADD="This is fü\$\$ing cràzy, \$(apt -v)\$!"
  9. TESTDIR="$(readlink -f "$(dirname "$0")")"
  10. . "$TESTDIR/framework"
  11. setupenvironment
  12. configarchitecture 'amd64'
  13. # start from a clean plate again
  14. cleanplate() {
  15. rm -rf "${ROOTDIR}/etc/apt/trusted.gpg.d/" "${ROOTDIR}/etc/apt/trusted.gpg"
  16. mkdir "${ROOTDIR}/etc/apt/trusted.gpg.d/"
  17. }
  18. testmultigpg() {
  19. testfailure --nomsg aptkey --quiet --readonly "$@"
  20. testsuccess grep "^gpgv: Can't check signature" "${ROOTDIR}/tmp/testfailure.output"
  21. testsuccess grep '^gpgv: Good signature from' "${ROOTDIR}/tmp/testfailure.output"
  22. }
  23. testrun() {
  24. echo "APT::Key::ArchiveKeyring \"${KEYDIR}/joesixpack.pub\";
  25. APT::Key::RemovedKeys \"${KEYDIR}/rexexpired.pub\";" > "${ROOTDIR}/etc/apt/apt.conf.d/aptkey.conf"
  26. cleanplate
  27. ln -sf "$(readlink -f "${KEYDIR}/joesixpack.pub")" "${ROOTDIR}/etc/apt/trusted.gpg.d/joesixpack.gpg"
  28. testaptkeys 'Joe Sixpack'
  29. testsuccess aptkey list
  30. msgtest 'Check that paths in list output are not' 'double-slashed'
  31. testfailure --nomsg grep '//' "${ROOTDIR}/tmp/testsuccess.output"
  32. testsuccess aptkey finger
  33. msgtest 'Check that paths in finger output are not' 'double-slashed'
  34. testfailure --nomsg grep '//' "${ROOTDIR}/tmp/testsuccess.output"
  35. testequalor2 'gpg: key DBAC8DAE: "Joe Sixpack (APT Testcases Dummy) <joe@example.org>" not changed
  36. gpg: Total number processed: 1
  37. gpg: unchanged: 1' 'gpg: key 5A90D141DBAC8DAE: "Joe Sixpack (APT Testcases Dummy) <joe@example.org>" not changed
  38. gpg: Total number processed: 1
  39. gpg: unchanged: 1' aptkey --fakeroot update
  40. testaptkeys 'Joe Sixpack'
  41. testfailure test -e "${ROOTDIR}/etc/apt/trusted.gpg"
  42. testsuccess aptkey --fakeroot add "${KEYDIR}/rexexpired.pub"
  43. testfilestats "${ROOTDIR}/etc/apt/trusted.gpg" '%a' '=' '644'
  44. testaptkeys 'Rex Expired' 'Joe Sixpack'
  45. msgtest 'Check that Sixpack key can be' 'exported'
  46. aptkey export 'Sixpack' > "${TMPWORKINGDIRECTORY}/aptkey.export"
  47. aptkey --keyring "${ROOTDIR}/etc/apt/trusted.gpg.d/joesixpack.gpg" exportall > "${TMPWORKINGDIRECTORY}/aptkey.exportall"
  48. testsuccess --nomsg cmp "${TMPWORKINGDIRECTORY}/aptkey.export" "${TMPWORKINGDIRECTORY}/aptkey.exportall"
  49. testsuccess test -s "${TMPWORKINGDIRECTORY}/aptkey.export"
  50. testsuccess test -s "${TMPWORKINGDIRECTORY}/aptkey.exportall"
  51. msgtest 'Execute update again to trigger removal of' 'Rex Expired key'
  52. testsuccess --nomsg aptkey --fakeroot update
  53. testaptkeys 'Joe Sixpack'
  54. msgtest "Try to remove a key which exists, but isn't in the" 'forced keyring'
  55. testsuccess --nomsg aptkey --fakeroot --keyring "${ROOTDIR}/etc/apt/trusted.gpg" del DBAC8DAE
  56. testaptkeys 'Joe Sixpack'
  57. testsuccess aptkey --fakeroot del DBAC8DAE
  58. testempty aptkey list
  59. msgtest 'Test key removal with' 'lowercase key ID' #keylength somewhere between 8byte and short
  60. cleanplate
  61. cp -a "${KEYDIR}/joesixpack.pub" "${ROOTDIR}/etc/apt/trusted.gpg.d/joesixpack.gpg"
  62. testsuccess --nomsg aptkey --fakeroot del d141dbac8dae
  63. testempty aptkey list
  64. if [ "$(id -u)" != '0' ]; then
  65. msgtest 'Test key removal with' 'unreadable key'
  66. cleanplate
  67. cp -a "${KEYDIR}/joesixpack.pub" "${ROOTDIR}/etc/apt/trusted.gpg.d/joesixpack.gpg"
  68. echo 'foobar' > "${ROOTDIR}/etc/apt/trusted.gpg.d/unreadablekey.gpg"
  69. chmod 000 "${ROOTDIR}/etc/apt/trusted.gpg.d/unreadablekey.gpg"
  70. testwarning --nomsg aptkey --fakeroot del d141dbac8dae
  71. testwarning aptkey list
  72. chmod 644 "${ROOTDIR}/etc/apt/trusted.gpg.d/unreadablekey.gpg"
  73. rm -f "${ROOTDIR}/etc/apt/trusted.gpg.d/unreadablekey.gpg"
  74. grep -v '^W: ' "${ROOTDIR}/tmp/testwarning.output" > "${ROOTDIR}/aptkeylist.output" || true
  75. testempty cat "${ROOTDIR}/aptkeylist.output"
  76. fi
  77. msgtest 'Test key removal with' 'single key in real file'
  78. cleanplate
  79. cp -a "${KEYDIR}/joesixpack.pub" "${ROOTDIR}/etc/apt/trusted.gpg.d/joesixpack.gpg"
  80. testsuccess --nomsg aptkey --fakeroot del DBAC8DAE
  81. testempty aptkey list
  82. testfailure test -e "${ROOTDIR}/etc/apt/trusted.gpg.d/joesixpack.gpg"
  83. testsuccess cmp "${KEYDIR}/joesixpack.pub" "${ROOTDIR}/etc/apt/trusted.gpg.d/joesixpack.gpg~"
  84. msgtest 'Test key removal with' 'different key specs'
  85. cleanplate
  86. cp -a "${KEYDIR}/joesixpack.pub" "${ROOTDIR}/etc/apt/trusted.gpg.d/joesixpack.gpg"
  87. cp -a "${KEYDIR}/marvinparanoid.pub" "${ROOTDIR}/etc/apt/trusted.gpg.d/marvinparanoid.gpg"
  88. testsuccess --nomsg aptkey --fakeroot del 0xDBAC8DAE 528144E2
  89. testempty aptkey list
  90. testfailure test -e "${ROOTDIR}/etc/apt/trusted.gpg.d/joesixpack.gpg"
  91. testsuccess cmp "${KEYDIR}/joesixpack.pub" "${ROOTDIR}/etc/apt/trusted.gpg.d/joesixpack.gpg~"
  92. testfailure test -e "${ROOTDIR}/etc/apt/trusted.gpg.d/marvinparanoid.gpg"
  93. testsuccess cmp "${KEYDIR}/marvinparanoid.pub" "${ROOTDIR}/etc/apt/trusted.gpg.d/marvinparanoid.gpg~"
  94. msgtest 'Test key removal with' 'long key ID'
  95. cleanplate
  96. cp -a "${KEYDIR}/joesixpack.pub" "${ROOTDIR}/etc/apt/trusted.gpg.d/joesixpack.gpg"
  97. testsuccess --nomsg aptkey --fakeroot del 5A90D141DBAC8DAE
  98. testempty aptkey list
  99. testfailure test -e "${ROOTDIR}/etc/apt/trusted.gpg.d/joesixpack.gpg"
  100. testsuccess cmp "${KEYDIR}/joesixpack.pub" "${ROOTDIR}/etc/apt/trusted.gpg.d/joesixpack.gpg~"
  101. msgtest 'Test key removal with' 'fingerprint'
  102. cleanplate
  103. cp -a "${KEYDIR}/joesixpack.pub" "${ROOTDIR}/etc/apt/trusted.gpg.d/joesixpack.gpg"
  104. testsuccess --nomsg aptkey --fakeroot del 34A8E9D18DB320F367E8EAA05A90D141DBAC8DAE
  105. testempty aptkey list
  106. testfailure test -e "${ROOTDIR}/etc/apt/trusted.gpg.d/joesixpack.gpg"
  107. testsuccess cmp "${KEYDIR}/joesixpack.pub" "${ROOTDIR}/etc/apt/trusted.gpg.d/joesixpack.gpg~"
  108. msgtest 'Test key removal with' 'spaced fingerprint'
  109. cleanplate
  110. cp -a "${KEYDIR}/joesixpack.pub" "${ROOTDIR}/etc/apt/trusted.gpg.d/joesixpack.gpg"
  111. testsuccess --nomsg aptkey --fakeroot del '34A8 E9D1 8DB3 20F3 67E8 EAA0 5A90 D141 DBAC 8DAE'
  112. testempty aptkey list
  113. testfailure test -e "${ROOTDIR}/etc/apt/trusted.gpg.d/joesixpack.gpg"
  114. testsuccess cmp "${KEYDIR}/joesixpack.pub" "${ROOTDIR}/etc/apt/trusted.gpg.d/joesixpack.gpg~"
  115. msgtest 'Test key removal with' 'single key in softlink'
  116. cleanplate
  117. ln -s "$(readlink -f "${KEYDIR}/joesixpack.pub")" "${ROOTDIR}/etc/apt/trusted.gpg.d/joesixpack.gpg"
  118. testsuccess --nomsg aptkey --fakeroot del DBAC8DAE
  119. testempty aptkey list
  120. testfailure test -e "${ROOTDIR}/etc/apt/trusted.gpg.d/joesixpack.gpg"
  121. testsuccess test -L "${ROOTDIR}/etc/apt/trusted.gpg.d/joesixpack.gpg~"
  122. cleanplate
  123. testsuccess aptkey --fakeroot add "${KEYDIR}/joesixpack.pub"
  124. ln -sf "$(readlink -f "${KEYDIR}/marvinparanoid.pub")" "${KEYDIR}/marvin paránöid.pub"
  125. testsuccess aptkey --fakeroot add "${KEYDIR}/marvin paránöid.pub"
  126. testaptkeys 'Joe Sixpack' 'Marvin Paranoid'
  127. cp -a "${ROOTDIR}/etc/apt/trusted.gpg" "${KEYDIR}/testcase-multikey.pub" # store for reuse
  128. msgtest 'Test key removal with' 'multi key in real file'
  129. cleanplate
  130. cp -a "${KEYDIR}/testcase-multikey.pub" "${ROOTDIR}/etc/apt/trusted.gpg.d/multikey.gpg"
  131. testsuccess --nomsg aptkey --fakeroot del DBAC8DAE
  132. testaptkeys 'Marvin Paranoid'
  133. testsuccess cmp "${KEYDIR}/testcase-multikey.pub" "${ROOTDIR}/etc/apt/trusted.gpg.d/multikey.gpg~"
  134. msgtest 'Test key removal with' 'multi key in softlink'
  135. cleanplate
  136. ln -s "$(readlink -f "${KEYDIR}/testcase-multikey.pub")" "${ROOTDIR}/etc/apt/trusted.gpg.d/multikey.gpg"
  137. testsuccess --nomsg aptkey --fakeroot del DBAC8DAE
  138. testaptkeys 'Marvin Paranoid'
  139. testsuccess cmp "${KEYDIR}/testcase-multikey.pub" "${ROOTDIR}/etc/apt/trusted.gpg.d/multikey.gpg~"
  140. testfailure test -L "${ROOTDIR}/etc/apt/trusted.gpg.d/multikey.gpg"
  141. testsuccess test -L "${ROOTDIR}/etc/apt/trusted.gpg.d/multikey.gpg~"
  142. msgtest 'Test key removal with' 'multiple files including key'
  143. cleanplate
  144. cp -a "${KEYDIR}/joesixpack.pub" "${ROOTDIR}/etc/apt/trusted.gpg.d/joesixpack.gpg"
  145. cp -a "${KEYDIR}/testcase-multikey.pub" "${ROOTDIR}/etc/apt/trusted.gpg.d/multikey.gpg"
  146. testsuccess --nomsg aptkey --fakeroot del DBAC8DAE
  147. testaptkeys 'Marvin Paranoid'
  148. testfailure test -e "${ROOTDIR}/etc/apt/trusted.gpg.d/joesixpack.gpg"
  149. testsuccess cmp "${KEYDIR}/joesixpack.pub" "${ROOTDIR}/etc/apt/trusted.gpg.d/joesixpack.gpg~"
  150. testsuccess cmp "${KEYDIR}/testcase-multikey.pub" "${ROOTDIR}/etc/apt/trusted.gpg.d/multikey.gpg~"
  151. cleanplate
  152. cp -a "${KEYDIR}/joesixpack.pub" "${ROOTDIR}/etc/apt/trusted.gpg.d/joesixpack.gpg"
  153. cp -a "${KEYDIR}/testcase-multikey.pub" "${ROOTDIR}/etc/apt/trusted.gpg.d/multikey.gpg"
  154. testaptkeys 'Joe Sixpack' 'Joe Sixpack' 'Marvin Paranoid'
  155. msgtest 'Test merge-back of' 'added keys'
  156. testsuccess --nomsg aptkey adv --batch --yes --import "${KEYDIR}/rexexpired.pub"
  157. testaptkeys 'Rex Expired' 'Joe Sixpack' 'Joe Sixpack' 'Marvin Paranoid'
  158. msgtest 'Test merge-back of' 'removed keys'
  159. testsuccess --nomsg aptkey adv --batch --yes --delete-keys 27CE74F9
  160. testaptkeys 'Joe Sixpack' 'Joe Sixpack' 'Marvin Paranoid'
  161. msgtest 'Test merge-back of' 'removed duplicate keys'
  162. testsuccess --nomsg aptkey adv --batch --yes --delete-keys DBAC8DAE
  163. testaptkeys 'Marvin Paranoid'
  164. cleanplate
  165. cp -a "${KEYDIR}/joesixpack.pub" "${ROOTDIR}/etc/apt/trusted.gpg.d/joesixpack.gpg"
  166. cp -a "${KEYDIR}/testcase-multikey.pub" "${ROOTDIR}/etc/apt/trusted.gpg.d/multikey.gpg"
  167. local SIGNATURE="${TMPWORKINGDIRECTORY}/signature"
  168. msgtest 'Test signing a file' 'with a key'
  169. echo 'Verify me. This is my signature.' > "$SIGNATURE"
  170. echo 'lalalalala' > "${SIGNATURE}2"
  171. testsuccess --nomsg aptkey --quiet --keyring "${KEYDIR}/marvinparanoid.pub" --secret-keyring "${KEYDIR}/marvinparanoid.sec" --readonly \
  172. adv --batch --yes --default-key 'Marvin' --armor --detach-sign --sign --output "${SIGNATURE}.gpg" "${SIGNATURE}"
  173. testsuccess test -s "${SIGNATURE}.gpg" -a -s "${SIGNATURE}"
  174. msgtest 'Test verify a file' 'with no sig'
  175. testfailure --nomsg aptkey --quiet --readonly --keyring "${KEYDIR}/testcase-multikey.pub" verify "${SIGNATURE}" "${SIGNATURE}2"
  176. for GPGV in '' 'gpgv' 'gpgv1' 'gpgv2'; do
  177. echo "APT::Key::GPGVCommand \"$GPGV\";" > "${ROOTDIR}/etc/apt/apt.conf.d/00gpgvcmd"
  178. if [ -n "$GPGV" ] && ! command dpkg -l gnupg1 2>&1 | grep -q '^ii'; then continue; fi
  179. msgtest 'Test verify a file' 'with all keys'
  180. testsuccess --nomsg aptkey --quiet --readonly verify "${SIGNATURE}.gpg" "${SIGNATURE}"
  181. if [ "$(id -u)" != '0' ]; then
  182. msgtest 'Test verify a file' 'with unreadable key'
  183. echo 'foobar' > "${ROOTDIR}/etc/apt/trusted.gpg.d/unreadablekey.gpg"
  184. chmod 000 "${ROOTDIR}/etc/apt/trusted.gpg.d/unreadablekey.gpg"
  185. testwarning --nomsg aptkey --quiet --readonly verify "${SIGNATURE}.gpg" "${SIGNATURE}"
  186. testwarning aptkey list
  187. chmod 644 "${ROOTDIR}/etc/apt/trusted.gpg.d/unreadablekey.gpg"
  188. rm -f "${ROOTDIR}/etc/apt/trusted.gpg.d/unreadablekey.gpg"
  189. fi
  190. msgtest 'Test verify a file' 'with good keyring'
  191. testsuccess --nomsg aptkey --quiet --readonly --keyring "${KEYDIR}/testcase-multikey.pub" verify "${SIGNATURE}.gpg" "${SIGNATURE}"
  192. msgtest 'Test fail verify a file' 'with bad keyring'
  193. testfailure --nomsg aptkey --quiet --readonly --keyring "${KEYDIR}/joesixpack.pub" verify "${SIGNATURE}.gpg" "${SIGNATURE}"
  194. msgtest 'Test fail verify a file' 'with non-existing keyring'
  195. testfailure --nomsg aptkey --quiet --readonly --keyring "${KEYDIR}/does-not-exist.pub" verify "${SIGNATURE}.gpg" "${SIGNATURE}"
  196. testfailure test -e "${KEYDIR}/does-not-exist.pub"
  197. # note: this isn't how apts gpgv method implements keyid for verify
  198. msgtest 'Test verify a file' 'with good keyid'
  199. testsuccess --nomsg aptkey --quiet --readonly --keyid 'Paranoid' verify "${SIGNATURE}.gpg" "${SIGNATURE}"
  200. msgtest 'Test fail verify a file' 'with bad keyid'
  201. testfailure --nomsg aptkey --quiet --readonly --keyid 'Sixpack' verify "${SIGNATURE}.gpg" "${SIGNATURE}"
  202. msgtest 'Test fail verify a file' 'with non-existing keyid'
  203. testfailure --nomsg aptkey --quiet --readonly --keyid 'Kalnischkies' verify "${SIGNATURE}.gpg" "${SIGNATURE}"
  204. msgtest 'Test verify fails on' 'bad file'
  205. testfailure --nomsg aptkey --quiet --readonly verify "${SIGNATURE}.gpg" "${SIGNATURE}2"
  206. done
  207. rm -f "${ROOTDIR}/etc/apt/apt.conf.d/00gpgvcmd"
  208. msgtest 'Test verify a file' 'with good keyring'
  209. testsuccess --nomsg aptkey --quiet --readonly --keyring "${KEYDIR}/testcase-multikey.pub" verify "${SIGNATURE}.gpg" "${SIGNATURE}"
  210. cleanplate
  211. cat "${KEYDIR}/joesixpack.pub" "${KEYDIR}/marvinparanoid.pub" > "${KEYDIR}/double.pub"
  212. cat "${KEYDIR}/joesixpack.sec" "${KEYDIR}/marvinparanoid.sec" > "${KEYDIR}/double.sec"
  213. cp -a "${KEYDIR}/double.pub" "${ROOTDIR}/etc/apt/trusted.gpg.d/double.gpg"
  214. cp -a "${KEYDIR}/testcase-multikey.pub" "${ROOTDIR}/etc/apt/trusted.gpg.d/multikey.gpg"
  215. rm -f "${SIGNATURE}.gpg"
  216. testsuccess aptkey --quiet --keyring "${KEYDIR}/double.pub" --secret-keyring "${KEYDIR}/double.sec" --readonly \
  217. adv --batch --yes -u 'Marvin' -u 'Joe' --armor --detach-sign --sign --output "${SIGNATURE}.gpg" "${SIGNATURE}"
  218. testsuccess test -s "${SIGNATURE}.gpg" -a -s "${SIGNATURE}"
  219. for GPGV in '' 'gpgv' 'gpgv1' 'gpgv2'; do
  220. echo "APT::Key::GPGVCommand \"$GPGV\";" > "${ROOTDIR}/etc/apt/apt.conf.d/00gpgvcmd"
  221. if [ -n "$GPGV" ] && ! command dpkg -l gnupg1 2>&1 | grep -q '^ii'; then continue; fi
  222. msgtest 'Test verify a doublesigned file' 'with all keys'
  223. testsuccess --nomsg aptkey --quiet --readonly verify "${SIGNATURE}.gpg" "${SIGNATURE}"
  224. msgtest 'Test verify a doublesigned file' 'with good keyring joe'
  225. testmultigpg --keyring "${KEYDIR}/joesixpack.pub" verify "${SIGNATURE}.gpg" "${SIGNATURE}"
  226. msgtest 'Test verify a doublesigned file' 'with good keyring marvin'
  227. testmultigpg --keyring "${KEYDIR}/marvinparanoid.pub" verify "${SIGNATURE}.gpg" "${SIGNATURE}"
  228. msgtest 'Test fail verify a doublesigned file' 'with bad keyring'
  229. testfailure --nomsg aptkey --quiet --readonly --keyring "${KEYDIR}/rexexpired.pub" verify "${SIGNATURE}.gpg" "${SIGNATURE}"
  230. msgtest 'Test fail verify a doublesigned file' 'with non-existing keyring'
  231. testfailure --nomsg aptkey --quiet --readonly --keyring "${KEYDIR}/does-not-exist.pub" verify "${SIGNATURE}.gpg" "${SIGNATURE}"
  232. testfailure test -e "${KEYDIR}/does-not-exist.pub"
  233. # note: this isn't how apts gpgv method implements keyid for verify
  234. msgtest 'Test verify a doublesigned file' 'with good keyid'
  235. testmultigpg --keyid 'Paranoid' verify "${SIGNATURE}.gpg" "${SIGNATURE}"
  236. msgtest 'Test fail verify a doublesigned file' 'with bad keyid'
  237. testfailure --nomsg aptkey --quiet --readonly --keyid 'Rex' verify "${SIGNATURE}.gpg" "${SIGNATURE}"
  238. msgtest 'Test fail verify a doublesigned file' 'with non-existing keyid'
  239. testfailure --nomsg aptkey --quiet --readonly --keyid 'Kalnischkies' verify "${SIGNATURE}.gpg" "${SIGNATURE}"
  240. msgtest 'Test verify fails on' 'bad doublesigned file'
  241. testfailure --nomsg aptkey --quiet --readonly verify "${SIGNATURE}.gpg" "${SIGNATURE}2"
  242. done
  243. rm -f "${ROOTDIR}/etc/apt/apt.conf.d/00gpgvcmd"
  244. }
  245. setupgpgcommand() {
  246. local GPGEXE;
  247. if command dpkg -l gnupg1 2>&1 | grep -q '^ii'; then
  248. if [ "$1" = '1' ]; then
  249. GPGEXE='gpg1'
  250. else
  251. GPGEXE='gpg'
  252. fi
  253. else
  254. if [ "$1" = '1' ]; then
  255. GPGEXE='gpg'
  256. else
  257. GPGEXE='gpg2'
  258. fi
  259. fi
  260. msgmsg 'Force tests to be run with' "$GPGEXE"
  261. echo "APT::Key::GPGCommand \"$GPGEXE\";" > "${ROOTDIR}/etc/apt/apt.conf.d/00gpgcmd"
  262. testsuccess aptkey --readonly adv --version
  263. cp "${ROOTDIR}/tmp/testsuccess.output" "${TMPWORKINGDIRECTORY}/aptkey.version"
  264. testsuccess grep "^gpg (GnuPG) $1\." "${TMPWORKINGDIRECTORY}/aptkey.version"
  265. }
  266. # run with default (whatever this is) in current CWD with relative paths
  267. ROOTDIR="./rootdir"
  268. KEYDIR="./keys"
  269. testrun
  270. # run with … and up the game with a strange CWD & absolute paths
  271. ROOTDIR="${TMPWORKINGDIRECTORY}/rootdir"
  272. KEYDIR="${TMPWORKINGDIRECTORY}/keys"
  273. mkdir inaccessible
  274. cd inaccessible
  275. chmod 600 ../inaccessible
  276. testfilestats "${TMPWORKINGDIRECTORY}/inaccessible" '%a' '=' '600'
  277. setupgpgcommand '1'
  278. testrun
  279. setupgpgcommand '2'
  280. testrun