]> git.saurik.com Git - apt.git/blob - test/integration/test-apt-keep-downloaded-pkgs
generalize secure->insecure downgrade protection
[apt.git] / test / integration / test-apt-keep-downloaded-pkgs
1 #!/bin/sh
2 set -e
3
4 TESTDIR="$(readlink -f "$(dirname "$0")")"
5 . "$TESTDIR/framework"
6
7 setupenvironment
8 configarchitecture 'native'
9
10 buildsimplenativepackage 'pkg1' 'all' '1.0' 'stable'
11 buildsimplenativepackage 'pkg2' 'all' '1.0' 'stable'
12 buildsimplenativepackage 'pkg3' 'all' '1.0' 'stable'
13 buildsimplenativepackage 'pkg4' 'all' '1.0' 'stable'
14
15 # local (file) installs
16 setupaptarchive
17
18 # ensure that install from local sources does not remove debs
19 testsuccess aptget install pkg1 -o APT::Keep-Downloaded-Packages=false
20 testsuccess test -f aptarchive/pool/pkg1_1.0_all.deb
21
22 # now switch to http and downloading debs
23 changetowebserver
24 testsuccess aptget update
25
26 # ensure that the downloaded pkg is kept with "keep=true"
27 testsuccess aptget install pkg2 -o APT::Keep-Downloaded-Packages=true
28 testsuccess test -f aptarchive/pool/pkg2_1.0_all.deb
29 testsuccess test -f rootdir/var/cache/apt/archives/pkg2_1.0_all.deb
30
31 # ensure that the downloaded pkg is removed when requested
32 testsuccess aptget install pkg3 -o APT::Keep-Downloaded-Packages=false
33 testsuccess test -f aptarchive/pool/pkg3_1.0_all.deb
34 # this was there before, keep it
35 testsuccess test -f rootdir/var/cache/apt/archives/pkg2_1.0_all.deb
36 # this got installed so we can remove it now
37 testfailure test -f rootdir/var/cache/apt/archives/pkg3_1.0_all.deb
38
39
40 # ensure that install from the download dir does not delete packages
41 mv aptarchive/pool/pkg4_1.0_all.deb rootdir/var/cache/apt/archives
42 testsuccess aptget install $(pwd)/rootdir/var/cache/apt/archives/pkg4_1.0_all.deb -o APT::Keep-Downloaded-Packages=false
43 testsuccess test -f $(pwd)/rootdir/var/cache/apt/archives/pkg4_1.0_all.deb