]> git.saurik.com Git - apt.git/blame - test/integration/test-apt-update-transactions
aborted reverify restores file owner and permission
[apt.git] / test / integration / test-apt-update-transactions
CommitLineData
47aca3cf
MV
1#!/bin/sh
2set -e
3
de81b2e2
DK
4# ensure that an update will only succeed entirely or not at all
5
47aca3cf
MV
6TESTDIR=$(readlink -f $(dirname $0))
7. $TESTDIR/framework
8
9setupenvironment
de81b2e2 10configarchitecture 'i386'
47aca3cf
MV
11
12insertpackage 'unstable' 'foo' 'all' '1.0'
de81b2e2 13insertsource 'unstable' 'foo' 'all' '1.0'
47aca3cf
MV
14
15setupaptarchive --no-update
47aca3cf 16
de81b2e2
DK
17breakfile() {
18 mv "$1" "${1}.bak"
19 cat > "$1" <<EOF
47aca3cf
MV
20Package: bar
21EOF
de81b2e2
DK
22 compressfile "$1"
23}
24restorefile() {
25 mv "${1}.bak" "$1"
26}
27
28listscheck() {
29 testequal "$(cat $1)" ls rootdir/var/lib/apt/lists
30 # all copied files are properly chmodded
31 find rootdir/var/lib/apt/lists -maxdepth 1 -type f | while read file; do
32 testaccessrights "$file" '644'
33 testfilestats "$file" '%U' '!=' '_apt'
34 done
35}
36
37testrun() {
38 # produce an unsigned repository
39 find aptarchive \( -name 'Release.gpg' -o -name 'InRelease' \) -delete
40 testfailure aptget update --no-allow-insecure-repositories
41 listscheck "$1"
42
43 # signed but broken
44 signreleasefiles
47aca3cf 45
de81b2e2
DK
46 breakfile aptarchive/dists/unstable/main/binary-i386/Packages
47 testfailure aptget update
48 listscheck "$1"
49 restorefile aptarchive/dists/unstable/main/binary-i386/Packages
50
51 breakfile aptarchive/dists/unstable/main/source/Sources
52 testfailure aptget update
53 listscheck "$1"
54 restorefile aptarchive/dists/unstable/main/source/Sources
55}
56
57testsetup() {
58 msgmsg 'Test with no initial data over' "$1"
59 rm -rf rootdir/var/lib/apt/lists
60 mkdir -p rootdir/var/lib/apt/lists/partial
61 ls rootdir/var/lib/apt/lists > listsdir.lst
62 testrun 'listsdir.lst'
63
64 msgmsg 'Test with initial data over' "$1"
65 testsuccess aptget update
66 ls rootdir/var/lib/apt/lists > listsdir.lst
67 testrun 'listsdir.lst'
68}
69
70testsetup 'file'
71changetowebserver
72testsetup 'http'
2737f28a 73