summaryrefslogtreecommitdiff
path: root/test/integration/test-packages-require-authorization
blob: 527497ce5543a99a77743a582f481fb785981489 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/sh
set -e

TESTDIR="$(readlink -f "$(dirname "$0")")"
. "$TESTDIR/framework"
setupenvironment
configarchitecture 'amd64'

insertpackage 'unstable' 'cool' 'amd64' '1.0'

export APT_DONT_SIGN='InRelease'
setupaptarchive --no-update
changetowebserver

echo 'Packages-Require-Authorization: yes' >> aptarchive/dists/unstable/Release
signreleasefiles

testsuccess aptget update
testsuccessequal "Package files:
 100 ${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg/status
     release a=now
-32768 http://localhost:${APTHTTPPORT} unstable/main amd64 Packages
     release a=unstable,n=sid,c=main,b=amd64
     origin localhost
Pinned packages:" aptcache policy

mkdir rootdir/etc/apt/auth.conf.d
cat > rootdir/etc/apt/auth.conf.d/myauth.conf  << EOF
machine localhost
login username
password usersPassword
EOF


testsuccessequal "Package files:
 100 ${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg/status
     release a=now
 500 http://localhost:${APTHTTPPORT} unstable/main amd64 Packages
     release a=unstable,n=sid,c=main,b=amd64
     origin localhost
Pinned packages:" aptcache policy


cat > rootdir/etc/apt/preferences.d/myauth.pref  << EOF
Package: *
Pin: origin localhost
Pin-Priority: 990

Package: cool
Pin: origin localhost
Pin-Priority: 990
EOF

testsuccessequal "Package files:
 100 ${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg/status
     release a=now
 990 http://localhost:${APTHTTPPORT} unstable/main amd64 Packages
     release a=unstable,n=sid,c=main,b=amd64
     origin localhost
Pinned packages:
     cool -> 1.0 with priority 990" aptcache policy