summaryrefslogtreecommitdiff
path: root/test/integration/test-packages-require-authorization
blob: 803957c5e124dd6f12be25991611c65ef34e9026 (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
testequal "Package files:
 100 ${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg/status
     release a=now
-32768 http://localhost:8080/ unstable/main amd64 Packages
     release a=unstable,n=sid,c=main
     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


testequal "Package files:
 100 ${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg/status
     release a=now
 500 http://localhost:8080/ unstable/main amd64 Packages
     release a=unstable,n=sid,c=main
     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

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