]> git.saurik.com Git - apt.git/blame - test/integration/test-apt-edit-sources
implement generic config fallback for methods
[apt.git] / test / integration / test-apt-edit-sources
CommitLineData
01047752
DK
1#!/bin/sh
2set -e
3
4TESTDIR="$(readlink -f "$(dirname "$0")")"
5. "$TESTDIR/framework"
6
7setupenvironment
8configarchitecture 'native'
9
10echo 'Dir::Bin::Editor "cat";' > rootdir/etc/apt/apt.conf.d/editor.conf
11
12echo 'deb http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list.d/rocks.list
13testsuccessequal "$(cat rootdir/etc/apt/sources.list.d/rocks.list)" apt edit-sources rocks.list
14
15cat >editor.sh <<EOF
16#!/bin/sh
17umask 077
18touch "\$@"
19EOF
20chmod +x ./editor.sh
21echo 'Dir::Bin::Editor "./editor.sh";' > rootdir/etc/apt/apt.conf.d/editor.conf
22testsuccess apt edit-sources blub.list
23testfailure test -e 'rootdir/etc/apt/sources.list.d/blub.list'
24
25cat >editor.sh <<EOF
26#!/bin/sh
27umask 077
28echo '#comment' > "\$1"
29EOF
30testsuccess apt edit-sources blub.list
31testfilestats 'rootdir/etc/apt/sources.list.d/blub.list' '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:644"
32
33echo 'Dir::Bin::Editor "cat";' > rootdir/etc/apt/apt.conf.d/editor.conf
34echo 'blub' > rootdir/etc/apt/sources.list.d/blub.list
35testfailure apt edit-sources blub.list --assume-no
36
37echo 'deb http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list.d/blub.list
38touch -m -d 'now + 1 hour' rootdir/etc/apt/sources.list.d/blub.list
39testwarning apt edit-sources blub.list --assume-no