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