]> git.saurik.com Git - apt.git/blob - test/integration/test-bug-604401-files-are-directories
merge lp:~mvo/apt/sha512-template to add support for sha512
[apt.git] / test / integration / test-bug-604401-files-are-directories
1 #!/bin/sh
2 set -e
3
4 TESTDIR=$(readlink -f $(dirname $0))
5 . $TESTDIR/framework
6 setupenvironment
7 configarchitecture "i386"
8 setupaptarchive
9
10 test ! -e rootdir/etc/apt/apt.conf || mv rootdir/etc/apt/apt.conf rootdir/etc/apt/apt.conf.d/000move-away-apt.conf
11
12 msgtest "Directory instead of a file as apt.conf ignored"
13 mkdir -p rootdir/etc/apt/apt.conf
14 aptconfig dump > /dev/null && msgpass || msgfail
15 rmdir rootdir/etc/apt/apt.conf
16
17 msgtest "Good link instead of a file as apt.conf ignored"
18 echo 'Test::APT::Link "good";' > rootdir/etc/apt/good-link.conf
19 ln -s rootdir/etc/apt/good-link.conf rootdir/etc/apt/apt.conf
20 test -n "$(aptconfig shell TestLink 'Test::APT::Link')" && msgfail || msgpass
21 rm rootdir/etc/apt/apt.conf
22
23 msgtest "Broken link instead of a file as apt.conf ignored"
24 ln -s /tmp/doesnt-exist rootdir/etc/apt/apt.conf
25 aptconfig dump > /dev/null && msgpass || msgfail
26 rm rootdir/etc/apt/apt.conf
27
28
29 test ! -e rootdir/etc/apt/sources.list || mv rootdir/etc/apt/sources.list rootdir/etc/apt/sources.list.d/000move-away-sources.list
30
31 msgtest "Directory instead of a file as sources.list ignored"
32 mkdir -p rootdir/etc/apt/sources.list
33 aptget update --print-uris 2> /dev/null && msgpass || msgfail
34 rmdir rootdir/etc/apt/sources.list
35
36 msgtest "Good link instead of a file as sources.list ignored"
37 echo 'deb file:///tmp/debian sid main' > rootdir/etc/apt/good-link.list
38 ln -s rootdir/etc/apt/good-link.list rootdir/etc/apt/sources.list
39 test -n "$(aptget update --print-uris)" && msgfail || msgpass
40 rm rootdir/etc/apt/sources.list
41
42 msgtest "Broken link instead of a file as sources.list ignored"
43 ln -s /tmp/doesnt-exist rootdir/etc/apt/sources.list
44 test -n "$(aptget update --print-uris)" && msgfail || msgpass
45 rm rootdir/etc/apt/sources.list
46
47
48 test ! -e rootdir/etc/apt/preferences || mv rootdir/etc/apt/preferences rootdir/etc/apt/preferences.d/000move-away-preferences
49
50 msgtest "Directory instead of a file as preferences ignored"
51 mkdir -p rootdir/etc/apt/preferences
52 aptcache policy > /dev/null 2> /dev/null && msgpass || msgfail
53 rmdir rootdir/etc/apt/preferences
54
55 msgtest "Good link instead of a file as preferences ignored"
56 echo 'Package: apt
57 Pin: release a=now
58 Pin-Value: 1000' > rootdir/etc/apt/good-link.pref
59 ln -s rootdir/etc/apt/good-link.pref rootdir/etc/apt/preferences
60 test -n "$(aptcache policy | grep 1000)" && msgfail || msgpass
61 rm rootdir/etc/apt/preferences
62
63 msgtest "Broken link instead of a file as preferences ignored"
64 ln -s /tmp/doesnt-exist rootdir/etc/apt/preferences
65 aptcache policy > /dev/null 2> /dev/null && msgpass || msgfail
66 rm rootdir/etc/apt/preferences