]> git.saurik.com Git - apt.git/blob - test/integration/test-apt-key-net-update
update to reflect the latest ubuntu key
[apt.git] / test / integration / test-apt-key-net-update
1 #!/bin/sh
2 set -e
3
4 TESTDIR=$(readlink -f $(dirname $0))
5 . $TESTDIR/framework
6
7 setupenvironment
8 configarchitecture "i386"
9
10 # mock
11 requires_root() {
12 return 0
13 }
14
15 # extract net_update() and import it
16 func=$( sed -n -e '/^add_keys_with_verify_against_master_keyring/,/^}/p' ${BUILDDIRECTORY}/apt-key )
17 eval "$func"
18
19 mkdir -p ./etc/apt
20 TRUSTEDFILE=./etc/apt/trusted.gpg
21 mkdir -p ./var/lib/apt/keyrings
22 TMP_KEYRING=./var/lib/apt/keyrings/maybe-import-keyring.gpg
23 GPG_CMD="gpg --ignore-time-conflict --no-options --no-default-keyring"
24 GPG="$GPG_CMD --keyring $TRUSTEDFILE"
25 MASTER_KEYRING=/usr/share/keyrings/ubuntu-master-keyring.gpg
26
27
28 msgtest "add_keys_with_verify_against_master_keyring"
29 if [ ! -e $MASTER_KEYRING ]; then
30 echo -n "No $MASTER_KEYRING found"
31 msgskip
32 exit 0
33 fi
34
35 # test bad keyring and ensure its not added (LP: #857472)
36 ADD_KEYRING=./keys/exploid-keyring-with-dupe-keys.pub
37 if add_keys_with_verify_against_master_keyring $ADD_KEYRING $MASTER_KEYRING; then
38 msgfail
39 else
40 msgpass
41 fi
42
43 # ensure the keyring is still empty
44 gpg_out=$($GPG --list-keys)
45 msgtest "Test if keyring is empty"
46 if [ -n "" ]; then
47 msgfail
48 else
49 msgpass
50 fi
51
52 # test good keyring and ensure we get no errors
53 ADD_KEYRING=/usr/share/keyrings/ubuntu-archive-keyring.gpg
54 if add_keys_with_verify_against_master_keyring $ADD_KEYRING $MASTER_KEYRING; then
55 msgpass
56 else
57 msgfail
58 fi
59
60 testequal './etc/apt/trusted.gpg
61 ---------------------
62 pub 1024D/437D05B5 2004-09-12
63 uid Ubuntu Archive Automatic Signing Key <ftpmaster@ubuntu.com>
64 sub 2048g/79164387 2004-09-12
65
66 pub 1024D/FBB75451 2004-12-30
67 uid Ubuntu CD Image Automatic Signing Key <cdimage@ubuntu.com>
68
69 pub 4096R/C0B21F32 2012-05-11
70 uid Ubuntu Archive Automatic Signing Key (2012) <ftpmaster@ubuntu.com>
71
72 pub 4096R/EFE21092 2012-05-11
73 uid Ubuntu CD Image Automatic Signing Key (2012) <cdimage@ubuntu.com>
74 ' $GPG --list-keys