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