]> git.saurik.com Git - apt.git/blame - test/integration/test-apt-get-download
check that auth.conf exists before chowning it
[apt.git] / test / integration / test-apt-get-download
CommitLineData
42d41ddb
DK
1#!/bin/sh
2set -e
3
4TESTDIR=$(readlink -f $(dirname $0))
5. $TESTDIR/framework
6
7setupenvironment
8configarchitecture "i386"
9
10buildsimplenativepackage 'apt' 'all' '1.0' 'stable'
11buildsimplenativepackage 'apt' 'all' '2.0' 'unstable'
567785b9 12insertinstalledpackage 'vrms' 'all' '1.0'
42d41ddb 13
68ba0b7f 14OLD_UMASK="$(umask)"
5684f71f 15umask 0027
68ba0b7f
DK
16setupaptarchive --no-update
17umask "$OLD_UMASK"
5684f71f 18
68ba0b7f
DK
19# directories should be readable by everyone
20find aptarchive/dists -type d | while read dir; do
21 chmod o+rx "$dir"
22done
5684f71f
DK
23# apt-ftparchive knows how to chmod files
24find aptarchive/dists -name '*Packages*' -type f | while read file; do
25 testaccessrights "$file" '644'
68ba0b7f 26 chmod 640 "$file"
5684f71f
DK
27done
28# created by the framework without special care
29find aptarchive/dists -name '*Release*' -type f | while read file; do
30 testaccessrights "$file" '640'
31done
68ba0b7f
DK
32
33testsuccess aptget update
34
42d41ddb 35testdownload() {
2aa7df1d
DK
36 local APT="$2"
37 if [ -n "$3" ]; then
38 APT="${APT}/${3}"
42d41ddb 39 fi
2aa7df1d 40 msgtest "Test download of package file $1 with" "$APT"
0954c58e 41 testsuccess --nomsg aptget download ${APT}
43acd019
DK
42 testsuccess test -f "$1"
43 rm -f "$1"
42d41ddb
DK
44}
45
43acd019
DK
46# normal case as "root"
47testdownload apt_2.0_all.deb apt
48
49# simulate normal user with non-existent root-owned directories
50rm -rf rootdir/var/cache/apt/archives/
51mkdir rootdir/var/cache/apt/archives/
52addtrap 'prefix' "chmod -f -R +w $PWD/rootdir/var/cache/apt/archives || true;"
53chmod -R -w rootdir/var/cache/apt/archives
54
6ae22905 55# normal case(es)
42d41ddb
DK
56testdownload apt_1.0_all.deb apt stable
57testdownload apt_2.0_all.deb apt
58
59DEBFILE="$(readlink -f aptarchive)/pool/apt_2.0_all.deb"
d57f6084 60testequal "'file://${DEBFILE}' apt_2.0_all.deb $(stat -c%s $DEBFILE) SHA512:$(sha512sum $DEBFILE | cut -d' ' -f 1)" aptget download apt --print-uris
567785b9
DK
61
62# deb:677887
63testequal "E: Can't find a source to download version '1.0' of 'vrms:i386'" aptget download vrms
6ae22905 64
e2095426
DK
65# deb:736962
66testsuccess aptget download apt
67testsuccess aptget download apt
68testsuccess test -s apt_2.0_all.deb
69
70rm -f apt_1.0_all.deb apt_2.0_all.deb
71
72# deb:738103
73testsuccess aptget download apt apt apt/unstable apt=2.0
6ae22905 74testsuccess test -s apt_2.0_all.deb
8f3594c3 75
43acd019
DK
76# restore "root" rights
77chmod -f -R +w $PWD/rootdir/var/cache/apt/archives
78rm -rf rootdir/var/cache/apt/archives/
79
80# file: debs aren't copied to archives, so change to http which obviously are
81changetowebserver
82testsuccess aptget update
83
84# test with already stored deb
85testsuccess aptget install -d apt
86testsuccess test -s rootdir/var/cache/apt/archives/apt_2.0_all.deb
5684f71f 87testaccessrights 'aptarchive/pool/apt_2.0_all.deb' '644'
43acd019
DK
88mv aptarchive/pool/apt_2.0_all.deb aptarchive/pool/apt_2.0_all.deb.gone
89testdownload apt_2.0_all.deb apt
90mv aptarchive/pool/apt_2.0_all.deb.gone aptarchive/pool/apt_2.0_all.deb