]> git.saurik.com Git - apt.git/blame - test/integration/test-apt-cdrom
Use _apt as our unprivileged user name
[apt.git] / test / integration / test-apt-cdrom
CommitLineData
c45233ea
DK
1#!/bin/sh
2set -e
3
4TESTDIR=$(readlink -f $(dirname $0))
5. $TESTDIR/framework
6setupenvironment
7configarchitecture 'amd64' 'i386'
8
9buildsimplenativepackage 'testing' 'amd64,i386' '0.8.15' 'stable'
b2ea1a47 10setupaptarchive --no-update
c45233ea
DK
11
12changetocdrom 'Debian APT Testdisk 0.8.15'
13
14# -de is not in the Release file, but picked up anyway for compatibility
a0975c8d
DK
15cd rootdir/media/cdrom-unmounted/dists/stable/main/i18n
16chmod +w .
c45233ea
DK
17sed -e '/^Description-en:/ d' -e '/^ / d' -e '/^$/ d' Translation-en > Translation-de
18echo 'Description-de: automatisch generiertes Testpaket testing=0.8.15/stable
19 Diese Pakete sind nur für das testen von APT gedacht,
20 sie erfüllen keinen Zweck auf einem normalen System…
21' >> Translation-de
276e51dd 22compressfile Translation-de
a0975c8d
DK
23rm -f Translation-en Translation-de
24chmod -R -w .
c45233ea
DK
25cd - > /dev/null
26
1e071c30
DK
27aptcdromlog() {
28 rm -f rootdir/tmp/apt-cdrom.log
a0975c8d
DK
29 test ! -e rootdir/media/cdrom || echo "CD-ROM is mounted, but shouldn't be!"
30 test -e rootdir/media/cdrom-unmounted || echo "Unmounted CD-ROM doesn't exist, but it should!"
31 aptcdrom "$@" -o quiet=1 >rootdir/tmp/apt-cdrom.log 2>&1 </dev/null
32 sed -e '/gpgv/ d' -e '/^Identifying/ d' -e '/Reading / d' rootdir/tmp/apt-cdrom.log
33 test ! -e rootdir/media/cdrom || echo "CD-ROM is mounted, but shouldn't be!"
34 test -e rootdir/media/cdrom-unmounted || echo "Unmounted CD-ROM doesn't exist, but it should!"
1e071c30
DK
35}
36
a0975c8d 37CDROM_PRE="Using CD-ROM mount point $(readlink -f ./rootdir/media)/cdrom/
1166ea79 38Unmounting CD-ROM...
a0975c8d
DK
39Waiting for disc...
40Please insert a Disc in the drive and press enter
41Mounting CD-ROM...
1166ea79 42Scanning disc for index files..."
a0975c8d 43CDROM_POST="This disc is called:
c45233ea
DK
44'Debian APT Testdisk 0.8.15'
45Writing new source list
46Source list entries for this disc are:
47deb cdrom:[Debian APT Testdisk 0.8.15]/ stable main
48deb-src cdrom:[Debian APT Testdisk 0.8.15]/ stable main
a0975c8d
DK
49Unmounting CD-ROM...
50Repeat this process for the rest of the CDs in your set."
51
52testequal "$CDROM_PRE
53Found 2 package indexes, 1 source indexes, 1 translation indexes and 1 signatures
54Found label 'Debian APT Testdisk 0.8.15'
55$CDROM_POST" aptcdromlog add
56
57testequal "Using CD-ROM mount point $(readlink -f ./rootdir/media)/cdrom/
58Mounting CD-ROM...
59Stored label: Debian APT Testdisk 0.8.15
60Unmounting CD-ROM..." aptcdromlog ident
1e071c30 61
a0975c8d
DK
62# apt-setup uses these commands (expect the tr in the id) to find id and label
63ident="$(LC_ALL=C aptcdrom ident 2>&1 )"
64CD_ID="$(echo "$ident" | grep "^Identifying" | head -n1 | cut -d" " -f2 | tr --delete '[]')"
65CD_LABEL="$(echo "$ident" | grep "^Stored label:" | head -n1 | sed "s/^[^:]*: //")"
66testequal "CD::${CD_ID} \"${CD_LABEL}\";
67CD::${CD_ID}::Label \"${CD_LABEL}\";" cat rootdir/var/lib/apt/cdroms.list
c45233ea
DK
68
69testequal 'Reading package lists...
70Building dependency tree...
71The following NEW packages will be installed:
72 testing
730 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
74Inst testing (0.8.15 stable [amd64])
75Conf testing (0.8.15 stable [amd64])' aptget install testing -s
76
77testequal 'Reading package lists...
78Building dependency tree...
79The following NEW packages will be installed:
80 testing:i386
810 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
82Inst testing:i386 (0.8.15 stable [i386])
83Conf testing:i386 (0.8.15 stable [i386])' aptget install testing:i386 -s
84
85# check Idempotence of apt-cdrom (and disabling of Translation dropping)
a0975c8d 86testequal "$CDROM_PRE
c45233ea 87Found 2 package indexes, 1 source indexes, 2 translation indexes and 1 signatures
a0975c8d 88$CDROM_POST" aptcdromlog add -o APT::CDROM::DropTranslation=0
c45233ea
DK
89
90# take Translations from previous runs as needed
a0975c8d 91testequal "$CDROM_PRE
c45233ea 92Found 2 package indexes, 1 source indexes, 2 translation indexes and 1 signatures
a0975c8d 93$CDROM_POST" aptcdromlog add
c45233ea
DK
94msgtest 'Test for the german description translation of' 'testing'
95aptcache show testing -o Acquire::Languages=de | grep -q '^Description-de: ' && msgpass || msgfail
96rm -rf rootdir/var/lib/apt/lists
97mkdir -p rootdir/var/lib/apt/lists/partial
a0975c8d 98testequal "$CDROM_PRE
c45233ea 99Found 2 package indexes, 1 source indexes, 1 translation indexes and 1 signatures
a0975c8d 100$CDROM_POST" aptcdromlog add
c45233ea
DK
101msgtest 'Test for the english description translation of' 'testing'
102aptcache show testing -o Acquire::Languages=en | grep -q '^Description-en: ' && msgpass || msgfail
103
c45233ea
DK
104# check that we really can install from a 'cdrom'
105testdpkgnotinstalled testing
0440d936 106testsuccess aptget install testing -y
c45233ea 107testdpkginstalled testing