Debian Codegraph @

debian/tests/mmdebstrap

raw
1 #!/bin/sh
2
3 set -exu
4
5 date="$(dpkg-parsechangelog --show-field=Date)"
6 SOURCE_DATE_EPOCH="$(date --date="$date" +%s)"
7 export SOURCE_DATE_EPOCH
8
9 # change to temporary directory to not interfere with the source
10 cd "$AUTOPKGTEST_TMP"
11
12 ret=0
13 # variants important and standard differ because permissions drwxr-sr-x
14 # and extended attributes of ./var/log/journal/ cannot be preserved
15 # in fakechroot mode
16 for variant in essential apt minbase buildd; do
17 mmdebstrap --variant=$variant --mode=root unstable root.tar
18 touch fakechroot.tar
19 chown "$AUTOPKGTEST_NORMAL_USER" fakechroot.tar
20 runuser -u "$AUTOPKGTEST_NORMAL_USER" -- mmdebstrap --variant=$variant --mode=fakechroot unstable fakechroot.tar
21 cmp root.tar fakechroot.tar || ret=$((ret+$?))
22 rm root.tar fakechroot.tar
23 done
24
25 if [ "$ret" -eq 0 ]; then
26 echo "all tests succeeded" >&2
27 else
28 echo "$ret tests failed" >&2
29 fi
30 exit $ret