]> git.saurik.com Git - apt.git/blob - test/integration/test-allow
generalize secure->insecure downgrade protection
[apt.git] / test / integration / test-allow
1 #!/bin/sh
2 #
3 # Test for --allow-remove-essential and friends replacing --force-yes
4 #
5 set -e
6
7 TESTDIR="$(readlink -f "$(dirname $0)")"
8 . "$TESTDIR/framework"
9 setupenvironment
10 configarchitecture 'amd64'
11
12 insertpackage 'unstable' 'downgrade' 'all' '1'
13 insertinstalledpackage 'downgrade' 'all' '2'
14
15 insertpackage 'unstable' 'hold' 'all' '2'
16 insertinstalledpackage 'hold' 'all' '1'
17
18 insertinstalledpackage 'essential' 'all' '1' 'Essential: yes'
19
20 setupaptarchive
21
22 testsuccess aptmark hold hold
23
24 # Test --allow-remove--essential
25
26 testfailureequal 'Reading package lists...
27 Building dependency tree...
28 The following packages will be REMOVED:
29 essential
30 WARNING: The following essential packages will be removed.
31 This should NOT be done unless you know exactly what you are doing!
32 essential
33 0 upgraded, 0 newly installed, 1 to remove and 1 not upgraded.
34 E: Essential packages were removed and -y was used without --allow-remove-essential.' aptget remove essential -y -s
35
36 testsuccessequal 'Reading package lists...
37 Building dependency tree...
38 The following packages will be REMOVED:
39 essential
40 WARNING: The following essential packages will be removed.
41 This should NOT be done unless you know exactly what you are doing!
42 essential
43 0 upgraded, 0 newly installed, 1 to remove and 1 not upgraded.
44 Remv essential [1]' aptget remove essential -y --allow-remove-essential -s
45
46 # Test --allow-change-held-packages (should not influence dist-upgrade, but an install)
47
48 testsuccessequal 'Reading package lists...
49 Building dependency tree...
50 Calculating upgrade...
51 The following packages have been kept back:
52 hold
53 0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.' aptget dist-upgrade --allow-change-held-packages -s
54
55 testfailureequal 'Reading package lists...
56 Building dependency tree...
57 The following held packages will be changed:
58 hold
59 The following packages will be upgraded:
60 hold
61 1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
62 E: Held packages were changed and -y was used without --allow-change-held-packages.' aptget install hold -y -s
63
64 testfailureequal 'Reading package lists...
65 Building dependency tree...
66 The following held packages will be changed:
67 hold
68 The following packages will be upgraded:
69 hold
70 1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
71 E: Held packages were changed and -y was used without --allow-change-held-packages.' aptget install hold -y -s
72
73 testsuccessequal 'Reading package lists...
74 Building dependency tree...
75 The following held packages will be changed:
76 hold
77 The following packages will be upgraded:
78 hold
79 1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
80 Inst hold [1] (2 unstable [all])
81 Conf hold (2 unstable [all])' aptget install hold -y -s --allow-change-held-packages
82
83 # Test --allow-downgrades
84
85 testfailureequal 'Reading package lists...
86 Building dependency tree...
87 The following packages will be DOWNGRADED:
88 downgrade
89 0 upgraded, 0 newly installed, 1 downgraded, 0 to remove and 1 not upgraded.
90 E: Packages were downgraded and -y was used without --allow-downgrades.' aptget install downgrade=1 -y -s
91
92 testsuccessequal 'Reading package lists...
93 Building dependency tree...
94 The following packages will be DOWNGRADED:
95 downgrade
96 0 upgraded, 0 newly installed, 1 downgraded, 0 to remove and 1 not upgraded.
97 Inst downgrade [2] (1 unstable [all])
98 Conf downgrade (1 unstable [all])' aptget install downgrade=1 --allow-downgrades -y -s