]> git.saurik.com Git - apt.git/blame - test/integration/skip-apt-dropprivs
correct cross & disappear progress detection
[apt.git] / test / integration / skip-apt-dropprivs
CommitLineData
34b491e7
DK
1#!/bin/sh
2set -e
3
4TESTDIR="$(readlink -f "$(dirname "$0")")"
5. "$TESTDIR/framework"
6
7setupenvironment
8configarchitecture 'amd64'
9
10aptdropprivs() { runapt "${APTTESTHELPERSBINDIR}/aptdropprivs" "$@"; }
11
12testsuccess aptdropprivs -- /bin/true
13testsuccess aptdropprivs --user "$USER" -- /bin/true
14testsuccess aptdropprivs --user 'nobody' -- /bin/true
15testsuccess aptdropprivs --user '_apt' -- /bin/true
16
17IDBIN='/usr/bin/id'
18testsuccessequal "$("$IDBIN")" aptdropprivs --user "$USER" -- "$IDBIN"
19
20SUDOBIN='/usr/bin/sudo'
21testequal "sudo: effective uid is not 0, is /usr/bin/sudo on a file system with the 'nosuid' option set or an NFS file system without root privileges?" aptdropprivs --user 'nobody' -- "$SUDOBIN" "$IDBIN"
22
23if [ "$(id -u)" = '0' ]; then
24 testsuccessequal '_apt' aptdropprivs --user '_apt' -- "$IDBIN" '-un'
25 testsuccess aptdropprivs --user '_apt' -- '/bin/sh' '-c' 'export'
26 cp rootdir/tmp/testsuccess.output apt.env
27 testsuccessequal "export HOME='/nonexistent'" grep '^export HOME' apt.env
28 testsuccessequal "export USER='_apt'
29export USERNAME='_apt'" grep '^export USER' apt.env
30 testsuccessequal "export LOGNAME='_apt'" grep '^export LOGNAME' apt.env
31 testsuccessequal "export SHELL='/bin/sh'" grep '^export SHELL=' apt.env
32fi